From: Jose Abreu <Jose.Abreu@synopsys.com> Date: 2019-11-14 11:43:20
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 and 4/7, removes the uneeded computations for RX Flow Control
activation/de-activation, on some cases.
Patch 5/7, tunes-up the default coalesce settings.
Patch 6/7, re-works the TX coalesce timer activation logic.
Patch 7/7, removes the now uneeded TBU interrupt.
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
From: Jose Abreu <Jose.Abreu@synopsys.com> Date: 2019-11-14 11:42:58
Now that TX Coalesce has been rewritten we no longer need this
additional interrupt enabled. This reduces CPU usage.
Signed-off-by: Jose Abreu <Jose.Abreu@synopsys.com>
---
Cc: Giuseppe Cavallaro <redacted>
Cc: Alexandre Torgue <redacted>
Cc: Jose Abreu <redacted>
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.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
From: Jose Abreu <Jose.Abreu@synopsys.com> Date: 2019-11-14 11:43:01
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 <redacted>
Cc: Alexandre Torgue <redacted>
Cc: Jose Abreu <redacted>
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(-)
From: Jose Abreu <Jose.Abreu@synopsys.com> Date: 2019-11-14 11:43:04
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 <redacted>
Cc: Alexandre Torgue <redacted>
Cc: Jose Abreu <redacted>
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(-)
From: Jose Abreu <Jose.Abreu@synopsys.com> Date: 2019-11-14 11:43:11
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 <redacted>
Cc: Alexandre Torgue <redacted>
Cc: Jose Abreu <redacted>
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(-)
From: Jose Abreu <Jose.Abreu@synopsys.com> Date: 2019-11-14 11:43:17
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 <redacted>
Cc: Alexandre Torgue <redacted>
Cc: Jose Abreu <redacted>
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(-)
From: Jose Abreu <Jose.Abreu@synopsys.com> Date: 2019-11-14 11:43:27
Coalesce logic currently increments the number of packets and sets the
IC bit when the coalesced packets have passed a given limit. This does
not reflect very well what coalesce was meant for as we can have a large
number of packets that are coalesced and then a single one, sent later
on that has the IC bit.
Rework the logic so that it coalesces only upon a limit of packets and
sets the IC bit for large number of packets.
Signed-off-by: Jose Abreu <Jose.Abreu@synopsys.com>
---
Cc: Giuseppe Cavallaro <redacted>
Cc: Alexandre Torgue <redacted>
Cc: Jose Abreu <redacted>
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 | 61 ++++++++++++++++-------
1 file changed, 42 insertions(+), 19 deletions(-)
@@ -3033,16 +3034,27 @@ 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;-if(likely(priv->tx_coal_frames>tx_q->tx_count_frames)&&-!((skb_shinfo(skb)->tx_flags&SKBTX_HW_TSTAMP)&&-priv->hwts_tx_en)){-stmmac_tx_timer_arm(priv,queue);-}else{+tx_packets=(tx_q->cur_tx+1)-first_tx;+tx_q->tx_count_frames+=tx_packets;++if((skb_shinfo(skb)->tx_flags&SKBTX_HW_TSTAMP)&&priv->hwts_tx_en)+set_ic=true;+elseif(!priv->tx_coal_frames)+set_ic=false;+elseif(tx_packets>priv->tx_coal_frames)+set_ic=true;+elseif((tx_q->tx_count_frames%priv->tx_coal_frames)<tx_packets)+set_ic=true;+else+set_ic=false;++if(set_ic){desc=&tx_q->dma_tx[tx_q->cur_tx];tx_q->tx_count_frames=0;stmmac_set_tx_ic(priv,desc);priv->xstats.tx_set_ic_bit++;+}else{+stmmac_tx_timer_arm(priv,queue);}/* We've used all descriptors we need for this skb, however,
@@ -3255,6 +3276,8 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)tx_q->tx_count_frames=0;stmmac_set_tx_ic(priv,desc);priv->xstats.tx_set_ic_bit++;+}else{+stmmac_tx_timer_arm(priv,queue);}/* We've used all descriptors we need for this skb, however,
From: Jose Abreu <Jose.Abreu@synopsys.com> Date: 2019-11-14 11:43:37
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 <redacted>
Cc: Alexandre Torgue <redacted>
Cc: Jose Abreu <redacted>
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 | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)