public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Oded Gabbay <oded.gabbay@amd.com>
To: Eric Dumazet <eric.dumazet@gmail.com>,
	Johannes Berg <johannes.berg@intel.com>
Cc: "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	Willem de Bruijn <willemb@google.com>,
	"Bridgman, John" <John.Bridgman@amd.com>,
	"Elifaz, Dana" <Dana.Elifaz@amd.com>
Subject: Re: [BUG] 3.19-rc1 net: less interrupt masking in NAPI
Date: Sun, 11 Jan 2015 00:05:32 +0200	[thread overview]
Message-ID: <54B1A22C.2020301@amd.com> (raw)
In-Reply-To: <1420926614.5947.89.camel@edumazet-glaptop2.roam.corp.google.com>



On 01/10/2015 11:50 PM, Eric Dumazet wrote:
> On Sat, 2015-01-10 at 23:30 +0200, Oded Gabbay wrote:
> 
>> Yes, no problem.
>> I will update on the result.
> 
> Please try this more complete patch, solving the TX pressure problem as
> well, and not lying about NAPI budget. thanks !
> 
> 
> diff --git a/drivers/net/ethernet/atheros/alx/main.c b/drivers/net/ethernet/atheros/alx/main.c
> index e398eda07298..5f05b387c0a7 100644
> --- a/drivers/net/ethernet/atheros/alx/main.c
> +++ b/drivers/net/ethernet/atheros/alx/main.c
> @@ -184,15 +184,16 @@ static void alx_schedule_reset(struct alx_priv *alx)
>  	schedule_work(&alx->reset_wk);
>  }
>  
> -static bool alx_clean_rx_irq(struct alx_priv *alx, int budget)
> +static int alx_clean_rx_irq(struct alx_priv *alx, int budget)
>  {
>  	struct alx_rx_queue *rxq = &alx->rxq;
>  	struct alx_rrd *rrd;
>  	struct alx_buffer *rxb;
>  	struct sk_buff *skb;
>  	u16 length, rfd_cleaned = 0;
> +	int work = 0;
>  
> -	while (budget > 0) {
> +	while (work < budget) {
>  		rrd = &rxq->rrd[rxq->rrd_read_idx];
>  		if (!(rrd->word3 & cpu_to_le32(1 << RRD_UPDATED_SHIFT)))
>  			break;
> @@ -243,7 +244,7 @@ static bool alx_clean_rx_irq(struct alx_priv *alx, int budget)
>  		}
>  
>  		napi_gro_receive(&alx->napi, skb);
> -		budget--;
> +		work++;
>  
>  next_pkt:
>  		if (++rxq->read_idx == alx->rx_ringsz)
> @@ -258,21 +259,22 @@ next_pkt:
>  	if (rfd_cleaned)
>  		alx_refill_rx_ring(alx, GFP_ATOMIC);
>  
> -	return budget > 0;
> +	return work;
>  }
>  
>  static int alx_poll(struct napi_struct *napi, int budget)
>  {
>  	struct alx_priv *alx = container_of(napi, struct alx_priv, napi);
>  	struct alx_hw *hw = &alx->hw;
> -	bool complete = true;
>  	unsigned long flags;
> +	bool tx_complete;
> +	int work;
>  
> -	complete = alx_clean_tx_irq(alx) &&
> -		   alx_clean_rx_irq(alx, budget);
> +	tx_complete = alx_clean_tx_irq(alx);
> +	work = alx_clean_rx_irq(alx, budget);
>  
> -	if (!complete)
> -		return 1;
> +	if (!tx_complete || work == budget)
> +		return budget;
>  
>  	napi_complete(&alx->napi);
>  
> @@ -284,7 +286,7 @@ static int alx_poll(struct napi_struct *napi, int budget)
>  
>  	alx_post_write(hw);
>  
> -	return 0;
> +	return work;
>  }
>  
>  static irqreturn_t alx_intr_handle(struct alx_priv *alx, u32 intr)
> 
> 
Hi,
Checked it and its working.
Thanks again.
Please note that I only use this Ethernet controller for NFS and SCP, it is
not used for development of networking software of any kind, so maybe a more
extensive testing is needed.

	Oded

  reply	other threads:[~2015-01-10 22:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-10 20:39 [BUG] 3.19-rc1 net: less interrupt masking in NAPI Oded Gabbay
2015-01-10 20:58 ` Eric Dumazet
2015-01-10 21:10   ` Eric Dumazet
2015-01-10 21:30   ` Oded Gabbay
2015-01-10 21:43     ` Oded Gabbay
2015-01-10 21:50     ` Eric Dumazet
2015-01-10 22:05       ` Oded Gabbay [this message]
2015-01-10 22:08         ` Oded Gabbay

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=54B1A22C.2020301@amd.com \
    --to=oded.gabbay@amd.com \
    --cc=Dana.Elifaz@amd.com \
    --cc=John.Bridgman@amd.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=eric.dumazet@gmail.com \
    --cc=johannes.berg@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=willemb@google.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