mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-22 06:57:57 +00:00
d59d69f9e1
Manually rebased: backport-5.15/704-15-v5.19-net-mtk_eth_soc-move-MAC_MCR-setting-to-mac_finish.patch Removed upstreamed: backport-5.15/060-v6.0-01-tools-build-Add-feature-test-for-init_disassemble_in.patch[1] backport-5.15/060-v6.0-02-tools-include-add-dis-asm-compat.h-to-handle-version.patch[2] backport-5.15/060-v6.0-03-tools-perf-Fix-compilation-error-with-new-binutils.patch[3] backport-5.15/060-v6.0-04-tools-bpf_jit_disasm-Fix-compilation-error-with-new-.patch[4] backport-5.15/060-v6.0-05-tools-bpftool-Fix-compilation-error-with-new-binutil.patch[5] pending-5.15/733-02-net-ethernet-mtk_eth_soc-fix-RX-data-corruption-issu.patch[6] bcm47xx/patches-5.15/170-bgmac-fix-initial-chip-reset-to-support-BCM5358.patch[7] All other patches automatically rebased. 1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.103&id=51b99dc38c1a053e2e732d7f9e2740e343ae7eae 2. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.103&id=451c9d7b16169645ed291ebb2ca9844caa088f2d 3. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.103&id=97f005c0bdbaf656a7808586d234965385a06c58 4. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.103&id=1c27fab243333821375e4d63128d60093fdbe149 5. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.103&id=4441a90091931fd81607567961dc122f24f735bb 6. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.103&id=2adc29350a5b4669544566f71f208d2abaec60ab 7. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.103&id=04bfc5bcdfc0fdb73587487c71b04d63807ae15a Build system: x86_64 Build-tested: bcm2711/RPi4B, ramips/tplink_archer-a6-v3, filogic/xiaomi_redmi-router-ax6000-ubootmod Run-tested: bcm2711/RPi4B, ramips/tplink_archer-a6-v3, filogic/xiaomi_redmi-router-ax6000-ubootmod Signed-off-by: John Audia <therealgraysky@proton.me>
74 lines
2.3 KiB
Diff
74 lines
2.3 KiB
Diff
From 3470079687448abac42deb62774253be1d6bdef3 Mon Sep 17 00:00:00 2001
|
|
From: Christian Marangi <ansuelsmth@gmail.com>
|
|
Date: Sat, 23 Jul 2022 16:29:33 +0200
|
|
Subject: [PATCH 5/5] net: ethernet: stmicro: stmmac: permit MTU change with
|
|
interface up
|
|
|
|
Remove the limitation where the interface needs to be down to change
|
|
MTU by releasing and opening the stmmac driver to set the new MTU.
|
|
Also call the set_filter function to correctly init the port.
|
|
This permits to remove the EBUSY error while the ethernet port is
|
|
running permitting a correct MTU change if for example a DSA request
|
|
a MTU change for a switch CPU port.
|
|
|
|
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
|
|
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
|
---
|
|
.../net/ethernet/stmicro/stmmac/stmmac_main.c | 30 +++++++++++++++----
|
|
1 file changed, 24 insertions(+), 6 deletions(-)
|
|
|
|
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
|
|
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
|
|
@@ -5626,18 +5626,15 @@ static int stmmac_change_mtu(struct net_
|
|
{
|
|
struct stmmac_priv *priv = netdev_priv(dev);
|
|
int txfifosz = priv->plat->tx_fifo_size;
|
|
+ struct stmmac_dma_conf *dma_conf;
|
|
const int mtu = new_mtu;
|
|
+ int ret;
|
|
|
|
if (txfifosz == 0)
|
|
txfifosz = priv->dma_cap.tx_fifo_size;
|
|
|
|
txfifosz /= priv->plat->tx_queues_to_use;
|
|
|
|
- if (netif_running(dev)) {
|
|
- netdev_err(priv->dev, "must be stopped to change its MTU\n");
|
|
- return -EBUSY;
|
|
- }
|
|
-
|
|
if (stmmac_xdp_is_enabled(priv) && new_mtu > ETH_DATA_LEN) {
|
|
netdev_dbg(priv->dev, "Jumbo frames not supported for XDP\n");
|
|
return -EINVAL;
|
|
@@ -5649,8 +5646,29 @@ static int stmmac_change_mtu(struct net_
|
|
if ((txfifosz < new_mtu) || (new_mtu > BUF_SIZE_16KiB))
|
|
return -EINVAL;
|
|
|
|
- dev->mtu = mtu;
|
|
+ if (netif_running(dev)) {
|
|
+ netdev_dbg(priv->dev, "restarting interface to change its MTU\n");
|
|
+ /* Try to allocate the new DMA conf with the new mtu */
|
|
+ dma_conf = stmmac_setup_dma_desc(priv, mtu);
|
|
+ if (IS_ERR(dma_conf)) {
|
|
+ netdev_err(priv->dev, "failed allocating new dma conf for new MTU %d\n",
|
|
+ mtu);
|
|
+ return PTR_ERR(dma_conf);
|
|
+ }
|
|
+
|
|
+ stmmac_release(dev);
|
|
+
|
|
+ ret = __stmmac_open(dev, dma_conf);
|
|
+ kfree(dma_conf);
|
|
+ if (ret) {
|
|
+ netdev_err(priv->dev, "failed reopening the interface after MTU change\n");
|
|
+ return ret;
|
|
+ }
|
|
+
|
|
+ stmmac_set_rx_mode(dev);
|
|
+ }
|
|
|
|
+ dev->mtu = mtu;
|
|
netdev_update_features(dev);
|
|
|
|
return 0;
|