bcm63xx: switch to Kernel 5.15 by default
[openwrt/staging/noltari.git] / target / linux / bcm63xx / patches-5.10 / 027-v5.12-bcm63xx_enet-fix-kernel-panic.patch
1 From 90eda07518ea7e8d1b3e6445eb3633eef9f65218 Mon Sep 17 00:00:00 2001
2 From: Sieng Piaw Liew <liew.s.piaw@gmail.com>
3 Date: Mon, 22 Feb 2021 09:15:12 +0800
4 Subject: [PATCH net] bcm63xx_enet: fix sporadic kernel panic
5
6 In ndo_stop functions, netdev_completed_queue() is called during forced
7 tx reclaim, after netdev_reset_queue(). This may trigger kernel panic if
8 there is any tx skb left.
9
10 This patch moves netdev_reset_queue() to after tx reclaim, so BQL can
11 complete successfully then reset.
12
13 Signed-off-by: Sieng Piaw Liew <liew.s.piaw@gmail.com>
14 Acked-by: Florian Fainelli <f.fainelli@gmail.com>
15 Fixes: 4c59b0f5543d ("bcm63xx_enet: add BQL support")
16 Signed-off-by: Jakub Kicinski <kuba@kernel.org>
17 ---
18 drivers/net/ethernet/broadcom/bcm63xx_enet.c | 8 ++++++--
19 1 file changed, 6 insertions(+), 2 deletions(-)
20
21 --- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
22 +++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
23 @@ -1192,7 +1192,6 @@ static int bcm_enet_stop(struct net_devi
24 kdev = &priv->pdev->dev;
25
26 netif_stop_queue(dev);
27 - netdev_reset_queue(dev);
28 napi_disable(&priv->napi);
29 if (priv->has_phy)
30 phy_stop(dev->phydev);
31 @@ -1231,6 +1230,9 @@ static int bcm_enet_stop(struct net_devi
32 if (priv->has_phy)
33 phy_disconnect(dev->phydev);
34
35 + /* reset BQL after forced tx reclaim to not kernel panic */
36 + netdev_reset_queue(dev);
37 +
38 return 0;
39 }
40
41 @@ -2343,7 +2345,6 @@ static int bcm_enetsw_stop(struct net_de
42
43 del_timer_sync(&priv->swphy_poll);
44 netif_stop_queue(dev);
45 - netdev_reset_queue(dev);
46 napi_disable(&priv->napi);
47 del_timer_sync(&priv->rx_timeout);
48
49 @@ -2371,6 +2372,9 @@ static int bcm_enetsw_stop(struct net_de
50 free_irq(priv->irq_tx, dev);
51 free_irq(priv->irq_rx, dev);
52
53 + /* reset BQL after forced tx reclaim to not kernel panic */
54 + netdev_reset_queue(dev);
55 +
56 return 0;
57 }
58