aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethoc.c
diff options
context:
space:
mode:
authorJonas Bonn <jonas@southpole.se>2010-11-24 21:30:28 -0500
committerDavid S. Miller <davem@davemloft.net>2010-11-28 14:16:36 -0500
commit20f70ddd6558a39a89dba4af675686c5a8dbd7b3 (patch)
tree759bde727810d041ac7cab116eccaedf52cd7490 /drivers/net/ethoc.c
parent7438a5455734d109fdf18d97147dc57a6dbe5a44 (diff)
ethoc: Double check pending RX packet
An interrupt may occur between checking bd.stat and clearing the interrupt source register which would result in the packet going totally unnoticed as the interrupt will be missed. Double check bd.stat after clearing the interrupt source register to guard against such an occurrence. Signed-off-by: Jonas Bonn <jonas@southpole.se> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethoc.c')
-rw-r--r--drivers/net/ethoc.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/drivers/net/ethoc.c b/drivers/net/ethoc.c
index db444a73e4b1..a12a07ea02b6 100644
--- a/drivers/net/ethoc.c
+++ b/drivers/net/ethoc.c
@@ -414,8 +414,19 @@ static int ethoc_rx(struct net_device *dev, int limit)
414 414
415 entry = priv->num_tx + (priv->cur_rx % priv->num_rx); 415 entry = priv->num_tx + (priv->cur_rx % priv->num_rx);
416 ethoc_read_bd(priv, entry, &bd); 416 ethoc_read_bd(priv, entry, &bd);
417 if (bd.stat & RX_BD_EMPTY) 417 if (bd.stat & RX_BD_EMPTY) {
418 break; 418 ethoc_ack_irq(priv, INT_MASK_RX);
419 /* If packet (interrupt) came in between checking
420 * BD_EMTPY and clearing the interrupt source, then we
421 * risk missing the packet as the RX interrupt won't
422 * trigger right away when we reenable it; hence, check
423 * BD_EMTPY here again to make sure there isn't such a
424 * packet waiting for us...
425 */
426 ethoc_read_bd(priv, entry, &bd);
427 if (bd.stat & RX_BD_EMPTY)
428 break;
429 }
419 430
420 if (ethoc_update_rx_stats(priv, &bd) == 0) { 431 if (ethoc_update_rx_stats(priv, &bd) == 0) {
421 int size = bd.stat >> 16; 432 int size = bd.stat >> 16;