1170620Sbms#ifndef _UAPI_LINUX_VIRTIO_NET_H 2189335Sbms#define _UAPI_LINUX_VIRTIO_NET_H 3189335Sbms/* This header is BSD licensed so anyone can use the definitions to implement 4170620Sbms * compatible drivers/servers. 5170620Sbms * 6170620Sbms * Redistribution and use in source and binary forms, with or without 7170620Sbms * modification, are permitted provided that the following conditions 8170620Sbms * are met: 9170620Sbms * 1. Redistributions of source code must retain the above copyright 10170620Sbms * notice, this list of conditions and the following disclaimer. 11170620Sbms * 2. Redistributions in binary form must reproduce the above copyright 12170620Sbms * notice, this list of conditions and the following disclaimer in the 13170620Sbms * documentation and/or other materials provided with the distribution. 14189335Sbms * 3. Neither the name of IBM nor the names of its contributors 15189335Sbms * may be used to endorse or promote products derived from this software 16189335Sbms * without specific prior written permission. 17189335Sbms * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND 18189335Sbms * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19189335Sbms * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20189335Sbms * ARE DISCLAIMED. IN NO EVENT SHALL IBM OR CONTRIBUTORS BE LIABLE 21189335Sbms * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22189335Sbms * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23189335Sbms * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24189335Sbms * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25170620Sbms * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26170620Sbms * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27170620Sbms * SUCH DAMAGE. */ 28170620Sbms#include <linux/types.h> 29170620Sbms#include <linux/virtio_ids.h> 30170620Sbms#include <linux/virtio_config.h> 31170620Sbms#include <linux/virtio_types.h> 32170620Sbms#include <linux/if_ether.h> 33170620Sbms 34170620Sbms/* The feature bitmap for virtio net */ 35170620Sbms#define VIRTIO_NET_F_CSUM 0 /* Host handles pkts w/ partial csum */ 36170620Sbms#define VIRTIO_NET_F_GUEST_CSUM 1 /* Guest handles pkts w/ partial csum */ 37170620Sbms#define VIRTIO_NET_F_CTRL_GUEST_OFFLOADS 2 /* Dynamic offload configuration. */ 38170620Sbms#define VIRTIO_NET_F_MTU 3 /* Initial MTU advice */ 39170620Sbms#define VIRTIO_NET_F_MAC 5 /* Host has given MAC address. */ 40170620Sbms#define VIRTIO_NET_F_GUEST_TSO4 7 /* Guest can handle TSOv4 in. */ 41170620Sbms#define VIRTIO_NET_F_GUEST_TSO6 8 /* Guest can handle TSOv6 in. */ 42170620Sbms#define VIRTIO_NET_F_GUEST_ECN 9 /* Guest can handle TSO[6] w/ ECN in. */ 43170620Sbms#define VIRTIO_NET_F_GUEST_UFO 10 /* Guest can handle UFO in. */ 44170620Sbms#define VIRTIO_NET_F_HOST_TSO4 11 /* Host can handle TSOv4 in. */ 45170620Sbms#define VIRTIO_NET_F_HOST_TSO6 12 /* Host can handle TSOv6 in. */ 46170620Sbms#define VIRTIO_NET_F_HOST_ECN 13 /* Host can handle TSO[6] w/ ECN in. */ 47170620Sbms#define VIRTIO_NET_F_HOST_UFO 14 /* Host can handle UFO in. */ 48170620Sbms#define VIRTIO_NET_F_MRG_RXBUF 15 /* Host can merge receive buffers. */ 49170620Sbms#define VIRTIO_NET_F_STATUS 16 /* virtio_net_config.status available */ 50170620Sbms#define VIRTIO_NET_F_CTRL_VQ 17 /* Control channel available */ 51170620Sbms#define VIRTIO_NET_F_CTRL_RX 18 /* Control channel RX mode support */ 52170620Sbms#define VIRTIO_NET_F_CTRL_VLAN 19 /* Control channel VLAN filtering */ 53170620Sbms#define VIRTIO_NET_F_CTRL_RX_EXTRA 20 /* Extra RX mode control support */ 54170620Sbms#define VIRTIO_NET_F_GUEST_ANNOUNCE 21 /* Guest can announce device on the 55170620Sbms * network */ 56170620Sbms#define VIRTIO_NET_F_MQ 22 /* Device supports Receive Flow 57170620Sbms * Steering */ 58170620Sbms#define VIRTIO_NET_F_CTRL_MAC_ADDR 23 /* Set MAC address */ 59170620Sbms#define VIRTIO_NET_F_VQ_NOTF_COAL 52 /* Device supports virtqueue notification coalescing */ 60170620Sbms#define VIRTIO_NET_F_NOTF_COAL 53 /* Device supports notifications coalescing */ 61170620Sbms#define VIRTIO_NET_F_GUEST_USO4 54 /* Guest can handle USOv4 in. */ 62170620Sbms#define VIRTIO_NET_F_GUEST_USO6 55 /* Guest can handle USOv6 in. */ 63170620Sbms#define VIRTIO_NET_F_HOST_USO 56 /* Host can handle USO in. */ 64170620Sbms#define VIRTIO_NET_F_HASH_REPORT 57 /* Supports hash report */ 65170620Sbms#define VIRTIO_NET_F_GUEST_HDRLEN 59 /* Guest provides the exact hdr_len value. */ 66170620Sbms#define VIRTIO_NET_F_RSS 60 /* Supports RSS RX steering */ 67170620Sbms#define VIRTIO_NET_F_RSC_EXT 61 /* extended coalescing info */ 68170620Sbms#define VIRTIO_NET_F_STANDBY 62 /* Act as standby for another device 69170620Sbms * with the same MAC. 70170620Sbms */ 71170620Sbms#define VIRTIO_NET_F_SPEED_DUPLEX 63 /* Device set linkspeed and duplex */ 72170620Sbms 73170620Sbms#ifndef VIRTIO_NET_NO_LEGACY 74170620Sbms#define VIRTIO_NET_F_GSO 6 /* Host handles pkts w/ any GSO type */ 75170620Sbms#endif /* VIRTIO_NET_NO_LEGACY */ 76170620Sbms 77170620Sbms#define VIRTIO_NET_S_LINK_UP 1 /* Link is up */ 78170620Sbms#define VIRTIO_NET_S_ANNOUNCE 2 /* Announcement is needed */ 79170620Sbms 80170620Sbms/* supported/enabled hash types */ 81170620Sbms#define VIRTIO_NET_RSS_HASH_TYPE_IPv4 (1 << 0) 82170620Sbms#define VIRTIO_NET_RSS_HASH_TYPE_TCPv4 (1 << 1) 83170620Sbms#define VIRTIO_NET_RSS_HASH_TYPE_UDPv4 (1 << 2) 84170620Sbms#define VIRTIO_NET_RSS_HASH_TYPE_IPv6 (1 << 3) 85170620Sbms#define VIRTIO_NET_RSS_HASH_TYPE_TCPv6 (1 << 4) 86170620Sbms#define VIRTIO_NET_RSS_HASH_TYPE_UDPv6 (1 << 5) 87170620Sbms#define VIRTIO_NET_RSS_HASH_TYPE_IP_EX (1 << 6) 88170620Sbms#define VIRTIO_NET_RSS_HASH_TYPE_TCP_EX (1 << 7) 89170620Sbms#define VIRTIO_NET_RSS_HASH_TYPE_UDP_EX (1 << 8) 90170620Sbms 91170620Sbmsstruct virtio_net_config { 92170620Sbms /* The config defining mac address (if VIRTIO_NET_F_MAC) */ 93170620Sbms __u8 mac[ETH_ALEN]; 94170620Sbms /* See VIRTIO_NET_F_STATUS and VIRTIO_NET_S_* above */ 95170620Sbms __virtio16 status; 96170620Sbms /* Maximum number of each of transmit and receive queues; 97170620Sbms * see VIRTIO_NET_F_MQ and VIRTIO_NET_CTRL_MQ. 98170620Sbms * Legal values are between 1 and 0x8000 99170620Sbms */ 100170620Sbms __virtio16 max_virtqueue_pairs; 101170620Sbms /* Default maximum transmit unit advice */ 102170620Sbms __virtio16 mtu; 103170620Sbms /* 104170620Sbms * speed, in units of 1Mb. All values 0 to INT_MAX are legal. 105170620Sbms * Any other value stands for unknown. 106170620Sbms */ 107170620Sbms __le32 speed; 108170620Sbms /* 109170620Sbms * 0x00 - half duplex 110170620Sbms * 0x01 - full duplex 111170620Sbms * Any other value stands for unknown. 112170620Sbms */ 113170620Sbms __u8 duplex; 114170620Sbms /* maximum size of RSS key */ 115170620Sbms __u8 rss_max_key_size; 116170620Sbms /* maximum number of indirection table entries */ 117170620Sbms __le16 rss_max_indirection_table_length; 118170620Sbms /* bitmask of supported VIRTIO_NET_RSS_HASH_ types */ 119170620Sbms __le32 supported_hash_types; 120170620Sbms} __attribute__((packed)); 121170620Sbms 122170620Sbms/* 123235640Smarcel * This header comes first in the scatter-gather list. If you don't 124170620Sbms * specify GSO or CSUM features, you can simply ignore the header. 125170620Sbms * 126170620Sbms * This is bitwise-equivalent to the legacy struct virtio_net_hdr_mrg_rxbuf, 127170620Sbms * only flattened. 128170620Sbms */ 129170620Sbmsstruct virtio_net_hdr_v1 { 130170620Sbms#define VIRTIO_NET_HDR_F_NEEDS_CSUM 1 /* Use csum_start, csum_offset */ 131170620Sbms#define VIRTIO_NET_HDR_F_DATA_VALID 2 /* Csum is valid */ 132170620Sbms#define VIRTIO_NET_HDR_F_RSC_INFO 4 /* rsc info in csum_ fields */ 133170620Sbms __u8 flags; 134170620Sbms#define VIRTIO_NET_HDR_GSO_NONE 0 /* Not a GSO frame */ 135170620Sbms#define VIRTIO_NET_HDR_GSO_TCPV4 1 /* GSO frame, IPv4 TCP (TSO) */ 136170620Sbms#define VIRTIO_NET_HDR_GSO_UDP 3 /* GSO frame, IPv4 UDP (UFO) */ 137170620Sbms#define VIRTIO_NET_HDR_GSO_TCPV6 4 /* GSO frame, IPv6 TCP */ 138170620Sbms#define VIRTIO_NET_HDR_GSO_UDP_L4 5 /* GSO frame, IPv4& IPv6 UDP (USO) */ 139170620Sbms#define VIRTIO_NET_HDR_GSO_ECN 0x80 /* TCP has ECN set */ 140170620Sbms __u8 gso_type; 141170620Sbms __virtio16 hdr_len; /* Ethernet + IP + tcp/udp hdrs */ 142170620Sbms __virtio16 gso_size; /* Bytes to append to hdr_len per frame */ 143170620Sbms union { 144170620Sbms struct { 145170620Sbms __virtio16 csum_start; 146170620Sbms __virtio16 csum_offset; 147170620Sbms }; 148170620Sbms /* Checksum calculation */ 149170620Sbms struct { 150170620Sbms /* Position to start checksumming from */ 151170620Sbms __virtio16 start; 152170620Sbms /* Offset after that to place checksum */ 153170620Sbms __virtio16 offset; 154170620Sbms } csum; 155170620Sbms /* Receive Segment Coalescing */ 156170620Sbms struct { 157170620Sbms /* Number of coalesced segments */ 158170620Sbms __le16 segments; 159170620Sbms /* Number of duplicated acks */ 160170620Sbms __le16 dup_acks; 161170620Sbms } rsc; 162170620Sbms }; 163170620Sbms __virtio16 num_buffers; /* Number of merged rx buffers */ 164170620Sbms}; 165170620Sbms 166170620Sbmsstruct virtio_net_hdr_v1_hash { 167170620Sbms struct virtio_net_hdr_v1 hdr; 168170620Sbms __le32 hash_value; 169170620Sbms#define VIRTIO_NET_HASH_REPORT_NONE 0 170170620Sbms#define VIRTIO_NET_HASH_REPORT_IPv4 1 171170620Sbms#define VIRTIO_NET_HASH_REPORT_TCPv4 2 172170620Sbms#define VIRTIO_NET_HASH_REPORT_UDPv4 3 173170620Sbms#define VIRTIO_NET_HASH_REPORT_IPv6 4 174170620Sbms#define VIRTIO_NET_HASH_REPORT_TCPv6 5 175170620Sbms#define VIRTIO_NET_HASH_REPORT_UDPv6 6 176170620Sbms#define VIRTIO_NET_HASH_REPORT_IPv6_EX 7 177170620Sbms#define VIRTIO_NET_HASH_REPORT_TCPv6_EX 8 178170620Sbms#define VIRTIO_NET_HASH_REPORT_UDPv6_EX 9 179170620Sbms __le16 hash_report; 180170620Sbms __le16 padding; 181170620Sbms}; 182170620Sbms 183170620Sbms#ifndef VIRTIO_NET_NO_LEGACY 184170620Sbms/* This header comes first in the scatter-gather list. 185170620Sbms * For legacy virtio, if VIRTIO_F_ANY_LAYOUT is not negotiated, it must 186170620Sbms * be the first element of the scatter-gather list. If you don't 187170620Sbms * specify GSO or CSUM features, you can simply ignore the header. */ 188170620Sbmsstruct virtio_net_hdr { 189170620Sbms /* See VIRTIO_NET_HDR_F_* */ 190170620Sbms __u8 flags; 191170620Sbms /* See VIRTIO_NET_HDR_GSO_* */ 192170620Sbms __u8 gso_type; 193170620Sbms __virtio16 hdr_len; /* Ethernet + IP + tcp/udp hdrs */ 194170620Sbms __virtio16 gso_size; /* Bytes to append to hdr_len per frame */ 195170620Sbms __virtio16 csum_start; /* Position to start checksumming from */ 196170620Sbms __virtio16 csum_offset; /* Offset after that to place checksum */ 197170620Sbms}; 198170620Sbms 199170620Sbms/* This is the version of the header to use when the MRG_RXBUF 200170620Sbms * feature has been negotiated. */ 201170620Sbmsstruct virtio_net_hdr_mrg_rxbuf { 202170620Sbms struct virtio_net_hdr hdr; 203170620Sbms __virtio16 num_buffers; /* Number of merged rx buffers */ 204170620Sbms}; 205170620Sbms#endif /* ...VIRTIO_NET_NO_LEGACY */ 206170620Sbms 207170620Sbms/* 208170620Sbms * Control virtqueue data structures 209170620Sbms * 210170620Sbms * The control virtqueue expects a header in the first sg entry 211170620Sbms * and an ack/status response in the last entry. Data for the 212170620Sbms * command goes in between. 213170620Sbms */ 214170620Sbmsstruct virtio_net_ctrl_hdr { 215170620Sbms __u8 class; 216170620Sbms __u8 cmd; 217170620Sbms} __attribute__((packed)); 218170620Sbms 219170620Sbmstypedef __u8 virtio_net_ctrl_ack; 220170620Sbms 221170620Sbms#define VIRTIO_NET_OK 0 222170620Sbms#define VIRTIO_NET_ERR 1 223170620Sbms 224170620Sbms/* 225170620Sbms * Control the RX mode, ie. promisucous, allmulti, etc... 226170620Sbms * All commands require an "out" sg entry containing a 1 byte 227170620Sbms * state value, zero = disable, non-zero = enable. Commands 228170620Sbms * 0 and 1 are supported with the VIRTIO_NET_F_CTRL_RX feature. 229170620Sbms * Commands 2-5 are added with VIRTIO_NET_F_CTRL_RX_EXTRA. 230170620Sbms */ 231170620Sbms#define VIRTIO_NET_CTRL_RX 0 232170620Sbms #define VIRTIO_NET_CTRL_RX_PROMISC 0 233170620Sbms #define VIRTIO_NET_CTRL_RX_ALLMULTI 1 234170620Sbms #define VIRTIO_NET_CTRL_RX_ALLUNI 2 235170620Sbms #define VIRTIO_NET_CTRL_RX_NOMULTI 3 236170620Sbms #define VIRTIO_NET_CTRL_RX_NOUNI 4 237170620Sbms #define VIRTIO_NET_CTRL_RX_NOBCAST 5 238170620Sbms 239170620Sbms/* 240170620Sbms * Control the MAC 241170620Sbms * 242170620Sbms * The MAC filter table is managed by the hypervisor, the guest should 243170620Sbms * assume the size is infinite. Filtering should be considered 244170620Sbms * non-perfect, ie. based on hypervisor resources, the guest may 245170620Sbms * received packets from sources not specified in the filter list. 246170620Sbms * 247170620Sbms * In addition to the class/cmd header, the TABLE_SET command requires 248170620Sbms * two out scatterlists. Each contains a 4 byte count of entries followed 249170620Sbms * by a concatenated byte stream of the ETH_ALEN MAC addresses. The 250170620Sbms * first sg list contains unicast addresses, the second is for multicast. 251170620Sbms * This functionality is present if the VIRTIO_NET_F_CTRL_RX feature 252170620Sbms * is available. 253170620Sbms * 254170620Sbms * The ADDR_SET command requests one out scatterlist, it contains a 255170620Sbms * 6 bytes MAC address. This functionality is present if the 256170620Sbms * VIRTIO_NET_F_CTRL_MAC_ADDR feature is available. 257170620Sbms */ 258170620Sbmsstruct virtio_net_ctrl_mac { 259170620Sbms __virtio32 entries; 260170620Sbms __u8 macs[][ETH_ALEN]; 261170620Sbms} __attribute__((packed)); 262170620Sbms 263170620Sbms#define VIRTIO_NET_CTRL_MAC 1 264170620Sbms #define VIRTIO_NET_CTRL_MAC_TABLE_SET 0 265170620Sbms #define VIRTIO_NET_CTRL_MAC_ADDR_SET 1 266170620Sbms 267170620Sbms/* 268170620Sbms * Control VLAN filtering 269170620Sbms * 270170620Sbms * The VLAN filter table is controlled via a simple ADD/DEL interface. 271170620Sbms * VLAN IDs not added may be filterd by the hypervisor. Del is the 272170620Sbms * opposite of add. Both commands expect an out entry containing a 2 273170620Sbms * byte VLAN ID. VLAN filterting is available with the 274170620Sbms * VIRTIO_NET_F_CTRL_VLAN feature bit. 275170620Sbms */ 276170620Sbms#define VIRTIO_NET_CTRL_VLAN 2 277170620Sbms #define VIRTIO_NET_CTRL_VLAN_ADD 0 278170620Sbms #define VIRTIO_NET_CTRL_VLAN_DEL 1 279170620Sbms 280170620Sbms/* 281170620Sbms * Control link announce acknowledgement 282170620Sbms * 283170620Sbms * The command VIRTIO_NET_CTRL_ANNOUNCE_ACK is used to indicate that 284170620Sbms * driver has recevied the notification; device would clear the 285170620Sbms * VIRTIO_NET_S_ANNOUNCE bit in the status field after it receives 286170620Sbms * this command. 287170620Sbms */ 288170620Sbms#define VIRTIO_NET_CTRL_ANNOUNCE 3 289170620Sbms #define VIRTIO_NET_CTRL_ANNOUNCE_ACK 0 290170620Sbms 291170620Sbms/* 292170620Sbms * Control Receive Flow Steering 293170620Sbms */ 294170620Sbms#define VIRTIO_NET_CTRL_MQ 4 295170620Sbms/* 296170620Sbms * The command VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET 297170620Sbms * enables Receive Flow Steering, specifying the number of the transmit and 298170620Sbms * receive queues that will be used. After the command is consumed and acked by 299170620Sbms * the device, the device will not steer new packets on receive virtqueues 300170620Sbms * other than specified nor read from transmit virtqueues other than specified. 301170620Sbms * Accordingly, driver should not transmit new packets on virtqueues other than 302170620Sbms * specified. 303170620Sbms */ 304170620Sbmsstruct virtio_net_ctrl_mq { 305170620Sbms __virtio16 virtqueue_pairs; 306170625Sbms}; 307170620Sbms 308170620Sbms #define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET 0 309170620Sbms #define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MIN 1 310170620Sbms #define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MAX 0x8000 311170620Sbms 312170620Sbms/* 313170620Sbms * The command VIRTIO_NET_CTRL_MQ_RSS_CONFIG has the same effect as 314170620Sbms * VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET does and additionally configures 315170620Sbms * the receive steering to use a hash calculated for incoming packet 316170620Sbms * to decide on receive virtqueue to place the packet. The command 317170620Sbms * also provides parameters to calculate a hash and receive virtqueue. 318170620Sbms */ 319170620Sbmsstruct virtio_net_rss_config { 320170620Sbms __le32 hash_types; 321170620Sbms __le16 indirection_table_mask; 322170620Sbms __le16 unclassified_queue; 323170620Sbms __le16 indirection_table[1/* + indirection_table_mask */]; 324170620Sbms __le16 max_tx_vq; 325170620Sbms __u8 hash_key_length; 326171197Speter __u8 hash_key_data[/* hash_key_length */]; 327170620Sbms}; 328170620Sbms 329170620Sbms #define VIRTIO_NET_CTRL_MQ_RSS_CONFIG 1 330170620Sbms 331170620Sbms/* 332170620Sbms * The command VIRTIO_NET_CTRL_MQ_HASH_CONFIG requests the device 333170620Sbms * to include in the virtio header of the packet the value of the 334170620Sbms * calculated hash and the report type of hash. It also provides 335170620Sbms * parameters for hash calculation. The command requires feature 336170620Sbms * VIRTIO_NET_F_HASH_REPORT to be negotiated to extend the 337170620Sbms * layout of virtio header as defined in virtio_net_hdr_v1_hash. 338170620Sbms */ 339170620Sbmsstruct virtio_net_hash_config { 340269480Spfg __le32 hash_types; 341269480Spfg /* for compatibility with virtio_net_rss_config */ 342170620Sbms __le16 reserved[4]; 343170620Sbms __u8 hash_key_length; 344170620Sbms __u8 hash_key_data[/* hash_key_length */]; 345170620Sbms}; 346170620Sbms 347170620Sbms #define VIRTIO_NET_CTRL_MQ_HASH_CONFIG 2 348170620Sbms 349191654Sbms/* 350170620Sbms * Control network offloads 351170620Sbms * 352170620Sbms * Reconfigures the network offloads that Guest can handle. 353170620Sbms * 354170620Sbms * Available with the VIRTIO_NET_F_CTRL_GUEST_OFFLOADS feature bit. 355170620Sbms * 356170620Sbms * Command data format matches the feature bit mask exactly. 357170620Sbms * 358170620Sbms * See VIRTIO_NET_F_GUEST_* for the list of offloads 359170620Sbms * that can be enabled/disabled. 360170620Sbms */ 361170620Sbms#define VIRTIO_NET_CTRL_GUEST_OFFLOADS 5 362170620Sbms#define VIRTIO_NET_CTRL_GUEST_OFFLOADS_SET 0 363170620Sbms 364170620Sbms/* 365170620Sbms * Control notifications coalescing. 366170620Sbms * 367170620Sbms * Request the device to change the notifications coalescing parameters. 368170620Sbms * 369170625Sbms * Available with the VIRTIO_NET_F_NOTF_COAL feature bit. 370170620Sbms */ 371170620Sbms#define VIRTIO_NET_CTRL_NOTF_COAL 6 372170620Sbms/* 373170620Sbms * Set the tx-usecs/tx-max-packets parameters. 374170620Sbms */ 375170620Sbmsstruct virtio_net_ctrl_coal_tx { 376170620Sbms /* Maximum number of packets to send before a TX notification */ 377170620Sbms __le32 tx_max_packets; 378170620Sbms /* Maximum number of usecs to delay a TX notification */ 379170620Sbms __le32 tx_usecs; 380170620Sbms}; 381170620Sbms 382170620Sbms#define VIRTIO_NET_CTRL_NOTF_COAL_TX_SET 0 383170620Sbms 384170620Sbms/* 385170620Sbms * Set the rx-usecs/rx-max-packets parameters. 386170620Sbms */ 387191654Sbmsstruct virtio_net_ctrl_coal_rx { 388170620Sbms /* Maximum number of packets to receive before a RX notification */ 389170620Sbms __le32 rx_max_packets; 390170620Sbms /* Maximum number of usecs to delay a RX notification */ 391170620Sbms __le32 rx_usecs; 392170620Sbms}; 393170620Sbms 394170620Sbms#define VIRTIO_NET_CTRL_NOTF_COAL_RX_SET 1 395170620Sbms#define VIRTIO_NET_CTRL_NOTF_COAL_VQ_SET 2 396171197Speter#define VIRTIO_NET_CTRL_NOTF_COAL_VQ_GET 3 397170620Sbms 398170620Sbmsstruct virtio_net_ctrl_coal { 399170620Sbms __le32 max_packets; 400170620Sbms __le32 max_usecs; 401170620Sbms}; 402170620Sbms 403170620Sbmsstruct virtio_net_ctrl_coal_vq { 404 __le16 vqn; 405 __le16 reserved; 406 struct virtio_net_ctrl_coal coal; 407}; 408 409#endif /* _UAPI_LINUX_VIRTIO_NET_H */ 410