linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/7] net: stmmac: CPU Performance Improvements
@ 2019-11-13 15:12 Jose Abreu
  2019-11-13 15:12 ` [PATCH net-next 1/7] net: stmmac: Do not set RX IC bit if RX Coalesce is zero Jose Abreu
                   ` (7 more replies)
  0 siblings, 8 replies; 10+ messages in thread
From: Jose Abreu @ 2019-11-13 15:12 UTC (permalink / raw)
  To: netdev
  Cc: Joao Pinto, Jose Abreu, Giuseppe Cavallaro, Alexandre Torgue,
	Jose Abreu, David S. Miller, Maxime Coquelin, linux-stm32,
	linux-arm-kernel, linux-kernel

CPU Performance improvements for stmmac. Please check bellow for results
before and after the series.

Patch 1/7, allows RX Interrupt on Completion to be disabled and only use the
RX HW Watchdog.

Patch 2/7, setups the default RX coalesce settings instead of using the
minimum value.

Patch 3/7, enables the Transmit Buffer Unavailable interrupt on GMAC4+ cores
so that we don't miss any packet that could have been coalesced.

Patch 4/7 and 5/7, removes the uneeded computations for RX Flow Control
activation/de-activation, on some cases.

Patch 6/7, tunes-up the default coalesce settings.

Patch 7/7, corrects the interpretation of TX Coalesce.


NetPerf UDP Results:
--------------------

Socket  Message  Elapsed      Messages                   CPU      Service
Size    Size     Time         Okay Errors   Throughput   Util     Demand
bytes   bytes    secs            #      #   10^6bits/sec % SS     us/KB
--- XGMAC@2.5G: Before
212992    1400   10.00     2100620      0     2351.7     36.69    5.112
212992           10.00     2100539            2351.6     26.18    3.648
--- XGMAC@2.5G: After
212992    1400   10.00     2116860      0     2370.4     27.61    3.816 
212992           10.00     2111552            2364.5     17.41    2.407

--- GMAC5@1G: Before
212992    1400   10.00      786000      0      880.2     34.71    12.923
212992           10.00      786000             880.2     23.42    8.719
--- GMAC5@1G: After
212992    1400   10.00      847702      0      949.3     15.07    5.201 
212992           10.00      847702             949.3     12.91    4.456


Perf TCP Results on RX Path:
----------------------------
--- XGMAC@2.5G: Before
22.51%  swapper          [stmmac]           [k] dwxgmac2_dma_interrupt
10.82%  swapper          [stmmac]           [k] dwxgmac2_host_mtl_irq_status
 5.21%  swapper          [stmmac]           [k] dwxgmac2_host_irq_status
 4.67%  swapper          [stmmac]           [k] dwxgmac3_safety_feat_irq_status
 3.63%  swapper          [kernel.kallsyms]  [k] stack_trace_consume_entry
 2.74%  iperf3           [kernel.kallsyms]  [k] copy_user_enhanced_fast_string
 2.52%  swapper          [kernel.kallsyms]  [k] update_stack_state
 1.94%  ksoftirqd/0      [stmmac]           [k] dwxgmac2_dma_interrupt
 1.45%  iperf3           [kernel.kallsyms]  [k] queued_spin_lock_slowpath
 1.26%  swapper          [kernel.kallsyms]  [k] create_object
--- XGMAC@2.5G: After
12.00%  swapper          [stmmac]           [k] dwxgmac2_dma_interrupt
 5.96%  swapper          [kernel.kallsyms]  [k] stack_trace_consume_entry
 5.65%  swapper          [stmmac]           [k] dwxgmac2_host_mtl_irq_status
 4.36%  swapper          [kernel.kallsyms]  [k] update_stack_state
 3.91%  iperf3           [kernel.kallsyms]  [k] copy_user_enhanced_fast_string
 2.82%  swapper          [stmmac]           [k] dwxgmac2_host_irq_status
 2.62%  swapper          [stmmac]           [k] dwxgmac3_safety_feat_irq_status
 2.25%  swapper          [kernel.kallsyms]  [k] create_object
 2.03%  swapper          [stmmac]           [k] stmmac_napi_poll_rx
 1.97%  swapper          [kernel.kallsyms]  [k] unwind_next_frame.part.4

