From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id BC9C25A6C for ; Mon, 15 Jun 2015 04:22:14 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP; 14 Jun 2015 19:22:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,615,1427785200"; d="scan'208";a="746662030" Received: from pgsmsx107.gar.corp.intel.com ([10.221.44.105]) by orsmga002.jf.intel.com with ESMTP; 14 Jun 2015 19:22:02 -0700 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by PGSMSX107.gar.corp.intel.com (10.221.44.105) with Microsoft SMTP Server (TLS) id 14.3.224.2; Mon, 15 Jun 2015 10:22:00 +0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.129]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.146]) with mapi id 14.03.0224.002; Mon, 15 Jun 2015 10:21:57 +0800 From: "Zhang, Helin" To: Jay Rolette Thread-Topic: [dpdk-dev] [PATCH 2/3] kni: minor opto Thread-Index: AQHQnjJOLCQPjv7RlE+S1846+PmJJp2s51aA Date: Mon, 15 Jun 2015 02:21:57 +0000 Message-ID: References: <1433359137-12720-1-git-send-email-rolette@infiniteio.com> <1433359137-12720-2-git-send-email-rolette@infiniteio.com> In-Reply-To: <1433359137-12720-2-git-send-email-rolette@infiniteio.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 Cc: "dev@dpdk.org" 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: Mon, 15 Jun 2015 02:22:15 -0000 > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Jay Rolette > Sent: Thursday, June 4, 2015 3:19 AM > To: dev@dpdk.org > Subject: [dpdk-dev] [PATCH 2/3] kni: minor opto The title is not so descriptive for the changes. The change itself seems OK for me. Thanks! - Helin >=20 > No reason to check out many entries are in kni->rx_q prior to actually pu= lling > them from the fifo. You can't dequeue more than are there anyway. Max ent= ries > to dequeue is either the max batch size or however much space is availabl= e on > kni->free_q (lesser of the two) >=20 > Signed-off-by: Jay Rolette > --- > lib/librte_eal/linuxapp/kni/kni_net.c | 21 ++++++++------------- > 1 file changed, 8 insertions(+), 13 deletions(-) >=20 > 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 =3D kni->net_dev; >=20 > - /* Get the number of entries in rx_q */ > - num_rq =3D kni_fifo_count(kni->rx_q); > - > /* Get the number of free entries in free_q */ > - num_fq =3D kni_fifo_free_count(kni->free_q); > - > - /* Calculate the number of entries to dequeue in rx_q */ > - num =3D min(num_rq, num_fq); > - num =3D min(num, (unsigned)MBUF_BURST_SZ); > - > - /* Return if no entry in rx_q and no free entry in free_q */ > - if (num =3D=3D 0) > + if ((num_fq =3D kni_fifo_free_count(kni->free_q)) =3D=3D 0) { > + /* No room on the free_q, bail out */ > return; > + } > + > + /* Calculate the number of entries to dequeue from rx_q */ > + num =3D min(num_fq, (unsigned)MBUF_BURST_SZ); >=20 > /* Burst dequeue from rx_q */ > ret =3D kni_fifo_get(kni->rx_q, (void **)va, num); > if (ret =3D=3D 0) > - return; /* Failing should not happen */ > + return; >=20 > /* Transfer received packets to netif */ > for (i =3D 0; i < num; i++) { > -- > 2.3.2 (Apple Git-55)