From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yuanhan Liu Subject: Re: [PATCH 2/3] vhost: optimize dequeue for small packets Date: Wed, 1 Jun 2016 14:44:03 +0800 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 Cc: "dev@dpdk.org" To: "Xie, Huawei" 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) Content-Disposition: inline In-Reply-To: List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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