]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
ramips: ethernet: ralink: mtu change while interface is down
authorLuiz Angelo Daros de Luca <luizluca@gmail.com>
Fri, 7 Jan 2022 05:24:03 +0000 (02:24 -0300)
committerRobert Marko <robimarko@gmail.com>
Mon, 29 Jun 2026 12:54:58 +0000 (14:54 +0200)
fe_change_mtu didn't update the registers if the interface was down.

DSA increases the CPU port MTU to accommodate the CPU tag. As this
happens while the CPU port was still down, the chip regs didn't get
updated and larger frames were dropped.

Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/23933
Signed-off-by: Robert Marko <robimarko@gmail.com>
target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.c

index 9c8b34aac04e153e1ee2118235d162c8e8c29607..3fc8ce8530414041e5f64a583523c4f44bbd9af3 100644 (file)
@@ -1452,10 +1452,9 @@ static int fe_change_mtu(struct net_device *dev, int new_mtu)
                priv->rx_ring.frag_size = PAGE_SIZE;
        priv->rx_ring.rx_buf_size = fe_max_buf_size(priv->rx_ring.frag_size);
 
-       if (!netif_running(dev))
-               return 0;
+       if (netif_running(dev))
+               fe_stop(dev);
 
-       fe_stop(dev);
        if (!IS_ENABLED(CONFIG_SOC_MT7621)) {
                fwd_cfg = fe_r32(DMA_FWD_REG);
                if (new_mtu <= ETH_DATA_LEN) {
@@ -1469,7 +1468,10 @@ static int fe_change_mtu(struct net_device *dev, int new_mtu)
                fe_w32(fwd_cfg, DMA_FWD_REG);
        }
 
-       return fe_open(dev);
+       if (netif_running(dev))
+               return fe_open(dev);
+
+       return 0;
 }
 
 static const struct net_device_ops fe_netdev_ops = {