blob: d2554a099482e62590785fefaf96f4339193756f [file] [log] [blame]
Ben Cheng655a7c02013-10-16 16:09:24 -07001/****************************************************************************
2 ****************************************************************************
3 ***
4 *** This header was automatically generated from a Linux kernel header
5 *** of the same name, to make information necessary for userspace to
6 *** call into the kernel available to libc. It contains only constants,
7 *** structures, and macros generated from the original header, and thus,
8 *** contains no copyrightable information.
9 ***
10 *** To edit the content of this header, modify the corresponding
11 *** source file (e.g. under external/kernel-headers/original/) then
12 *** run bionic/libc/kernel/tools/update_all.py
13 ***
14 *** Any manual change here will be lost the next time this script will
15 *** be run. You've been warned!
16 ***
17 ****************************************************************************
18 ****************************************************************************/
Christopher Ferris49f525c2016-12-12 14:55:36 -080019#ifndef _UAPI_LINUX_VIRTIO_NET_H
20#define _UAPI_LINUX_VIRTIO_NET_H
Ben Cheng655a7c02013-10-16 16:09:24 -070021#include <linux/types.h>
22#include <linux/virtio_ids.h>
Ben Cheng655a7c02013-10-16 16:09:24 -070023#include <linux/virtio_config.h>
Christopher Ferris05d08e92016-02-04 13:16:38 -080024#include <linux/virtio_types.h>
Ben Cheng655a7c02013-10-16 16:09:24 -070025#include <linux/if_ether.h>
26#define VIRTIO_NET_F_CSUM 0
27#define VIRTIO_NET_F_GUEST_CSUM 1
Christopher Ferris05d08e92016-02-04 13:16:38 -080028#define VIRTIO_NET_F_CTRL_GUEST_OFFLOADS 2
Christopher Ferris49f525c2016-12-12 14:55:36 -080029#define VIRTIO_NET_F_MTU 3
Ben Cheng655a7c02013-10-16 16:09:24 -070030#define VIRTIO_NET_F_MAC 5
Christopher Ferris49f525c2016-12-12 14:55:36 -080031#define VIRTIO_NET_F_GUEST_TSO4 7
Christopher Ferris05d08e92016-02-04 13:16:38 -080032#define VIRTIO_NET_F_GUEST_TSO6 8
Ben Cheng655a7c02013-10-16 16:09:24 -070033#define VIRTIO_NET_F_GUEST_ECN 9
34#define VIRTIO_NET_F_GUEST_UFO 10
Christopher Ferris49f525c2016-12-12 14:55:36 -080035#define VIRTIO_NET_F_HOST_TSO4 11
Christopher Ferris05d08e92016-02-04 13:16:38 -080036#define VIRTIO_NET_F_HOST_TSO6 12
Ben Cheng655a7c02013-10-16 16:09:24 -070037#define VIRTIO_NET_F_HOST_ECN 13
38#define VIRTIO_NET_F_HOST_UFO 14
Christopher Ferris49f525c2016-12-12 14:55:36 -080039#define VIRTIO_NET_F_MRG_RXBUF 15
Christopher Ferris05d08e92016-02-04 13:16:38 -080040#define VIRTIO_NET_F_STATUS 16
Ben Cheng655a7c02013-10-16 16:09:24 -070041#define VIRTIO_NET_F_CTRL_VQ 17
42#define VIRTIO_NET_F_CTRL_RX 18
Christopher Ferris49f525c2016-12-12 14:55:36 -080043#define VIRTIO_NET_F_CTRL_VLAN 19
Christopher Ferris05d08e92016-02-04 13:16:38 -080044#define VIRTIO_NET_F_CTRL_RX_EXTRA 20
Ben Cheng655a7c02013-10-16 16:09:24 -070045#define VIRTIO_NET_F_GUEST_ANNOUNCE 21
46#define VIRTIO_NET_F_MQ 22
Christopher Ferris49f525c2016-12-12 14:55:36 -080047#define VIRTIO_NET_F_CTRL_MAC_ADDR 23
Christopher Ferris7447a1c2022-10-04 18:24:44 -070048#define VIRTIO_NET_F_NOTF_COAL 53
Christopher Ferris8b7fdc92023-02-21 13:36:32 -080049#define VIRTIO_NET_F_GUEST_USO4 54
50#define VIRTIO_NET_F_GUEST_USO6 55
51#define VIRTIO_NET_F_HOST_USO 56
Christopher Ferrisaf09c702020-06-01 20:29:29 -070052#define VIRTIO_NET_F_HASH_REPORT 57
Christopher Ferris37c3f3c2023-07-10 10:59:05 -070053#define VIRTIO_NET_F_GUEST_HDRLEN 59
Christopher Ferrisaf09c702020-06-01 20:29:29 -070054#define VIRTIO_NET_F_RSS 60
55#define VIRTIO_NET_F_RSC_EXT 61
Christopher Ferris9ce28842018-10-25 12:11:39 -070056#define VIRTIO_NET_F_STANDBY 62
Christopher Ferris76a1d452018-06-27 14:12:29 -070057#define VIRTIO_NET_F_SPEED_DUPLEX 63
Christopher Ferris05d08e92016-02-04 13:16:38 -080058#ifndef VIRTIO_NET_NO_LEGACY
59#define VIRTIO_NET_F_GSO 6
60#endif
Christopher Ferris49f525c2016-12-12 14:55:36 -080061#define VIRTIO_NET_S_LINK_UP 1
Ben Cheng655a7c02013-10-16 16:09:24 -070062#define VIRTIO_NET_S_ANNOUNCE 2
Christopher Ferrisaf09c702020-06-01 20:29:29 -070063#define VIRTIO_NET_RSS_HASH_TYPE_IPv4 (1 << 0)
64#define VIRTIO_NET_RSS_HASH_TYPE_TCPv4 (1 << 1)
65#define VIRTIO_NET_RSS_HASH_TYPE_UDPv4 (1 << 2)
66#define VIRTIO_NET_RSS_HASH_TYPE_IPv6 (1 << 3)
67#define VIRTIO_NET_RSS_HASH_TYPE_TCPv6 (1 << 4)
68#define VIRTIO_NET_RSS_HASH_TYPE_UDPv6 (1 << 5)
69#define VIRTIO_NET_RSS_HASH_TYPE_IP_EX (1 << 6)
70#define VIRTIO_NET_RSS_HASH_TYPE_TCP_EX (1 << 7)
71#define VIRTIO_NET_RSS_HASH_TYPE_UDP_EX (1 << 8)
Ben Cheng655a7c02013-10-16 16:09:24 -070072struct virtio_net_config {
Tao Baod7db5942015-01-28 10:07:51 -080073 __u8 mac[ETH_ALEN];
Christopher Ferris25c18d42020-10-14 17:42:58 -070074 __virtio16 status;
75 __virtio16 max_virtqueue_pairs;
76 __virtio16 mtu;
77 __le32 speed;
Christopher Ferris76a1d452018-06-27 14:12:29 -070078 __u8 duplex;
Christopher Ferrisaf09c702020-06-01 20:29:29 -070079 __u8 rss_max_key_size;
80 __le16 rss_max_indirection_table_length;
81 __le32 supported_hash_types;
Ben Cheng655a7c02013-10-16 16:09:24 -070082} __attribute__((packed));
Christopher Ferris05d08e92016-02-04 13:16:38 -080083struct virtio_net_hdr_v1 {
Ben Cheng655a7c02013-10-16 16:09:24 -070084#define VIRTIO_NET_HDR_F_NEEDS_CSUM 1
Ben Cheng655a7c02013-10-16 16:09:24 -070085#define VIRTIO_NET_HDR_F_DATA_VALID 2
Christopher Ferrisaf09c702020-06-01 20:29:29 -070086#define VIRTIO_NET_HDR_F_RSC_INFO 4
Tao Baod7db5942015-01-28 10:07:51 -080087 __u8 flags;
Ben Cheng655a7c02013-10-16 16:09:24 -070088#define VIRTIO_NET_HDR_GSO_NONE 0
89#define VIRTIO_NET_HDR_GSO_TCPV4 1
Ben Cheng655a7c02013-10-16 16:09:24 -070090#define VIRTIO_NET_HDR_GSO_UDP 3
91#define VIRTIO_NET_HDR_GSO_TCPV6 4
Christopher Ferris8b7fdc92023-02-21 13:36:32 -080092#define VIRTIO_NET_HDR_GSO_UDP_L4 5
Ben Cheng655a7c02013-10-16 16:09:24 -070093#define VIRTIO_NET_HDR_GSO_ECN 0x80
Tao Baod7db5942015-01-28 10:07:51 -080094 __u8 gso_type;
Christopher Ferris05d08e92016-02-04 13:16:38 -080095 __virtio16 hdr_len;
96 __virtio16 gso_size;
Christopher Ferrisaf09c702020-06-01 20:29:29 -070097 union {
98 struct {
99 __virtio16 csum_start;
100 __virtio16 csum_offset;
101 };
102 struct {
103 __virtio16 start;
104 __virtio16 offset;
105 } csum;
106 struct {
107 __le16 segments;
108 __le16 dup_acks;
109 } rsc;
110 };
Christopher Ferris05d08e92016-02-04 13:16:38 -0800111 __virtio16 num_buffers;
112};
Christopher Ferrisaf09c702020-06-01 20:29:29 -0700113struct virtio_net_hdr_v1_hash {
114 struct virtio_net_hdr_v1 hdr;
115 __le32 hash_value;
116#define VIRTIO_NET_HASH_REPORT_NONE 0
117#define VIRTIO_NET_HASH_REPORT_IPv4 1
118#define VIRTIO_NET_HASH_REPORT_TCPv4 2
119#define VIRTIO_NET_HASH_REPORT_UDPv4 3
120#define VIRTIO_NET_HASH_REPORT_IPv6 4
121#define VIRTIO_NET_HASH_REPORT_TCPv6 5
122#define VIRTIO_NET_HASH_REPORT_UDPv6 6
123#define VIRTIO_NET_HASH_REPORT_IPv6_EX 7
124#define VIRTIO_NET_HASH_REPORT_TCPv6_EX 8
125#define VIRTIO_NET_HASH_REPORT_UDPv6_EX 9
126 __le16 hash_report;
127 __le16 padding;
128};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800129#ifndef VIRTIO_NET_NO_LEGACY
130struct virtio_net_hdr {
Christopher Ferris05d08e92016-02-04 13:16:38 -0800131 __u8 flags;
132 __u8 gso_type;
133 __virtio16 hdr_len;
134 __virtio16 gso_size;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800135 __virtio16 csum_start;
136 __virtio16 csum_offset;
Ben Cheng655a7c02013-10-16 16:09:24 -0700137};
138struct virtio_net_hdr_mrg_rxbuf {
Christopher Ferris05d08e92016-02-04 13:16:38 -0800139 struct virtio_net_hdr hdr;
140 __virtio16 num_buffers;
Ben Cheng655a7c02013-10-16 16:09:24 -0700141};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800142#endif
Ben Cheng655a7c02013-10-16 16:09:24 -0700143struct virtio_net_ctrl_hdr {
Tao Baod7db5942015-01-28 10:07:51 -0800144 __u8 class;
145 __u8 cmd;
Ben Cheng655a7c02013-10-16 16:09:24 -0700146} __attribute__((packed));
147typedef __u8 virtio_net_ctrl_ack;
148#define VIRTIO_NET_OK 0
149#define VIRTIO_NET_ERR 1
Ben Cheng655a7c02013-10-16 16:09:24 -0700150#define VIRTIO_NET_CTRL_RX 0
151#define VIRTIO_NET_CTRL_RX_PROMISC 0
152#define VIRTIO_NET_CTRL_RX_ALLMULTI 1
153#define VIRTIO_NET_CTRL_RX_ALLUNI 2
Ben Cheng655a7c02013-10-16 16:09:24 -0700154#define VIRTIO_NET_CTRL_RX_NOMULTI 3
155#define VIRTIO_NET_CTRL_RX_NOUNI 4
156#define VIRTIO_NET_CTRL_RX_NOBCAST 5
157struct virtio_net_ctrl_mac {
Christopher Ferris05d08e92016-02-04 13:16:38 -0800158 __virtio32 entries;
Tao Baod7db5942015-01-28 10:07:51 -0800159 __u8 macs[][ETH_ALEN];
Ben Cheng655a7c02013-10-16 16:09:24 -0700160} __attribute__((packed));
161#define VIRTIO_NET_CTRL_MAC 1
Ben Cheng655a7c02013-10-16 16:09:24 -0700162#define VIRTIO_NET_CTRL_MAC_TABLE_SET 0
163#define VIRTIO_NET_CTRL_MAC_ADDR_SET 1
164#define VIRTIO_NET_CTRL_VLAN 2
165#define VIRTIO_NET_CTRL_VLAN_ADD 0
Ben Cheng655a7c02013-10-16 16:09:24 -0700166#define VIRTIO_NET_CTRL_VLAN_DEL 1
167#define VIRTIO_NET_CTRL_ANNOUNCE 3
168#define VIRTIO_NET_CTRL_ANNOUNCE_ACK 0
Christopher Ferrisaf09c702020-06-01 20:29:29 -0700169#define VIRTIO_NET_CTRL_MQ 4
Ben Cheng655a7c02013-10-16 16:09:24 -0700170struct virtio_net_ctrl_mq {
Christopher Ferris05d08e92016-02-04 13:16:38 -0800171 __virtio16 virtqueue_pairs;
Ben Cheng655a7c02013-10-16 16:09:24 -0700172};
Ben Cheng655a7c02013-10-16 16:09:24 -0700173#define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET 0
Ben Cheng655a7c02013-10-16 16:09:24 -0700174#define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MIN 1
175#define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MAX 0x8000
Christopher Ferrisaf09c702020-06-01 20:29:29 -0700176struct virtio_net_rss_config {
177 __le32 hash_types;
178 __le16 indirection_table_mask;
179 __le16 unclassified_queue;
180 __le16 indirection_table[1];
181 __le16 max_tx_vq;
182 __u8 hash_key_length;
183 __u8 hash_key_data[];
184};
185#define VIRTIO_NET_CTRL_MQ_RSS_CONFIG 1
186struct virtio_net_hash_config {
187 __le32 hash_types;
188 __le16 reserved[4];
189 __u8 hash_key_length;
190 __u8 hash_key_data[];
191};
192#define VIRTIO_NET_CTRL_MQ_HASH_CONFIG 2
Christopher Ferris05d08e92016-02-04 13:16:38 -0800193#define VIRTIO_NET_CTRL_GUEST_OFFLOADS 5
194#define VIRTIO_NET_CTRL_GUEST_OFFLOADS_SET 0
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700195#define VIRTIO_NET_CTRL_NOTF_COAL 6
196struct virtio_net_ctrl_coal_tx {
197 __le32 tx_max_packets;
198 __le32 tx_usecs;
199};
200#define VIRTIO_NET_CTRL_NOTF_COAL_TX_SET 0
201struct virtio_net_ctrl_coal_rx {
202 __le32 rx_max_packets;
203 __le32 rx_usecs;
204};
205#define VIRTIO_NET_CTRL_NOTF_COAL_RX_SET 1
Ben Cheng655a7c02013-10-16 16:09:24 -0700206#endif