From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wg0-f51.google.com (mail-wg0-f51.google.com [74.125.82.51]) by dpdk.org (Postfix) with ESMTP id 66C6BC31C for ; Wed, 3 Jun 2015 21:18:10 +0200 (CEST) Received: by wgme6 with SMTP id e6so17214869wgm.2 for ; Wed, 03 Jun 2015 12:18:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=SLlnJZx3J34M1m6z4hSoX2TVEclPs3GcsLrSBp/Ymmg=; b=ZJebv3/SnGCB0fiwZZuli0YcwYbENJgMWX6ONLWh88ACHf9GRpwGlAqg40WEsT1/sY B7oOALQnWqDc3VxxPhqI05IjkaYLg9v9HR5XG1lHvdYci8DwpDH34IbVVuI+PN+45F8U R15/wueLzypvgQOcKibVVtLFXUzqsSwJ5Qu/mgy34E+YA3V3/mMYBIji6nFepL+Zsn6x sOI9v9BnpmU/l/KSSOkGDTOCtocNuQuYp8hbkY3i3MW0n0Y4W3MECTZFzBsmyf+j2bLB iO0jNg1/AwzAVlc7e+ry5BrY06z9rUTaICxFlaLG2gavC1eB51+mnLGm/Lb/G9PafV/9 4PoQ== X-Gm-Message-State: ALoCoQk004DGewMqChhGe/r68yr0NyOkGIG3VEOj50BQZgVl5StbOStjTMo+txV6e4yL33DyooiI MIME-Version: 1.0 X-Received: by 10.194.58.70 with SMTP id o6mr10259395wjq.54.1433359090270; Wed, 03 Jun 2015 12:18:10 -0700 (PDT) Received: by 10.194.36.193 with HTTP; Wed, 3 Jun 2015 12:18:10 -0700 (PDT) In-Reply-To: <1433358478-12668-2-git-send-email-rolette@infiniteio.com> References: <1433358478-12668-1-git-send-email-rolette@infiniteio.com> <1433358478-12668-2-git-send-email-rolette@infiniteio.com> Date: Wed, 3 Jun 2015 14:18:10 -0500 Message-ID: From: Jay Rolette To: DPDK Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] [PATCH 2/3] kni: minor opto 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, 03 Jun 2015 19:18:10 -0000 Some sort of hiccup sending. Not sure why 2/3 didn't come out as expected. I'll try sending again. Jay On Wed, Jun 3, 2015 at 2:07 PM, Jay Rolette wrote: > No reason to check out many entries are in kni->rx_q prior to > actually pulling them from the fifo. You can't dequeue more than > are there anyway. Max entries to dequeue is either the max batch > size or however much space is available on kni->free_q (lesser of the two) > > Signed-off-by: Jay Rolette > --- > lib/librte_eal/linuxapp/kni/kni_net.c | 21 ++++++++------------- > 1 file changed, 8 insertions(+), 13 deletions(-) > > diff --git a/lib/librte_eal/linuxapp/kni/kni_net.c > b/lib/librte_eal/linuxapp/kni/kni_net.c > index dd95db5..13ccbb8 100644 > --- a/lib/librte_eal/linuxapp/kni/kni_net.c > +++ b/lib/librte_eal/linuxapp/kni/kni_net.c > @@ -131,7 +131,7 @@ kni_net_rx_normal(struct kni_dev *kni) > { > unsigned ret; > uint32_t len; > - unsigned i, num, num_rq, num_fq; > + unsigned i, num, num_fq; > struct rte_kni_mbuf *kva; > struct rte_kni_mbuf *va[MBUF_BURST_SZ]; > void * data_kva; > @@ -139,24 +139,19 @@ kni_net_rx_normal(struct kni_dev *kni) > struct sk_buff *skb; > struct net_device *dev = kni->net_dev; > > - /* Get the number of entries in rx_q */ > - num_rq = kni_fifo_count(kni->rx_q); > - > /* Get the number of free entries in free_q */ > - num_fq = kni_fifo_free_count(kni->free_q); > - > - /* Calculate the number of entries to dequeue in rx_q */ > - num = min(num_rq, num_fq); > - num = min(num, (unsigned)MBUF_BURST_SZ); > - > - /* Return if no entry in rx_q and no free entry in free_q */ > - if (num == 0) > + if ((num_fq = kni_fifo_free_count(kni->free_q)) == 0) { > + /* No room on the free_q, bail out */ > return; > + } > + > + /* Calculate the number of entries to dequeue from rx_q */ > + num = min(num_fq, (unsigned)MBUF_BURST_SZ); > > /* Burst dequeue from rx_q */ > ret = kni_fifo_get(kni->rx_q, (void **)va, num); > if (ret == 0) > - return; /* Failing should not happen */ > + return; > > /* Transfer received packets to netif */ > for (i = 0; i < num; i++) { > -- > 2.3.2 (Apple Git-55) > >