Rusty Russell | 296f96f | 2007-10-22 11:03:37 +1000 | [diff] [blame] | 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 | |
Rusty Russell | a586d4f | 2008-02-04 23:49:56 -0500 | [diff] [blame] | 8 | /* The feature bitmap for virtio net */ |
Rusty Russell | 296f96f | 2007-10-22 11:03:37 +1000 | [diff] [blame] | 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 |
Rusty Russell | a586d4f | 2008-02-04 23:49:56 -0500 | [diff] [blame] | 14 | #define VIRTIO_NET_F_MAC 5 |
Rusty Russell | 296f96f | 2007-10-22 11:03:37 +1000 | [diff] [blame] | 15 | |
Rusty Russell | a586d4f | 2008-02-04 23:49:56 -0500 | [diff] [blame] | 16 | struct virtio_net_config |
| 17 | { |
| 18 | /* The config defining mac address (if VIRTIO_NET_F_MAC) */ |
| 19 | __u8 mac[6]; |
| 20 | } __attribute__((packed)); |
Rusty Russell | 296f96f | 2007-10-22 11:03:37 +1000 | [diff] [blame] | 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 |
Rusty Russell | 50c8ea8 | 2008-02-04 23:50:01 -0500 | [diff] [blame^] | 27 | __u8 flags; |
Rusty Russell | 296f96f | 2007-10-22 11:03:37 +1000 | [diff] [blame] | 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 |
Rusty Russell | 50c8ea8 | 2008-02-04 23:50:01 -0500 | [diff] [blame^] | 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 */ |
Rusty Russell | 296f96f | 2007-10-22 11:03:37 +1000 | [diff] [blame] | 39 | }; |
| 40 | #endif /* _LINUX_VIRTIO_NET_H */ |