From patchwork Wed Apr 6 12:40:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laszlo Ersek X-Patchwork-Id: 65172 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp1027618lbc; Wed, 6 Apr 2016 05:41:05 -0700 (PDT) X-Received: by 10.98.73.221 with SMTP id r90mr38009065pfi.70.1459946451599; Wed, 06 Apr 2016 05:40:51 -0700 (PDT) Return-Path: Received: from ml01.01.org (ml01.01.org. [198.145.21.10]) by mx.google.com with ESMTPS id ji9si4439274pac.108.2016.04.06.05.40.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 06 Apr 2016 05:40:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id B201D1A1FC1; Wed, 6 Apr 2016 05:40:48 -0700 (PDT) X-Original-To: edk2-devel@ml01.01.org Delivered-To: edk2-devel@ml01.01.org Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id D5F9E1A1FC1 for ; Wed, 6 Apr 2016 05:40:46 -0700 (PDT) Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 73B5120A89; Wed, 6 Apr 2016 12:40:46 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com ([10.3.113.15]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u36CeV8S027635; Wed, 6 Apr 2016 08:40:44 -0400 From: Laszlo Ersek To: edk2-devel-01 Date: Wed, 6 Apr 2016 14:40:17 +0200 Message-Id: <1459946427-15771-8-git-send-email-lersek@redhat.com> In-Reply-To: <1459946427-15771-1-git-send-email-lersek@redhat.com> References: <1459946427-15771-1-git-send-email-lersek@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 Subject: [edk2] [wave 3 PATCH v2 07/17] OvmfPkg: IndustryStandard: factor out Virtio095Net.h X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Jordan Justen , Ard Biesheuvel MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" 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 Cc: Ard Biesheuvel Suggested-by: Jordan Justen Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek --- Notes: v2: - new in v2 [Jordan] OvmfPkg/Include/IndustryStandard/{VirtioNet.h => Virtio095Net.h} | 10 +-- OvmfPkg/Include/IndustryStandard/VirtioNet.h | 81 +------------------- 2 files changed, 8 insertions(+), 83 deletions(-) -- 1.8.3.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/OvmfPkg/Include/IndustryStandard/VirtioNet.h b/OvmfPkg/Include/IndustryStandard/Virtio095Net.h similarity index 91% copy from OvmfPkg/Include/IndustryStandard/VirtioNet.h copy to OvmfPkg/Include/IndustryStandard/Virtio095Net.h index 34bf15a5883d..819604289efa 100644 --- a/OvmfPkg/Include/IndustryStandard/VirtioNet.h +++ b/OvmfPkg/Include/IndustryStandard/Virtio095Net.h @@ -1,27 +1,27 @@ /** @file Virtio Network Device specific type and macro definitions corresponding to the virtio-0.9.5 specification. - Copyright (C) 2013, Red Hat, Inc. + 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_NET_H_ -#define _VIRTIO_NET_H_ +#ifndef _VIRTIO_0_9_5_NET_H_ +#define _VIRTIO_0_9_5_NET_H_ -#include +#include // // virtio-0.9.5, Appendix C: Network Device // #pragma pack(1) typedef struct { UINT8 Mac[6]; @@ -90,8 +90,8 @@ typedef struct { // // Link Status Bits in VIRTIO_NET_CONFIG.LinkStatus // #define VIRTIO_NET_S_LINK_UP BIT0 #define VIRTIO_NET_S_ANNOUNCE BIT1 -#endif // _VIRTIO_NET_H_ +#endif // _VIRTIO_0_9_5_NET_H_ diff --git a/OvmfPkg/Include/IndustryStandard/VirtioNet.h b/OvmfPkg/Include/IndustryStandard/VirtioNet.h index 34bf15a5883d..db4882abaef3 100644 --- a/OvmfPkg/Include/IndustryStandard/VirtioNet.h +++ b/OvmfPkg/Include/IndustryStandard/VirtioNet.h @@ -1,97 +1,22 @@ /** @file Virtio Network Device specific type and macro definitions corresponding to - the virtio-0.9.5 specification. + the virtio specifications. - Copyright (C) 2013, Red Hat, Inc. + 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_NET_H_ #define _VIRTIO_NET_H_ -#include - -// -// 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 +#include #endif // _VIRTIO_NET_H_