diff options
| author | Serge Semin <fancer.lancer@gmail.com> | 2025-07-24 00:42:11 +0300 |
|---|---|---|
| committer | Serge Semin <fancer.lancer@gmail.com> | 2026-08-13 20:31:43 +0300 |
| commit | 9407bf274087632814b5b337bc0c8bdf9dc89c42 (patch) | |
| tree | 03638179f8dae4f6ec03048bfbaf52d99f5813ea | |
| parent | 43b004020cf631086374654966117e81bf41b37a (diff) | |
| download | linux-9407bf274087632814b5b337bc0c8bdf9dc89c42.tar.gz linux-9407bf274087632814b5b337bc0c8bdf9dc89c42.zip | |
net: stmmac: dwmac1000: Fix change MTU procedure malfunction
Currently the MTU change procedure doesn't work properly on the DW GMAC
devices. It does change the Rx buffer size respectively though but as long
as there is greater than 2K/9K frames get to be received they will be
discarded by the MAC. The problem is that the stmmac_ops::core_init()
method relies on the net_device::mtu field value which on the MTU-change
procedure contains not new but old MTU. So the GMAC_CONTROL.JE and
GMAC_CONTROL.2K flags responsible for the Rx frames length constraints
won't be properly initialized.
Let's fix that by making sure that the net_device::mtu field contains a
new MTU before the interface restart procedure is executed in the
stmmac_change_mtu() method.
Note even though the commit 347007968744 ("net: ethernet: stmicro: stmmac:
permit MTU change with interface up") changed the core part of the STMMAC
driver the problem is specific to the DW GMAC only. The rest of
stmmac_ops::core_init() implementations have the Giant frames always
enabled. So the MTU change procedure just doesn't cause the frames length
constraints enabling/disabling.
Fixes: 347007968744 ("net: ethernet: stmicro: stmmac: permit MTU change with interface up")
Signed-off-by: Serge Semin <fancer.lancer@gmail.com>
| -rw-r--r-- | drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index e4a16757346b..a34aebb775b4 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -6276,6 +6276,8 @@ static int stmmac_change_mtu(struct net_device *dev, int new_mtu) __stmmac_release(dev); + WRITE_ONCE(dev->mtu, new_mtu); + ret = __stmmac_open(dev, dma_conf); if (ret) { free_dma_desc_resources(priv, dma_conf); @@ -6287,9 +6289,10 @@ static int stmmac_change_mtu(struct net_device *dev, int new_mtu) kfree(dma_conf); stmmac_set_rx_mode(dev); + } else { + WRITE_ONCE(dev->mtu, new_mtu); } - WRITE_ONCE(dev->mtu, new_mtu); netdev_update_features(dev); return 0; |
