mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-20 14:13:16 +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>
99 lines
3.0 KiB
Diff
99 lines
3.0 KiB
Diff
From: Lorenzo Bianconi <lorenzo@kernel.org>
|
|
Date: Thu, 17 Nov 2022 00:35:04 +0100
|
|
Subject: [PATCH] net: ethernet: mtk_eth_soc: do not overwrite mtu
|
|
configuration running reset routine
|
|
|
|
Restore user configured MTU running mtk_hw_init() during tx timeout routine
|
|
since it will be overwritten after a hw reset.
|
|
|
|
Reported-by: Felix Fietkau <nbd@nbd.name>
|
|
Fixes: 9ea4d311509f ("net: ethernet: mediatek: add the whole ethernet reset into the reset process")
|
|
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
|
|
Signed-off-by: David S. Miller <davem@davemloft.net>
|
|
---
|
|
|
|
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
|
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
|
@@ -3176,6 +3176,30 @@ static void mtk_dim_tx(struct work_struc
|
|
dim->state = DIM_START_MEASURE;
|
|
}
|
|
|
|
+static void mtk_set_mcr_max_rx(struct mtk_mac *mac, u32 val)
|
|
+{
|
|
+ struct mtk_eth *eth = mac->hw;
|
|
+ u32 mcr_cur, mcr_new;
|
|
+
|
|
+ if (MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628))
|
|
+ return;
|
|
+
|
|
+ mcr_cur = mtk_r32(mac->hw, MTK_MAC_MCR(mac->id));
|
|
+ mcr_new = mcr_cur & ~MAC_MCR_MAX_RX_MASK;
|
|
+
|
|
+ if (val <= 1518)
|
|
+ mcr_new |= MAC_MCR_MAX_RX(MAC_MCR_MAX_RX_1518);
|
|
+ else if (val <= 1536)
|
|
+ mcr_new |= MAC_MCR_MAX_RX(MAC_MCR_MAX_RX_1536);
|
|
+ else if (val <= 1552)
|
|
+ mcr_new |= MAC_MCR_MAX_RX(MAC_MCR_MAX_RX_1552);
|
|
+ else
|
|
+ mcr_new |= MAC_MCR_MAX_RX(MAC_MCR_MAX_RX_2048);
|
|
+
|
|
+ if (mcr_new != mcr_cur)
|
|
+ mtk_w32(mac->hw, mcr_new, MTK_MAC_MCR(mac->id));
|
|
+}
|
|
+
|
|
static int mtk_hw_init(struct mtk_eth *eth)
|
|
{
|
|
u32 dma_mask = ETHSYS_DMA_AG_MAP_PDMA | ETHSYS_DMA_AG_MAP_QDMA |
|
|
@@ -3250,8 +3274,16 @@ static int mtk_hw_init(struct mtk_eth *e
|
|
* up with the more appropriate value when mtk_mac_config call is being
|
|
* invoked.
|
|
*/
|
|
- for (i = 0; i < MTK_MAC_COUNT; i++)
|
|
+ for (i = 0; i < MTK_MAC_COUNT; i++) {
|
|
+ struct net_device *dev = eth->netdev[i];
|
|
+
|
|
mtk_w32(eth, MAC_MCR_FORCE_LINK_DOWN, MTK_MAC_MCR(i));
|
|
+ if (dev) {
|
|
+ struct mtk_mac *mac = netdev_priv(dev);
|
|
+
|
|
+ mtk_set_mcr_max_rx(mac, dev->mtu + MTK_RX_ETH_HLEN);
|
|
+ }
|
|
+ }
|
|
|
|
/* Indicates CDM to parse the MTK special tag from CPU
|
|
* which also is working out for untag packets.
|
|
@@ -3367,7 +3399,6 @@ static int mtk_change_mtu(struct net_dev
|
|
int length = new_mtu + MTK_RX_ETH_HLEN;
|
|
struct mtk_mac *mac = netdev_priv(dev);
|
|
struct mtk_eth *eth = mac->hw;
|
|
- u32 mcr_cur, mcr_new;
|
|
|
|
if (rcu_access_pointer(eth->prog) &&
|
|
length > MTK_PP_MAX_BUF_SIZE) {
|
|
@@ -3375,23 +3406,7 @@ static int mtk_change_mtu(struct net_dev
|
|
return -EINVAL;
|
|
}
|
|
|
|
- if (!MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628)) {
|
|
- mcr_cur = mtk_r32(mac->hw, MTK_MAC_MCR(mac->id));
|
|
- mcr_new = mcr_cur & ~MAC_MCR_MAX_RX_MASK;
|
|
-
|
|
- if (length <= 1518)
|
|
- mcr_new |= MAC_MCR_MAX_RX(MAC_MCR_MAX_RX_1518);
|
|
- else if (length <= 1536)
|
|
- mcr_new |= MAC_MCR_MAX_RX(MAC_MCR_MAX_RX_1536);
|
|
- else if (length <= 1552)
|
|
- mcr_new |= MAC_MCR_MAX_RX(MAC_MCR_MAX_RX_1552);
|
|
- else
|
|
- mcr_new |= MAC_MCR_MAX_RX(MAC_MCR_MAX_RX_2048);
|
|
-
|
|
- if (mcr_new != mcr_cur)
|
|
- mtk_w32(mac->hw, mcr_new, MTK_MAC_MCR(mac->id));
|
|
- }
|
|
-
|
|
+ mtk_set_mcr_max_rx(mac, length);
|
|
dev->mtu = new_mtu;
|
|
|
|
return 0;
|