Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 1 | /**************************************************************************** |
| 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 Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 19 | #ifndef _UAPI_LINUX_VIRTIO_NET_H |
| 20 | #define _UAPI_LINUX_VIRTIO_NET_H |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 21 | #include <linux/types.h> |
| 22 | #include <linux/virtio_ids.h> |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 23 | #include <linux/virtio_config.h> |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 24 | #include <linux/virtio_types.h> |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 25 | #include <linux/if_ether.h> |
| 26 | #define VIRTIO_NET_F_CSUM 0 |
| 27 | #define VIRTIO_NET_F_GUEST_CSUM 1 |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 28 | #define VIRTIO_NET_F_CTRL_GUEST_OFFLOADS 2 |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 29 | #define VIRTIO_NET_F_MTU 3 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 30 | #define VIRTIO_NET_F_MAC 5 |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 31 | #define VIRTIO_NET_F_GUEST_TSO4 7 |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 32 | #define VIRTIO_NET_F_GUEST_TSO6 8 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 33 | #define VIRTIO_NET_F_GUEST_ECN 9 |
| 34 | #define VIRTIO_NET_F_GUEST_UFO 10 |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 35 | #define VIRTIO_NET_F_HOST_TSO4 11 |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 36 | #define VIRTIO_NET_F_HOST_TSO6 12 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 37 | #define VIRTIO_NET_F_HOST_ECN 13 |
| 38 | #define VIRTIO_NET_F_HOST_UFO 14 |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 39 | #define VIRTIO_NET_F_MRG_RXBUF 15 |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 40 | #define VIRTIO_NET_F_STATUS 16 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 41 | #define VIRTIO_NET_F_CTRL_VQ 17 |
| 42 | #define VIRTIO_NET_F_CTRL_RX 18 |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 43 | #define VIRTIO_NET_F_CTRL_VLAN 19 |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 44 | #define VIRTIO_NET_F_CTRL_RX_EXTRA 20 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 45 | #define VIRTIO_NET_F_GUEST_ANNOUNCE 21 |
| 46 | #define VIRTIO_NET_F_MQ 22 |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 47 | #define VIRTIO_NET_F_CTRL_MAC_ADDR 23 |
Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 48 | #define VIRTIO_NET_F_STANDBY 62 |
Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 49 | #define VIRTIO_NET_F_SPEED_DUPLEX 63 |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 50 | #ifndef VIRTIO_NET_NO_LEGACY |
| 51 | #define VIRTIO_NET_F_GSO 6 |
| 52 | #endif |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 53 | #define VIRTIO_NET_S_LINK_UP 1 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 54 | #define VIRTIO_NET_S_ANNOUNCE 2 |
| 55 | struct virtio_net_config { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 56 | __u8 mac[ETH_ALEN]; |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 57 | __u16 status; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 58 | __u16 max_virtqueue_pairs; |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 59 | __u16 mtu; |
Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 60 | __u32 speed; |
| 61 | __u8 duplex; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 62 | } __attribute__((packed)); |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 63 | struct virtio_net_hdr_v1 { |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 64 | #define VIRTIO_NET_HDR_F_NEEDS_CSUM 1 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 65 | #define VIRTIO_NET_HDR_F_DATA_VALID 2 |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 66 | __u8 flags; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 67 | #define VIRTIO_NET_HDR_GSO_NONE 0 |
| 68 | #define VIRTIO_NET_HDR_GSO_TCPV4 1 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 69 | #define VIRTIO_NET_HDR_GSO_UDP 3 |
| 70 | #define VIRTIO_NET_HDR_GSO_TCPV6 4 |
| 71 | #define VIRTIO_NET_HDR_GSO_ECN 0x80 |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 72 | __u8 gso_type; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 73 | __virtio16 hdr_len; |
| 74 | __virtio16 gso_size; |
| 75 | __virtio16 csum_start; |
| 76 | __virtio16 csum_offset; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 77 | __virtio16 num_buffers; |
| 78 | }; |
| 79 | #ifndef VIRTIO_NET_NO_LEGACY |
| 80 | struct virtio_net_hdr { |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 81 | __u8 flags; |
| 82 | __u8 gso_type; |
| 83 | __virtio16 hdr_len; |
| 84 | __virtio16 gso_size; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 85 | __virtio16 csum_start; |
| 86 | __virtio16 csum_offset; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 87 | }; |
| 88 | struct virtio_net_hdr_mrg_rxbuf { |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 89 | struct virtio_net_hdr hdr; |
| 90 | __virtio16 num_buffers; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 91 | }; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 92 | #endif |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 93 | struct virtio_net_ctrl_hdr { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 94 | __u8 class; |
| 95 | __u8 cmd; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 96 | } __attribute__((packed)); |
| 97 | typedef __u8 virtio_net_ctrl_ack; |
| 98 | #define VIRTIO_NET_OK 0 |
| 99 | #define VIRTIO_NET_ERR 1 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 100 | #define VIRTIO_NET_CTRL_RX 0 |
| 101 | #define VIRTIO_NET_CTRL_RX_PROMISC 0 |
| 102 | #define VIRTIO_NET_CTRL_RX_ALLMULTI 1 |
| 103 | #define VIRTIO_NET_CTRL_RX_ALLUNI 2 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 104 | #define VIRTIO_NET_CTRL_RX_NOMULTI 3 |
| 105 | #define VIRTIO_NET_CTRL_RX_NOUNI 4 |
| 106 | #define VIRTIO_NET_CTRL_RX_NOBCAST 5 |
| 107 | struct virtio_net_ctrl_mac { |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 108 | __virtio32 entries; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 109 | __u8 macs[][ETH_ALEN]; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 110 | } __attribute__((packed)); |
| 111 | #define VIRTIO_NET_CTRL_MAC 1 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 112 | #define VIRTIO_NET_CTRL_MAC_TABLE_SET 0 |
| 113 | #define VIRTIO_NET_CTRL_MAC_ADDR_SET 1 |
| 114 | #define VIRTIO_NET_CTRL_VLAN 2 |
| 115 | #define VIRTIO_NET_CTRL_VLAN_ADD 0 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 116 | #define VIRTIO_NET_CTRL_VLAN_DEL 1 |
| 117 | #define VIRTIO_NET_CTRL_ANNOUNCE 3 |
| 118 | #define VIRTIO_NET_CTRL_ANNOUNCE_ACK 0 |
| 119 | struct virtio_net_ctrl_mq { |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 120 | __virtio16 virtqueue_pairs; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 121 | }; |
| 122 | #define VIRTIO_NET_CTRL_MQ 4 |
| 123 | #define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET 0 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 124 | #define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MIN 1 |
| 125 | #define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MAX 0x8000 |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 126 | #define VIRTIO_NET_CTRL_GUEST_OFFLOADS 5 |
| 127 | #define VIRTIO_NET_CTRL_GUEST_OFFLOADS_SET 0 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 128 | #endif |