All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Figo.zhang" <figo1802@gmail.com>
To: Stephen Hemminger <shemminger@vyatta.com>
Cc: Yegor Yefremov <yegorslists@googlemail.com>,
	Dick Hollenbeck <dick@softplc.com>,
	netdev@vger.kernel.org, zealcook@gmail.com
Subject: Re: KS8695: possible NAPI issue
Date: Sat, 06 Mar 2010 10:40:50 +0800	[thread overview]
Message-ID: <1267843250.2669.7.camel@myhost> (raw)
In-Reply-To: <20100305082218.4f734857@nehalam>


> 
> One of the requirements for NAPI to work is that the IRQ is level triggered.
> Otherwise there can be a race between packet arrival and the end of
> NAPI processing:
> 
> static int ks8695_poll(struct napi_struct *napi, int budget)
> {
> 	struct ks8695_priv *ksp = container_of(napi, struct ks8695_priv, napi);
> 	unsigned long  work_done;
> 
> 	unsigned long isr = readl(KS8695_IRQ_VA + KS8695_INTEN);
> 	unsigned long mask_bit = 1 << ks8695_get_rx_enable_bit(ksp);
> 
> 	work_done = ks8695_rx(ksp, budget);
> 
> 	if (work_done < budget) {
> 		unsigned long flags;
> 		spin_lock_irqsave(&ksp->rx_lock, flags);
> >>> packet arrives >>
> 		/*enable rx interrupt*/
> 		writel(isr | mask_bit, KS8695_IRQ_VA + KS8695_INTEN);
> >>> or here >>
> 		__napi_complete(napi);
> 		spin_unlock_irqrestore(&ksp->rx_lock, flags);
> 

yes, it is right, it maybe a race condition. so you can motify
ks8695_poll() to try, like this:

		__napi_complete(napi);
		/*enable rx interrupt*/
		writel(isr | mask_bit, KS8695_IRQ_VA + KS8695_INTEN); 


Best,
Figo.zhang


  reply	other threads:[~2010-03-06  2:40 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-02 12:04 KS8695: possible NAPI issue Yegor Yefremov
2010-03-02 14:09 ` Dick Hollenbeck
2010-03-03  1:46   ` figo zhang
2010-03-03  5:01     ` Dick Hollenbeck
2010-03-03  8:28       ` Yegor Yefremov
2010-03-04 10:10     ` Yegor Yefremov
2010-03-05  6:54       ` figo zhang
2010-03-05 10:06         ` Yegor Yefremov
2010-03-05 13:52           ` Figo.zhang
2010-03-05 15:03             ` Yegor Yefremov
2010-03-05 14:07           ` Figo.zhang
2010-03-05 15:00             ` Yegor Yefremov
2010-03-05 16:22               ` Stephen Hemminger
2010-03-06  2:40                 ` Figo.zhang [this message]
2010-03-08  9:04               ` figo zhang
2010-03-08 14:10                 ` Yegor Yefremov
2010-03-08 14:11                   ` Yegor Yefremov
2010-03-09  1:50                     ` figo zhang
2010-03-15  9:19                       ` Yegor Yefremov
2010-08-04 14:40                         ` Yegor Yefremov

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=1267843250.2669.7.camel@myhost \
    --to=figo1802@gmail.com \
    --cc=dick@softplc.com \
    --cc=netdev@vger.kernel.org \
    --cc=shemminger@vyatta.com \
    --cc=yegorslists@googlemail.com \
    --cc=zealcook@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.