[NET]: Make NAPI polling independent of struct net_device objects.
authorStephen Hemminger <shemminger@linux-foundation.org>
Wed, 3 Oct 2007 23:41:36 +0000 (16:41 -0700)
committerDavid S. Miller <davem@sunset.davemloft.net>
Wed, 10 Oct 2007 23:47:45 +0000 (16:47 -0700)
commitbea3348eef27e6044b6161fd04c3152215f96411
treef0990b263e5ce42505d290a4c346fe990bcd4c33
parentdde4e47e8fe333a5649a3fa0e7db1fa7c08d6158
[NET]: Make NAPI polling independent 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, Roland Dreier,
Michael Chan, Jeff Garzik, and Jamal Hadi Salim.

Bug fixes from Thomas Graf, Roland Dreier, Peter Zijlstra,
Joseph Fannin, Scott Wood, Hans J. Koch, and Michael Chan.

[ Ported to current tree and all drivers converted.  Integrated
  Stephen's follow-on kerneldoc additions, and restored poll_list
  handling to the old style to fix mutual exclusion issues.  -DaveM ]

Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
91 files changed:
Documentation/DocBook/kernel-api.tmpl
Documentation/networking/NAPI_HOWTO.txt [deleted file]
Documentation/networking/netdevices.txt
drivers/infiniband/ulp/ipoib/ipoib.h
drivers/infiniband/ulp/ipoib/ipoib_ib.c
drivers/infiniband/ulp/ipoib/ipoib_main.c
drivers/net/8139cp.c
drivers/net/8139too.c
drivers/net/amd8111e.c
drivers/net/amd8111e.h
drivers/net/arm/ep93xx_eth.c
drivers/net/b44.c
drivers/net/b44.h
drivers/net/bnx2.c
drivers/net/bnx2.h
drivers/net/cassini.c
drivers/net/cassini.h
drivers/net/chelsio/common.h
drivers/net/chelsio/cxgb2.c
drivers/net/chelsio/sge.c
drivers/net/chelsio/sge.h
drivers/net/cxgb3/adapter.h
drivers/net/cxgb3/cxgb3_main.c
drivers/net/cxgb3/sge.c
drivers/net/e100.c
drivers/net/e1000/e1000.h
drivers/net/e1000/e1000_main.c
drivers/net/ehea/ehea.h
drivers/net/ehea/ehea_main.c
drivers/net/epic100.c
drivers/net/fec_8xx/fec_8xx.h
drivers/net/fec_8xx/fec_main.c
drivers/net/forcedeth.c
drivers/net/fs_enet/fs_enet-main.c
drivers/net/fs_enet/fs_enet.h
drivers/net/gianfar.c
drivers/net/gianfar.h
drivers/net/ibmveth.c
drivers/net/ibmveth.h
drivers/net/ixgb/ixgb.h
drivers/net/ixgb/ixgb_main.c
drivers/net/ixp2000/ixpdev.c
drivers/net/ixp2000/ixpdev.h
drivers/net/macb.c
drivers/net/macb.h
drivers/net/mv643xx_eth.c
drivers/net/mv643xx_eth.h
drivers/net/myri10ge/myri10ge.c
drivers/net/natsemi.c
drivers/net/netxen/netxen_nic.h
drivers/net/netxen/netxen_nic_main.c
drivers/net/pasemi_mac.c
drivers/net/pasemi_mac.h
drivers/net/pcnet32.c
drivers/net/ps3_gelic_net.c
drivers/net/ps3_gelic_net.h
drivers/net/qla3xxx.c
drivers/net/qla3xxx.h
drivers/net/r8169.c
drivers/net/s2io.c
drivers/net/s2io.h
drivers/net/sb1250-mac.c
drivers/net/sis190.c
drivers/net/skge.c
drivers/net/skge.h
drivers/net/sky2.c
drivers/net/sky2.h
drivers/net/spider_net.c
drivers/net/spider_net.h
drivers/net/starfire.c
drivers/net/sungem.c
drivers/net/sungem.h
drivers/net/tc35815.c
drivers/net/tg3.c
drivers/net/tg3.h
drivers/net/tsi108_eth.c
drivers/net/tulip/interrupt.c
drivers/net/tulip/tulip.h
drivers/net/tulip/tulip_core.c
drivers/net/typhoon.c
drivers/net/ucc_geth.c
drivers/net/ucc_geth.h
drivers/net/via-rhine.c
drivers/net/xen-netfront.c
include/linux/netdevice.h
include/linux/netpoll.h
net/core/dev.c
net/core/net-sysfs.c
net/core/netpoll.c
net/core/rtnetlink.c
net/sched/sch_generic.c