| 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 | 34a4857 | 2008-02-04 23:50:02 -0500 | [diff] [blame] | 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 */ | 
| Rusty Russell | 296f96f | 2007-10-22 11:03:37 +1000 | [diff] [blame] | 12 |  | 
| Rusty Russell | a586d4f | 2008-02-04 23:49:56 -0500 | [diff] [blame] | 13 | struct virtio_net_config | 
 | 14 | { | 
 | 15 | 	/* The config defining mac address (if VIRTIO_NET_F_MAC) */ | 
 | 16 | 	__u8 mac[6]; | 
 | 17 | } __attribute__((packed)); | 
| Rusty Russell | 296f96f | 2007-10-22 11:03:37 +1000 | [diff] [blame] | 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 | 
| Rusty Russell | 50c8ea8 | 2008-02-04 23:50:01 -0500 | [diff] [blame] | 24 | 	__u8 flags; | 
| Rusty Russell | 296f96f | 2007-10-22 11:03:37 +1000 | [diff] [blame] | 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) | 
| Rusty Russell | 296f96f | 2007-10-22 11:03:37 +1000 | [diff] [blame] | 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 | 
| Rusty Russell | 34a4857 | 2008-02-04 23:50:02 -0500 | [diff] [blame] | 29 | #define VIRTIO_NET_HDR_GSO_ECN		0x80	// TCP has ECN set | 
| Rusty Russell | 50c8ea8 | 2008-02-04 23:50:01 -0500 | [diff] [blame] | 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 */ | 
| Rusty Russell | 296f96f | 2007-10-22 11:03:37 +1000 | [diff] [blame] | 35 | }; | 
 | 36 | #endif /* _LINUX_VIRTIO_NET_H */ |