blob: 07afd06cc464e6185928c71f8c87eed8e6c051c5 [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 Ferris9ce28842018-10-25 12:11:39 -070048#define VIRTIO_NET_F_STANDBY 62
Christopher Ferris76a1d452018-06-27 14:12:29 -070049#define VIRTIO_NET_F_SPEED_DUPLEX 63
Christopher Ferris05d08e92016-02-04 13:16:38 -080050#ifndef VIRTIO_NET_NO_LEGACY
51#define VIRTIO_NET_F_GSO 6
52#endif
Christopher Ferris49f525c2016-12-12 14:55:36 -080053#define VIRTIO_NET_S_LINK_UP 1
Ben Cheng655a7c02013-10-16 16:09:24 -070054#define VIRTIO_NET_S_ANNOUNCE 2
55struct virtio_net_config {
Tao Baod7db5942015-01-28 10:07:51 -080056 __u8 mac[ETH_ALEN];
Christopher Ferris49f525c2016-12-12 14:55:36 -080057 __u16 status;
Tao Baod7db5942015-01-28 10:07:51 -080058 __u16 max_virtqueue_pairs;
Christopher Ferris49f525c2016-12-12 14:55:36 -080059 __u16 mtu;
Christopher Ferris76a1d452018-06-27 14:12:29 -070060 __u32 speed;
61 __u8 duplex;
Ben Cheng655a7c02013-10-16 16:09:24 -070062} __attribute__((packed));
Christopher Ferris05d08e92016-02-04 13:16:38 -080063struct virtio_net_hdr_v1 {
Ben Cheng655a7c02013-10-16 16:09:24 -070064#define VIRTIO_NET_HDR_F_NEEDS_CSUM 1
Ben Cheng655a7c02013-10-16 16:09:24 -070065#define VIRTIO_NET_HDR_F_DATA_VALID 2
Tao Baod7db5942015-01-28 10:07:51 -080066 __u8 flags;
Ben Cheng655a7c02013-10-16 16:09:24 -070067#define VIRTIO_NET_HDR_GSO_NONE 0
68#define VIRTIO_NET_HDR_GSO_TCPV4 1
Ben Cheng655a7c02013-10-16 16:09:24 -070069#define VIRTIO_NET_HDR_GSO_UDP 3
70#define VIRTIO_NET_HDR_GSO_TCPV6 4
71#define VIRTIO_NET_HDR_GSO_ECN 0x80
Tao Baod7db5942015-01-28 10:07:51 -080072 __u8 gso_type;
Christopher Ferris05d08e92016-02-04 13:16:38 -080073 __virtio16 hdr_len;
74 __virtio16 gso_size;
75 __virtio16 csum_start;
76 __virtio16 csum_offset;
Christopher Ferris05d08e92016-02-04 13:16:38 -080077 __virtio16 num_buffers;
78};
79#ifndef VIRTIO_NET_NO_LEGACY
80struct virtio_net_hdr {
Christopher Ferris05d08e92016-02-04 13:16:38 -080081 __u8 flags;
82 __u8 gso_type;
83 __virtio16 hdr_len;
84 __virtio16 gso_size;
Christopher Ferris05d08e92016-02-04 13:16:38 -080085 __virtio16 csum_start;
86 __virtio16 csum_offset;
Ben Cheng655a7c02013-10-16 16:09:24 -070087};
88struct virtio_net_hdr_mrg_rxbuf {
Christopher Ferris05d08e92016-02-04 13:16:38 -080089 struct virtio_net_hdr hdr;
90 __virtio16 num_buffers;
Ben Cheng655a7c02013-10-16 16:09:24 -070091};
Christopher Ferris05d08e92016-02-04 13:16:38 -080092#endif
Ben Cheng655a7c02013-10-16 16:09:24 -070093struct virtio_net_ctrl_hdr {
Tao Baod7db5942015-01-28 10:07:51 -080094 __u8 class;
95 __u8 cmd;
Ben Cheng655a7c02013-10-16 16:09:24 -070096} __attribute__((packed));
97typedef __u8 virtio_net_ctrl_ack;
98#define VIRTIO_NET_OK 0
99#define VIRTIO_NET_ERR 1
Ben Cheng655a7c02013-10-16 16:09:24 -0700100#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 Cheng655a7c02013-10-16 16:09:24 -0700104#define VIRTIO_NET_CTRL_RX_NOMULTI 3
105#define VIRTIO_NET_CTRL_RX_NOUNI 4
106#define VIRTIO_NET_CTRL_RX_NOBCAST 5
107struct virtio_net_ctrl_mac {
Christopher Ferris05d08e92016-02-04 13:16:38 -0800108 __virtio32 entries;
Tao Baod7db5942015-01-28 10:07:51 -0800109 __u8 macs[][ETH_ALEN];
Ben Cheng655a7c02013-10-16 16:09:24 -0700110} __attribute__((packed));
111#define VIRTIO_NET_CTRL_MAC 1
Ben Cheng655a7c02013-10-16 16:09:24 -0700112#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 Cheng655a7c02013-10-16 16:09:24 -0700116#define VIRTIO_NET_CTRL_VLAN_DEL 1
117#define VIRTIO_NET_CTRL_ANNOUNCE 3
118#define VIRTIO_NET_CTRL_ANNOUNCE_ACK 0
119struct virtio_net_ctrl_mq {
Christopher Ferris05d08e92016-02-04 13:16:38 -0800120 __virtio16 virtqueue_pairs;
Ben Cheng655a7c02013-10-16 16:09:24 -0700121};
122#define VIRTIO_NET_CTRL_MQ 4
123#define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET 0
Ben Cheng655a7c02013-10-16 16:09:24 -0700124#define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MIN 1
125#define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MAX 0x8000
Christopher Ferris05d08e92016-02-04 13:16:38 -0800126#define VIRTIO_NET_CTRL_GUEST_OFFLOADS 5
127#define VIRTIO_NET_CTRL_GUEST_OFFLOADS_SET 0
Ben Cheng655a7c02013-10-16 16:09:24 -0700128#endif