Thread (5 messages) flat view 5 messages, 3 authors, 2007-08-09

Re: [PATCH RFC]: napi_struct V6

From: Stephen Hemminger <hidden>
Date: 2007-08-08 11:06:52

On Tue, 07 Aug 2007 21:54:32 -0700 (PDT)
David Miller [off-list ref] wrote:
Changes since V5:

1) Revert unnecessary TX locking changes in bnx2 and tg3

2) ++i

This is probably what I'll check into my net-2.6.24 tree

Thanks.

[NET]: Make NAPI polling independant of struct net_device objects.

Several devices have multiple independant RX queues per net
device, and some have a single interrupt doorbell for several
queues.

In either case, it's easier to support layouts like that if the
structure representing the poll is independant from the net
device itself.

The signature of the ->poll() call back goes from:

	int foo_poll(struct net_device *dev, int *budget)

to

	int foo_poll(struct napi_struct *napi, int budget)

The caller is returned the number of RX packets processed (or
the number of "NAPI credits" consumed if you want to get
abstract).  The callee no longer messes around bumping
dev->quota, *budget, etc. because that is all handled in the
caller upon return.

The napi_struct is to be embedded in the device driver private data
structures.

Furthermore, it is the driver's responsibility to disable all NAPI
instances in it's ->stop() device close handler.  Since the
napi_struct is privatized into the driver's private data structures,
only the driver knows how to get at all of the napi_struct instances
it may have per-device.

With lots of help and suggestions from Rusty Russell.

[ Ported to current tree and all drivers converted.  -DaveM ]

Signed-off-by: Stephen Hemminger <redacted>
Signed-off-by: David S. Miller <davem@davemloft.net>

Thanks for doing all this. Looks great.
Documentation of NAPI still needs more work. I'll take a start at getting
net_device docbook format cleaned up, then start on a redo of the API
documentation.  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help