From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 576F72BB9 for ; Wed, 1 Jun 2016 08:41:13 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga103.fm.intel.com with ESMTP; 31 May 2016 23:41:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,400,1459839600"; d="scan'208";a="992784551" Received: from yliu-dev.sh.intel.com (HELO yliu-dev) ([10.239.67.162]) by fmsmga002.fm.intel.com with ESMTP; 31 May 2016 23:41:11 -0700 Date: Wed, 1 Jun 2016 14:44:03 +0800 From: Yuanhan Liu To: "Xie, Huawei" Cc: "dev@dpdk.org" Message-ID: <20160601064403.GA10038@yliu-dev.sh.intel.com> References: <1462236378-7604-1-git-send-email-yuanhan.liu@linux.intel.com> <1462236378-7604-3-git-send-email-yuanhan.liu@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) 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: Wed, 01 Jun 2016 06:41:13 -0000 On Wed, Jun 01, 2016 at 06:24:18AM +0000, Xie, Huawei wrote: > On 5/3/2016 8:42 AM, Yuanhan Liu wrote: > > Both current kernel virtio driver and DPDK virtio driver use at least > > 2 desc buffer for Tx: the first for storing the header, and the others > > for storing the data. > > Tx could prepend some space for virtio net header whenever possible, so > that it could use only one descriptor. In such case, it will work as well: it will goto the "else" code path then. > Another thing is this doesn't reduce the check because you also add a check. Actually, yes, it does save check. Before this patch, we have: while (not done yet) { if (desc_is_drain) ...; if (mbuf_is_full) ...; COPY(); } Note that the "while" check will be done twice, therefore, it's 4 checks in total. After this patch, it would be: if (virtio_net_hdr_takes_one_desc) ... while (1) { COPY(); if (desc_is_drain) { break if done; ...; } if (mbuf_is_full { /* small packets will bypass this check */ ....; } } So, for small packets, it takes 2 checks only, which actually saves 2 checks. --yliu