]> git.karo-electronics.de Git - karo-tx-linux.git/blob - include/linux/virtio_net.h
virtio: Net header needs hdr_len
[karo-tx-linux.git] / include / linux / virtio_net.h
1 #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
8 /* The feature bitmap for virtio net */
9 #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
14 #define VIRTIO_NET_F_MAC        5
15
16 struct virtio_net_config
17 {
18         /* The config defining mac address (if VIRTIO_NET_F_MAC) */
19         __u8 mac[6];
20 } __attribute__((packed));
21
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. */
24 struct virtio_net_hdr
25 {
26 #define VIRTIO_NET_HDR_F_NEEDS_CSUM     1       // Use csum_start, csum_offset
27         __u8 flags;
28 #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
34         __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 */
39 };
40 #endif /* _LINUX_VIRTIO_NET_H */