lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1267843250.2669.7.camel@myhost>
Date:	Sat, 06 Mar 2010 10:40:50 +0800
From:	"Figo.zhang" <figo1802@...il.com>
To:	Stephen Hemminger <shemminger@...tta.com>
Cc:	Yegor Yefremov <yegorslists@...glemail.com>,
	Dick Hollenbeck <dick@...tplc.com>, netdev@...r.kernel.org,
	zealcook@...il.com
Subject: Re: KS8695: possible NAPI issue


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

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