: [NET]: Fix drivers to handle napi_disable() disabling interrupts.
Subsystems (2)
Don Fry
Acked-byTested pcnet32 on x86_64 box and see no problems with the change. The code is only exercised if doing loopback testing, or changing the ring size during a receive storm.
---
[NET]: Fix drivers to handle napi_disable() disabling interrupts.
When we add the generic napi_disable_pending() breakout logic to net_rx_action() it means that napi_disable() can cause NAPI poll interrupt events to be disabled.
And this is exactly what we want. If a napi_disable() is pending, and we are looping in the ->poll(), we want ->poll() event interrupts to stay disabled and we want to complete the NAPI poll ASAP.
When ->poll() break out during device down was being handled on a per-driver basis, often these drivers would turn interrupts back on when '!netif_running()' was detected.
And this would just cause a reschedule of the NAPI ->poll() in the interrupt handler before the napi_disable() could get in there and grab the NAPI_STATE_SCHED bit.
The vast majority of drivers don't care if napi_disable() might have the side effect of disabling NAPI ->poll() event interrupts. In all such cases, when a napi_disable() is performed, the driver just disabled interrupts or is about to.
However there were three exceptions to this in PCNET32, R8169, and SKY2. To fix those cases, at the subsequent napi_enable() points, I added code to ensure that the ->poll() interrupt events are enabled in the hardware.
--- drivers/net/pcnet32.c | 5 +++++ drivers/net/r8169.c | 2 ++ drivers/net/sky2.c | 3 +++ 3 files changed, 10 insertions(+), 0 deletions(-)
drivers/net/pcnet32.c +0 -0
@@ -455,9 +455,14 @@ static void pcnet32_netif_start(struct net_device
*dev)
{
#ifdef CONFIG_PCNET32_NAPI
struct pcnet32_private *lp = netdev_priv(dev);
+ ulong ioaddr = dev->base_addr;
+ u16 val;
#endif
netif_wake_queue(dev);
#ifdef CONFIG_PCNET32_NAPI
+ val = lp->a.read_csr(ioaddr, CSR3);
+ val &= 0x00ff;
+ lp->a.write_csr(ioaddr, CSR3, val);
napi_enable(&lp->napi);
#endif
}
Signature · 6 lines
1.5.4.rc2.38.gd6da3 -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
David Miller
maintainerFrom: Don Fry <[email protected]>
Date: Tue, 08 Jan 2008 22:14:29 -0800
Quoted 5 lines
Tested pcnet32 on
x86_64box and see no problems with the change. The code is only exercised if doing loopback testing, or changing the ring size during a receive storm.Acked-by Don Fry <[email protected]>
Thanks for testing and the feedback.