From: Nicolas Ferre Date: Tue, 12 Feb 2013 10:08:48 +0000 (+0100) Subject: net/macb: fix race with RX interrupt while doing NAPI X-Git-Tag: firefly_0821_release~3680^2~1139^2~3 X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=8770e91aa61127f82eb8a9e641832474dbbcc8f1;p=firefly-linux-kernel-4.4.55.git net/macb: fix race with RX interrupt while doing NAPI When interrupts are disabled, an RX condition can occur but it is not reported when enabling interrupts again. We need to check RSR and use napi_reschedule() if condition is met. Signed-off-by: Nicolas Ferre Signed-off-by: David S. Miller --- diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c index a9b0830fb39d..b9d4bb9530e5 100644 --- a/drivers/net/ethernet/cadence/macb.c +++ b/drivers/net/ethernet/cadence/macb.c @@ -693,6 +693,11 @@ static int macb_poll(struct napi_struct *napi, int budget) * get notified when new packets arrive. */ macb_writel(bp, IER, MACB_RX_INT_FLAGS); + + /* Packets received while interrupts were disabled */ + status = macb_readl(bp, RSR); + if (unlikely(status)) + napi_reschedule(napi); } /* TODO: Handle errors */