summaryrefslogtreecommitdiffstats
path: root/OvmfPkg/Include/IndustryStandard/Virtio095Net.h
diff options
context:
space:
mode:
authorLaszlo Ersek <lersek@redhat.com>2016-04-06 10:29:00 +0200
committerLaszlo Ersek <lersek@redhat.com>2016-04-06 19:21:26 +0200
commit0bad4cb6f654ed4a3383b8a2ce68508ae7cf0ded (patch)
tree6ed65f82ed8475dae3bdac9ef0c8fc08a7bfd1f1 /OvmfPkg/Include/IndustryStandard/Virtio095Net.h
parent3eb6278a64bed0aff7efb937f374681cf8c9f117 (diff)
downloadedk2-0bad4cb6f654ed4a3383b8a2ce68508ae7cf0ded.tar.gz
edk2-0bad4cb6f654ed4a3383b8a2ce68508ae7cf0ded.tar.bz2
edk2-0bad4cb6f654ed4a3383b8a2ce68508ae7cf0ded.zip
OvmfPkg: IndustryStandard: factor out Virtio095Net.h
In the upcoming virtio-1.0 series, we'll introduce "Virtio10Net.h". However, the "VirtioNet.h" header file should continue to expose the Virtio Network Device specific type and macro definitions for all virtio versions that OvmfPkg supports. Therefore extract "Virtio095Net.h" like this: VirtioNet.h -> Virtio095Net.h so that in the upcoming patches, we can insert "Virtio10Net.h" in the middle of the inclusion chain. This follows the example of "Acpi.h" and "Pci.h" under "MdePkg/Include/IndustryStandard". Cc: Jordan Justen <jordan.l.justen@intel.com> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Suggested-by: Jordan Justen <jordan.l.justen@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Diffstat (limited to 'OvmfPkg/Include/IndustryStandard/Virtio095Net.h')
-rw-r--r--OvmfPkg/Include/IndustryStandard/Virtio095Net.h97
1 files changed, 97 insertions, 0 deletions
diff --git a/OvmfPkg/Include/IndustryStandard/Virtio095Net.h b/OvmfPkg/Include/IndustryStandard/Virtio095Net.h
new file mode 100644
index 0000000000..819604289e
--- /dev/null
+++ b/OvmfPkg/Include/IndustryStandard/Virtio095Net.h
@@ -0,0 +1,97 @@
+/** @file
+ Virtio Network Device specific type and macro definitions corresponding to
+ the virtio-0.9.5 specification.
+
+ Copyright (C) 2013-2016, Red Hat, Inc.
+
+ This program and the accompanying materials are licensed and made available
+ under the terms and conditions of the BSD License which accompanies this
+ distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT
+ WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#ifndef _VIRTIO_0_9_5_NET_H_
+#define _VIRTIO_0_9_5_NET_H_
+
+#include <IndustryStandard/Virtio095.h>
+
+//
+// virtio-0.9.5, Appendix C: Network Device
+//
+#pragma pack(1)
+typedef struct {
+ UINT8 Mac[6];
+ UINT16 LinkStatus;
+} VIRTIO_NET_CONFIG;
+#pragma pack()
+
+#define OFFSET_OF_VNET(Field) OFFSET_OF (VIRTIO_NET_CONFIG, Field)
+#define SIZE_OF_VNET(Field) (sizeof ((VIRTIO_NET_CONFIG *) 0)->Field)
+
+//
+// Queue Identifiers
+//
+#define VIRTIO_NET_Q_RX 0
+#define VIRTIO_NET_Q_TX 1
+
+//
+// Feature Bits
+//
+#define VIRTIO_NET_F_CSUM BIT0 // host to checksum outgoing packets
+#define VIRTIO_NET_F_GUEST_CSUM BIT1 // guest to checksum incoming packets
+#define VIRTIO_NET_F_MAC BIT5 // MAC available to guest
+#define VIRTIO_NET_F_GSO BIT6 // deprecated
+#define VIRTIO_NET_F_GUEST_TSO4 BIT7 // guest can receive TSOv4
+#define VIRTIO_NET_F_GUEST_TSO6 BIT8 // guest can receive TSOv6
+#define VIRTIO_NET_F_GUEST_ECN BIT9 // guest can receive TSO with ECN
+#define VIRTIO_NET_F_GUEST_UFO BIT10 // guest can receive UFO
+#define VIRTIO_NET_F_HOST_TSO4 BIT11 // host can receive TSOv4
+#define VIRTIO_NET_F_HOST_TSO6 BIT12 // host can receive TSOv6
+#define VIRTIO_NET_F_HOST_ECN BIT13 // host can receive TSO with ECN
+#define VIRTIO_NET_F_HOST_UFO BIT14 // host can receive UFO
+#define VIRTIO_NET_F_MRG_RXBUF BIT15 // guest can merge receive buffers
+#define VIRTIO_NET_F_STATUS BIT16 // link status available to guest
+#define VIRTIO_NET_F_CTRL_VQ BIT17 // control channel available
+#define VIRTIO_NET_F_CTRL_RX BIT18 // control channel RX mode support
+#define VIRTIO_NET_F_CTRL_VLAN BIT19 // control channel VLAN filtering
+#define VIRTIO_NET_F_GUEST_ANNOUNCE BIT21 // guest can send gratuitous pkts
+
+//
+// Packet Header
+//
+#pragma pack(1)
+typedef struct {
+ UINT8 Flags;
+ UINT8 GsoType;
+ UINT16 HdrLen;
+ UINT16 GsoSize;
+ UINT16 CsumStart;
+ UINT16 CsumOffset;
+} VIRTIO_NET_REQ;
+#pragma pack()
+
+//
+// Bits in VIRTIO_NET_REQ.Flags
+//
+#define VIRTIO_NET_HDR_F_NEEDS_CSUM BIT0
+
+//
+// Types/Bits for VIRTIO_NET_REQ.GsoType
+//
+#define VIRTIO_NET_HDR_GSO_NONE 0x00
+#define VIRTIO_NET_HDR_GSO_TCPV4 0x01
+#define VIRTIO_NET_HDR_GSO_UDP 0x03
+#define VIRTIO_NET_HDR_GSO_TCPV6 0x04
+#define VIRTIO_NET_HDR_GSO_ECN BIT7
+
+//
+// Link Status Bits in VIRTIO_NET_CONFIG.LinkStatus
+//
+#define VIRTIO_NET_S_LINK_UP BIT0
+#define VIRTIO_NET_S_ANNOUNCE BIT1
+
+#endif // _VIRTIO_0_9_5_NET_H_