--- GMAC5@1G: Before
31.29%  swapper          [stmmac]           [k] dwmac4_dma_interrupt
14.57%  swapper          [stmmac]           [k] dwmac4_irq_mtl_status
10.66%  swapper          [stmmac]           [k] dwmac4_irq_status
 1.97%  swapper          [kernel.kallsyms]  [k] stack_trace_consume_entry
 1.73%  iperf3           [kernel.kallsyms]  [k] copy_user_enhanced_fast_string
 1.59%  swapper          [kernel.kallsyms]  [k] update_stack_state
 1.15%  iperf3           [kernel.kallsyms]  [k] do_syscall_64
 1.01%  ksoftirqd/0      [stmmac]           [k] dwmac4_dma_interrupt
 0.89%  swapper          [kernel.kallsyms]  [k] __default_send_IPI_dest_field
 0.75%  swapper          [stmmac]           [k] stmmac_napi_poll_rx
--- GMAC5@1G: After
 9.27%  swapper          [stmmac]           [k] dwmac4_dma_interrupt
 6.35%  swapper          [kernel.kallsyms]  [k] stack_trace_consume_entry
 4.94%  swapper          [kernel.kallsyms]  [k] update_stack_state
 4.70%  swapper          [stmmac]           [k] dwmac4_irq_mtl_status
 3.58%  swapper          [stmmac]           [k] dwmac4_irq_status
 3.42%  iperf3           [kernel.kallsyms]  [k] copy_user_enhanced_fast_string
 2.18%  swapper          [kernel.kallsyms]  [k] unwind_next_frame.part.4
 2.17%  swapper          [stmmac]           [k] stmmac_napi_poll_rx
 2.15%  swapper          [kernel.kallsyms]  [k] create_object
 1.26%  swapper          [kernel.kallsyms]  [k] unwind_get_return_address

---
Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Cc: Alexandre Torgue <alexandre.torgue@st.com>
Cc: Jose Abreu <joabreu@synopsys.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
Cc: netdev@vger.kernel.org
Cc: linux-stm32@st-md-mailman.stormreply.com
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---

Jose Abreu (7):
  net: stmmac: Do not set RX IC bit if RX Coalesce is zero
  net: stmmac: Setup a default RX Coalesce value instead of the minimum
  net: stmmac: gmac4+: Enable the TBU Interrupt
  net: stmmac: gmac4+: Remove uneeded computation for RFA/RFD
  net: stmmac: xgmac: Remove uneeded computation for RFA/RFD
  net: stmmac: Tune-up default coalesce settings
  net: stmmac: TX Coalesce should be per-packet

 drivers/net/ethernet/stmicro/stmmac/common.h       |  5 +++--
 drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c   | 14 ++------------
 drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.h   |  2 ++
 drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c | 14 ++------------
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c  | 14 ++++++++------
 5 files changed, 17 insertions(+), 32 deletions(-)

-- 
2.7.4


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH net-next 1/7] net: stmmac: Do not set RX IC bit if RX Coalesce is zero
  2019-11-13 15:12 [PATCH net-next 0/7] net: stmmac: CPU Performance Improvements Jose Abreu
@ 2019-11-13 15:12 ` Jose Abreu
  2019-11-13 15:12 ` [PATCH net-next 2/7] net: stmmac: Setup a default RX Coalesce value instead of the minimum Jose Abreu
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: Jose Abreu @ 2019-11-13 15:12 UTC (permalink / raw)
  To: netdev
  Cc: Joao Pinto, Jose Abreu, Giuseppe Cavallaro, Alexandre Torgue,
	Jose Abreu, David S. Miller, Maxime Coquelin, linux-stm32,
	linux-arm-kernel, linux-kernel

