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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 23 Jul 2007 22:47:07 -0700 (PDT)
From:	David Miller <>
Subject: Re: [PATCH RFX]: napi_struct V3

From: Rusty Russell <>
Date: Tue, 24 Jul 2007 14:47:19 +1000

> On Mon, 2007-07-23 at 21:07 -0700, David Miller wrote:
> > Another area of consternation are drivers that were using
> > netif_rx_reschedule(), as that interface was removed because it
> > doesn't fit well with the caller managing the dev->quota et al.  I
> > left race conditions in the drivers that were using that interface,
> > but they should still basically work nonetheless.
> Hmm, virtio does this, if the implementation returns false from
> ->restart.  But it's basically a bandaid for things like lguest which
> don't check irq status on irq enable, hence is subject to the race.
> But AFAICT netif_rx_reschedule() is implementable in a driver anyway.
> What am I missing?

That looks like it would work, yes.

This is the least understood area, semantically, of NAPI.  It is
commonly believed that level-triggered interrupts obviate the need to
handle this race condition, and nothing could be further from the

I don't think it's wise to implement this over and over again in each
driver, since we already know at least a handfull of drivers will use

A netdev_napi_init() suggests itself already.  We could put the work
struct into the napi_struct and make the init routine something like:

static inline void netif_napi_init(struct napi_struct *napi,
				   int (*poll)(struct napi_struct *, int),
				   void (*resched)(struct work *),
				   int weight)
	napi->poll = poll;
	napi->weight = weight;
	INIT_WORK(&napi->work, resched);

and then we have napi_resched():

static inline void napi_resched(struct napi_struct *napi)

If this can be handled in a better way inside the driver, as is the
case for tg3 et al., "resched" can be passed in as NULL.

Any objections?
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to
More majordomo info at

Powered by blists - more mailing lists