mirror of
git://git.openwrt.org/openwrt/openwrt.git
synced 2024-12-22 06:41:17 +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>
95 lines
2.7 KiB
Diff
95 lines
2.7 KiB
Diff
From: Felix Fietkau <nbd@nbd.name>
|
|
Date: Thu, 3 Nov 2022 12:38:49 +0100
|
|
Subject: [PATCH] net: ethernet: mtk_eth_soc: work around issue with sending
|
|
small fragments
|
|
|
|
When lots of frames are sent with a number of very small fragments, an
|
|
internal FIFO can overflow, causing the DMA engine to lock up lock up and
|
|
transmit attempts time out.
|
|
|
|
Fix this on MT7986 by increasing the reserved FIFO space.
|
|
Fix this on older chips by detecting the presence of small fragments and use
|
|
skb_gso_segment + skb_linearize to deal with them.
|
|
|
|
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|
---
|
|
|
|
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
|
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
|
@@ -1403,12 +1403,28 @@ static void mtk_wake_queue(struct mtk_et
|
|
}
|
|
}
|
|
|
|
+static bool mtk_skb_has_small_frag(struct sk_buff *skb)
|
|
+{
|
|
+ int min_size = 16;
|
|
+ int i;
|
|
+
|
|
+ if (skb_headlen(skb) < min_size)
|
|
+ return true;
|
|
+
|
|
+ for (i = 0; i < skb_shinfo(skb)->nr_frags; i++)
|
|
+ if (skb_frag_size(&skb_shinfo(skb)->frags[i]) < min_size)
|
|
+ return true;
|
|
+
|
|
+ return false;
|
|
+}
|
|
+
|
|
static netdev_tx_t mtk_start_xmit(struct sk_buff *skb, struct net_device *dev)
|
|
{
|
|
struct mtk_mac *mac = netdev_priv(dev);
|
|
struct mtk_eth *eth = mac->hw;
|
|
struct mtk_tx_ring *ring = ð->tx_ring;
|
|
struct net_device_stats *stats = &dev->stats;
|
|
+ struct sk_buff *segs, *next;
|
|
bool gso = false;
|
|
int tx_num;
|
|
|
|
@@ -1430,6 +1446,18 @@ static netdev_tx_t mtk_start_xmit(struct
|
|
return NETDEV_TX_BUSY;
|
|
}
|
|
|
|
+ if (!MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2) &&
|
|
+ skb_is_gso(skb) && mtk_skb_has_small_frag(skb)) {
|
|
+ segs = skb_gso_segment(skb, dev->features & ~NETIF_F_ALL_TSO);
|
|
+ if (IS_ERR(segs))
|
|
+ goto drop;
|
|
+
|
|
+ if (segs) {
|
|
+ consume_skb(skb);
|
|
+ skb = segs;
|
|
+ }
|
|
+ }
|
|
+
|
|
/* TSO: fill MSS info in tcp checksum field */
|
|
if (skb_is_gso(skb)) {
|
|
if (skb_cow_head(skb, 0)) {
|
|
@@ -1445,8 +1473,14 @@ static netdev_tx_t mtk_start_xmit(struct
|
|
}
|
|
}
|
|
|
|
- if (mtk_tx_map(skb, dev, tx_num, ring, gso) < 0)
|
|
- goto drop;
|
|
+ skb_list_walk_safe(skb, skb, next) {
|
|
+ if ((!MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2) &&
|
|
+ mtk_skb_has_small_frag(skb) && skb_linearize(skb)) ||
|
|
+ mtk_tx_map(skb, dev, tx_num, ring, gso) < 0) {
|
|
+ stats->tx_dropped++;
|
|
+ dev_kfree_skb_any(skb);
|
|
+ }
|
|
+ }
|
|
|
|
if (unlikely(atomic_read(&ring->free_count) <= ring->thresh))
|
|
netif_tx_stop_all_queues(dev);
|
|
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h
|
|
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
|
|
@@ -258,7 +258,7 @@
|
|
#define MTK_CHK_DDONE_EN BIT(28)
|
|
#define MTK_DMAD_WR_WDONE BIT(26)
|
|
#define MTK_WCOMP_EN BIT(24)
|
|
-#define MTK_RESV_BUF (0x40 << 16)
|
|
+#define MTK_RESV_BUF (0x80 << 16)
|
|
#define MTK_MUTLI_CNT (0x4 << 12)
|
|
#define MTK_LEAKY_BUCKET_EN BIT(11)
|
|
|