We may only want to use the RX Watchdog so lets check if RX Coalesce
settings are non-zero and only set the RX Interrupt on Completion bit if
its not.

Signed-off-by: Jose Abreu <Jose.Abreu@synopsys.com>

---
Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Cc: Alexandre Torgue <alexandre.torgue@st.com>
Cc: Jose Abreu <joabreu@synopsys.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
Cc: netdev@vger.kernel.org
Cc: linux-stm32@st-md-mailman.stormreply.com
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 39b4efd521f9..e3677883ea30 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -3440,7 +3440,8 @@ static inline void stmmac_rx_refill(struct stmmac_priv *priv, u32 queue)
 		rx_q->rx_count_frames += priv->rx_coal_frames;
 		if (rx_q->rx_count_frames > priv->rx_coal_frames)
 			rx_q->rx_count_frames = 0;
-		use_rx_wd = priv->use_riwt && rx_q->rx_count_frames;
+		use_rx_wd = !priv->rx_coal_frames;
+		use_rx_wd |= priv->use_riwt && rx_q->rx_count_frames;
 
 		dma_wmb();
 		stmmac_set_rx_owner(priv, p, use_rx_wd);
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH net-next 2/7] net: stmmac: Setup a default RX Coalesce value instead of the minimum
  2019-11-13 15:12 [PATCH net-next 0/7] net: stmmac: CPU Performance Improvements Jose Abreu
  2019-11-13 15:12 ` [PATCH net-next 1/7] net: stmmac: Do not set RX IC bit if RX Coalesce is zero Jose Abreu
@ 2019-11-13 15:12 ` Jose Abreu
  2019-11-13 15:12 ` [PATCH net-next 3/7] net: stmmac: gmac4+: Enable the TBU Interrupt Jose Abreu
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: Jose Abreu @ 2019-11-13 15:12 UTC (permalink / raw)
  To: netdev
  Cc: Joao Pinto, Jose Abreu, Giuseppe Cavallaro, Alexandre Torgue,
	Jose Abreu, David S. Miller, Maxime Coquelin, linux-stm32,
	linux-arm-kernel, linux-kernel

For performance reasons, sometimes using the minimum RX Coalesce value
is not optimal. Lets setup a default value that is optimal in most of
the use cases.

Signed-off-by: Jose Abreu <Jose.Abreu@synopsys.com>

---
Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Cc: Alexandre Torgue <alexandre.torgue@st.com>
Cc: Jose Abreu <joabreu@synopsys.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
Cc: netdev@vger.kernel.org
Cc: linux-stm32@st-md-mailman.stormreply.com
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 drivers/net/ethernet/stmicro/stmmac/common.h      | 1 +
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 7 ++++---
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h
index 912bbb6515b2..309ea12ea61f 100644
--- a/drivers/net/ethernet/stmicro/stmmac/common.h
+++ b/drivers/net/ethernet/stmicro/stmmac/common.h
@@ -248,6 +248,7 @@ struct stmmac_safety_stats {
 /* Max/Min RI Watchdog Timer count value */
 #define MAX_DMA_RIWT		0xff
 #define MIN_DMA_RIWT		0x10
+#define DEF_DMA_RIWT		0xa0
 /* Tx coalesce parameters */
 #define STMMAC_COAL_TX_TIMER	1000
 #define STMMAC_MAX_COAL_TX_TICK	100000
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index e3677883ea30..6136ada20c8e 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -2605,9 +2605,10 @@ static int stmmac_hw_setup(struct net_device *dev, bool init_ptp)
 	priv->tx_lpi_timer = STMMAC_DEFAULT_TWT_LS;
 
 	if (priv->use_riwt) {
-		ret = stmmac_rx_watchdog(priv, priv->ioaddr, MIN_DMA_RIWT, rx_cnt);
-		if (!ret)
-			priv->rx_riwt = MIN_DMA_RIWT;
+		if (!priv->rx_riwt)
+			priv->rx_riwt = DEF_DMA_RIWT;
+
+		ret = stmmac_rx_watchdog(priv, priv->ioaddr, priv->rx_riwt, rx_cnt);
 	}
 
 	if (priv->hw->pcs)
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH net-next 3/7] net: stmmac: gmac4+: Enable the TBU Interrupt
  2019-11-13 15:12 [PATCH net-next 0/7] net: stmmac: CPU Performance Improvements Jose Abreu
  2019-11-13 15:12 ` [PATCH net-next 1/7] net: stmmac: Do not set RX IC bit if RX Coalesce is zero Jose Abreu
  2019-11-13 15:12 ` [PATCH net-next 2/7] net: stmmac: Setup a default RX Coalesce value instead of the minimum Jose Abreu
@ 2019-11-13 15:12 ` Jose Abreu
  2019-11-13 15:12 ` [PATCH net-next 4/7] net: stmmac: gmac4+: Remove uneeded computation for RFA/RFD Jose Abreu
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: Jose Abreu @ 2019-11-13 15:12 UTC (permalink / raw)
  To: netdev
  Cc: Joao Pinto, Jose Abreu, Giuseppe Cavallaro, Alexandre Torgue,
	Jose Abreu, David S. Miller, Maxime Coquelin, linux-stm32,
	linux-arm-kernel, linux-kernel

Enables Transmit Buffer Unavailable interrupt so that any coalesced
packet is not missed on transmission.

Signed-off-by: Jose Abreu <Jose.Abreu@synopsys.com>

---
Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Cc: Alexandre Torgue <alexandre.torgue@st.com>
Cc: Jose Abreu <joabreu@synopsys.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
Cc: netdev@vger.kernel.org
Cc: linux-stm32@st-md-mailman.stormreply.com
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.h b/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.h
index 589931795847..1be1df5f65de 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.h
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.h
@@ -161,6 +161,7 @@
 
 #define DMA_CHAN_INTR_NORMAL		(DMA_CHAN_INTR_ENA_NIE | \
 					 DMA_CHAN_INTR_ENA_RIE | \
+					 DMA_CHAN_INTR_ENA_TBUE | \
 					 DMA_CHAN_INTR_ENA_TIE)
 
 #define DMA_CHAN_INTR_ABNORMAL		(DMA_CHAN_INTR_ENA_AIE | \
@@ -171,6 +172,7 @@
 
 #define DMA_CHAN_INTR_NORMAL_4_10	(DMA_CHAN_INTR_ENA_NIE_4_10 | \
 					 DMA_CHAN_INTR_ENA_RIE | \
+					 DMA_CHAN_INTR_ENA_TBUE | \
 					 DMA_CHAN_INTR_ENA_TIE)
 
 #define DMA_CHAN_INTR_ABNORMAL_4_10	(DMA_CHAN_INTR_ENA_AIE_4_10 | \
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH net-next 4/7] net: stmmac: gmac4+: Remove uneeded computation for RFA/RFD
  2019-11-13 15:12 [PATCH net-next 0/7] net: stmmac: CPU Performance Improvements Jose Abreu
                   ` (2 preceding siblings ...)
  2019-11-13 15:12 ` [PATCH net-next 3/7] net: stmmac: gmac4+: Enable the TBU Interrupt Jose Abreu
@ 2019-11-13 15:12 ` Jose Abreu
  2019-11-13 15:12 ` [PATCH net-next 5/7] net: stmmac: xgmac: " Jose Abreu
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: Jose Abreu @ 2019-11-13 15:12 UTC (permalink / raw)
  To: netdev
  Cc: Joao Pinto, Jose Abreu, Giuseppe Cavallaro, Alexandre Torgue,
	Jose Abreu, David S. Miller, Maxime Coquelin, linux-stm32,
	linux-arm-kernel, linux-kernel

RFA and RFD should not be dependent on FIFO size. In fact, the more FIFO
space we have, the later we can activate Flow Control. Let's use
hard-coded values for RFA and RFD for all FIFO sizes with the exception
of 4k, which is a special case.

Signed-off-by: Jose Abreu <Jose.Abreu@synopsys.com>

---
Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Cc: Alexandre Torgue <alexandre.torgue@st.com>
Cc: Jose Abreu <joabreu@synopsys.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
Cc: netdev@vger.kernel.org
Cc: linux-stm32@st-md-mailman.stormreply.com
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c
index 36a0af8bf89f..c15409030710 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c
@@ -252,19 +252,9 @@ static void dwmac4_dma_rx_chan_op_mode(void __iomem *ioaddr, int mode,
 			rfa = 0x01; /* Full-1.5K */
 			break;
 
-		case 8192:
-			rfd = 0x06; /* Full-4K */
-			rfa = 0x0a; /* Full-6K */
-			break;
-
-		case 16384:
-			rfd = 0x06; /* Full-4K */
-			rfa = 0x12; /* Full-10K */
-			break;
-
 		default:
-			rfd = 0x06; /* Full-4K */
-			rfa = 0x1e; /* Full-16K */
+			rfd = 0x07; /* Full-4.5K */
+			rfa = 0x04; /* Full-3K */
 			break;
 		}
 
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH net-next 5/7] net: stmmac: xgmac: Remove uneeded computation for RFA/RFD
  2019-11-13 15:12 [PATCH net-next 0/7] net: stmmac: CPU Performance Improvements Jose Abreu
                   ` (3 preceding siblings ...)
  2019-11-13 15:12 ` [PATCH net-next 4/7] net: stmmac: gmac4+: Remove uneeded computation for RFA/RFD Jose Abreu
@ 2019-11-13 15:12 ` Jose Abreu
  2019-11-13 15:12 ` [PATCH net-next 6/7] net: stmmac: Tune-up default coalesce settings Jose Abreu
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: Jose Abreu @ 2019-11-13 15:12 UTC (permalink / raw)
  To: netdev
  Cc: Joao Pinto, Jose Abreu, Giuseppe Cavallaro, Alexandre Torgue,
	Jose Abreu, David S. Miller, Maxime Coquelin, linux-stm32,
	linux-arm-kernel, linux-kernel

RFA and RFD should not be dependent on FIFO size. In fact, the more FIFO
space we have, the later we can activate Flow Control. Let's use
hard-coded values for RFA and RFD for all FIFO sizes with the exception
of 4k, which is a special case.

Signed-off-by: Jose Abreu <Jose.Abreu@synopsys.com>

---
Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Cc: Alexandre Torgue <alexandre.torgue@st.com>
Cc: Jose Abreu <joabreu@synopsys.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
Cc: netdev@vger.kernel.org
Cc: linux-stm32@st-md-mailman.stormreply.com
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c
index f148cb2061d8..22a7f0cc1b90 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c
@@ -183,19 +183,9 @@ static void dwxgmac2_dma_rx_mode(void __iomem *ioaddr, int mode,
 			rfa = 0x01; /* Full-1.5K */
 			break;
 
-		case 8192:
-			rfd = 0x06; /* Full-4K */
-			rfa = 0x0a; /* Full-6K */
-			break;
-
-		case 16384:
-			rfd = 0x06; /* Full-4K */
-			rfa = 0x12; /* Full-10K */
-			break;
-
 		default:
-			rfd = 0x06; /* Full-4K */
-			rfa = 0x1e; /* Full-16K */
+			rfd = 0x07; /* Full-4.5K */
+			rfa = 0x04; /* Full-3K */
 			break;
 		}
 
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH net-next 6/7] net: stmmac: Tune-up default coalesce settings
  2019-11-13 15:12 [PATCH net-next 0/7] net: stmmac: CPU Performance Improvements Jose Abreu
                   ` (4 preceding siblings ...)
  2019-11-13 15:12 ` [PATCH net-next 5/7] net: stmmac: xgmac: " Jose Abreu
@ 2019-11-13 15:12 ` Jose Abreu
  2019-11-13 15:12 ` [PATCH net-next 7/7] net: stmmac: TX Coalesce should be per-packet Jose Abreu
  2019-11-14 10:59 ` [PATCH net-next 0/7] net: stmmac: CPU Performance Improvements Jose Abreu
  7 siblings, 0 replies; 10+ messages in thread
