Commit | Line | Data |
---|---|---|
296f96fc RR |
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 | ||
a586d4f6 | 8 | /* The feature bitmap for virtio net */ |
34a48579 RR |
9 | #define VIRTIO_NET_F_CSUM 0 /* Can handle pkts w/ partial csum */ |
10 | #define VIRTIO_NET_F_MAC 5 /* Host has given MAC address. */ | |
11 | #define VIRTIO_NET_F_GSO 6 /* Can handle pkts w/ any GSO type */ | |
296f96fc | 12 | |
a586d4f6 RR |
13 | struct virtio_net_config |
14 | { | |
15 | /* The config defining mac address (if VIRTIO_NET_F_MAC) */ | |
16 | __u8 mac[6]; | |
17 | } __attribute__((packed)); | |
296f96fc RR |
18 | |
19 | /* This is the first element of the scatter-gather list. If you don't | |
20 | * specify GSO or CSUM features, you can simply ignore the header. */ | |
21 | struct virtio_net_hdr | |
22 | { | |
23 | #define VIRTIO_NET_HDR_F_NEEDS_CSUM 1 // Use csum_start, csum_offset | |
50c8ea80 | 24 | __u8 flags; |
296f96fc RR |
25 | #define VIRTIO_NET_HDR_GSO_NONE 0 // Not a GSO frame |
26 | #define VIRTIO_NET_HDR_GSO_TCPV4 1 // GSO frame, IPv4 TCP (TSO) | |
296f96fc RR |
27 | #define VIRTIO_NET_HDR_GSO_UDP 3 // GSO frame, IPv4 UDP (UFO) |
28 | #define VIRTIO_NET_HDR_GSO_TCPV6 4 // GSO frame, IPv6 TCP | |
34a48579 | 29 | #define VIRTIO_NET_HDR_GSO_ECN 0x80 // TCP has ECN set |
50c8ea80 RR |
30 | __u8 gso_type; |
31 | __u16 hdr_len; /* Ethernet + IP + tcp/udp hdrs */ | |
32 | __u16 gso_size; /* Bytes to append to gso_hdr_len per frame */ | |
33 | __u16 csum_start; /* Position to start checksumming from */ | |
34 | __u16 csum_offset; /* Offset after that to place checksum */ | |
296f96fc RR |
35 | }; |
36 | #endif /* _LINUX_VIRTIO_NET_H */ |