From b5d425af237dc03327078d6b9be178a38b5f8723 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Thu, 27 Aug 2020 06:39:48 +0200 Subject: mediatek/ramips: unify ethernet driver fixes and add performance optimizations Increase DMA burst size and tx ring size and optimize tx processing Signed-off-by: Felix Fietkau --- ...et-ethernet-mediatek-use-napi_consume_skb.patch | 72 ---------------------- ...t-mediatek-significantly-reduce-mdio-bus-.patch | 26 -------- ...-net-ethernet-mediatek-support-net-labels.patch | 4 +- 3 files changed, 2 insertions(+), 100 deletions(-) delete mode 100644 target/linux/ramips/patches-5.4/0400-net-ethernet-mediatek-use-napi_consume_skb.patch delete mode 100644 target/linux/ramips/patches-5.4/0401-net-ethernet-mediatek-significantly-reduce-mdio-bus-.patch (limited to 'target/linux/ramips/patches-5.4') diff --git a/target/linux/ramips/patches-5.4/0400-net-ethernet-mediatek-use-napi_consume_skb.patch b/target/linux/ramips/patches-5.4/0400-net-ethernet-mediatek-use-napi_consume_skb.patch deleted file mode 100644 index a31100642b..0000000000 --- a/target/linux/ramips/patches-5.4/0400-net-ethernet-mediatek-use-napi_consume_skb.patch +++ /dev/null @@ -1,72 +0,0 @@ -From: Felix Fietkau -Date: Mon, 8 Jun 2020 17:01:12 +0200 -Subject: [PATCH] net: ethernet: mediatek: use napi_consume_skb - -Should improve performance, since it can use bulk free - -Signed-off-by: Felix Fietkau ---- - ---- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c -+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -853,7 +853,8 @@ static int txd_to_idx(struct mtk_tx_ring - return ((void *)dma - (void *)ring->dma) / sizeof(*dma); - } - --static void mtk_tx_unmap(struct mtk_eth *eth, struct mtk_tx_buf *tx_buf) -+static void mtk_tx_unmap(struct mtk_eth *eth, struct mtk_tx_buf *tx_buf, -+ bool napi) - { - if (MTK_HAS_CAPS(eth->soc->caps, MTK_QDMA)) { - if (tx_buf->flags & MTK_TX_FLAGS_SINGLE0) { -@@ -885,8 +886,12 @@ static void mtk_tx_unmap(struct mtk_eth - - tx_buf->flags = 0; - if (tx_buf->skb && -- (tx_buf->skb != (struct sk_buff *)MTK_DMA_DUMMY_DESC)) -- dev_kfree_skb_any(tx_buf->skb); -+ (tx_buf->skb != (struct sk_buff *)MTK_DMA_DUMMY_DESC)) { -+ if (napi) -+ napi_consume_skb(tx_buf->skb, napi); -+ else -+ dev_kfree_skb_any(tx_buf->skb); -+ } - tx_buf->skb = NULL; - } - -@@ -1064,7 +1069,7 @@ err_dma: - tx_buf = mtk_desc_to_tx_buf(ring, itxd); - - /* unmap dma */ -- mtk_tx_unmap(eth, tx_buf); -+ mtk_tx_unmap(eth, tx_buf, false); - - itxd->txd3 = TX_DMA_LS0 | TX_DMA_OWNER_CPU; - if (!MTK_HAS_CAPS(eth->soc->caps, MTK_QDMA)) -@@ -1382,7 +1387,7 @@ static int mtk_poll_tx_qdma(struct mtk_e - done[mac]++; - budget--; - } -- mtk_tx_unmap(eth, tx_buf); -+ mtk_tx_unmap(eth, tx_buf, true); - - ring->last_free = desc; - atomic_inc(&ring->free_count); -@@ -1419,7 +1424,7 @@ static int mtk_poll_tx_pdma(struct mtk_e - budget--; - } - -- mtk_tx_unmap(eth, tx_buf); -+ mtk_tx_unmap(eth, tx_buf, true); - - desc = &ring->dma[cpu]; - ring->last_free = desc; -@@ -1621,7 +1626,7 @@ static void mtk_tx_clean(struct mtk_eth - - if (ring->buf) { - for (i = 0; i < MTK_DMA_SIZE; i++) -- mtk_tx_unmap(eth, &ring->buf[i]); -+ mtk_tx_unmap(eth, &ring->buf[i], false); - kfree(ring->buf); - ring->buf = NULL; - } diff --git a/target/linux/ramips/patches-5.4/0401-net-ethernet-mediatek-significantly-reduce-mdio-bus-.patch b/target/linux/ramips/patches-5.4/0401-net-ethernet-mediatek-significantly-reduce-mdio-bus-.patch deleted file mode 100644 index c2ba9964e9..0000000000 --- a/target/linux/ramips/patches-5.4/0401-net-ethernet-mediatek-significantly-reduce-mdio-bus-.patch +++ /dev/null @@ -1,26 +0,0 @@ -From: Felix Fietkau -Date: Mon, 8 Jun 2020 17:02:39 +0200 -Subject: [PATCH] net: ethernet: mediatek: significantly reduce mdio bus - access latency - -usleep_range often ends up sleeping much longer than the 10-20us provided -as a range here. This causes significant latency in mdio bus acceses, -which easily adds multiple seconds to the boot time on MT7621 when polling -DSA slave ports. -Use cond_resched instead of usleep_range, since the MDIO access does not -take much time - -Signed-off-by: Felix Fietkau ---- - ---- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c -+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -85,7 +85,7 @@ static int mtk_mdio_busy_wait(struct mtk - return 0; - if (time_after(jiffies, t_start + PHY_IAC_TIMEOUT)) - break; -- usleep_range(10, 20); -+ cond_resched(); - } - - dev_err(eth->dev, "mdio: MDIO timeout\n"); diff --git a/target/linux/ramips/patches-5.4/401-net-ethernet-mediatek-support-net-labels.patch b/target/linux/ramips/patches-5.4/401-net-ethernet-mediatek-support-net-labels.patch index 3332587671..66f1b12618 100644 --- a/target/linux/ramips/patches-5.4/401-net-ethernet-mediatek-support-net-labels.patch +++ b/target/linux/ramips/patches-5.4/401-net-ethernet-mediatek-support-net-labels.patch @@ -14,7 +14,7 @@ Signed-off-by: René van Dorst --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -2793,6 +2793,7 @@ static const struct net_device_ops mtk_n +@@ -2856,6 +2856,7 @@ static const struct net_device_ops mtk_n static int mtk_add_mac(struct mtk_eth *eth, struct device_node *np) { @@ -22,7 +22,7 @@ Signed-off-by: René van Dorst const __be32 *_id = of_get_property(np, "reg", NULL); struct phylink *phylink; int phy_mode, id, err; -@@ -2885,6 +2886,9 @@ static int mtk_add_mac(struct mtk_eth *e +@@ -2948,6 +2949,9 @@ static int mtk_add_mac(struct mtk_eth *e eth->netdev[id]->max_mtu = MTK_MAX_RX_LENGTH - MTK_RX_ETH_HLEN; -- cgit v1.2.3