blob: 329d736bb42fd67694806a467583e4451a6191fe [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 Ferris76a1d452018-06-27 14:12:29 -070048#define VIRTIO_NET_F_SPEED_DUPLEX 63
Christopher Ferris05d08e92016-02-04 13:16:38 -080049#ifndef VIRTIO_NET_NO_LEGACY
50#define VIRTIO_NET_F_GSO 6
51#endif
Christopher Ferris49f525c2016-12-12 14:55:36 -080052#define VIRTIO_NET_S_LINK_UP 1
Ben Cheng655a7c02013-10-16 16:09:24 -070053#define VIRTIO_NET_S_ANNOUNCE 2
54struct virtio_net_config {
Tao Baod7db5942015-01-28 10:07:51 -080055 __u8 mac[ETH_ALEN];
Christopher Ferris49f525c2016-12-12 14:55:36 -080056 __u16 status;
Tao Baod7db5942015-01-28 10:07:51 -080057 __u16 max_virtqueue_pairs;
Christopher Ferris49f525c2016-12-12 14:55:36 -080058 __u16 mtu;
Christopher Ferris76a1d452018-06-27 14:12:29 -070059 __u32 speed;
60 __u8 duplex;
Ben Cheng655a7c02013-10-16 16:09:24 -070061} __attribute__((packed));
Christopher Ferris05d08e92016-02-04 13:16:38 -080062struct virtio_net_hdr_v1 {
Ben Cheng655a7c02013-10-16 16:09:24 -070063#define VIRTIO_NET_HDR_F_NEEDS_CSUM 1
Ben Cheng655a7c02013-10-16 16:09:24 -070064#define VIRTIO_NET_HDR_F_DATA_VALID 2
Tao Baod7db5942015-01-28 10:07:51 -080065 __u8 flags;
Ben Cheng655a7c02013-10-16 16:09:24 -070066#define VIRTIO_NET_HDR_GSO_NONE 0
67#define VIRTIO_NET_HDR_GSO_TCPV4 1
Ben Cheng655a7c02013-10-16 16:09:24 -070068#define VIRTIO_NET_HDR_GSO_UDP 3
69#define VIRTIO_NET_HDR_GSO_TCPV6 4
70#define VIRTIO_NET_HDR_GSO_ECN 0x80
Tao Baod7db5942015-01-28 10:07:51 -080071 __u8 gso_type;
Christopher Ferris05d08e92016-02-04 13:16:38 -080072 __virtio16 hdr_len;
73 __virtio16 gso_size;
74 __virtio16 csum_start;
75 __virtio16 csum_offset;
Christopher Ferris05d08e92016-02-04 13:16:38 -080076 __virtio16 num_buffers;
77};
78#ifndef VIRTIO_NET_NO_LEGACY
79struct virtio_net_hdr {
Christopher Ferris05d08e92016-02-04 13:16:38 -080080 __u8 flags;
81 __u8 gso_type;
82 __virtio16 hdr_len;
83 __virtio16 gso_size;
Christopher Ferris05d08e92016-02-04 13:16:38 -080084 __virtio16 csum_start;
85 __virtio16 csum_offset;
Ben Cheng655a7c02013-10-16 16:09:24 -070086};
87struct virtio_net_hdr_mrg_rxbuf {
Christopher Ferris05d08e92016-02-04 13:16:38 -080088 struct virtio_net_hdr hdr;
89 __virtio16 num_buffers;
Ben Cheng655a7c02013-10-16 16:09:24 -070090};
Christopher Ferris05d08e92016-02-04 13:16:38 -080091#endif
Ben Cheng655a7c02013-10-16 16:09:24 -070092struct virtio_net_ctrl_hdr {
Tao Baod7db5942015-01-28 10:07:51 -080093 __u8 class;
94 __u8 cmd;
Ben Cheng655a7c02013-10-16 16:09:24 -070095} __attribute__((packed));
96typedef __u8 virtio_net_ctrl_ack;
97#define VIRTIO_NET_OK 0
98#define VIRTIO_NET_ERR 1
Ben Cheng655a7c02013-10-16 16:09:24 -070099#define VIRTIO_NET_CTRL_RX 0
100#define VIRTIO_NET_CTRL_RX_PROMISC 0
101#define VIRTIO_NET_CTRL_RX_ALLMULTI 1
102#define VIRTIO_NET_CTRL_RX_ALLUNI 2
Ben Cheng655a7c02013-10-16 16:09:24 -0700103#define VIRTIO_NET_CTRL_RX_NOMULTI 3
104#define VIRTIO_NET_CTRL_RX_NOUNI 4
105#define VIRTIO_NET_CTRL_RX_NOBCAST 5
106struct virtio_net_ctrl_mac {
Christopher Ferris05d08e92016-02-04 13:16:38 -0800107 __virtio32 entries;
Tao Baod7db5942015-01-28 10:07:51 -0800108 __u8 macs[][ETH_ALEN];
Ben Cheng655a7c02013-10-16 16:09:24 -0700109} __attribute__((packed));
110#define VIRTIO_NET_CTRL_MAC 1
Ben Cheng655a7c02013-10-16 16:09:24 -0700111#define VIRTIO_NET_CTRL_MAC_TABLE_SET 0
112#define VIRTIO_NET_CTRL_MAC_ADDR_SET 1
113#define VIRTIO_NET_CTRL_VLAN 2
114#define VIRTIO_NET_CTRL_VLAN_ADD 0
Ben Cheng655a7c02013-10-16 16:09:24 -0700115#define VIRTIO_NET_CTRL_VLAN_DEL 1
116#define VIRTIO_NET_CTRL_ANNOUNCE 3
117#define VIRTIO_NET_CTRL_ANNOUNCE_ACK 0
118struct virtio_net_ctrl_mq {
Christopher Ferris05d08e92016-02-04 13:16:38 -0800119 __virtio16 virtqueue_pairs;
Ben Cheng655a7c02013-10-16 16:09:24 -0700120};
121#define VIRTIO_NET_CTRL_MQ 4
122#define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET 0
Ben Cheng655a7c02013-10-16 16:09:24 -0700123#define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MIN 1
124#define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MAX 0x8000
Christopher Ferris05d08e92016-02-04 13:16:38 -0800125#define VIRTIO_NET_CTRL_GUEST_OFFLOADS 5
126#define VIRTIO_NET_CTRL_GUEST_OFFLOADS_SET 0
Ben Cheng655a7c02013-10-16 16:09:24 -0700127#endif