From: Luiz Angelo Daros de Luca Date: Fri, 7 Jan 2022 05:24:03 +0000 (-0300) Subject: ramips: ethernet: ralink: mtu change while interface is down X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=84aafc08d7346ee5c3d7b5e53d213d543d791517;p=thirdparty%2Fopenwrt.git ramips: ethernet: ralink: mtu change while interface is down 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 Link: https://github.com/openwrt/openwrt/pull/23933 Signed-off-by: Robert Marko --- diff --git a/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.c b/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.c index 9c8b34aac04..3fc8ce85304 100644 --- a/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.c +++ b/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.c @@ -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 = {