2 * Acess2 VirtIO Network Driver
3 * - By John Hodge (thePowersGang)
6 * - Hardware definitions
8 #ifndef _VIRTIONET__VIRTIO_NET_H_
9 #define _VIRTIONET__VIRTIO_NET_H_
11 typedef struct sVirtIONet_PktHdr tVirtIONet_PktHdr;
13 enum eVirtIO_FeatureBits
15 VIRTIO_NET_F_CSUM = (1 << 0), // Checksum offloading
16 VIRTIO_NET_F_GUEST_CSUM = (1 << 1), // ??? "Guest handles packets with partial checksum"
17 VIRTIO_NET_F_MAC = (1 << 5), // Device has given MAC address
18 // TCP Segmentation Offloading / UDP Fragmentation Offloading
19 VIRTIO_NET_F_GUEST_TSO4 = (1 << 7), // Guest can receive TSOv4
20 VIRTIO_NET_F_GUEST_TSO6 = 1 << 8, // Guest can receive TSOv6
21 VIRTIO_NET_F_GUEST_TSOE = 1 << 9, // Guest can receive TSO with ECN (Explicit Congestion Notifcation)
22 VIRTIO_NET_F_GUEST_UFO = 1 << 10, // Guest can recieve UFO
23 VIRTIO_NET_F_HOST_TSO4 = 1 << 11, // Device can receive TSOv4
24 VIRTIO_NET_F_HOST_TSO6 = 1 << 12, // Device can receive TSOv6
25 VIRTIO_NET_F_HOST_TSOE = 1 << 13, // Device can receive TSO with ECN
26 VIRTIO_NET_F_HOST_UFO = 1 << 14, // Device can recieve UFO
28 VIRTIO_NET_F_MRG_RXBUF = 1 << 15, // Guest can merge recieve buffers
29 VIRTIO_NET_F_STATUS = 1 << 16, // Configuration status field is avaliable
31 VIRTIO_NET_F_CTRL_VQ = 1 << 17, // Control VQ is avaliable
32 VIRTIO_NET_F_CTRL_RX = 1 << 18, // Control VQ RX mode is supported
33 VIRTIO_NET_F_CTRL_VLAN = 1 << 19, // Control channel VLAN filtering
34 VIRTIO_NET_F_GUEST_ANNOUNCE = 1 << 21, // "Guest can send gratuious packets"
37 #define VIRTIO_NET_S_LINK_UP 1
38 #define VIRTIO_NET_S_ANNOUNCE 2
42 Uint8 MACAddr[6]; // only valid if VIRTIO_NET_F_MAC
43 Uint16 Status; // only valid if VIRTIO_NET_F_STATUS
46 enum eVirtIONet_Queues
50 VIRTIONET_QUEUE_CTRL, // only valid if VIRTIO_NET_F_CTRL_VQ
53 #define VIRTIO_NET_HDR_F_NEEDS_CSUM 1 // Checksum needs to be performed
54 enum eVirtIONet_GSOTypes
56 VIRTIO_NET_HDR_GSO_NONE,
57 VIRTIO_NET_HDR_GSO_TCPV4,
58 VIRTIO_NET_HDR_GSO_UDP,
59 VIRTIO_NET_HDR_GSO_TCPV6,
60 VIRTIO_NET_HDR_GSO_ECN = 0x80
63 struct sVirtIONet_PktHdr
70 Uint16 CSumOffset; // Offset from CSumStart
72 Uint16 NumBuffers; // Only if VIRTIO_NET_F_MRG_RXBUF
75 struct sVirtIONet_CmdHdr
77 Uint8 Class; // Command class (RX, MAC, VLAN, Announce)
78 Uint8 Command; // Actual command (RxPromisc,RxAllMulti,,MACSet,,VLANAdd,VLANDel)