mediatek/ramips: remove an ethernet optimization patch that was reported to cause a regression

In some tests, crashes were observed

Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: maurerr <mariusd84@gmail.com>
This commit is contained in:
Felix Fietkau 2020-09-09 11:51:21 +02:00 committed by maurerr
parent b81793524e
commit f99046076c
6 changed files with 18 additions and 52 deletions

View File

@ -1,34 +0,0 @@
From: Felix Fietkau <nbd@nbd.name>
Date: Wed, 26 Aug 2020 17:48:14 +0200
Subject: [PATCH] net: ethernet: mtk_eth_soc: drop descriptor cpu-own bit check
in qdma tx cleanup
mtk_poll_tx_qdma already checks the MTK_QTX_DRX_PTR register, which points
at the last completed descriptor.
To slightly improve performance, also remove the register bit which forces
the hardware to write back this bit earlier.
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
@@ -1368,9 +1368,6 @@ static int mtk_poll_tx_qdma(struct mtk_e
int mac = 0;
desc = mtk_qdma_phys_to_virt(ring, desc->txd2);
- if ((desc->txd3 & TX_DMA_OWNER_CPU) == 0)
- break;
-
tx_buf = mtk_desc_to_tx_buf(ring, desc);
if (tx_buf->flags & MTK_TX_FLAGS_FPORT1)
mac = 1;
@@ -2203,7 +2200,7 @@ static int mtk_start_dma(struct mtk_eth
if (MTK_HAS_CAPS(eth->soc->caps, MTK_QDMA)) {
mtk_w32(eth,
- MTK_TX_WB_DDONE | MTK_TX_DMA_EN |
+ MTK_TX_DMA_EN |
MTK_TX_BT_32DWORDS | MTK_NDP_CO_PRO |
MTK_RX_DMA_EN | MTK_RX_2B_OFFSET |
MTK_RX_BT_32DWORDS,

View File

@ -20,7 +20,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
dma = mtk_r32(eth, MTK_QTX_DRX_PTR); dma = mtk_r32(eth, MTK_QTX_DRX_PTR);
desc = mtk_qdma_phys_to_virt(ring, cpu); desc = mtk_qdma_phys_to_virt(ring, cpu);
@@ -1389,6 +1389,7 @@ static int mtk_poll_tx_qdma(struct mtk_e @@ -1392,6 +1392,7 @@ static int mtk_poll_tx_qdma(struct mtk_e
cpu = next_cpu; cpu = next_cpu;
} }
@ -28,7 +28,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
mtk_w32(eth, cpu, MTK_QTX_CRX_PTR); mtk_w32(eth, cpu, MTK_QTX_CRX_PTR);
return budget; return budget;
@@ -1589,6 +1590,7 @@ static int mtk_tx_alloc(struct mtk_eth * @@ -1592,6 +1593,7 @@ static int mtk_tx_alloc(struct mtk_eth *
atomic_set(&ring->free_count, MTK_DMA_SIZE - 2); atomic_set(&ring->free_count, MTK_DMA_SIZE - 2);
ring->next_free = &ring->dma[0]; ring->next_free = &ring->dma[0];
ring->last_free = &ring->dma[MTK_DMA_SIZE - 1]; ring->last_free = &ring->dma[MTK_DMA_SIZE - 1];
@ -36,7 +36,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
ring->thresh = MAX_SKB_FRAGS; ring->thresh = MAX_SKB_FRAGS;
/* make sure that all changes to the dma ring are flushed before we /* make sure that all changes to the dma ring are flushed before we
@@ -1602,9 +1604,7 @@ static int mtk_tx_alloc(struct mtk_eth * @@ -1605,9 +1607,7 @@ static int mtk_tx_alloc(struct mtk_eth *
mtk_w32(eth, mtk_w32(eth,
ring->phys + ((MTK_DMA_SIZE - 1) * sz), ring->phys + ((MTK_DMA_SIZE - 1) * sz),
MTK_QTX_CRX_PTR); MTK_QTX_CRX_PTR);

View File

@ -10,7 +10,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
@@ -1512,8 +1512,8 @@ static int mtk_napi_tx(struct napi_struc @@ -1515,8 +1515,8 @@ static int mtk_napi_tx(struct napi_struc
if (status & MTK_TX_DONE_INT) if (status & MTK_TX_DONE_INT)
return budget; return budget;
@ -21,7 +21,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
return tx_done; return tx_done;
} }
@@ -1546,8 +1546,9 @@ poll_again: @@ -1549,8 +1549,9 @@ poll_again:
remain_budget -= rx_done; remain_budget -= rx_done;
goto poll_again; goto poll_again;
} }

View File

@ -147,7 +147,7 @@
#include "mtk_eth_soc.h" #include "mtk_eth_soc.h"
@@ -1319,8 +1321,16 @@ static int mtk_poll_rx(struct napi_struc @@ -1320,8 +1322,16 @@ static int mtk_poll_rx(struct napi_struc
(trxd.rxd2 & RX_DMA_VTAG)) (trxd.rxd2 & RX_DMA_VTAG))
__vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q),
RX_DMA_VID(trxd.rxd3)); RX_DMA_VID(trxd.rxd3));
@ -166,7 +166,7 @@
skip_rx: skip_rx:
ring->data[idx] = new_data; ring->data[idx] = new_data;
@@ -2251,6 +2261,9 @@ static int mtk_open(struct net_device *d @@ -2255,6 +2265,9 @@ static int mtk_open(struct net_device *d
mtk_tx_irq_enable(eth, MTK_TX_DONE_INT); mtk_tx_irq_enable(eth, MTK_TX_DONE_INT);
mtk_rx_irq_enable(eth, MTK_RX_DONE_INT); mtk_rx_irq_enable(eth, MTK_RX_DONE_INT);
refcount_set(&eth->dma_refcnt, 1); refcount_set(&eth->dma_refcnt, 1);
@ -176,7 +176,7 @@
} }
else else
refcount_inc(&eth->dma_refcnt); refcount_inc(&eth->dma_refcnt);
@@ -2312,6 +2325,9 @@ static int mtk_stop(struct net_device *d @@ -2316,6 +2329,9 @@ static int mtk_stop(struct net_device *d
mtk_dma_free(eth); mtk_dma_free(eth);
@ -186,7 +186,7 @@
return 0; return 0;
} }
@@ -2825,6 +2841,27 @@ static int mtk_set_rxnfc(struct net_devi @@ -2829,6 +2845,27 @@ static int mtk_set_rxnfc(struct net_devi
return ret; return ret;
} }
@ -214,7 +214,7 @@
static const struct ethtool_ops mtk_ethtool_ops = { static const struct ethtool_ops mtk_ethtool_ops = {
.get_link_ksettings = mtk_get_link_ksettings, .get_link_ksettings = mtk_get_link_ksettings,
.set_link_ksettings = mtk_set_link_ksettings, .set_link_ksettings = mtk_set_link_ksettings,
@@ -2856,6 +2893,9 @@ static const struct net_device_ops mtk_n @@ -2860,6 +2897,9 @@ static const struct net_device_ops mtk_n
#ifdef CONFIG_NET_POLL_CONTROLLER #ifdef CONFIG_NET_POLL_CONTROLLER
.ndo_poll_controller = mtk_poll_controller, .ndo_poll_controller = mtk_poll_controller,
#endif #endif
@ -224,7 +224,7 @@
}; };
static int mtk_add_mac(struct mtk_eth *eth, struct device_node *np) static int mtk_add_mac(struct mtk_eth *eth, struct device_node *np)
@@ -3198,6 +3238,7 @@ static const struct mtk_soc_data mt7622_ @@ -3202,6 +3242,7 @@ static const struct mtk_soc_data mt7622_
.hw_features = MTK_HW_FEATURES, .hw_features = MTK_HW_FEATURES,
.required_clks = MT7622_CLKS_BITMAP, .required_clks = MT7622_CLKS_BITMAP,
.required_pctl = false, .required_pctl = false,

View File

@ -1,6 +1,6 @@
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
@@ -2236,6 +2236,31 @@ static int mtk_start_dma(struct mtk_eth @@ -2240,6 +2240,31 @@ static int mtk_start_dma(struct mtk_eth
return 0; return 0;
} }
@ -32,7 +32,7 @@
static int mtk_open(struct net_device *dev) static int mtk_open(struct net_device *dev)
{ {
struct mtk_mac *mac = netdev_priv(dev); struct mtk_mac *mac = netdev_priv(dev);
@@ -2256,6 +2281,8 @@ static int mtk_open(struct net_device *d @@ -2260,6 +2285,8 @@ static int mtk_open(struct net_device *d
if (err) if (err)
return err; return err;
@ -41,7 +41,7 @@
napi_enable(&eth->tx_napi); napi_enable(&eth->tx_napi);
napi_enable(&eth->rx_napi); napi_enable(&eth->rx_napi);
mtk_tx_irq_enable(eth, MTK_TX_DONE_INT); mtk_tx_irq_enable(eth, MTK_TX_DONE_INT);
@@ -2311,6 +2338,8 @@ static int mtk_stop(struct net_device *d @@ -2315,6 +2342,8 @@ static int mtk_stop(struct net_device *d
if (!refcount_dec_and_test(&eth->dma_refcnt)) if (!refcount_dec_and_test(&eth->dma_refcnt))
return 0; return 0;
@ -50,7 +50,7 @@
mtk_tx_irq_disable(eth, MTK_TX_DONE_INT); mtk_tx_irq_disable(eth, MTK_TX_DONE_INT);
mtk_rx_irq_disable(eth, MTK_RX_DONE_INT); mtk_rx_irq_disable(eth, MTK_RX_DONE_INT);
napi_disable(&eth->tx_napi); napi_disable(&eth->tx_napi);
@@ -2494,8 +2523,6 @@ static int mtk_hw_init(struct mtk_eth *e @@ -2498,8 +2527,6 @@ static int mtk_hw_init(struct mtk_eth *e
/* disable delay and normal interrupt */ /* disable delay and normal interrupt */
mtk_tx_irq_disable(eth, ~0); mtk_tx_irq_disable(eth, ~0);
mtk_rx_irq_disable(eth, ~0); mtk_rx_irq_disable(eth, ~0);
@ -59,7 +59,7 @@
/* FE int grouping */ /* FE int grouping */
mtk_w32(eth, MTK_TX_DONE_INT, MTK_PDMA_INT_GRP1); mtk_w32(eth, MTK_TX_DONE_INT, MTK_PDMA_INT_GRP1);
@@ -2504,19 +2531,6 @@ static int mtk_hw_init(struct mtk_eth *e @@ -2508,19 +2535,6 @@ static int mtk_hw_init(struct mtk_eth *e
mtk_w32(eth, MTK_RX_DONE_INT, MTK_QDMA_INT_GRP2); mtk_w32(eth, MTK_RX_DONE_INT, MTK_QDMA_INT_GRP2);
mtk_w32(eth, 0x21021000, MTK_FE_INT_GRP); mtk_w32(eth, 0x21021000, MTK_FE_INT_GRP);

View File

@ -37,7 +37,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
#include <linux/mfd/syscon.h> #include <linux/mfd/syscon.h>
#include <linux/regmap.h> #include <linux/regmap.h>
#include <linux/clk.h> #include <linux/clk.h>
@@ -2472,6 +2473,12 @@ static int mtk_hw_init(struct mtk_eth *e @@ -2476,6 +2477,12 @@ static int mtk_hw_init(struct mtk_eth *e
if (ret) if (ret)
goto err_disable_pm; goto err_disable_pm;
@ -50,7 +50,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
if (MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628)) { if (MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628)) {
ret = device_reset(eth->dev); ret = device_reset(eth->dev);
if (ret) { if (ret) {
@@ -3074,6 +3081,16 @@ static int mtk_probe(struct platform_dev @@ -3078,6 +3085,16 @@ static int mtk_probe(struct platform_dev
} }
} }