blob: 1ea3351df609474d097b67e4f0df31131257a34f [file] [log] [blame]
Rusty Russell296f96f2007-10-22 11:03:37 +10001#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 Russella586d4f2008-02-04 23:49:56 -05008/* The feature bitmap for virtio net */
Rusty Russell34a48572008-02-04 23:50:02 -05009#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 Russell296f96f2007-10-22 11:03:37 +100012
Rusty Russella586d4f2008-02-04 23:49:56 -050013struct virtio_net_config
14{
15 /* The config defining mac address (if VIRTIO_NET_F_MAC) */
16 __u8 mac[6];
17} __attribute__((packed));
Rusty Russell296f96f2007-10-22 11:03:37 +100018
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
Rusty Russell50c8ea82008-02-04 23:50:01 -050024 __u8 flags;
Rusty Russell296f96f2007-10-22 11:03:37 +100025#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 Russell296f96f2007-10-22 11:03:37 +100027#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 Russell34a48572008-02-04 23:50:02 -050029#define VIRTIO_NET_HDR_GSO_ECN 0x80 // TCP has ECN set
Rusty Russell50c8ea82008-02-04 23:50:01 -050030 __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 Russell296f96f2007-10-22 11:03:37 +100035};
36#endif /* _LINUX_VIRTIO_NET_H */