[openwrt/openwrt] mediatek/ramips: add patch to avoid unnecessary rearming of interrupts

LEDE Commits lede-commits at lists.infradead.org
Fri Sep 4 13:42:46 EDT 2020


nbd pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/7081b1704e978414cf8e9ea10bf77be9787aa338

commit 7081b1704e978414cf8e9ea10bf77be9787aa338
Author: Felix Fietkau <nbd at nbd.name>
AuthorDate: Fri Sep 4 18:30:07 2020 +0200

    mediatek/ramips: add patch to avoid unnecessary rearming of interrupts
    
    Signed-off-by: Felix Fietkau <nbd at nbd.name>
---
 ...rnet-mtk_eth_soc-avoid-rearming-interrupt-if.pa | 35 ++++++++++++++++++++++
 target/linux/mediatek/patches-5.4/0999-hnat.patch  | 10 +++----
 .../patches-5.4/1000-eth-gdm-config-backport.patch | 10 +++----
 3 files changed, 45 insertions(+), 10 deletions(-)

diff --git a/target/linux/generic/pending-5.4/770-11-net-ethernet-mtk_eth_soc-avoid-rearming-interrupt-if.pa b/target/linux/generic/pending-5.4/770-11-net-ethernet-mtk_eth_soc-avoid-rearming-interrupt-if.pa
new file mode 100644
index 0000000000..c8d17aefa8
--- /dev/null
+++ b/target/linux/generic/pending-5.4/770-11-net-ethernet-mtk_eth_soc-avoid-rearming-interrupt-if.pa
@@ -0,0 +1,35 @@
+From: Felix Fietkau <nbd at nbd.name>
+Date: Fri, 4 Sep 2020 18:14:05 +0200
+Subject: [PATCH] net: ethernet: mtk_eth_soc: avoid rearming interrupt if
+ napi_complete returns false
+
+Reduces unnecessary interrupts
+
+Signed-off-by: Felix Fietkau <nbd at nbd.name>
+---
+
+--- a/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
+ 	if (status & MTK_TX_DONE_INT)
+ 		return budget;
+ 
+-	napi_complete(napi);
+-	mtk_tx_irq_enable(eth, MTK_TX_DONE_INT);
++	if (napi_complete(napi))
++		mtk_tx_irq_enable(eth, MTK_TX_DONE_INT);
+ 
+ 	return tx_done;
+ }
+@@ -1546,8 +1546,9 @@ poll_again:
+ 		remain_budget -= rx_done;
+ 		goto poll_again;
+ 	}
+-	napi_complete(napi);
+-	mtk_rx_irq_enable(eth, MTK_RX_DONE_INT);
++
++	if (napi_complete(napi))
++		mtk_rx_irq_enable(eth, MTK_RX_DONE_INT);
+ 
+ 	return rx_done + budget - remain_budget;
+ }
diff --git a/target/linux/mediatek/patches-5.4/0999-hnat.patch b/target/linux/mediatek/patches-5.4/0999-hnat.patch
index 30294e02a1..cd0ad54c7e 100644
--- a/target/linux/mediatek/patches-5.4/0999-hnat.patch
+++ b/target/linux/mediatek/patches-5.4/0999-hnat.patch
@@ -166,7 +166,7 @@
  
  skip_rx:
  		ring->data[idx] = new_data;
