]> bbs.cooldavid.org Git - net-next-2.6.git/commit - include/linux/netdevice.h
[NET]: Add NAPI_STATE_DISABLE.
authorDavid S. Miller <davem@davemloft.net>
Tue, 8 Jan 2008 04:35:07 +0000 (20:35 -0800)
committerDavid S. Miller <davem@davemloft.net>
Wed, 9 Jan 2008 07:30:07 +0000 (23:30 -0800)
commita0a46196cd98af5cc015842bba757571f02a8c30
tree1e73ef1d0251f969fbb1a51637722c2c793ff0b6
parentbdb95b1792664f25eb2a4d13a587d2020aa93002
[NET]: Add NAPI_STATE_DISABLE.

Create a bit to signal that a napi_disable() is in progress.

This sets up infrastructure such that net_rx_action() can generically
break out of the ->poll() loop on a NAPI context that has a pending
napi_disable() yet is being bombed with packets (and thus would
otherwise poll endlessly and not allow the napi_disable() to finish).

Now, what napi_disable() does is first set the NAPI_STATE_DISABLE bit
(to indicate that a disable is pending), then it polls for the
NAPI_STATE_SCHED bit, and once the NAPI_STATE_SCHED bit is acquired
the NAPI_STATE_DISABLE bit is cleared.  Here, the test_and_set_bit()
provides the necessary memory barrier between the various bitops.

napi_schedule_prep() now tests for a pending disable as it's first
action and won't try to obtain the NAPI_STATE_SCHED bit if a disable
is pending.

As a result, we can remove the netif_running() check in
netif_rx_schedule_prep() because the NAPI disable pending state serves
this purpose.  And, it does so in a NAPI centric manner which is what
we really want.

Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/netdevice.h