Skip to contentSkip to conversation

net: macb: Only disable NAPI on the actual error path

PATCH Applied Charles Keepax 3 participants 3 messages Jun 15, 2020

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

PATCH 1/1 net: macb: Only disable NAPI on the actual error path

A recent change added a disable to NAPI into macb_open, this was intended to only happen on the error path but accidentally applies to all paths. This causes NAPI to be disabled on the success path, which leads to the network to no longer functioning.

Fixes 014406babc1f ("net: cadence: macb: disable NAPI on error")
---
 drivers/net/ethernet/cadence/macb_main.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/net/ethernet/cadence/macb_main.c +4 -5
index 5b9d7c60eebc0..67933079aeea5 100644
@@ -2565,15 +2565,14 @@ static int macb_open(struct net_device *dev)
 	if (bp->ptp_info)
 		bp->ptp_info->ptp_init(dev);
 
+	return 0;
+
 napi_exit:
 	for (q = 0, queue = bp->queues; q < bp->num_queues; ++q, ++queue)
 		napi_disable(&queue->napi);
 pm_exit:
-	if (err) {
-		pm_runtime_put_sync(&bp->pdev->dev);
-		return err;
-	}
-	return 0;
+	pm_runtime_put_sync(&bp->pdev->dev);
+	return err;
 }
 
 static int macb_close(struct net_device *dev)
Signature · 1 line
2.11.0
Tested-by on v1 1/1
#1 lore raw
Quoted 38 lines · Charles Keepax

A recent change added a disable to NAPI into macb_open, this was intended to only happen on the error path but accidentally applies to all paths. This causes NAPI to be disabled on the success path, which leads to the network to no longer functioning.

Fixes 014406babc1f ("net: cadence: macb: disable NAPI on error")
---
 drivers/net/ethernet/cadence/macb_main.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/net/ethernet/cadence/macb_main.c +4 -5
index 5b9d7c60eebc0..67933079aeea5 100644
@@ -2565,15 +2565,14 @@ static int macb_open(struct net_device *dev)
 	if (bp->ptp_info)
 		bp->ptp_info->ptp_init(dev);
 
+	return 0;
+
 napi_exit:
 	for (q = 0, queue = bp->queues; q < bp->num_queues; ++q, ++queue)
 		napi_disable(&queue->napi);
 pm_exit:
-	if (err) {
-		pm_runtime_put_sync(&bp->pdev->dev);
-		return err;
-	}
-	return 0;
+	pm_runtime_put_sync(&bp->pdev->dev);
+	return err;
 }
 
 static int macb_close(struct net_device *dev)
Signature · 1 line
2.11.0

Shame on me to not have see this.

With the fix it works.

Tested-on: qemu-xilinx-zynq-a9

maintainer Applied
#2 lore raw
In reply to Charles Keepax

From: Charles Keepax <[email protected]>
Date: Mon, 15 Jun 2020 14:18:54 +0100

Quoted 7 lines

A recent change added a disable to NAPI into macb_open, this was intended to only happen on the error path but accidentally applies to all paths. This causes NAPI to be disabled on the success path, which leads to the network to no longer functioning.

Fixes 014406babc1f ("net: cadence: macb: disable NAPI on error")

Applied, thank you.