From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 31A3321D492DD for ; Wed, 13 Sep 2017 07:37:17 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B5BE781E15; Wed, 13 Sep 2017 14:40:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com B5BE781E15 Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=lersek@redhat.com Received: from lacos-laptop-7.usersys.redhat.com (ovpn-120-116.rdu2.redhat.com [10.10.120.116]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0110561787; Wed, 13 Sep 2017 14:40:12 +0000 (UTC) To: Brijesh Singh , edk2-devel@lists.01.org Cc: Jordan Justen , Tom Lendacky , Ard Biesheuvel References: <20170911121657.34992-1-brijesh.singh@amd.com> <20170911121657.34992-6-brijesh.singh@amd.com> From: Laszlo Ersek Message-ID: <2591f6fa-3eb9-3db9-77f4-75e7c7c2d2d4@redhat.com> Date: Wed, 13 Sep 2017 16:40:11 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <20170911121657.34992-6-brijesh.singh@amd.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 13 Sep 2017 14:40:14 +0000 (UTC) Subject: Re: [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: Wed, 13 Sep 2017 14:37:17 -0000 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit On 09/11/17 14:16, Brijesh Singh wrote: > 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 > Reviewed-by: Laszlo Ersek