From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-bl2nam02on0054.outbound.protection.outlook.com [104.47.38.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 5D2A520945C0B for ; Thu, 14 Sep 2017 14:19:59 -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=DlsWxRnJjSYnXppVcj5BTJzAMkStOVmBo1fMmUaTNcLx+JvyXMCiy+ep2hPPV/Z9qcO/TsAEg5Lzpc8v514H67bF2Ec9ek/Pf3Iri3v1a/2kdEU/4AQO7ZZfS1V+Ntb6JCTnZtm8sj9FpfR28FY+afHFuHrTCIG9UPSz75BxqUY= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; Received: from ubuntu-010236106000.amd.com (165.204.78.1) by DM2PR12MB0155.namprd12.prod.outlook.com (2a01:111:e400:50ce::18) 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 21:22:56 +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 16:22:40 -0500 Message-Id: <20170914212247.124937-2-brijesh.singh@amd.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20170914212247.124937-1-brijesh.singh@amd.com> References: <20170914212247.124937-1-brijesh.singh@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.78.1] X-ClientProxiedBy: DM5PR20CA0014.namprd20.prod.outlook.com (2603:10b6:3:93::24) To DM2PR12MB0155.namprd12.prod.outlook.com (2a01:111:e400:50ce::18) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 79c1817d-dde9-4f37-be69-08d4fbb6c499 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:DM2PR12MB0155; X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0155; 3:jCCSHUVts1WWDjDpq4XmzXZ0+MsKmuol/2L2UPX3yWqBF+Afri48gS9XvXWz7Y6qgS7q+jrWi0QmU1xZNdnBiGjxJimAj/b273+aXWjq4mNFxqrL0ZbptmfnQDH40kCtV3j4/3vsUG1PCQE2WzbmkEwDsyDgRXRkyNFixoskVhC4KI05nUzG14SIIpZM9CN2Q3PEi4pOIYlQzC3josf06FlxwLUox38qTA8IJMEcxbCwMTw88NT+ILflCKXNEN2J; 25:dZG9Q55wngAsKrZi+ekdLci8P1qokMqr/nebBnJcxw6d1r4O6dxAa0JqPgxlxktBY+FTDmVMKaiEZpbzJCbnzPzFDfU3P/zQrJ0bok2IsmKZWzRDJGlsypP6EAmRmwHWQEcn+tvFTXGys2LV2Gp2ICE9KPXGa/k38ReVCs8MTVaawFnkwx9ccC/peddWwDMBT0b44tYB88pRXf4wXc9wlUNo4j3TOEIaXltzw4mSdn642ymYqbFDavo2WHS3APD2GGzKrQ9/bHdSomnwYnJgv6MxlWTg2oNthPyUofWqcGAxyAJHriePKBNNDl8CefBeyyVFlnIhKqM9tOfhr/3SsA==; 31:iFOB8JPVoL1+tQ6dKrCrjBF46d0Y1M1u7jRqWv5EutBYSDy4ZuVJDZcOHkdEPSr2HTkiWU+FnkNyna42B38zb6A3irusWrh9wU9qb8SlAMkybmb4/GGHX9hZourYxSwFqTsyKoxgJXvcoeXENGobGU2i46rlzkl464hItPyPXxRZ21gcP6LUE5ZAVmVhfRnUItoNqGJNkAhA9A3SRxFMvilMLYcUydqzRxKJ+NJoEWU= X-MS-TrafficTypeDiagnostic: DM2PR12MB0155: X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0155; 20:zkH6XE1AteqTmaSgFhm+9Xnza8AiMMNCgV3ar0fqi+43KNIdYvxXMqQKbHKqC27dx2J9ov7trjV4ECSzidiC5YVnxw9IY3qy/ELDs1ez91tz8f/wSk0cMb7Pexg7uScSYvjJKO+7+EkjboVL271YDXgzHbqKuiA3yBwEHFntjSoBGgad8i374uri+Uz9rELEDJ9K2fwbI0kCXBd78Cj9XST5BNQEXjYXV7eGo0MxVsPH888p/3MndVFyaoK8tbfGC44IUAPPxdXChPcAnxW3bL7hfNQWgB1TohId8FOkVwtyHi6ky7omKqFVzhfX/gwpjp7Rr7tb4TCxH0VYM0B5Y81S349Q3EPZepxI65Q+EEcxn45fWc+mGzVUms29B9HqgXcX6Hmvb1mkmnMFgRVQDWCkHB9BGsazrPu8mQXx/xeYVUVcdM3oMVIuQXVk6H1BtU4k5SMSlXglWPxLIUXD6HQUqoNfhDVsycHrDmuinPnmTtMomw85zE2SoZ/zUlFi; 4:5kkMCQz5e6vFEK+MXYZlYSQYqoDUke9Mcdpc1HAqpiPH5YLvXu0dC62IB8z9btDbNh0ltVIfx0XWuYamQcHhbIOLDYtkCVUUgiyXMadZWwbF4YOKDqcJrt/fNAFqdfNXVXNVEixJVpdg9+AJjf9ImweXP1MbS0zZilegGNB/MSqZ9qY1rzetT9UsKzfSkX7c925VLY8uwRdkjC3oynN35W4IZkSoA+rqJ/cvunBB6QUOEGvoqvgu27TBFPUDhzDwq3OXKvzWVc8YtzQufPnu60bBbPIWfkVW4PZorG5VwmpxhxfzPnfBzjdU7X2XclPzJLIoybWV6iKT+D7y/gV33g== X-Exchange-Antispam-Report-Test: UriScan:(767451399110)(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)(3002001)(93006095)(93001095)(100000703101)(100105400095)(10201501046)(6055026)(6041248)(20161123555025)(20161123562025)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(20161123560025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:DM2PR12MB0155; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:DM2PR12MB0155; X-Forefront-PRVS: 0430FA5CB7 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(39860400002)(346002)(376002)(199003)(189002)(53936002)(4326008)(110136004)(50466002)(47776003)(50226002)(81156014)(81166006)(68736007)(54906002)(8676002)(2361001)(66066001)(2950100002)(6916009)(33646002)(2351001)(36756003)(106356001)(105586002)(53416004)(101416001)(48376002)(8936002)(25786009)(6486002)(97736004)(305945005)(7736002)(5660300001)(16526017)(16586007)(2906002)(5003940100001)(1076002)(6116002)(3846002)(316002)(50986999)(6666003)(575784001)(76176999)(86362001)(478600001)(189998001); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR12MB0155; H:ubuntu-010236106000.amd.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX: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; DM2PR12MB0155; 23:JE6JxIV6o2rlDAljOaC/pqA/mDlzDxeLnUNYliJl9?= =?us-ascii?Q?OicxKjcKXkzlF0znyrqalo5j4NfVMpv2bYAv2skbkv27uBSt+R/ZMDoNo2xB?= =?us-ascii?Q?oXC/rzux1gNBrUrSMF3sEieISr6z41qWBVVv6gjwxXX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O26i3sHilO7eKh3zrUJy/r7+68vlApyrNpHrPZB100M0C2N3m3nnVLnjhZGjQcgc= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0155; 20:b1xE6vYi1/VkqCwuYEoXfhqrw3bSxeOlu/DqCXd59MlsBi6aGiJFEPpJ0Ylhr2iSVJiV3HIcE70fmKEX+DVUplbhHkWcjkXAqR0SDjzrum67edvpqAXMZueOb3XtXoIU4Vxk+R776ax18aqkeBzZvsIy8L9IYmEUWjHj655zLLstnDbBOGO1KCorssytm8AmOBf+8U7C8WuPp+31dCBbewEhrHw50boPpIiFqHifBom+rPcGHw8EaCq4UKdiJJ/m X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Sep 2017 21:22:56.5081 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR12MB0155 Subject: [PATCH v4 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 21:19:59 -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