]> git.proxmox.com Git - mirror_edk2.git/blob - OvmfPkg/Include/IndustryStandard/Virtio095Net.h
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / OvmfPkg / Include / IndustryStandard / Virtio095Net.h
1 /** @file
2 Virtio Network Device specific type and macro definitions corresponding to
3 the virtio-0.9.5 specification.
4
5 Copyright (C) 2013-2016, Red Hat, Inc.
6
7 SPDX-License-Identifier: BSD-2-Clause-Patent
8
9 **/
10
11 #ifndef _VIRTIO_0_9_5_NET_H_
12 #define _VIRTIO_0_9_5_NET_H_
13
14 #include <IndustryStandard/Virtio095.h>
15
16 //
17 // virtio-0.9.5, Appendix C: Network Device
18 //
19 #pragma pack(1)
20 typedef struct {
21 UINT8 Mac[6];
22 UINT16 LinkStatus;
23 } VIRTIO_NET_CONFIG;
24 #pragma pack()
25
26 #define OFFSET_OF_VNET(Field) OFFSET_OF (VIRTIO_NET_CONFIG, Field)
27 #define SIZE_OF_VNET(Field) (sizeof ((VIRTIO_NET_CONFIG *) 0)->Field)
28
29 //
30 // Queue Identifiers
31 //
32 #define VIRTIO_NET_Q_RX 0
33 #define VIRTIO_NET_Q_TX 1
34
35 //
36 // Feature Bits
37 //
38 #define VIRTIO_NET_F_CSUM BIT0 // host to checksum outgoing packets
39 #define VIRTIO_NET_F_GUEST_CSUM BIT1 // guest to checksum incoming packets
40 #define VIRTIO_NET_F_MAC BIT5 // MAC available to guest
41 #define VIRTIO_NET_F_GSO BIT6 // deprecated
42 #define VIRTIO_NET_F_GUEST_TSO4 BIT7 // guest can receive TSOv4
43 #define VIRTIO_NET_F_GUEST_TSO6 BIT8 // guest can receive TSOv6
44 #define VIRTIO_NET_F_GUEST_ECN BIT9 // guest can receive TSO with ECN
45 #define VIRTIO_NET_F_GUEST_UFO BIT10 // guest can receive UFO
46 #define VIRTIO_NET_F_HOST_TSO4 BIT11 // host can receive TSOv4
47 #define VIRTIO_NET_F_HOST_TSO6 BIT12 // host can receive TSOv6
48 #define VIRTIO_NET_F_HOST_ECN BIT13 // host can receive TSO with ECN
49 #define VIRTIO_NET_F_HOST_UFO BIT14 // host can receive UFO
50 #define VIRTIO_NET_F_MRG_RXBUF BIT15 // guest can merge receive buffers
51 #define VIRTIO_NET_F_STATUS BIT16 // link status available to guest
52 #define VIRTIO_NET_F_CTRL_VQ BIT17 // control channel available
53 #define VIRTIO_NET_F_CTRL_RX BIT18 // control channel RX mode support
54 #define VIRTIO_NET_F_CTRL_VLAN BIT19 // control channel VLAN filtering
55 #define VIRTIO_NET_F_GUEST_ANNOUNCE BIT21 // guest can send gratuitous pkts
56
57 //
58 // Packet Header
59 //
60 #pragma pack(1)
61 typedef struct {
62 UINT8 Flags;
63 UINT8 GsoType;
64 UINT16 HdrLen;
65 UINT16 GsoSize;
66 UINT16 CsumStart;
67 UINT16 CsumOffset;
68 } VIRTIO_NET_REQ;
69 #pragma pack()
70
71 //
72 // Bits in VIRTIO_NET_REQ.Flags
73 //
74 #define VIRTIO_NET_HDR_F_NEEDS_CSUM BIT0
75
76 //
77 // Types/Bits for VIRTIO_NET_REQ.GsoType
78 //
79 #define VIRTIO_NET_HDR_GSO_NONE 0x00
80 #define VIRTIO_NET_HDR_GSO_TCPV4 0x01
81 #define VIRTIO_NET_HDR_GSO_UDP 0x03
82 #define VIRTIO_NET_HDR_GSO_TCPV6 0x04
83 #define VIRTIO_NET_HDR_GSO_ECN BIT7
84
85 //
86 // Link Status Bits in VIRTIO_NET_CONFIG.LinkStatus
87 //
88 #define VIRTIO_NET_S_LINK_UP BIT0
89 #define VIRTIO_NET_S_ANNOUNCE BIT1
90
91 #endif // _VIRTIO_0_9_5_NET_H_