]>
Commit | Line | Data |
---|---|---|
24669084 OM |
1 | /** @file\r |
2 | \r | |
3 | Virtio Network Device specific type and macro definitions corresponding to\r | |
4 | the virtio-0.9.5 specification.\r | |
5 | \r | |
6 | Copyright (C) 2013, Red Hat, Inc.\r | |
7 | \r | |
8 | This program and the accompanying materials are licensed and made available\r | |
9 | under the terms and conditions of the BSD License which accompanies this\r | |
10 | distribution. The full text of the license may be found at\r | |
11 | http://opensource.org/licenses/bsd-license.php\r | |
12 | \r | |
13 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT\r | |
14 | WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
15 | \r | |
16 | **/\r | |
17 | \r | |
18 | #ifndef _VIRTIO_NET_H_\r | |
19 | #define _VIRTIO_NET_H_\r | |
20 | \r | |
21 | #include <IndustryStandard/Virtio.h>\r | |
22 | \r | |
23 | //\r | |
24 | // virtio-0.9.5, Appendix C: Network Device\r | |
25 | //\r | |
26 | #pragma pack(1)\r | |
27 | typedef struct {\r | |
28 | VIRTIO_HDR Generic;\r | |
29 | UINT8 VhdrMac[6];\r | |
30 | UINT16 VhdrLinkStatus;\r | |
31 | } VNET_HDR;\r | |
32 | #pragma pack()\r | |
33 | \r | |
34 | #define OFFSET_OF_VNET(Field) OFFSET_OF (VNET_HDR, Field)\r | |
35 | #define SIZE_OF_VNET(Field) (sizeof ((VNET_HDR *) 0)->Field)\r | |
36 | \r | |
37 | //\r | |
38 | // Queue Identifiers\r | |
39 | //\r | |
40 | #define VIRTIO_NET_Q_RX 0\r | |
41 | #define VIRTIO_NET_Q_TX 1\r | |
42 | \r | |
43 | //\r | |
44 | // Feature Bits\r | |
45 | //\r | |
46 | #define VIRTIO_NET_F_CSUM BIT0 // host to checksum outgoing packets\r | |
47 | #define VIRTIO_NET_F_GUEST_CSUM BIT1 // guest to checksum incoming packets\r | |
48 | #define VIRTIO_NET_F_MAC BIT5 // MAC available to guest\r | |
49 | #define VIRTIO_NET_F_GSO BIT6 // deprecated\r | |
50 | #define VIRTIO_NET_F_GUEST_TSO4 BIT7 // guest can receive TSOv4\r | |
51 | #define VIRTIO_NET_F_GUEST_TSO6 BIT8 // guest can receive TSOv6\r | |
52 | #define VIRTIO_NET_F_GUEST_ECN BIT9 // guest can receive TSO with ECN\r | |
53 | #define VIRTIO_NET_F_GUEST_UFO BIT10 // guest can receive UFO\r | |
54 | #define VIRTIO_NET_F_HOST_TSO4 BIT11 // host can receive TSOv4\r | |
55 | #define VIRTIO_NET_F_HOST_TSO6 BIT12 // host can receive TSOv6\r | |
56 | #define VIRTIO_NET_F_HOST_ECN BIT13 // host can receive TSO with ECN\r | |
57 | #define VIRTIO_NET_F_HOST_UFO BIT14 // host can receive UFO\r | |
58 | #define VIRTIO_NET_F_MRG_RXBUF BIT15 // guest can merge receive buffers\r | |
59 | #define VIRTIO_NET_F_STATUS BIT16 // link status available to guest\r | |
60 | #define VIRTIO_NET_F_CTRL_VQ BIT17 // control channel available\r | |
61 | #define VIRTIO_NET_F_CTRL_RX BIT18 // control channel RX mode support\r | |
62 | #define VIRTIO_NET_F_CTRL_VLAN BIT19 // control channel VLAN filtering\r | |
63 | #define VIRTIO_NET_F_GUEST_ANNOUNCE BIT21 // guest can send gratuitous pkts\r | |
64 | \r | |
65 | //\r | |
66 | // Packet Header\r | |
67 | //\r | |
68 | #pragma pack(1)\r | |
69 | typedef struct {\r | |
70 | UINT8 Flags;\r | |
71 | UINT8 GsoType;\r | |
72 | UINT16 HdrLen;\r | |
73 | UINT16 GsoSize;\r | |
74 | UINT16 CsumStart;\r | |
75 | UINT16 CsumOffset;\r | |
76 | } VIRTIO_NET_REQ;\r | |
77 | #pragma pack()\r | |
78 | \r | |
79 | //\r | |
80 | // Bits in VIRTIO_NET_REQ.Flags\r | |
81 | //\r | |
82 | #define VIRTIO_NET_HDR_F_NEEDS_CSUM BIT0\r | |
83 | \r | |
84 | //\r | |
85 | // Types/Bits for VIRTIO_NET_REQ.GsoType\r | |
86 | //\r | |
87 | #define VIRTIO_NET_HDR_GSO_NONE 0x00\r | |
88 | #define VIRTIO_NET_HDR_GSO_TCPV4 0x01\r | |
89 | #define VIRTIO_NET_HDR_GSO_UDP 0x03\r | |
90 | #define VIRTIO_NET_HDR_GSO_TCPV6 0x04\r | |
91 | #define VIRTIO_NET_HDR_GSO_ECN BIT7\r | |
92 | \r | |
93 | //\r | |
94 | // Link Status Bits in VNET_HDR.VhdrLinkStatus\r | |
95 | //\r | |
96 | #define VIRTIO_NET_S_LINK_UP BIT0\r | |
97 | #define VIRTIO_NET_S_ANNOUNCE BIT1\r | |
98 | \r | |
99 | #endif // _VIRTIO_NET_H_\r |