From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id E6DF55955 for ; Fri, 3 Jun 2016 09:42:18 +0200 (CEST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP; 03 Jun 2016 00:42:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,411,1459839600"; d="scan'208";a="980046355" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by fmsmga001.fm.intel.com with ESMTP; 03 Jun 2016 00:42:18 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.248.2; Fri, 3 Jun 2016 00:42:17 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.150]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.181]) with mapi id 14.03.0248.002; Fri, 3 Jun 2016 15:42:16 +0800 From: "Xie, Huawei" To: Yuanhan Liu CC: "dev@dpdk.org" Thread-Topic: [PATCH 2/3] vhost: optimize dequeue for small packets Thread-Index: AdG7zjn+DVRyUoDVRFOTVpGyu8m8xQ== Date: Fri, 3 Jun 2016 07:42:14 +0000 Message-ID: References: <1462236378-7604-1-git-send-email-yuanhan.liu@linux.intel.com> <1462236378-7604-3-git-send-email-yuanhan.liu@linux.intel.com> <20160601064403.GA10038@yliu-dev.sh.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH 2/3] vhost: optimize dequeue for small packets X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jun 2016 07:42:19 -0000 On 6/1/2016 2:41 PM, Yuanhan Liu wrote:=0A= > On Wed, Jun 01, 2016 at 06:24:18AM +0000, Xie, Huawei wrote:=0A= >> On 5/3/2016 8:42 AM, Yuanhan Liu wrote:=0A= >>> Both current kernel virtio driver and DPDK virtio driver use at least= =0A= >>> 2 desc buffer for Tx: the first for storing the header, and the others= =0A= >>> for storing the data.=0A= >> Tx could prepend some space for virtio net header whenever possible, so= =0A= >> that it could use only one descriptor.=0A= > In such case, it will work as well: it will goto the "else" code path=0A= > then.=0A= =0A= It works, but the problem is the statement.=0A= =0A= >> Another thing is this doesn't reduce the check because you also add a ch= eck.=0A= > Actually, yes, it does save check. Before this patch, we have:=0A= >=0A= > while (not done yet) {=0A= > if (desc_is_drain)=0A= > ...;=0A= >=0A= > if (mbuf_is_full)=0A= > ...;=0A= >=0A= > COPY();=0A= > }=0A= >=0A= > Note that the "while" check will be done twice, therefore, it's 4=0A= > checks in total. After this patch, it would be:=0A= >=0A= > if (virtio_net_hdr_takes_one_desc)=0A= > ...=0A= >=0A= > while (1) {=0A= > COPY();=0A= >=0A= > if (desc_is_drain) {=0A= > break if done;=0A= > ...;=0A= > }=0A= >=0A= > if (mbuf_is_full {=0A= > /* small packets will bypass this check */=0A= > ....;=0A= > }=0A= > }=0A= >=0A= > So, for small packets, it takes 2 checks only, which actually saves=0A= > 2 checks.=0A= >=0A= > --yliu=0A= >=0A= =0A= For small packets, we have three checks totally. It worth we use space=0A= to save checks, so would ack this patch, but note that there is one=0A= assumption that rte_memcpy API could handle zero length copy.=0A= =0A= =0A= =0A=