From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-dm3nam03on0070.outbound.protection.outlook.com [104.47.41.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 5539221E8799E for ; Thu, 14 Sep 2017 04:05:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=ZiUMQTmwFDrGjWBAAU3s8ilXSsuUXilrAgr+fl4lWAw=; b=I/qaOAmNIgKegsoFpezdaTsWZoRd9LLrKevSs1ev6ADjTKGbw0AdB1lu/YMgRlJ1vonqsZs6+DHCRQQpdDQsdb+eCAdq81dHPbMJDAf28Bv/uzt+nCzlZnjJz6BvE7cxeUHf1uZhnaYu5nngzUGMBK+0z39uR77gantseimnewk= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; Received: from ubuntu-010236106000.amd.com (165.204.78.1) by DM2PR12MB0156.namprd12.prod.outlook.com (2a01:111:e400:50ce::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.35.12; Thu, 14 Sep 2017 11:08:35 +0000 From: Brijesh Singh To: edk2-devel@lists.01.org Cc: Brijesh Singh , Ard Biesheuvel , Jordan Justen , Tom Lendacky , Laszlo Ersek Date: Thu, 14 Sep 2017 06:08:15 -0500 Message-Id: <20170914110822.112540-2-brijesh.singh@amd.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20170914110822.112540-1-brijesh.singh@amd.com> References: <20170914110822.112540-1-brijesh.singh@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.78.1] X-ClientProxiedBy: BN6PR08CA0083.namprd08.prod.outlook.com (2603:10b6:404:b6::21) To DM2PR12MB0156.namprd12.prod.outlook.com (2a01:111:e400:50ce::19) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5dc3b492-bdc8-4d37-3416-08d4fb60f1e9 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(48565401081)(300000503095)(300135400095)(2017052603199)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:DM2PR12MB0156; X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0156; 3:Y8eSrkL6lzgoixg1k3p9xk7nfiE4mPn0VgVnoZ5tUvZx0TjOfkMX5PdWZSI2vxvhkD9B9jIKnnCNWvAsan/L21FiehxQ/gC4GMqbp49LGQm+mL7T+elEO4XD/agex10pJjRAagE+J9PFeZ1RsRwrlfJYk4ksf9po/vbXOt4mBit+65I7J+HkHl9k4ETp5Q41iiVFXs2VePiPgwh5Y2+as2LhGfS9YM3Vw8ekCSJMXxXaq3RRIqO/Zvyd+WuZ0PGC; 25:3Ng1jTR09sfMz93/704Idou9Q8/iNYvRW9+uJSw0oKyAmcYeSS2TTdKtbe2kZrqdl3scrXp58Trdup48r4iu8VnQiZd2CIrixzpDhh6mntLU483VJi+m2BxaTrRbWp8t4C6q83xaQUrSESwF7jjKyOP1tRJW+eqgvr8WG4c9ncz9br2JD+NIrG12KCy3X/rLqhN352VKPaovYRVa5FeDoAaNYUrJ32kM6WDUWwZT368YA5gpvPtB8nMD9eHhNtjOIfbAXUPxlNCrQYTVs3gbRN6KnJE/LXK/0T/AgarFjvcmUcIW+L57lM86gKgeEZYMhQK6o4isHg5gXyfey86/nw==; 31:4o4CnAPXQEC97uDHv8X5ziocabfumGpsKEkS8KVnraAVyKOYGpKq8UNFtP3If+sBlia4kwaaDgvD57C+QPfsI8piiZORTJgAV03Yl5Ftd1cYjRAY31lZMg1sUx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451399110)(228905959029699); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(8121501046)(5005006)(10201501046)(93006095)(93001095)(3002001)(100000703101)(100105400095)(6055026)(6041248)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123560025)(20161123558100)(20161123564025)(20161123562025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:DM2PR12MB0156; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:DM2PR12MB0156; X-Forefront-PRVS: 0430FA5CB7 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(346002)(376002)(39860400002)(189002)(199003)(189998001)(50986999)(76176999)(105586002)(106356001)(33646002)(2361001)(2351001)(5660300001)(6666003)(6916009)(2950100002)(6116002)(25786009)(36756003)(1076002)(101416001)(68736007)(3846002)(53416004)(16586007)(6486002)(478600001)(97736004)(50226002)(110136004)(81156014)(47776003)(48376002)(16526017)(81166006)(54906002)(8676002)(8936002)(7736002)(316002)(305945005)(2906002)(4326008)(53936002)(86362001)(5003940100001)(50466002)(66066001)(575784001); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR12MB0156; H:ubuntu-010236106000.amd.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM2PR12MB0156; 23:sH6dAtJX0/XbPrUXpCETD65H3lYPKq0baw22z+xbd?= =?us-ascii?Q?W8LMHsO2H4gu5oX5J867+mzEGYISU9O2fUG4Qg+DRdB5DTx7kYk20QdjgmFL?= =?us-ascii?Q?w0JIfkOEhF2ocshkYn9/AyP20giroBoLTt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GKwhaKTcw1+pXkgIYmOq13l0aZfQEkFcDLRWNIQOGDh9BkiWuj29lhu0= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0156; 20:yYuCkLbZdD/dEuIxhvnOz/YwDdBfgL3M//cnHTAZ4B624N4AXu4cII6+ad6BIOv4MYTkbAH+JeBb2d6Jo+RiyFh/7ocr0rCx09NhxS7hV3V5y7gpRd08nHb/VtrCxyHXIwLID+VpTLb5aNfMLnMPLUAaX9HcJfI8WfrICle4C+sfFR1LnQPIe6adGZeAm7WXVGutYWemGPUEwHbPPIfxFKekYEtrF46CsaIjlI+jQc89a54qxVo66NKxfsC66kkM X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Sep 2017 11:08:35.4013 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR12MB0156 Subject: [PATCH v3 1/8] OvmfPkg/VirtioNetDxe: add helper VirtioNetUninitRing() X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Sep 2017 11:05:39 -0000 Content-Type: text/plain Consolidate the virtio VRING resource cleanup into VirtioNetUninitRing(). Cc: Ard Biesheuvel Cc: Jordan Justen Cc: Tom Lendacky Cc: Laszlo Ersek Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Brijesh Singh Reviewed-by: Laszlo Ersek --- OvmfPkg/VirtioNetDxe/VirtioNet.h | 7 +++++++ OvmfPkg/VirtioNetDxe/SnpInitialize.c | 4 ++-- OvmfPkg/VirtioNetDxe/SnpSharedHelpers.c | 16 ++++++++++++++++ OvmfPkg/VirtioNetDxe/SnpShutdown.c | 4 ++-- OvmfPkg/VirtioNetDxe/TechNotes.txt | 5 +++-- 5 files changed, 30 insertions(+), 6 deletions(-) diff --git a/OvmfPkg/VirtioNetDxe/VirtioNet.h b/OvmfPkg/VirtioNetDxe/VirtioNet.h index 710859bc6115..87a0f06e01a4 100644 --- a/OvmfPkg/VirtioNetDxe/VirtioNet.h +++ b/OvmfPkg/VirtioNetDxe/VirtioNet.h @@ -263,6 +263,13 @@ VirtioNetShutdownTx ( IN OUT VNET_DEV *Dev ); +VOID +EFIAPI +VirtioNetUninitRing ( + IN OUT VNET_DEV *Dev, + IN OUT VRING *Ring + ); + // // event callbacks // diff --git a/OvmfPkg/VirtioNetDxe/SnpInitialize.c b/OvmfPkg/VirtioNetDxe/SnpInitialize.c index 0ecfe044a977..637c978709fd 100644 --- a/OvmfPkg/VirtioNetDxe/SnpInitialize.c +++ b/OvmfPkg/VirtioNetDxe/SnpInitialize.c @@ -510,10 +510,10 @@ AbortDevice: Dev->VirtIo->SetDeviceStatus (Dev->VirtIo, 0); ReleaseTxRing: - VirtioRingUninit (Dev->VirtIo, &Dev->TxRing); + VirtioNetUninitRing (Dev, &Dev->TxRing); ReleaseRxRing: - VirtioRingUninit (Dev->VirtIo, &Dev->RxRing); + VirtioNetUninitRing (Dev, &Dev->RxRing); DeviceFailed: // diff --git a/OvmfPkg/VirtioNetDxe/SnpSharedHelpers.c b/OvmfPkg/VirtioNetDxe/SnpSharedHelpers.c index 9fedb72fdbd4..5b75eabc7a6b 100644 --- a/OvmfPkg/VirtioNetDxe/SnpSharedHelpers.c +++ b/OvmfPkg/VirtioNetDxe/SnpSharedHelpers.c @@ -51,3 +51,19 @@ VirtioNetShutdownTx ( { FreePool (Dev->TxFreeStack); } + +/** + Release TX and RX VRING resources. + + @param[in,out] Dev The VNET_DEV driver instance which was using the ring. + @param[in,out] Ring The virtio ring to clean up. +*/ +VOID +EFIAPI +VirtioNetUninitRing ( + IN OUT VNET_DEV *Dev, + IN OUT VRING *Ring + ) +{ + VirtioRingUninit (Dev->VirtIo, Ring); +} diff --git a/OvmfPkg/VirtioNetDxe/SnpShutdown.c b/OvmfPkg/VirtioNetDxe/SnpShutdown.c index 5e84191fbbdd..432e0691d457 100644 --- a/OvmfPkg/VirtioNetDxe/SnpShutdown.c +++ b/OvmfPkg/VirtioNetDxe/SnpShutdown.c @@ -67,8 +67,8 @@ VirtioNetShutdown ( Dev->VirtIo->SetDeviceStatus (Dev->VirtIo, 0); VirtioNetShutdownRx (Dev); VirtioNetShutdownTx (Dev); - VirtioRingUninit (Dev->VirtIo, &Dev->TxRing); - VirtioRingUninit (Dev->VirtIo, &Dev->RxRing); + VirtioNetUninitRing (Dev, &Dev->TxRing); + VirtioNetUninitRing (Dev, &Dev->RxRing); Dev->Snm.State = EfiSimpleNetworkStarted; Status = EFI_SUCCESS; diff --git a/OvmfPkg/VirtioNetDxe/TechNotes.txt b/OvmfPkg/VirtioNetDxe/TechNotes.txt index 9c1dfe6a773e..86b91f561495 100644 --- a/OvmfPkg/VirtioNetDxe/TechNotes.txt +++ b/OvmfPkg/VirtioNetDxe/TechNotes.txt @@ -70,8 +70,9 @@ faithfully indented) that implement the transition. VirtioNetInitialize | | VirtioNetShutdown VirtioNetInitRing {Rx, Tx} | | VirtioNetShutdownRx [SnpSharedHelpers.c] VirtioRingInit | | VirtioNetShutdownTx [SnpSharedHelpers.c] - VirtioNetInitTx | | VirtioRingUninit {Tx, Rx} - VirtioNetInitRx | | + VirtioNetInitTx | | VirtioNetUninitRing [SnpSharedHelpers.c] + VirtioNetInitRx | | {Tx, Rx} + | | VirtioRingUninit v | +-----------------------------+ | EfiSimpleNetworkInitialized | -- 2.9.5