From nobody Thu Dec 26 13:40:58 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1505132234857907.7864895723786; Mon, 11 Sep 2017 05:17:14 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id B162521CEB0EA; Mon, 11 Sep 2017 05:14:16 -0700 (PDT) Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-bl2nam02on0073.outbound.protection.outlook.com [104.47.38.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 7ABAC2095BB98 for ; Mon, 11 Sep 2017 05:14:15 -0700 (PDT) Received: from ubuntu-010236106000.amd.com (165.204.78.1) by SN1PR12MB0158.namprd12.prod.outlook.com (10.162.3.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.35.12; Mon, 11 Sep 2017 12:17:08 +0000 X-Original-To: edk2-devel@lists.01.org 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=MpR5RcKBSm2mbrshc4QcF6KhR6etzb8b7Zdp4GuY7h0=; b=3tj7blApjZbN7HBbP7M6Sdp8Z0BR6mZRgX2RRottDDXyXckKBl9+Pbd6ShsOFBZ9aVasX4ZUpuCqKRDbkF02Eg/5/jO3htcGkZ9qvNfvkZd20YdbDx9w3/WN7JgpLdrAy+ti6jd2Ax7WqJN26nWd84rpMrLxghBjuU59YUdac5w= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; From: Brijesh Singh To: edk2-devel@lists.01.org Date: Mon, 11 Sep 2017 07:16:50 -0500 Message-Id: <20170911121657.34992-2-brijesh.singh@amd.com> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170911121657.34992-1-brijesh.singh@amd.com> References: <20170911121657.34992-1-brijesh.singh@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.78.1] X-ClientProxiedBy: DM3PR12CA0047.namprd12.prod.outlook.com (10.161.151.15) To SN1PR12MB0158.namprd12.prod.outlook.com (10.162.3.145) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a4bb8f97-b704-43a5-d396-08d4f90f062e 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:SN1PR12MB0158; X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0158; 3:ALoUPRZPC/wudyAjhK0bwKueCnEteNJK79oEgVYG06QQHe+DpW3t0Qp04ORPbQN18/NMtuCzrWErnPa48q6xn7N1B4y/DG7CSeMZ7u/9MX5lnRyNGUULEtx5cv3GqUSAp/lk2A84QtIFXJg/68hu+z3cq5rQ+SNE2YEvC9/sueiXXwba6IPJPqNKuGd2oUPaxWymkYWwwa0DF8mupQeI1gAc4Msp6mf27eyoE2rTcvB+h2rj+d2pcTW54nYMy7fJ; 25:xEarkUNekUqdfdAvneFddc+ZgIpA9DIeGRu0zC8fAsV/loGIcIjAk5lHpknNNfYLS90w4ThnVfCbni3gL8GabGY6R62LqSIkw/TLBB872/a793XT+reRgzM7U88noiyb92CBbahQWLNREwijH/4Sf5trCbOR/D3J0/esn0BYh5wfAWB0OSTn26FqnU/BMtgiG+8Wfw37SqhhpsH/8gGT+IxOLM8FutR2VgM2a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5/Cvs1Cxo63W4FMfbwiiCzEzd27mVt7xz0AKqYbmIdA9sjdrJmNruaBjEe6dntc1znfXiVF7HE3YpwQus7POdA7GP++wBAlRtqAGhLMyFswtRujPC6Vn02q92vj9ay3NU7iqSPCBCyBJVZKbvcKAd5WpF46+gYtsIEBFlrabZwoLUbJruwCrpqBy0nEbrsd6ebKYtI7Yqm7D4+kD8Q== 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)(100000703101)(100105400095)(3002001)(93006095)(93001095)(10201501046)(6055026)(6041248)(20161123560025)(20161123564025)(20161123558100)(20161123562025)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:SN1PR12MB0158; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:SN1PR12MB0158; X-Forefront-PRVS: 04270EF89C X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(189002)(199003)(110136004)(106356001)(7736002)(105586002)(101416001)(4326008)(53416004)(1076002)(2361001)(2906002)(305945005)(2351001)(5660300001)(189998001)(25786009)(33646002)(50986999)(76176999)(3846002)(6116002)(68736007)(8676002)(478600001)(81156014)(81166006)(42186005)(50466002)(54906002)(6666003)(50226002)(97736004)(48376002)(36756003)(6916009)(2950100002)(8936002)(66066001)(47776003)(86362001)(5003940100001)(6486002)(575784001)(53936002); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR12MB0158; H:ubuntu-010236106000.amd.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN1PR12MB0158; 23:7YGJhv6B0bvKoiEv6zt0krdRBWcXLXfTZACtf3jsM?= =?us-ascii?Q?w2oRytX+WuWIFtyAviTpiv5f/KyZuYO4zF2WLidOzUUTeNjiv0oMthsLyRTQ?= =?us-ascii?Q?mDJOtvJm01Z+OFXQd6I2P588d8GARNC5IQf/SSQBS9EhPsVzaCQ8nvmTDOKD?= =?us-ascii?Q?2Jp10SP+orGLib3tFmjzHVHujzuFEiOe2xI4AeWEMu5PPe0mnzM1zu2fE/LJ?= =?us-ascii?Q?t6QmANfexy7KEaWESha8e2nyt1fSjYNwHBhc5Swb30Wmdjnfr5ia6ZsyVSZH?= =?us-ascii?Q?rugpKmeR3OSgDujkcsKh4YNcquyBuulIjPr/KRsB+aCU0vHXBUi6FjrbzwWX?= =?us-ascii?Q?roeVysJiUsHYMK2mmnut13fo/RpATRRzl0VS03OoKsE/dugxBVgEKmt9HW+z?= =?us-ascii?Q?bRqSdIpr6Q5HvYEC/JGZLMJDK3fKl0s1MMJOOoyMcK9pSnnYyGe4Hcuk0Xid?= =?us-ascii?Q?KRVJZ0ZSeovLf5vuMzJIfN0VjR7S4xcWep3e1mg1Gn/xbmmWHBQvVXDqr8cm?= =?us-ascii?Q?IkVTefi8w9W0ieENtNwx9NQFgHcKDqgPnQH3bfNDknL0+DD4mTweh/PkTVKt?= =?us-ascii?Q?wl3UbpQ8ySdgc6bde7wmt6YsGfa4jQddm+kxwUuGhMt29jzvt32s4bXNR9fJ?= =?us-ascii?Q?jE+xf5AhNfsKRBh842Hru6OQfNA65gLqbhg4ZgizDolTUgVqm/YpL7/K1tBF?= =?us-ascii?Q?T+eWuwbHDL71jBLKc2c1BUpvrTHhDycbxoQbf3TrHRVIbDLTGpAjXzUc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GrZWDn7zB8GdZ2drY5AZvk=; 7:cElev+3rco+BtRWZmhYOhJ+RF55iYqx+gtRh0zg3bWczb6Wj7JPGsrzY1A26EJ7oHkdai7OY1XIubwJP84ylpfP9VokkEqPfCd5k6qTJcZUZIHxjuVxr5HBMBXgWzLUmkQBvsQA8b//8omdB6Kb3Mv51CGvOZkWPetQ1Bsu1nxLYBn958aRespaAjOjXJgJmc7ugz/Hddts0Dp+ptp/tD3T/3ZaHDlEys5QOvjlYaVo= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0158; 20:0FKuMI58tXnpL7fN7AH4q/54ywXKpS9NKGzucBEAotsbqn+NFiHfsGL+AeBb+Zq98CeQzZDV1/i1TpWpZIFwQdfn77QLBj0iFlwc6juKxDxhwz/0JyH46reJvAK5GX0+zJ+rWM5kPvSphyQhwTPBr+ccGkAxxJ9drGYzSUrrrmaKqvv2qT4V6gMxI3n+1wTV4qDrx2uezEG5hT/v5WkO5qekO/Jwh8jc0iM6h/AvINxbhM1InZpKs439SPchP09Y X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Sep 2017 12:17:08.5890 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB0158 Subject: [edk2] [PATCH v2 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: , Cc: Jordan Justen , Tom Lendacky , Brijesh Singh , Laszlo Ersek , Ard Biesheuvel Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" 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/Virtio= Net.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 ); =20 +VOID +EFIAPI +VirtioNetUninitRing ( + IN OUT VNET_DEV *Dev, + IN OUT VRING *Ring + ); + // // event callbacks // diff --git a/OvmfPkg/VirtioNetDxe/SnpInitialize.c b/OvmfPkg/VirtioNetDxe/Sn= pInitialize.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); =20 ReleaseTxRing: - VirtioRingUninit (Dev->VirtIo, &Dev->TxRing); + VirtioNetUninitRing (Dev, &Dev->TxRing); =20 ReleaseRxRing: - VirtioRingUninit (Dev->VirtIo, &Dev->RxRing); + VirtioNetUninitRing (Dev, &Dev->RxRing); =20 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 ri= ng. + @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/SnpS= hutdown.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); =20 Dev->Snm.State =3D EfiSimpleNetworkStarted; Status =3D EFI_SUCCESS; diff --git a/OvmfPkg/VirtioNetDxe/TechNotes.txt b/OvmfPkg/VirtioNetDxe/Tech= Notes.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 [SnpSharedHelper= s.c] VirtioRingInit | | VirtioNetShutdownTx [SnpSharedHelper= s.c] - VirtioNetInitTx | | VirtioRingUninit {Tx, Rx} - VirtioNetInitRx | | + VirtioNetInitTx | | VirtioNetUninitRing [SnpSharedHelper= s.c] + VirtioNetInitRx | | {Tx, Rx} + | | VirtioRingUninit v | +-----------------------------+ | EfiSimpleNetworkInitialized | --=20 2.9.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel