aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/bcm63xx/patches-5.10/027-bcm63xx_enet-fix-kernel-panic.patch
diff options
context:
space:
mode:
Diffstat (limited to 'target/linux/bcm63xx/patches-5.10/027-bcm63xx_enet-fix-kernel-panic.patch')
-rw-r--r--target/linux/bcm63xx/patches-5.10/027-bcm63xx_enet-fix-kernel-panic.patch50
1 files changed, 35 insertions, 15 deletions
diff --git a/target/linux/bcm63xx/patches-5.10/027-bcm63xx_enet-fix-kernel-panic.patch b/target/linux/bcm63xx/patches-5.10/027-bcm63xx_enet-fix-kernel-panic.patch
index 6f2ab6e735..6d07c737e7 100644
--- a/target/linux/bcm63xx/patches-5.10/027-bcm63xx_enet-fix-kernel-panic.patch
+++ b/target/linux/bcm63xx/patches-5.10/027-bcm63xx_enet-fix-kernel-panic.patch
@@ -1,15 +1,23 @@
+From ca6be00ca1d3a2f5b8794894e2dae175e63768f5 Mon Sep 17 00:00:00 2001
+From: Sieng Piaw Liew <liew.s.piaw@gmail.com>
+Date: Tue, 16 Feb 2021 16:23:08 +0800
+Subject: [PATCH] bcm63xx_enet: Fix sporadic kernel panic
+
+In ndo_stop functions, netdev_completed_queue() is called during forced
+tx reclaim, after netdev_reset_queue(). This may trigger kernel panic if
+there is any tx skb left.
+
+This patch moves netdev_reset_queue() to after tx reclaim, so BQL can
+complete successfully then reset.
+
+Signed-off-by: Sieng Piaw Liew <liew.s.piaw@gmail.com>
+---
+ drivers/net/ethernet/broadcom/bcm63xx_enet.c | 8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
-@@ -1104,6 +1104,8 @@ static int bcm_enet_open(struct net_devi
- else
- bcm_enet_adjust_link(dev);
-
-+ netdev_reset_queue(dev);
-+
- netif_start_queue(dev);
- return 0;
-
-@@ -1192,7 +1194,6 @@ static int bcm_enet_stop(struct net_devi
+@@ -1192,7 +1192,6 @@ static int bcm_enet_stop(struct net_devi
kdev = &priv->pdev->dev;
netif_stop_queue(dev);
@@ -17,13 +25,15 @@
napi_disable(&priv->napi);
if (priv->has_phy)
phy_stop(dev->phydev);
-@@ -2262,6 +2263,7 @@ static int bcm_enetsw_open(struct net_de
- enet_dmac_writel(priv, ENETDMAC_IR_PKTDONE_MASK,
- ENETDMAC_IRMASK, priv->tx_chan);
+@@ -1231,6 +1230,9 @@ static int bcm_enet_stop(struct net_devi
+ if (priv->has_phy)
+ phy_disconnect(dev->phydev);
++ /* reset BQL after forced tx reclaim to not kernel panic */
+ netdev_reset_queue(dev);
- netif_carrier_on(dev);
- netif_start_queue(dev);
++
+ return 0;
+ }
@@ -2343,7 +2345,6 @@ static int bcm_enetsw_stop(struct net_de
@@ -33,3 +43,13 @@
napi_disable(&priv->napi);
del_timer_sync(&priv->rx_timeout);
+@@ -2371,6 +2372,9 @@ static int bcm_enetsw_stop(struct net_de
+ free_irq(priv->irq_tx, dev);
+ free_irq(priv->irq_rx, dev);
+
++ /* reset BQL after forced tx reclaim to not kernel panic */
++ netdev_reset_queue(dev);
++
+ return 0;
+ }
+