bcm63xx: fix bcm63xx ethernet kernel panics
authorÁlvaro Fernández Rojas <noltari@gmail.com>
Thu, 28 Jan 2021 10:49:16 +0000 (11:49 +0100)
committerÁlvaro Fernández Rojas <noltari@gmail.com>
Thu, 28 Jan 2021 11:01:14 +0000 (12:01 +0100)
Calling netdev_reset_queue() from _stop() functions is causing sporadic kernel
panics on bcm63xx, which happen mainly on BCM6318 and BCM6328.
This reverts to the previous behaviour, which called netdev_reset_queue() from
_open() functions.

Tested on Comtrend AR-5315u (BCM6318).

Fixes: 1d6f422e346b ("bcm63xx: sync ethernet driver with net-next")
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
target/linux/bcm63xx/patches-5.4/047-bcm63xx_enet-fix-kernel-panic.patch [new file with mode: 0644]
target/linux/bcm63xx/patches-5.4/402_bcm63xx_enet_vlan_incoming_fixed.patch
target/linux/bcm63xx/patches-5.4/404-NET-bcm63xx_enet-move-phy_-dis-connect-into-probe-re.patch
target/linux/bcm63xx/patches-5.4/408-bcm63xx_enet-enable-rgmii-clock-on-external-ports.patch
target/linux/bcm63xx/patches-5.4/423-bcm63xx_enet_add_b53_support.patch
target/linux/bcm63xx/patches-5.4/424-bcm63xx_enet_no_request_mem_region.patch
target/linux/bcm63xx/patches-5.4/428-bcm63xx_enet-rgmii-ctrl-fix.patch

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
new file mode 100644 (file)
index 0000000..466a64c
--- /dev/null
@@ -0,0 +1,35 @@
+--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
++++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
+@@ -1105,6 +1105,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;
+@@ -1193,7 +1195,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);
+@@ -2267,6 +2268,7 @@ static int bcm_enetsw_open(struct net_de
+       enet_dmac_writel(priv, ENETDMAC_IR_PKTDONE_MASK,
+                        ENETDMAC_IRMASK, priv->tx_chan);
++      netdev_reset_queue(dev);
+       netif_carrier_on(dev);
+       netif_start_queue(dev);
+@@ -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);
index 949fb8d2938599c937cb2ae042ef213437470089..bd0c4cfc3f7a853d95ec11d1a84266284bb24ccb 100644 (file)
@@ -1,6 +1,6 @@
 --- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
 +++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
