Skip to contentSkip to conversation

net: ethoc: enable NAPI before poll may be scheduled

PATCH In review Max Filippov 4 participants 4 messages Jun 6, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: ethoc: enable NAPI before poll may be scheduled

ethoc_reset enables device interrupts, ethoc_interrupt may schedule a NAPI poll before NAPI is enabled in the ethoc_open, which results in device being unable to send or receive anything until it's closed and reopened. In case the device is flooded with ingress packets it may be unable to recover at all.
Move napi_enable above ethoc_reset in the ethoc_open to fix that.

---
 drivers/net/ethernet/ethoc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/ethoc.c +2 -1
index 23d8274..4f33660 100644
@@ -739,6 +739,8 @@ static int ethoc_open(struct net_device *dev)
 	if (ret)
 		return ret;
 
+	napi_enable(&priv->napi);
+
 	ethoc_init_ring(priv, dev->mem_start);
 	ethoc_reset(priv);
 
@@ -754,7 +756,6 @@ static int ethoc_open(struct net_device *dev)
 	priv->old_duplex = -1;
 
 	phy_start(dev->phydev);
-	napi_enable(&priv->napi);
 
 	if (netif_msg_ifup(priv)) {
 		dev_info(&dev->dev, "I/O: %08lx Memory: %08lx-%08lx\n",
Signature · 1 line
2.1.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Max Filippov

ethoc_reset enables device interrupts, ethoc_interrupt may schedule a NAPI poll before NAPI is enabled in the ethoc_open, which results in device being unable to send or receive anything until it's closed and reopened. In case the device is flooded with ingress packets it may be unable to recover at all.
Move napi_enable above ethoc_reset in the ethoc_open to fix that.

Reviewed-by on v1 1/1
#2 lore raw
In reply to Max Filippov
Quoted 9 lines · Max Filippov

ethoc_reset enables device interrupts, ethoc_interrupt may schedule a NAPI poll before NAPI is enabled in the ethoc_open, which results in device being unable to send or receive anything until it's closed and reopened. In case the device is flooded with ingress packets it may be unable to recover at all.
Move napi_enable above ethoc_reset in the ethoc_open to fix that.

Fixes a1702857724f ("net: Add support for the OpenCores 10/100 Mbps

Ethernet MAC.")

Signature · 1 line
Florian
maintainer
#3 lore raw
In reply to Max Filippov

From: Max Filippov <[email protected]>
Date: Mon, 5 Jun 2017 18:31:16 -0700

Quoted 9 lines

ethoc_reset enables device interrupts, ethoc_interrupt may schedule a NAPI poll before NAPI is enabled in the ethoc_open, which results in device being unable to send or receive anything until it's closed and reopened. In case the device is flooded with ingress packets it may be unable to recover at all.
Move napi_enable above ethoc_reset in the ethoc_open to fix that.

Applied and queued up for -stable.