/****************************************************************************** * netif.h * * Unified network-device I/O interface for Xen guest OSes. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * * Copyright (c) 2003-2004, Keir Fraser */ #ifndef __XEN_PUBLIC_IO_NETIF_H__ #define __XEN_PUBLIC_IO_NETIF_H__ FILE_LICENCE ( MIT ); #include "ring.h" #include "../grant_table.h" /* * Older implementation of Xen network frontend / backend has an * implicit dependency on the MAX_SKB_FRAGS as the maximum number of * ring slots a skb can use. Netfront / netback may not work as * expected when frontend and backend have different MAX_SKB_FRAGS. * * A better approach is to add mechanism for netfront / netback to * negotiate this value. However we cannot fix all possible * frontends, so we need to define a value which states the minimum * slots backend must support. * * The minimum value derives from older Linux kernel's MAX_SKB_FRAGS * (18), which is proved to work with most frontends. Any new backend * which doesn't negotiate with frontend should expect frontend to * send a valid packet using slots up to this value. */ #define XEN_NETIF_NR_SLOTS_MIN 18 /* * Notifications after enqueuing any type of message should be conditional on * the appropriate req_event or rsp_event field in the shared ring. * If the client sends notification for rx requests then it should specify * feature 'feature-rx-notify' via xenbus. Otherwise the backend will assume * that it cannot safely queue packets (as it may not be kicked to send them). */ /* * "feature-split-event-channels" is introduced to separate guest TX * and RX notification. Backend either doesn't support this feature or * advertises it via xenstore as 0 (disabled) or 1 (enabled). * * To make use of this feature, frontend should allocate two event * channels for TX and RX, advertise them to backend as * "event-channel-tx" and "event-channel-rx" respectively. If frontend * doesn't want to use this feature, it just writes "event-channel" * node as before. */ /* * Multiple transmit and receive queues: * If supported, the backend will write the key "multi-queue-max-queues" to * the directory for that vif, and set its value to the maximum supported * number of queues. * Frontends that are aware of this feature and wish to use it can write the * key "multi-queue-num-queues", set to the number they wish to use, which * must be greater than zero, and no more than the value reported by the backend * in "multi-queue-max-queues". * * Queues replicate the shared rings and event channels. * "feature-split-event-channels" may optionally be used when using * multiple queues, but is not mandatory. * * Each queue consists of one shared ring pair, i.e. there must be the same * number of tx and rx rings. * * For frontends requesting just one queue, the usual event-channel and * ring-ref keys are written as before, simplifying the backend processing * to avoid distinguishing between a frontend that doesn't understand the * multi-queue feature, and one that does, but requested only one queue. * * Frontends requesting two or more queues must not write the toplevel * event-channel (or event-channel-{tx,rx}) and {tx,rx}-ring-ref keys, * instead writing those keys under sub-keys having the name "queue-N" where * N is the integer ID of the queue for which those keys belong. Queues * are indexed from zero. For example, a frontend with two queues and split * event channels must write the following set of queue-related keys: * * /local/domain/1/device/vif/0/multi-queue-num-queues = "2" * /local/domain/1/device/vif/0/queue-0 = "" * /local/domain/1/device/vif/0/queue-0/tx-ring-ref = "" * /local/domain/1/device/vif/0/queue-0/rx-ring-ref = "" * /local/domain/1/device/vif/0/queue-0/event-channel-tx = "" * /local/domain/1/device/vif/0/queue-0/event-channel-rx = "" * /local/domain/1/device/vif/0/queue-1 = "" * /local/domain/1/device/vif/0/queue-1/tx-ring-ref = "" * /local/domain/1/device/vif/0/queue-1/rx-ring-ref = "