-@@ -1629,7 +1629,7 @@ static int bcm_enet_change_mtu(struct ne
+@@ -1630,7 +1630,7 @@ static int bcm_enet_change_mtu(struct ne
                return -EBUSY;
  
        /* add ethernet header + vlan tag size */
index d9e49727da85bbc6243eef3a84c12cc909aba97c..a389f642ad857c38674b508b3104da4ddcd5f036 100644 (file)
@@ -79,7 +79,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
        else
                bcm_enet_adjust_link(dev);
  
-@@ -1131,10 +1108,6 @@ out_freeirq_rx:
+@@ -1133,10 +1110,6 @@ out_freeirq_rx:
  out_freeirq:
        free_irq(dev->irq, dev);
  
@@ -90,7 +90,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
        return ret;
  }
  
-@@ -1228,10 +1201,6 @@ static int bcm_enet_stop(struct net_devi
+@@ -1229,10 +1202,6 @@ static int bcm_enet_stop(struct net_devi
        free_irq(priv->irq_rx, dev);
        free_irq(dev->irq, dev);
  
@@ -101,7 +101,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
        return 0;
  }
  
-@@ -1800,14 +1769,47 @@ static int bcm_enet_probe(struct platfor
+@@ -1801,14 +1770,47 @@ static int bcm_enet_probe(struct platfor
  
        /* do minimal hardware init to be able to probe mii bus */
        bcm_enet_hw_preinit(priv);
@@ -150,7 +150,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
                }
  
                bus = priv->mii_bus;
-@@ -1831,6 +1833,26 @@ static int bcm_enet_probe(struct platfor
+@@ -1832,6 +1834,26 @@ static int bcm_enet_probe(struct platfor
                        dev_err(&pdev->dev, "unable to register mdio bus\n");
                        goto out_free_mdio;
                }
@@ -177,7 +177,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
        } else {
  
                /* run platform code to initialize PHY device */
-@@ -1838,45 +1860,16 @@ static int bcm_enet_probe(struct platfor
+@@ -1839,45 +1861,16 @@ static int bcm_enet_probe(struct platfor
                    pd->mii_config(dev, 1, bcm_enet_mdio_read_mii,
                                   bcm_enet_mdio_write_mii)) {
                        dev_err(&pdev->dev, "unable to configure mdio bus\n");
@@ -227,7 +227,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
        if (priv->mii_bus)
                mdiobus_unregister(priv->mii_bus);
  
-@@ -1884,6 +1877,9 @@ out_free_mdio:
+@@ -1885,6 +1878,9 @@ out_free_mdio:
        if (priv->mii_bus)
                mdiobus_free(priv->mii_bus);
  
@@ -237,7 +237,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
  out_uninit_hw:
        /* turn off mdc clock */
        enet_writel(priv, 0, ENET_MIISC_REG);
-@@ -1914,6 +1910,7 @@ static int bcm_enet_remove(struct platfo
+@@ -1915,6 +1911,7 @@ static int bcm_enet_remove(struct platfo
        enet_writel(priv, 0, ENET_MIISC_REG);
  
        if (priv->has_phy) {
index d4a22c99f2ca0006125fc7250b378c5d03c0e7fa..772e40b2b5d858174c1cdb6760d0537d78a0ffa3 100644 (file)
@@ -32,7 +32,7 @@ Subject: [PATCH 54/81] bcm63xx_enet: enable rgmii clock on external ports
  #define ENETSW_MDIOC_EXT_MASK         (1 << 16)
 --- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
 +++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
-@@ -2183,6 +2183,18 @@ static int bcm_enetsw_open(struct net_de
+@@ -2184,6 +2184,18 @@ static int bcm_enetsw_open(struct net_de
                priv->sw_port_link[i] = 0;
        }
  
index 92dc05f909230fc050d586b5ee8027bfb0045d9d..961f34ce788d8f6a16f79007a8271d2181288355 100644 (file)
@@ -20,7 +20,7 @@
  
  #include <bcm63xx_dev_enet.h>
  #include "bcm63xx_enet.h"
-@@ -1930,7 +1931,8 @@ static int bcm_enet_remove(struct platfo
+@@ -1931,7 +1932,8 @@ static int bcm_enet_remove(struct platfo
        return 0;
  }
  
@@ -30,7 +30,7 @@
        .probe  = bcm_enet_probe,
        .remove = bcm_enet_remove,
        .driver = {
-@@ -1939,6 +1941,42 @@ struct platform_driver bcm63xx_enet_driv
+@@ -1940,6 +1942,42 @@ struct platform_driver bcm63xx_enet_driv
        },
  };
  
@@ -73,7 +73,7 @@
  /*
   * switch mii access callbacks
   */
-@@ -2195,29 +2233,6 @@ static int bcm_enetsw_open(struct net_de
+@@ -2196,29 +2234,6 @@ static int bcm_enetsw_open(struct net_de
                enetsw_writeb(priv, rgmii_ctrl, ENETSW_RGMII_CTRL_REG(i));
        }
  
        /* initialize flow control buffer allocation */
        enet_dma_writel(priv, ENETDMA_BUFALLOC_FORCE_MASK | 0,
                        ENETDMA_BUFALLOC_REG(priv->rx_chan));
-@@ -2651,6 +2666,9 @@ static int bcm_enetsw_probe(struct platf
+@@ -2652,6 +2667,9 @@ static int bcm_enetsw_probe(struct platf
        struct bcm63xx_enetsw_platform_data *pd;
        struct resource *res_mem;
        int ret, irq_rx, irq_tx;
  
        if (!bcm_enet_shared_base[0])
                return -EPROBE_DEFER;
-@@ -2731,6 +2749,43 @@ static int bcm_enetsw_probe(struct platf
+@@ -2732,6 +2750,43 @@ static int bcm_enetsw_probe(struct platf
        priv->pdev = pdev;
        priv->net_dev = dev;
  
        return 0;
  
  out_disable_clk:
-@@ -2752,6 +2807,9 @@ static int bcm_enetsw_remove(struct plat
+@@ -2753,6 +2808,9 @@ static int bcm_enetsw_remove(struct plat
        priv = netdev_priv(dev);
        unregister_netdev(dev);
  
index 240525083cb2439bdb46a945ab21c422b6238c20..6c002a7b5f5fcd483aae4abd37cde6e23a8a5500 100644 (file)
@@ -1,6 +1,6 @@
 --- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
 +++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
-@@ -2710,9 +2710,9 @@ static int bcm_enetsw_probe(struct platf
+@@ -2711,9 +2711,9 @@ static int bcm_enetsw_probe(struct platf
        if (ret)
                goto out;
  
index 3c4fa8ffade53d83d57b0752773b2fc64c9ec20d..52740b9a5b1828790e30d036065304af035e3167 100644 (file)
@@ -12,7 +12,7 @@
  
 --- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
 +++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
-@@ -2230,6 +2230,10 @@ static int bcm_enetsw_open(struct net_de
+@@ -2231,6 +2231,10 @@ static int bcm_enetsw_open(struct net_de
  
                rgmii_ctrl = enetsw_readb(priv, ENETSW_RGMII_CTRL_REG(i));
                rgmii_ctrl |= ENETSW_RGMII_CTRL_GMII_CLK_EN;