net/ethernet: cpsw: Bugfix interrupts before enabling napi
authorMarkus Pargmann <mpa@pengutronix.de>
Sun, 13 Oct 2013 19:17:01 +0000 (21:17 +0200)
committerDavid S. Miller <davem@davemloft.net>
Thu, 17 Oct 2013 19:48:14 +0000 (15:48 -0400)
If interrupts happen before napi_enable was called, the driver will not
work as expected. Network transmissions are impossible in this state.
This bug can be reproduced easily by restarting the network interface in
a loop. After some time any network transmissions on the network
interface will fail.

This patch fixes the bug by enabling napi before enabling the network
interface interrupts.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Acked-by: Peter Korsgaard <jacmet@sunsite.dk>
Acked-by: Mugunthan V N <mugunthanvnm@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/ti/cpsw.c

index 804846eb5fc25c6c78fedecee447e3f04a908c90..fccd9d4d4ae095e143566a4d11cb66803398c6fc 100644 (file)
@@ -1169,9 +1169,9 @@ static int cpsw_ndo_open(struct net_device *ndev)
                }
        }
 
+       napi_enable(&priv->napi);
        cpdma_ctlr_start(priv->dma);
        cpsw_intr_enable(priv);
-       napi_enable(&priv->napi);
        cpdma_ctlr_eoi(priv->dma, CPDMA_EOI_RX);
        cpdma_ctlr_eoi(priv->dma, CPDMA_EOI_TX);