DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Zhang, Helin" <helin.zhang@intel.com>
To: Jay Rolette <rolette@infiniteio.com>, "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH 2/3] kni: minor opto
Date: Tue, 16 Jun 2015 01:13:47 +0000	[thread overview]
Message-ID: <F35DEAC7BCE34641BA9FAC6BCA4A12E70A882533@SHSMSX104.ccr.corp.intel.com> (raw)
In-Reply-To: <1433358478-12668-2-git-send-email-rolette@infiniteio.com>



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Jay Rolette
> Sent: Thursday, June 4, 2015 3:08 AM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH 2/3] kni: minor opto
> 
> 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 <rolette@infiniteio.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>

> ---
>  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)

  parent reply	other threads:[~2015-06-16  1:13 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-03 19:07 [dpdk-dev] [PATCH 1/3] " Jay Rolette
2015-06-03 19:07 ` [dpdk-dev] [PATCH 2/3] " Jay Rolette
2015-06-03 19:18   ` Jay Rolette
2015-06-16  1:13   ` Zhang, Helin [this message]
2015-06-03 19:07 ` [dpdk-dev] [PATCH 3/3] kni: rx loop was using the wrong counter Jay Rolette
2015-06-16  1:12 ` [dpdk-dev] [PATCH 1/3] kni: minor opto Zhang, Helin
2015-06-03 19:18 Jay Rolette
2015-06-03 19:18 ` [dpdk-dev] [PATCH 2/3] " Jay Rolette
2015-06-04 13:44   ` Bruce Richardson
2015-06-15  2:21   ` Zhang, Helin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=F35DEAC7BCE34641BA9FAC6BCA4A12E70A882533@SHSMSX104.ccr.corp.intel.com \
    --to=helin.zhang@intel.com \
    --cc=dev@dpdk.org \
    --cc=rolette@infiniteio.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).