* [net-next PATCH v2 0/4] net: stmmac: improve tx timer logic
@ 2023-10-12 10:04 Christian Marangi
2023-10-12 10:04 ` [net-next PATCH v2 1/4] net: introduce napi_is_scheduled helper Christian Marangi
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: Christian Marangi @ 2023-10-12 10:04 UTC (permalink / raw)
To: Raju Rangoju, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Alexandre Torgue, Jose Abreu, Maxime Coquelin,
Ping-Ke Shih, Kalle Valo, Simon Horman, Daniel Borkmann,
Jiri Pirko, Hangbin Liu, netdev, linux-kernel, linux-stm32,
linux-arm-kernel, linux-wireless
Cc: Christian Marangi
This series comes with the intention of restoring original performance
of stmmac on some router/device that used the stmmac driver to handle
gigabit traffic.
More info are present in patch 3. This cover letter is to show results
and improvements of the following change.
The move to hr_timer for tx timer and commit 8fce33317023 ("net: stmmac:
Rework coalesce timer and fix multi-queue races") caused big performance
regression on these kind of device.
This was observed on ipq806x that after kernel 4.19 couldn't handle
gigabit speed anymore.
The following series is currently applied and tested in OpenWrt SNAPSHOT
and have great performance increase. (the scenario is qca8k switch +
stmmac dwmac1000) Some good comparison can be found here [1].
The difference is from a swconfig scenario (where dsa tagging is not
used so very low CPU impact in handling traffic) and DSA scenario where
tagging is used and there is a minimal impact in the CPU. As can be
notice even with DSA in place we have better perf.
It was observed by other user that also SQM scenario with cake scheduler
were improved in the order of 100mbps (this scenario is CPU limited and
any increase of perf is caused by removing load on the CPU)
Been at least 15 days that this is in use without any complain or bug
reported about queue timeout. (was the case with v1 before the
additional patch was added, only appear on real world tests and not on
iperf tests)
[1] https://forum.openwrt.org/t/netgear-r7800-exploration-ipq8065-qca9984/285/3427?u=ansuel
Changes v2:
- Add patch to move tx timer arm outside tx clean.
Christian Marangi (4):
net: introduce napi_is_scheduled helper
net: stmmac: improve TX timer arm logic
net: stmmac: move TX timer arm after DMA enable
net: stmmac: increase TX coalesce timer to 5ms
drivers/net/ethernet/chelsio/cxgb3/sge.c | 8 ----
drivers/net/ethernet/stmicro/stmmac/common.h | 2 +-
.../net/ethernet/stmicro/stmmac/stmmac_main.c | 37 +++++++++++++++----
drivers/net/wireless/realtek/rtw89/core.c | 2 +-
include/linux/netdevice.h | 23 ++++++++++++
net/core/dev.c | 2 +-
6 files changed, 56 insertions(+), 18 deletions(-)
--
2.40.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 8+ messages in thread
* [net-next PATCH v2 1/4] net: introduce napi_is_scheduled helper
2023-10-12 10:04 [net-next PATCH v2 0/4] net: stmmac: improve tx timer logic Christian Marangi
@ 2023-10-12 10:04 ` Christian Marangi
2023-10-12 10:04 ` [net-next PATCH v2 2/4] net: stmmac: improve TX timer arm logic Christian Marangi
` (2 subsequent siblings)
3 siblings, 0 replies; 8+ messages in thread
From: Christian Marangi @ 2023-10-12 10:04 UTC (permalink / raw)
To: Raju Rangoju, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Alexandre Torgue, Jose Abreu, Maxime Coquelin,
Ping-Ke Shih, Kalle Valo, Simon Horman, Daniel Borkmann,
Jiri Pirko, Hangbin Liu, netdev, linux-kernel, linux-stm32,
linux-arm-kernel, linux-wireless
Cc: Christian Marangi
We currently have napi_if_scheduled_mark_missed that can be used to
check if napi is scheduled but that does more thing than simply checking
it and return a bool. Some driver already implement custom function to
check if napi is scheduled.
Drop these custom function and introduce napi_is_scheduled that simply
check if napi is scheduled atomically.
Update any driver and code that implement a similar check and instead
use this new helper.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
drivers/net/ethernet/chelsio/cxgb3/sge.c | 8 --------
drivers/net/wireless/realtek/rtw89/core.c | 2 +-
include/linux/netdevice.h | 23 +++++++++++++++++++++++
net/core/dev.c | 2 +-
4 files changed, 25 insertions(+), 10 deletions(-)
diff --git a/drivers/net/ethernet/chelsio/cxgb3/sge.c b/drivers/net/ethernet/chelsio/cxgb3/sge.c
index 2e9a74fe0970..71fa2dc19034 100644
--- a/drivers/net/ethernet/chelsio/cxgb3/sge.c
+++ b/drivers/net/ethernet/chelsio/cxgb3/sge.c
@@ -2501,14 +2501,6 @@ static int napi_rx_handler(struct napi_struct *napi, int budget)
return work_done;
}
-/*
- * Returns true if the device is already scheduled for polling.
- */
-static inline int napi_is_scheduled(struct napi_struct *napi)
-{
- return test_bit(NAPI_STATE_SCHED, &napi->state);
-}
-
/**
* process_pure_responses - process pure responses from a response queue
* @adap: the adapter
diff --git a/drivers/net/wireless/realtek/rtw89/core.c b/drivers/net/wireless/realtek/rtw89/core.c
index cca18d7ea1dd..6faf4dcf007c 100644
--- a/drivers/net/wireless/realtek/rtw89/core.c
+++ b/drivers/net/wireless/realtek/rtw89/core.c
@@ -1919,7 +1919,7 @@ static void rtw89_core_rx_to_mac80211(struct rtw89_dev *rtwdev,
struct napi_struct *napi = &rtwdev->napi;
/* In low power mode, napi isn't scheduled. Receive it to netif. */
- if (unlikely(!test_bit(NAPI_STATE_SCHED, &napi->state)))
+ if (unlikely(!napi_is_scheduled(napi)))
napi = NULL;
rtw89_core_hw_to_sband_rate(rx_status);
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index ae553f886796..ad75875a854d 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -482,6 +482,29 @@ static inline bool napi_prefer_busy_poll(struct napi_struct *n)
return test_bit(NAPI_STATE_PREFER_BUSY_POLL, &n->state);
}
+/**
+ * napi_is_scheduled - test if NAPI is scheduled
+ * @n: NAPI context
+ *
+ * This check is "best-effort". With no locking implemented,
+ * a NAPI can be scheduled or terminate right after this check
+ * and produce not precise results.
+ *
+ * NAPI_STATE_SCHED is an internal state, napi_is_scheduled
+ * should not be used normally and napi_schedule should be
+ * used instead.
+ *
+ * Use only if the driver really needs to check if a NAPI
+ * is scheduled for example in the context of delayed timer
+ * that can be skipped if a NAPI is already scheduled.
+ *
+ * Return True if NAPI is scheduled, False otherwise.
+ */
+static inline bool napi_is_scheduled(struct napi_struct *n)
+{
+ return test_bit(NAPI_STATE_SCHED, &n->state);
+}
+
bool napi_schedule_prep(struct napi_struct *n);
/**
diff --git a/net/core/dev.c b/net/core/dev.c
index 02949a929e7f..c2ec535bc9b4 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -6523,7 +6523,7 @@ static int __napi_poll(struct napi_struct *n, bool *repoll)
* accidentally calling ->poll() when NAPI is not scheduled.
*/
work = 0;
- if (test_bit(NAPI_STATE_SCHED, &n->state)) {
+ if (napi_is_scheduled(n)) {
work = n->poll(n, weight);
trace_napi_poll(n, work, weight);
}
--
2.40.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [net-next PATCH v2 2/4] net: stmmac: improve TX timer arm logic
2023-10-12 10:04 [net-next PATCH v2 0/4] net: stmmac: improve tx timer logic Christian Marangi
2023-10-12 10:04 ` [net-next PATCH v2 1/4] net: introduce napi_is_scheduled helper Christian Marangi
@ 2023-10-12 10:04 ` Christian Marangi
2023-10-12 10:04 ` [net-next PATCH v2 3/4] net: stmmac: move TX timer arm after DMA enable Christian Marangi
2023-10-12 10:04 ` [net-next PATCH v2 4/4] net: stmmac: increase TX coalesce timer to 5ms Christian Marangi
3 siblings, 0 replies; 8+ messages in thread
From: Christian Marangi @ 2023-10-12 10:04 UTC (permalink / raw)
To: Raju Rangoju, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Alexandre Torgue, Jose Abreu, Maxime Coquelin,
Ping-Ke Shih, Kalle Valo, Simon Horman, Daniel Borkmann,
Jiri Pirko, Hangbin Liu, netdev, linux-kernel, linux-stm32,
linux-arm-kernel, linux-wireless
Cc: Christian Marangi
There is currently a problem with the TX timer getting armed multiple
unnecessary times causing big performance regression on some device that
suffer from heavy handling of hrtimer rearm.
The use of the TX timer is an old implementation that predates the napi
implementation and the interrupt enable/disable handling.
Due to stmmac being a very old code, the TX timer was never evaluated
again with this new implementation and was kept there causing
performance regression. The performance regression started to appear
with kernel version 4.19 with 8fce33317023 ("net: stmmac: Rework coalesce
timer and fix multi-queue races") where the timer was reduced to 1ms
causing it to be armed 40 times more than before.
Decreasing the timer made the problem more present and caused the
regression in the other of 600-700mbps on some device (regression where
this was notice is ipq806x).
The problem is in the fact that handling the hrtimer on some target is
expensive and recent kernel made the timer armed much more times.
A solution that was proposed was reverting the hrtimer change and use
mod_timer but such solution would still hide the real problem in the
current implementation.
To fix the regression, apply some additional logic and skip arming the
timer when not needed.
Arm the timer ONLY if a napi is not already scheduled. Running the timer
is redundant since the same function (stmmac_tx_clean) will run in the
napi TX poll. Also try to cancel any timer if a napi is scheduled to
prevent redundant run of TX call.
With the following new logic the original performance are restored while
keeping using the hrtimer.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
.../net/ethernet/stmicro/stmmac/stmmac_main.c | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index bb1dbf4c9f6c..5124ee87286c 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -2996,13 +2996,25 @@ static void stmmac_tx_timer_arm(struct stmmac_priv *priv, u32 queue)
{
struct stmmac_tx_queue *tx_q = &priv->dma_conf.tx_queue[queue];
u32 tx_coal_timer = priv->tx_coal_timer[queue];
+ struct stmmac_channel *ch;
+ struct napi_struct *napi;
if (!tx_coal_timer)
return;
- hrtimer_start(&tx_q->txtimer,
- STMMAC_COAL_TIMER(tx_coal_timer),
- HRTIMER_MODE_REL);
+ ch = &priv->channel[tx_q->queue_index];
+ napi = tx_q->xsk_pool ? &ch->rxtx_napi : &ch->tx_napi;
+
+ /* Arm timer only if napi is not already scheduled.
+ * Try to cancel any timer if napi is scheduled, timer will be armed
+ * again in the next scheduled napi.
+ */
+ if (unlikely(!napi_is_scheduled(napi)))
+ hrtimer_start(&tx_q->txtimer,
+ STMMAC_COAL_TIMER(tx_coal_timer),
+ HRTIMER_MODE_REL);
+ else
+ hrtimer_try_to_cancel(&tx_q->txtimer);
}
/**
--
2.40.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [net-next PATCH v2 3/4] net: stmmac: move TX timer arm after DMA enable
2023-10-12 10:04 [net-next PATCH v2 0/4] net: stmmac: improve tx timer logic Christian Marangi
2023-10-12 10:04 ` [net-next PATCH v2 1/4] net: introduce napi_is_scheduled helper Christian Marangi
2023-10-12 10:04 ` [net-next PATCH v2 2/4] net: stmmac: improve TX timer arm logic Christian Marangi
@ 2023-10-12 10:04 ` Christian Marangi
2023-10-14 1:13 ` Jakub Kicinski
2023-10-17 4:52 ` kernel test robot
2023-10-12 10:04 ` [net-next PATCH v2 4/4] net: stmmac: increase TX coalesce timer to 5ms Christian Marangi
3 siblings, 2 replies; 8+ messages in thread
From: Christian Marangi @ 2023-10-12 10:04 UTC (permalink / raw)
To: Raju Rangoju, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Alexandre Torgue, Jose Abreu, Maxime Coquelin,
Ping-Ke Shih, Kalle Valo, Simon Horman, Daniel Borkmann,
Jiri Pirko, Hangbin Liu, netdev, linux-kernel, linux-stm32,
linux-arm-kernel, linux-wireless
Cc: Christian Marangi
Move TX timer arm call after DMA interrupt is enabled again.
The TX timer arm function changed logic and now is skipped if a napi is
already scheduled. By moving the TX timer arm call after DMA is enabled,
we permit to correctly skip if a DMA interrupt has been fired and a napi
has been scheduled again.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
.../net/ethernet/stmicro/stmmac/stmmac_main.c | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 5124ee87286c..b2f63f12aee5 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -2545,7 +2545,8 @@ static void stmmac_bump_dma_threshold(struct stmmac_priv *priv, u32 chan)
* @queue: TX queue index
* Description: it reclaims the transmit resources after transmission completes.
*/
-static int stmmac_tx_clean(struct stmmac_priv *priv, int budget, u32 queue)
+static int stmmac_tx_clean(struct stmmac_priv *priv, int budget, u32 queue
+ bool *pending_packets)
{
struct stmmac_tx_queue *tx_q = &priv->dma_conf.tx_queue[queue];
struct stmmac_txq_stats *txq_stats = &priv->xstats.txq_stats[queue];
@@ -2706,7 +2707,7 @@ static int stmmac_tx_clean(struct stmmac_priv *priv, int budget, u32 queue)
/* We still have pending packets, let's call for a new scheduling */
if (tx_q->dirty_tx != tx_q->cur_tx)
- stmmac_tx_timer_arm(priv, queue);
+ *pending_packets = true;
flags = u64_stats_update_begin_irqsave(&txq_stats->syncp);
txq_stats->tx_packets += tx_packets;
@@ -5572,6 +5573,7 @@ static int stmmac_napi_poll_tx(struct napi_struct *napi, int budget)
container_of(napi, struct stmmac_channel, tx_napi);
struct stmmac_priv *priv = ch->priv_data;
struct stmmac_txq_stats *txq_stats;
+ bool pending_packets = false;
u32 chan = ch->index;
unsigned long flags;
int work_done;
@@ -5581,7 +5583,7 @@ static int stmmac_napi_poll_tx(struct napi_struct *napi, int budget)
txq_stats->napi_poll++;
u64_stats_update_end_irqrestore(&txq_stats->syncp, flags);
- work_done = stmmac_tx_clean(priv, budget, chan);
+ work_done = stmmac_tx_clean(priv, budget, chan, &pending_packets);
work_done = min(work_done, budget);
if (work_done < budget && napi_complete_done(napi, work_done)) {
@@ -5592,6 +5594,10 @@ static int stmmac_napi_poll_tx(struct napi_struct *napi, int budget)
spin_unlock_irqrestore(&ch->lock, flags);
}
+ /* TX still have packet to handle, check if we need to arm tx timer */
+ if (pending_packets)
+ stmmac_tx_timer_arm(priv, chan);
+
return work_done;
}
@@ -5600,6 +5606,7 @@ static int stmmac_napi_poll_rxtx(struct napi_struct *napi, int budget)
struct stmmac_channel *ch =
container_of(napi, struct stmmac_channel, rxtx_napi);
struct stmmac_priv *priv = ch->priv_data;
+ bool tx_pending_packets = false;
int rx_done, tx_done, rxtx_done;
struct stmmac_rxq_stats *rxq_stats;
struct stmmac_txq_stats *txq_stats;
@@ -5616,7 +5623,7 @@ static int stmmac_napi_poll_rxtx(struct napi_struct *napi, int budget)
txq_stats->napi_poll++;
u64_stats_update_end_irqrestore(&txq_stats->syncp, flags);
- tx_done = stmmac_tx_clean(priv, budget, chan);
+ tx_done = stmmac_tx_clean(priv, budget, chan, &tx_pending_packets);
tx_done = min(tx_done, budget);
rx_done = stmmac_rx_zc(priv, budget, chan);
@@ -5641,6 +5648,10 @@ static int stmmac_napi_poll_rxtx(struct napi_struct *napi, int budget)
spin_unlock_irqrestore(&ch->lock, flags);
}
+ /* TX still have packet to handle, check if we need to arm tx timer */
+ if (tx_pending_packets)
+ stmmac_tx_timer_arm(priv, chan);
+
return min(rxtx_done, budget - 1);
}
--
2.40.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [net-next PATCH v2 4/4] net: stmmac: increase TX coalesce timer to 5ms
2023-10-12 10:04 [net-next PATCH v2 0/4] net: stmmac: improve tx timer logic Christian Marangi
` (2 preceding siblings ...)
2023-10-12 10:04 ` [net-next PATCH v2 3/4] net: stmmac: move TX timer arm after DMA enable Christian Marangi
@ 2023-10-12 10:04 ` Christian Marangi
3 siblings, 0 replies; 8+ messages in thread
From: Christian Marangi @ 2023-10-12 10:04 UTC (permalink / raw)
To: Raju Rangoju, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Alexandre Torgue, Jose Abreu, Maxime Coquelin,
Ping-Ke Shih, Kalle Valo, Simon Horman, Daniel Borkmann,
Jiri Pirko, Hangbin Liu, netdev, linux-kernel, linux-stm32,
linux-arm-kernel, linux-wireless
Cc: Christian Marangi
Commit 8fce33317023 ("net: stmmac: Rework coalesce timer and fix
multi-queue races") decreased the TX coalesce timer from 40ms to 1ms.
This caused some performance regression on some target (regression was
reported at least on ipq806x) in the order of 600mbps dropping from
gigabit handling to only 200mbps.
The problem was identified in the TX timer getting armed too much time.
While this was fixed and improved in another commit, performance can be
improved even further by increasing the timer delay a bit moving from
1ms to 5ms.
The value is a good balance between battery saving by prevending too
much interrupt to be generated and permitting good performance for
internet oriented devices.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
drivers/net/ethernet/stmicro/stmmac/common.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h
index 1e996c29043d..e3f650e88f82 100644
--- a/drivers/net/ethernet/stmicro/stmmac/common.h
+++ b/drivers/net/ethernet/stmicro/stmmac/common.h
@@ -293,7 +293,7 @@ struct stmmac_safety_stats {
#define MIN_DMA_RIWT 0x10
#define DEF_DMA_RIWT 0xa0
/* Tx coalesce parameters */
-#define STMMAC_COAL_TX_TIMER 1000
+#define STMMAC_COAL_TX_TIMER 5000
#define STMMAC_MAX_COAL_TX_TICK 100000
#define STMMAC_TX_MAX_FRAMES 256
#define STMMAC_TX_FRAMES 25
--
2.40.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [net-next PATCH v2 3/4] net: stmmac: move TX timer arm after DMA enable
2023-10-12 10:04 ` [net-next PATCH v2 3/4] net: stmmac: move TX timer arm after DMA enable Christian Marangi
@ 2023-10-14 1:13 ` Jakub Kicinski
2023-10-14 9:27 ` Christian Marangi
2023-10-17 4:52 ` kernel test robot
1 sibling, 1 reply; 8+ messages in thread
From: Jakub Kicinski @ 2023-10-14 1:13 UTC (permalink / raw)
To: Christian Marangi
Cc: Raju Rangoju, David S. Miller, Eric Dumazet, Paolo Abeni,
Alexandre Torgue, Jose Abreu, Maxime Coquelin, Ping-Ke Shih,
Kalle Valo, Simon Horman, Daniel Borkmann, Jiri Pirko,
Hangbin Liu, netdev, linux-kernel, linux-stm32, linux-arm-kernel,
linux-wireless
On Thu, 12 Oct 2023 12:04:58 +0200 Christian Marangi wrote:
> +static int stmmac_tx_clean(struct stmmac_priv *priv, int budget, u32 queue
missing comma at the end, does not build :(
--
pw-bot: cr
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [net-next PATCH v2 3/4] net: stmmac: move TX timer arm after DMA enable
2023-10-14 1:13 ` Jakub Kicinski
@ 2023-10-14 9:27 ` Christian Marangi
0 siblings, 0 replies; 8+ messages in thread
From: Christian Marangi @ 2023-10-14 9:27 UTC (permalink / raw)
To: Jakub Kicinski
Cc: Raju Rangoju, David S. Miller, Eric Dumazet, Paolo Abeni,
Alexandre Torgue, Jose Abreu, Maxime Coquelin, Ping-Ke Shih,
Kalle Valo, Simon Horman, Daniel Borkmann, Jiri Pirko,
Hangbin Liu, netdev, linux-kernel, linux-stm32, linux-arm-kernel,
linux-wireless
On Fri, Oct 13, 2023 at 06:13:05PM -0700, Jakub Kicinski wrote:
> On Thu, 12 Oct 2023 12:04:58 +0200 Christian Marangi wrote:
> > +static int stmmac_tx_clean(struct stmmac_priv *priv, int budget, u32 queue
>
> missing comma at the end, does not build :(
> --
> pw-bot: cr
Sorry for wasting your time :(
Having to port this between 6.1 and net-next and it slipped in while
fixing the rebase conflict. Totally my fault.
--
Ansuel
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [net-next PATCH v2 3/4] net: stmmac: move TX timer arm after DMA enable
2023-10-12 10:04 ` [net-next PATCH v2 3/4] net: stmmac: move TX timer arm after DMA enable Christian Marangi
2023-10-14 1:13 ` Jakub Kicinski
@ 2023-10-17 4:52 ` kernel test robot
1 sibling, 0 replies; 8+ messages in thread
From: kernel test robot @ 2023-10-17 4:52 UTC (permalink / raw)
To: Christian Marangi, Raju Rangoju, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Alexandre Torgue, Jose Abreu,
Maxime Coquelin, Ping-Ke Shih, Kalle Valo, Simon Horman,
Daniel Borkmann, Jiri Pirko, Hangbin Liu, linux-kernel,
linux-stm32, linux-arm-kernel, linux-wireless
Cc: oe-kbuild-all, netdev, Christian Marangi
Hi Christian,
kernel test robot noticed the following build warnings:
[auto build test WARNING on net-next/main]
url: https://github.com/intel-lab-lkp/linux/commits/Christian-Marangi/net-introduce-napi_is_scheduled-helper/20231017-104641
base: net-next/main
patch link: https://lore.kernel.org/r/20231012100459.6158-4-ansuelsmth%40gmail.com
patch subject: [net-next PATCH v2 3/4] net: stmmac: move TX timer arm after DMA enable
config: m68k-allyesconfig (https://download.01.org/0day-ci/archive/20231017/202310171222.UN3fzVpz-lkp@intel.com/config)
compiler: m68k-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231017/202310171222.UN3fzVpz-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202310171222.UN3fzVpz-lkp@intel.com/
All warnings (new ones prefixed by >>):
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:2549:28: error: expected ';', ',' or ')' before 'bool'
2549 | bool *pending_packets)
| ^~~~
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c: In function 'stmmac_napi_poll_tx':
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:5586:21: error: implicit declaration of function 'stmmac_tx_clean'; did you mean 'stmmac_rx_vlan'? [-Werror=implicit-function-declaration]
5586 | work_done = stmmac_tx_clean(priv, budget, chan, &pending_packets);
| ^~~~~~~~~~~~~~~
| stmmac_rx_vlan
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c: At top level:
>> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:2425:13: warning: 'stmmac_xdp_xmit_zc' defined but not used [-Wunused-function]
2425 | static bool stmmac_xdp_xmit_zc(struct stmmac_priv *priv, u32 queue, u32 budget)
| ^~~~~~~~~~~~~~~~~~
>> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:536:13: warning: 'stmmac_get_tx_hwtstamp' defined but not used [-Wunused-function]
536 | static void stmmac_get_tx_hwtstamp(struct stmmac_priv *priv,
| ^~~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
vim +/stmmac_xdp_xmit_zc +2425 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
47dd7a540b8a0c drivers/net/stmmac/stmmac_main.c Giuseppe Cavallaro 2009-10-14 2424
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 @2425 static bool stmmac_xdp_xmit_zc(struct stmmac_priv *priv, u32 queue, u32 budget)
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2426 {
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2427 struct netdev_queue *nq = netdev_get_tx_queue(priv->dev, queue);
8531c80800c10e drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Christian Marangi 2022-07-23 2428 struct stmmac_tx_queue *tx_q = &priv->dma_conf.tx_queue[queue];
8070274b472e2e drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Jisheng Zhang 2023-09-18 2429 struct stmmac_txq_stats *txq_stats = &priv->xstats.txq_stats[queue];
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2430 struct xsk_buff_pool *pool = tx_q->xsk_pool;
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2431 unsigned int entry = tx_q->cur_tx;
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2432 struct dma_desc *tx_desc = NULL;
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2433 struct xdp_desc xdp_desc;
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2434 bool work_done = true;
133466c3bbe171 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Jisheng Zhang 2023-07-18 2435 u32 tx_set_ic_bit = 0;
133466c3bbe171 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Jisheng Zhang 2023-07-18 2436 unsigned long flags;
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2437
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2438 /* Avoids TX time-out as we are sharing with slow path */
e92af33e472cf3 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Alexander Lobakin 2021-11-17 2439 txq_trans_cond_update(nq);
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2440
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2441 budget = min(budget, stmmac_tx_avail(priv, queue));
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2442
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2443 while (budget-- > 0) {
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2444 dma_addr_t dma_addr;
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2445 bool set_ic;
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2446
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2447 /* We are sharing with slow path and stop XSK TX desc submission when
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2448 * available TX ring is less than threshold.
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2449 */
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2450 if (unlikely(stmmac_tx_avail(priv, queue) < STMMAC_TX_XSK_AVAIL) ||
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2451 !netif_carrier_ok(priv->dev)) {
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2452 work_done = false;
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2453 break;
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2454 }
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2455
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2456 if (!xsk_tx_peek_desc(pool, &xdp_desc))
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2457 break;
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2458
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2459 if (likely(priv->extend_desc))
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2460 tx_desc = (struct dma_desc *)(tx_q->dma_etx + entry);
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2461 else if (tx_q->tbs & STMMAC_TBS_AVAIL)
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2462 tx_desc = &tx_q->dma_entx[entry].basic;
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2463 else
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2464 tx_desc = tx_q->dma_tx + entry;
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2465
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2466 dma_addr = xsk_buff_raw_get_dma(pool, xdp_desc.addr);
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2467 xsk_buff_raw_dma_sync_for_device(pool, dma_addr, xdp_desc.len);
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2468
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2469 tx_q->tx_skbuff_dma[entry].buf_type = STMMAC_TXBUF_T_XSK_TX;
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2470
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2471 /* To return XDP buffer to XSK pool, we simple call
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2472 * xsk_tx_completed(), so we don't need to fill up
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2473 * 'buf' and 'xdpf'.
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2474 */
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2475 tx_q->tx_skbuff_dma[entry].buf = 0;
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2476 tx_q->xdpf[entry] = NULL;
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2477
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2478 tx_q->tx_skbuff_dma[entry].map_as_page = false;
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2479 tx_q->tx_skbuff_dma[entry].len = xdp_desc.len;
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2480 tx_q->tx_skbuff_dma[entry].last_segment = true;
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2481 tx_q->tx_skbuff_dma[entry].is_jumbo = false;
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2482
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2483 stmmac_set_desc_addr(priv, tx_desc, dma_addr);
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2484
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2485 tx_q->tx_count_frames++;
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2486
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2487 if (!priv->tx_coal_frames[queue])
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2488 set_ic = false;
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2489 else if (tx_q->tx_count_frames % priv->tx_coal_frames[queue] == 0)
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2490 set_ic = true;
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2491 else
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2492 set_ic = false;
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2493
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2494 if (set_ic) {
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2495 tx_q->tx_count_frames = 0;
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2496 stmmac_set_tx_ic(priv, tx_desc);
133466c3bbe171 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Jisheng Zhang 2023-07-18 2497 tx_set_ic_bit++;
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2498 }
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2499
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2500 stmmac_prepare_tx_desc(priv, tx_desc, 1, xdp_desc.len,
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2501 true, priv->mode, true, true,
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2502 xdp_desc.len);
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2503
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2504 stmmac_enable_dma_transmission(priv, priv->ioaddr);
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2505
8531c80800c10e drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Christian Marangi 2022-07-23 2506 tx_q->cur_tx = STMMAC_GET_ENTRY(tx_q->cur_tx, priv->dma_conf.dma_tx_size);
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2507 entry = tx_q->cur_tx;
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2508 }
8070274b472e2e drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Jisheng Zhang 2023-09-18 2509 flags = u64_stats_update_begin_irqsave(&txq_stats->syncp);
8070274b472e2e drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Jisheng Zhang 2023-09-18 2510 txq_stats->tx_set_ic_bit += tx_set_ic_bit;
8070274b472e2e drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Jisheng Zhang 2023-09-18 2511 u64_stats_update_end_irqrestore(&txq_stats->syncp, flags);
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2512
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2513 if (tx_desc) {
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2514 stmmac_flush_tx_descriptors(priv, queue);
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2515 xsk_tx_release(pool);
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2516 }
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2517
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2518 /* Return true if all of the 3 conditions are met
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2519 * a) TX Budget is still available
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2520 * b) work_done = true when XSK TX desc peek is empty (no more
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2521 * pending XSK TX for transmission)
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2522 */
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2523 return !!budget && work_done;
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2524 }
132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2525
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2023-10-17 4:53 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-12 10:04 [net-next PATCH v2 0/4] net: stmmac: improve tx timer logic Christian Marangi
2023-10-12 10:04 ` [net-next PATCH v2 1/4] net: introduce napi_is_scheduled helper Christian Marangi
2023-10-12 10:04 ` [net-next PATCH v2 2/4] net: stmmac: improve TX timer arm logic Christian Marangi
2023-10-12 10:04 ` [net-next PATCH v2 3/4] net: stmmac: move TX timer arm after DMA enable Christian Marangi
2023-10-14 1:13 ` Jakub Kicinski
2023-10-14 9:27 ` Christian Marangi
2023-10-17 4:52 ` kernel test robot
2023-10-12 10:04 ` [net-next PATCH v2 4/4] net: stmmac: increase TX coalesce timer to 5ms Christian Marangi
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).