]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
net/cpsw: don't rely only on netif_running() to check which device is active
authorSebastian Siewior <bigeasy@linutronix.de>
Tue, 23 Apr 2013 07:31:37 +0000 (07:31 +0000)
committerDavid S. Miller <davem@davemloft.net>
Thu, 25 Apr 2013 08:11:49 +0000 (04:11 -0400)
commitfd51cf199421197d14099b4ba382301cc28e5544
tree8539a2027985795fce3fa5ac86ac5ce4b14f1c6b
parentaacebbf8026ecdae1b55db3912e65c6b1308f5ed
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>
drivers/net/ethernet/ti/cpsw.c