net/cpsw: don't rely only on netif_running() to check which device is active
netif_running() reports false before the ->ndo_stop() callback is
called. That means if one executes "ifconfig down" and the system
receives an interrupt before the interrupt source has been disabled we
hang for always for two reasons:
- we never disable the interrupt source because devices claim to be
already inactive and don't feel responsible.
- since the ISR always reports IRQ_HANDLED the line is never deactivated
because it looks like the ISR feels responsible.
This patch changes the logic in the ISR a little:
- If none of the status registers reports an active source (RX or TX,
misc is ignored because it is not actived) we leave with IRQ_NONE.
- the interrupt is deactivated
- The first active network device is taken and napi is scheduled. If
none are active (a small race window between ndo_down() and the
interrupt the) then we leave and should not come back because the
source is off.
There is no need to schedule the second NAPI because both share the
same dma queue.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Acked-by: Mugunthan V N <mugunthanvnm@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>