blob: 1456f7b936d0eb699d00c75223bf1636bf8de6d3 [file] [log] [blame]
Rusty Russell296f96f2007-10-22 11:03:37 +10001#ifndef _LINUX_VIRTIO_NET_H
2#define _LINUX_VIRTIO_NET_H
3#include <linux/virtio_config.h>
4
5/* The ID for virtio_net */
6#define VIRTIO_ID_NET 1
7
Rusty Russella586d4f2008-02-04 23:49:56 -05008/* The feature bitmap for virtio net */
Rusty Russell296f96f2007-10-22 11:03:37 +10009#define VIRTIO_NET_F_NO_CSUM 0
10#define VIRTIO_NET_F_TSO4 1
11#define VIRTIO_NET_F_UFO 2
12#define VIRTIO_NET_F_TSO4_ECN 3
13#define VIRTIO_NET_F_TSO6 4
Rusty Russella586d4f2008-02-04 23:49:56 -050014#define VIRTIO_NET_F_MAC 5
Rusty Russell296f96f2007-10-22 11:03:37 +100015
Rusty Russella586d4f2008-02-04 23:49:56 -050016struct virtio_net_config
17{
18 /* The config defining mac address (if VIRTIO_NET_F_MAC) */
19 __u8 mac[6];
20} __attribute__((packed));
Rusty Russell296f96f2007-10-22 11:03:37 +100021
22/* This is the first element of the scatter-gather list. If you don't
23 * specify GSO or CSUM features, you can simply ignore the header. */
24struct virtio_net_hdr
25{
26#define VIRTIO_NET_HDR_F_NEEDS_CSUM 1 // Use csum_start, csum_offset
Rusty Russell50c8ea82008-02-04 23:50:01 -050027 __u8 flags;
Rusty Russell296f96f2007-10-22 11:03:37 +100028#define VIRTIO_NET_HDR_GSO_NONE 0 // Not a GSO frame
29#define VIRTIO_NET_HDR_GSO_TCPV4 1 // GSO frame, IPv4 TCP (TSO)
30/* FIXME: Do we need this? If they said they can handle ECN, do they care? */
31#define VIRTIO_NET_HDR_GSO_TCPV4_ECN 2 // GSO frame, IPv4 TCP w/ ECN
32#define VIRTIO_NET_HDR_GSO_UDP 3 // GSO frame, IPv4 UDP (UFO)
33#define VIRTIO_NET_HDR_GSO_TCPV6 4 // GSO frame, IPv6 TCP
Rusty Russell50c8ea82008-02-04 23:50:01 -050034 __u8 gso_type;
35 __u16 hdr_len; /* Ethernet + IP + tcp/udp hdrs */
36 __u16 gso_size; /* Bytes to append to gso_hdr_len per frame */
37 __u16 csum_start; /* Position to start checksumming from */
38 __u16 csum_offset; /* Offset after that to place checksum */
Rusty Russell296f96f2007-10-22 11:03:37 +100039};
40#endif /* _LINUX_VIRTIO_NET_H */