-@@ -2250,6 +2260,9 @@ static int mtk_open(struct net_device *d
+@@ -2251,6 +2261,9 @@ static int mtk_open(struct net_device *d
  		mtk_tx_irq_enable(eth, MTK_TX_DONE_INT);
  		mtk_rx_irq_enable(eth, MTK_RX_DONE_INT);
  		refcount_set(&eth->dma_refcnt, 1);
@@ -176,7 +176,7 @@
  	}
  	else
  		refcount_inc(&eth->dma_refcnt);
-@@ -2311,6 +2324,9 @@ static int mtk_stop(struct net_device *d
+@@ -2312,6 +2325,9 @@ static int mtk_stop(struct net_device *d
  
  	mtk_dma_free(eth);
  
@@ -186,7 +186,7 @@
  	return 0;
  }
  
-@@ -2824,6 +2840,27 @@ static int mtk_set_rxnfc(struct net_devi
+@@ -2825,6 +2841,27 @@ static int mtk_set_rxnfc(struct net_devi
  	return ret;
  }
  
@@ -214,7 +214,7 @@
  static const struct ethtool_ops mtk_ethtool_ops = {
  	.get_link_ksettings	= mtk_get_link_ksettings,
  	.set_link_ksettings	= mtk_set_link_ksettings,
-@@ -2855,6 +2892,9 @@ static const struct net_device_ops mtk_n
+@@ -2856,6 +2893,9 @@ static const struct net_device_ops mtk_n
  #ifdef CONFIG_NET_POLL_CONTROLLER
  	.ndo_poll_controller	= mtk_poll_controller,
  #endif
@@ -224,7 +224,7 @@
  };
  
  static int mtk_add_mac(struct mtk_eth *eth, struct device_node *np)
-@@ -3197,6 +3237,7 @@ static const struct mtk_soc_data mt7622_
+@@ -3198,6 +3238,7 @@ static const struct mtk_soc_data mt7622_
  	.hw_features = MTK_HW_FEATURES,
  	.required_clks = MT7622_CLKS_BITMAP,
  	.required_pctl = false,
diff --git a/target/linux/mediatek/patches-5.4/1000-eth-gdm-config-backport.patch b/target/linux/mediatek/patches-5.4/1000-eth-gdm-config-backport.patch
index a9b1424f95..38addd36ed 100644
--- a/target/linux/mediatek/patches-5.4/1000-eth-gdm-config-backport.patch
+++ b/target/linux/mediatek/patches-5.4/1000-eth-gdm-config-backport.patch
@@ -1,6 +1,6 @@
 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
 +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
-@@ -2235,6 +2235,31 @@ static int mtk_start_dma(struct mtk_eth
+@@ -2236,6 +2236,31 @@ static int mtk_start_dma(struct mtk_eth
  	return 0;
  }
  
@@ -32,7 +32,7 @@
  static int mtk_open(struct net_device *dev)
  {
  	struct mtk_mac *mac = netdev_priv(dev);
-@@ -2255,6 +2280,8 @@ static int mtk_open(struct net_device *d
+@@ -2256,6 +2281,8 @@ static int mtk_open(struct net_device *d
  		if (err)
  			return err;
  
@@ -41,7 +41,7 @@
  		napi_enable(&eth->tx_napi);
  		napi_enable(&eth->rx_napi);
  		mtk_tx_irq_enable(eth, MTK_TX_DONE_INT);
-@@ -2310,6 +2337,8 @@ static int mtk_stop(struct net_device *d
+@@ -2311,6 +2338,8 @@ static int mtk_stop(struct net_device *d
  	if (!refcount_dec_and_test(&eth->dma_refcnt))
  		return 0;
  
@@ -50,7 +50,7 @@
  	mtk_tx_irq_disable(eth, MTK_TX_DONE_INT);
  	mtk_rx_irq_disable(eth, MTK_RX_DONE_INT);
  	napi_disable(&eth->tx_napi);
-@@ -2493,8 +2522,6 @@ static int mtk_hw_init(struct mtk_eth *e
+@@ -2494,8 +2523,6 @@ static int mtk_hw_init(struct mtk_eth *e
  	/* disable delay and normal interrupt */
  	mtk_tx_irq_disable(eth, ~0);
  	mtk_rx_irq_disable(eth, ~0);
@@ -59,7 +59,7 @@
  
  	/* FE int grouping */
  	mtk_w32(eth, MTK_TX_DONE_INT, MTK_PDMA_INT_GRP1);
-@@ -2503,19 +2530,6 @@ static int mtk_hw_init(struct mtk_eth *e
+@@ -2504,19 +2531,6 @@ static int mtk_hw_init(struct mtk_eth *e
  	mtk_w32(eth, MTK_RX_DONE_INT, MTK_QDMA_INT_GRP2);
  	mtk_w32(eth, 0x21021000, MTK_FE_INT_GRP);
  



More information about the lede-commits mailing list