at v2.6.25 36 lines 1.3 kB view raw
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_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 */ 12 13struct virtio_net_config 14{ 15 /* The config defining mac address (if VIRTIO_NET_F_MAC) */ 16 __u8 mac[6]; 17} __attribute__((packed)); 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. */ 21struct virtio_net_hdr 22{ 23#define VIRTIO_NET_HDR_F_NEEDS_CSUM 1 // Use csum_start, csum_offset 24 __u8 flags; 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) 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 29#define VIRTIO_NET_HDR_GSO_ECN 0x80 // TCP has ECN set 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 */ 35}; 36#endif /* _LINUX_VIRTIO_NET_H */