From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-bl2nam02on0078.outbound.protection.outlook.com [104.47.38.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 9DD5721CEB0F9 for ; Mon, 11 Sep 2017 05:14:17 -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=Ih2zQllWYEZ9QIVtzlqzNjUsavUDwzuWH+xZQwhBK7w=; b=rNv/jTX3KVFuHkLiR7z20ZHP+6pSymd+vCFysT8GIMCZDkThUxzkYR0fsgfn0SpnfaSRD6NenWsJVisU+gZiHFqDwsDRqoqH6qxOxsjGx6xCUyeKYHeMQAV5gQVjgy13xYsRfK9xy1234UQrMPONAJtPj1cpe4u6B7xL0KOVPxQ= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; 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:11 +0000 From: Brijesh Singh To: edk2-devel@lists.01.org Cc: Brijesh Singh , Ard Biesheuvel , Jordan Justen , Tom Lendacky , Laszlo Ersek Date: Mon, 11 Sep 2017 07:16:54 -0500 Message-Id: <20170911121657.34992-6-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: 5b041bab-960c-4980-8509-08d4f90f07c6 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:5PGW5nyII12851P14VMVZnihMu7IFPapHrz1TpznPXMgZbihk5kWX1vDZ8lbDuKP2E+aSC+YbxhwZ8MfFmZHy3/PJ7BjDbCtswzAwfm9RdWCUNZZUrFUMYSIIikjbDpfB/u9I41owCHS3+edjYpo2RXiBmWXNkjBiRcDlmw9DVHwc0miJnQKWX3ol0aYFwRu3ArROlQxH0aTt3F4m6Pv9HFL/Ndo5rmdmO8C2f3hD3GK4p90uJElZFy2RsiJbewm; 25:r7IC8rP43hEcSpJjgrIWYKFw58JcyfMiAqb6fh7c5t6QxtlkwV8wNm2mV8jNKGCZIFDyAOSuq+W05fGR8UMdxh67AqlIdorABGsks8pKBGgtTdgMbsbsyByCpUhFEE4p3ybYmhFj5UnQndmZ7yfxCOK2iPxh3UkmdlSM3YXi5kT4ZFN0zQDaOEzf3njbGugeTEzlu4czA2oM4AvUSYeKZBLNtoyaX59iarGkrdluaRwi/7GqqbFl6Jn7FXgbYZXJmkfTYnh0/dgtAQN+zPH0Ie6gUqQJ7y5i3bHl2cnHsOR7SGNdEv9iZpjg1FHIWc+M0yvLCDz1KxSm2Mi6z8DYDw==; 31:cIF6gwn0hCSLX3z7S3QTZE6YznSADK9xzq6Xu/fEWHzjjrXnC6bXKkjqjL5YBosMNqBkjzAkxcFDRy4Sodlb9h1TEAiSHGuChaRA/s5lU705aJ67jID9JAFyShBBD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am-Report-Test: UriScan:(20558992708506)(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)(15650500001)(47776003)(86362001)(5003940100001)(6486002)(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 (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN1PR12MB0158; 23:D6Hx3hCTqW7bS3MXKdpMBEp4TvzAfQC/M1lpiOzk5?= =?us-ascii?Q?/n/bA8lgJbEILkjsVusPbfPiTNPshdoMP1TBLZ9kcbBKE1BFmtibK2duKduL?= =?us-ascii?Q?MmZzfKk+zplC24t7XQ659cdn5HZiBpvbX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vvlOBFS353ZjxvQmTiuW4Mzg9gbW4CBe4TEFWcUr/xtWIj4NDdtoN2?= =?us-ascii?Q?BKkdt3tXkJ1TRFG3EyokXNVKQJTJsPObv0Zbmdfy6ob/aTAXw=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0158; 6:avMUil7LPkgyMg++mQe2HRa/yRWI/PHo5+KOuZ+Zy2vyZoYtXBl3gGNGh7gWhu0Ei1sTrVIMRqax5a55zfSB2fqEgVSnUv+n4vHjElUppc4Gda0dbwyQ9FTncRbehF+ghfGEsZt3rDALAgAraXtB/K0RO3KRTlmPupVsHDFqWwCVQwTgfBZgAjBhCTA+3BwuNfqawgc8uEmdJWBrFYEf6yQX+AxbIhgKerQHQCPZdn65PM0Cg+9yUOXesypVGnkZJRJbKymBfN4k8EEhvd8r+vSzSAGD67KTft42zfff6o70bX23bSnPKrLDraQ6sSoiH7S2nOmGzEh4crkMTegDOA==; 5:vhuKdg+hYuZcjoNHebwRa+4b5LplKIK2Sf2aUXK9QkP/XWqdrLKUnrgn74zxCOL+IHTLJ8ocAPcGch/7Qebia98a5ftgU9X2/1Nubzk/nSOqH8G/f9lEbj5klwJssOUedgn8k4r1DPEVKu+/P/BILQ==; 24:IchtIMuJxqVyy5VicpBtu12vIzyJvXiqpKLJb3TdNWpj46Uc1ABBhSF9zogLzSuhtNdwqLkI75TwuBR/+1p1R05vb5WOU5xQNol7H+AjYkM=; 7:+TL+rgJDP/V6CqdYnIUEqnqOU9Mfot0lPZ9AjE66fNdyXits3frKPIALD9cqkIzCIm8ABich/l0oh5s/qhBpwwM9f7fGn3O5wE+y5FiYVsMiA6+nP4+24U5iV0YeHIomVUCYjylYOjdv/HNg838bnA0M66e6CNhjX77RBpLvNUua4quSc6WGwBTvvHywiaioERhtM7mTh07J55MsZyH+jPZvgk713UdE3rNIzBV8n1E= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0158; 20:SxaC5Wzu9eZW80hTMnGmDJSP5mVnHNL9DR6vDtEDtxaNfQS13qonVTZd165yS2gg5aJzhFIwYjcmbXdvdVo/o9gSrnEPDZwLhBNBvgOixZ1iqgXY7Q/4e7BC1l7Up11JfYEk642OpK++z2L6BZBPkwi+fEMoS54hz4sAuXALrVwjz6kNCfJvZLb4yLTRic8phujlKLE/P7a+hfNNPnlVGrb3hZRk7t/V4sGU6QbrCjQr2h1ej4P24RevY0x59ZpI X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Sep 2017 12:17:11.2452 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB0158 Subject: [PATCH v2 5/8] OvmfPkg/VirtioNetDxe: update TechNotes 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: Mon, 11 Sep 2017 12:14:18 -0000 Content-Type: text/plain In next patches we will update Virtio transmit to use the device-mapped address of the caller-supplied packet. The patch documents the new model. Cc: Ard Biesheuvel Cc: Jordan Justen Cc: Tom Lendacky Cc: Laszlo Ersek Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Brijesh Singh --- OvmfPkg/VirtioNetDxe/TechNotes.txt | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/OvmfPkg/VirtioNetDxe/TechNotes.txt b/OvmfPkg/VirtioNetDxe/TechNotes.txt index f39426fb13e4..c6ca341ead15 100644 --- a/OvmfPkg/VirtioNetDxe/TechNotes.txt +++ b/OvmfPkg/VirtioNetDxe/TechNotes.txt @@ -312,10 +312,14 @@ in the following: that is shared by all of the head descriptors. This virtio-net request header is never modified by the host. -- Each tail descriptor is re-pointed to the caller-supplied packet buffer - whenever VirtioNetTransmit places the corresponding head descriptor on the - Available Ring. The caller is responsible to hang on to the unmodified buffer - until it is reported transmitted by VirtioNetGetStatus. +- Each tail descriptor is re-pointed to the device-mapped address of the + caller-supplied packet buffer whenever VirtioNetTransmit places the + corresponding head descriptor on the Available Ring. A reverse mapping, from + the device-mapped address to the caller-supplied packet address, is saved in + an associative data structure that belongs to the driver instance. + +- Per spec, the caller is responsible to hang on to the unmodified packet + buffer until it is reported transmitted by VirtioNetGetStatus. Steps of packet transmission: @@ -338,9 +342,11 @@ Steps of packet transmission: - Client code calls VirtioNetGetStatus. In case the Used Ring is empty, the function reports no Tx completion. Otherwise, a head descriptor's index is consumed from the Used Ring and recycled to the private stack. The client - code's original packet buffer address is fetched from the tail descriptor - (where it has been stored at VirtioNetTransmit time) and returned to the - caller. + code's original packet buffer address is calculated by fetching the + device-mapped address from the tail descriptor (where it has been stored at + VirtioNetTransmit time), and by looking up the device-mapped address in the + associative data structure. The reverse-mapped packet buffer address is + returned to the caller. - The Len field of the Used Ring Element is not checked. The host is assumed to have transmitted the entire packet -- VirtioNetTransmit had forced it below -- 2.9.4