From: Sieng Piaw Liew <liew.s.piaw@gmail.com>
Date: Wed, 24 Feb 2021 01:23:43 +0000 (+0800)
Subject: bcm63xx: rename upstreamed patch
X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=63aad66ddf2c156a5775dae03911d2e281b9de0f;p=openwrt%2Fstaging%2Fblogic.git

bcm63xx: rename upstreamed patch

Patch to fix kernel panic was recently accepted upstream so rename patch
and add acked lines to reflect that.

Signed-off-by: Sieng Piaw Liew <liew.s.piaw@gmail.com>
(add the same patch for v5.10)
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
---

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
deleted file mode 100644
index 6d07c737e7c9..000000000000
--- a/target/linux/bcm63xx/patches-5.10/027-bcm63xx_enet-fix-kernel-panic.patch
+++ /dev/null
@@ -1,55 +0,0 @@
-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
-@@ -1192,7 +1192,6 @@ static int bcm_enet_stop(struct net_devi
- 	kdev = &priv->pdev->dev;
- 
- 	netif_stop_queue(dev);
--	netdev_reset_queue(dev);
- 	napi_disable(&priv->napi);
- 	if (priv->has_phy)
- 		phy_stop(dev->phydev);
-@@ -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);
-+
- 	return 0;
- }
- 
-@@ -2343,7 +2345,6 @@ static int bcm_enetsw_stop(struct net_de
- 
- 	del_timer_sync(&priv->swphy_poll);
- 	netif_stop_queue(dev);
--	netdev_reset_queue(dev);
- 	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;
- }
- 
diff --git a/target/linux/bcm63xx/patches-5.10/027-v5.12-bcm63xx_enet-fix-kernel-panic.patch b/target/linux/bcm63xx/patches-5.10/027-v5.12-bcm63xx_enet-fix-kernel-panic.patch
new file mode 100644
index 000000000000..727a380348c6
--- /dev/null
+++ b/target/linux/bcm63xx/patches-5.10/027-v5.12-bcm63xx_enet-fix-kernel-panic.patch
@@ -0,0 +1,58 @@
+From 90eda07518ea7e8d1b3e6445eb3633eef9f65218 Mon Sep 17 00:00:00 2001
+From: Sieng Piaw Liew <liew.s.piaw@gmail.com>
+Date: Mon, 22 Feb 2021 09:15:12 +0800
+Subject: [PATCH net] 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>
+Acked-by: Florian Fainelli <f.fainelli@gmail.com>
+Fixes: 4c59b0f5543d ("bcm63xx_enet: add BQL support")
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+---
+ 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
+@@ -1192,7 +1192,6 @@ static int bcm_enet_stop(struct net_devi
+ 	kdev = &priv->pdev->dev;
+ 
+ 	netif_stop_queue(dev);
+-	netdev_reset_queue(dev);
+ 	napi_disable(&priv->napi);
+ 	if (priv->has_phy)
+ 		phy_stop(dev->phydev);
+@@ -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);
++
+ 	return 0;
+ }
+ 
+@@ -2343,7 +2345,6 @@ static int bcm_enetsw_stop(struct net_de
+ 
+ 	del_timer_sync(&priv->swphy_poll);
+ 	netif_stop_queue(dev);
+-	netdev_reset_queue(dev);
+ 	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;
+ }
+ 
diff --git a/target/linux/bcm63xx/patches-5.4/047-bcm63xx_enet-fix-kernel-panic.patch b/target/linux/bcm63xx/patches-5.4/047-bcm63xx_enet-fix-kernel-panic.patch
deleted file mode 100644
index 4a1feb3a10fe..000000000000
--- a/target/linux/bcm63xx/patches-5.4/047-bcm63xx_enet-fix-kernel-panic.patch
+++ /dev/null
@@ -1,55 +0,0 @@
-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
-@@ -1193,7 +1193,6 @@ static int bcm_enet_stop(struct net_devi
- 	kdev = &priv->pdev->dev;
- 
- 	netif_stop_queue(dev);
--	netdev_reset_queue(dev);
- 	napi_disable(&priv->napi);
- 	if (priv->has_phy)
- 		phy_stop(dev->phydev);
-@@ -1232,6 +1231,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);
-+
- 	return 0;
- }
- 
-@@ -2348,7 +2350,6 @@ static int bcm_enetsw_stop(struct net_de
- 
- 	del_timer_sync(&priv->swphy_poll);
- 	netif_stop_queue(dev);
--	netdev_reset_queue(dev);
- 	napi_disable(&priv->napi);
- 	del_timer_sync(&priv->rx_timeout);
- 
-@@ -2376,6 +2377,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;
- }
- 
diff --git a/target/linux/bcm63xx/patches-5.4/047-v5.12-bcm63xx_enet-fix-kernel-panic.patch b/target/linux/bcm63xx/patches-5.4/047-v5.12-bcm63xx_enet-fix-kernel-panic.patch
new file mode 100644
index 000000000000..fad336a64383
--- /dev/null
+++ b/target/linux/bcm63xx/patches-5.4/047-v5.12-bcm63xx_enet-fix-kernel-panic.patch
@@ -0,0 +1,58 @@
+From 90eda07518ea7e8d1b3e6445eb3633eef9f65218 Mon Sep 17 00:00:00 2001
+From: Sieng Piaw Liew <liew.s.piaw@gmail.com>
+Date: Mon, 22 Feb 2021 09:15:12 +0800
+Subject: [PATCH net] 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>
+Acked-by: Florian Fainelli <f.fainelli@gmail.com>
+Fixes: 4c59b0f5543d ("bcm63xx_enet: add BQL support")
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+---
+ 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
+@@ -1193,7 +1193,6 @@ static int bcm_enet_stop(struct net_devi
+ 	kdev = &priv->pdev->dev;
+ 
+ 	netif_stop_queue(dev);
+-	netdev_reset_queue(dev);
+ 	napi_disable(&priv->napi);
+ 	if (priv->has_phy)
+ 		phy_stop(dev->phydev);
+@@ -1232,6 +1231,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);
++
+ 	return 0;
+ }
+ 
+@@ -2348,7 +2350,6 @@ static int bcm_enetsw_stop(struct net_de
+ 
+ 	del_timer_sync(&priv->swphy_poll);
+ 	netif_stop_queue(dev);
+-	netdev_reset_queue(dev);
+ 	napi_disable(&priv->napi);
+ 	del_timer_sync(&priv->rx_timeout);
+ 
+@@ -2376,6 +2377,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;
+ }
+