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