From: Jose Abreu @ 2019-11-13 15:12 UTC (permalink / raw)
  To: netdev
  Cc: Joao Pinto, Jose Abreu, Giuseppe Cavallaro, Alexandre Torgue,
	Jose Abreu, David S. Miller, Maxime Coquelin, linux-stm32,
	linux-arm-kernel, linux-kernel

Tune-up the defalt coalesce settings for optimal values. This gives the
best performance in most of the use-cases.

Signed-off-by: Jose Abreu <Jose.Abreu@synopsys.com>

---
Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Cc: Alexandre Torgue <alexandre.torgue@st.com>
Cc: Jose Abreu <joabreu@synopsys.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
Cc: netdev@vger.kernel.org
Cc: linux-stm32@st-md-mailman.stormreply.com
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 drivers/net/ethernet/stmicro/stmmac/common.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h
index 309ea12ea61f..b210e987a1db 100644
--- a/drivers/net/ethernet/stmicro/stmmac/common.h
+++ b/drivers/net/ethernet/stmicro/stmmac/common.h
@@ -253,8 +253,8 @@ struct stmmac_safety_stats {
 #define STMMAC_COAL_TX_TIMER	1000
 #define STMMAC_MAX_COAL_TX_TICK	100000
 #define STMMAC_TX_MAX_FRAMES	256
-#define STMMAC_TX_FRAMES	1
-#define STMMAC_RX_FRAMES	25
+#define STMMAC_TX_FRAMES	25
+#define STMMAC_RX_FRAMES	0
 
 /* Packets types */
 enum packets_types {
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH net-next 7/7] net: stmmac: TX Coalesce should be per-packet
  2019-11-13 15:12 [PATCH net-next 0/7] net: stmmac: CPU Performance Improvements Jose Abreu
                   ` (5 preceding siblings ...)
  2019-11-13 15:12 ` [PATCH net-next 6/7] net: stmmac: Tune-up default coalesce settings Jose Abreu
@ 2019-11-13 15:12 ` Jose Abreu
  2019-11-14 10:59 ` [PATCH net-next 0/7] net: stmmac: CPU Performance Improvements Jose Abreu
  7 siblings, 0 replies; 10+ messages in thread
From: Jose Abreu @ 2019-11-13 15:12 UTC (permalink / raw)
  To: netdev
  Cc: Joao Pinto, Jose Abreu, Giuseppe Cavallaro, Alexandre Torgue,
	Jose Abreu, David S. Miller, Maxime Coquelin, linux-stm32,
	linux-arm-kernel, linux-kernel

TX Coalesce settings are per packet and not per fragment because
otherwise the coalesce would be different between TSO and non-TSO
packets.

Signed-off-by: Jose Abreu <Jose.Abreu@synopsys.com>

---
Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Cc: Alexandre Torgue <alexandre.torgue@st.com>
Cc: Jose Abreu <joabreu@synopsys.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
Cc: netdev@vger.kernel.org
Cc: linux-stm32@st-md-mailman.stormreply.com
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 6136ada20c8e..140abfcb54c6 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -3033,7 +3033,7 @@ static netdev_tx_t stmmac_tso_xmit(struct sk_buff *skb, struct net_device *dev)
 	tx_q->tx_skbuff[tx_q->cur_tx] = skb;
 
 	/* Manage tx mitigation */
-	tx_q->tx_count_frames += nfrags + 1;
+	tx_q->tx_count_frames++;
 	if (likely(priv->tx_coal_frames > tx_q->tx_count_frames) &&
 	    !((skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) &&
 	      priv->hwts_tx_en)) {
@@ -3241,7 +3241,7 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)
 	 * This approach takes care about the fragments: desc is the first
 	 * element in case of no SG.
 	 */
-	tx_q->tx_count_frames += nfrags + 1;
+	tx_q->tx_count_frames++;
 	if (likely(priv->tx_coal_frames > tx_q->tx_count_frames) &&
 	    !((skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) &&
 	      priv->hwts_tx_en)) {
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* RE: [PATCH net-next 0/7] net: stmmac: CPU Performance Improvements
  2019-11-13 15:12 [PATCH net-next 0/7] net: stmmac: CPU Performance Improvements Jose Abreu
                   ` (6 preceding siblings ...)
  2019-11-13 15:12 ` [PATCH net-next 7/7] net: stmmac: TX Coalesce should be per-packet Jose Abreu
@ 2019-11-14 10:59 ` Jose Abreu
  2019-11-14 21:34   ` David Miller
  7 siblings, 1 reply; 10+ messages in thread
From: Jose Abreu @ 2019-11-14 10:59 UTC (permalink / raw)
  To: Jose Abreu, netdev
  Cc: Joao Pinto, Giuseppe Cavallaro, Alexandre Torgue,
	David S. Miller, Maxime Coquelin, linux-stm32, linux-arm-kernel,
	linux-kernel

From: Jose Abreu <Jose.Abreu@synopsys.com>
Date: Nov/13/2019, 15:12:01 (UTC+00:00)

> CPU Performance improvements for stmmac. Please check bellow for results
> before and after the series.

Please do not apply this. I found an issue with patch 1/7 and I have 
some more changes that reduce even more the CPU usage.

---
Thanks,
Jose Miguel Abreu

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH net-next 0/7] net: stmmac: CPU Performance Improvements
  2019-11-14 10:59 ` [PATCH net-next 0/7] net: stmmac: CPU Performance Improvements Jose Abreu
@ 2019-11-14 21:34   ` David Miller
  0 siblings, 0 replies; 10+ messages in thread
From: David Miller @ 2019-11-14 21:34 UTC (permalink / raw)
  To: Jose.Abreu
  Cc: netdev, Joao.Pinto, peppe.cavallaro, alexandre.torgue,
	mcoquelin.stm32, linux-stm32, linux-arm-kernel, linux-kernel

From: Jose Abreu <Jose.Abreu@synopsys.com>
Date: Thu, 14 Nov 2019 10:59:14 +0000

> From: Jose Abreu <Jose.Abreu@synopsys.com>
> Date: Nov/13/2019, 15:12:01 (UTC+00:00)
> 
>> CPU Performance improvements for stmmac. Please check bellow for results
>> before and after the series.
> 
> Please do not apply this. I found an issue with patch 1/7 and I have 
> some more changes that reduce even more the CPU usage.

Ok.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2019-11-14 21:34 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-13 15:12 [PATCH net-next 0/7] net: stmmac: CPU Performance Improvements Jose Abreu
2019-11-13 15:12 ` [PATCH net-next 1/7] net: stmmac: Do not set RX IC bit if RX Coalesce is zero Jose Abreu
2019-11-13 15:12 ` [PATCH net-next 2/7] net: stmmac: Setup a default RX Coalesce value instead of the minimum Jose Abreu
2019-11-13 15:12 ` [PATCH net-next 3/7] net: stmmac: gmac4+: Enable the TBU Interrupt Jose Abreu
2019-11-13 15:12 ` [PATCH net-next 4/7] net: stmmac: gmac4+: Remove uneeded computation for RFA/RFD Jose Abreu
2019-11-13 15:12 ` [PATCH net-next 5/7] net: stmmac: xgmac: " Jose Abreu
2019-11-13 15:12 ` [PATCH net-next 6/7] net: stmmac: Tune-up default coalesce settings Jose Abreu
2019-11-13 15:12 ` [PATCH net-next 7/7] net: stmmac: TX Coalesce should be per-packet Jose Abreu
2019-11-14 10:59 ` [PATCH net-next 0/7] net: stmmac: CPU Performance Improvements Jose Abreu
2019-11-14 21:34   ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).