From: Christian Marangi <ansuelsmth@gmail.com>
To: Vincent Whitchurch <Vincent.Whitchurch@axis.com>
Cc: "linux-stm32@st-md-mailman.stormreply.com"
<linux-stm32@st-md-mailman.stormreply.com>,
"davem@davemloft.net" <davem@davemloft.net>,
"liuhangbin@gmail.com" <liuhangbin@gmail.com>,
"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"pabeni@redhat.com" <pabeni@redhat.com>,
"jiri@resnulli.us" <jiri@resnulli.us>,
"joabreu@synopsys.com" <joabreu@synopsys.com>,
"rajur@chelsio.com" <rajur@chelsio.com>,
"horms@kernel.org" <horms@kernel.org>,
"kuba@kernel.org" <kuba@kernel.org>,
"kvalo@kernel.org" <kvalo@kernel.org>,
"alexandre.torgue@foss.st.com" <alexandre.torgue@foss.st.com>,
"mcoquelin.stm32@gmail.com" <mcoquelin.stm32@gmail.com>,
"daniel@iogearbox.net" <daniel@iogearbox.net>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"edumazet@google.com" <edumazet@google.com>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"pkshih@realtek.com" <pkshih@realtek.com>
Subject: Re: [net-next PATCH 2/3] net: stmmac: improve TX timer arm logic
Date: Sat, 30 Sep 2023 14:04:29 +0200 [thread overview]
Message-ID: <65180ecf.050a0220.10a98.7a51@mx.google.com> (raw)
In-Reply-To: <0a62a2b6bff4fd01065e0de6a8703c96e344f1dc.camel@axis.com>
On Fri, Sep 29, 2023 at 12:38:48PM +0000, Vincent Whitchurch wrote:
> On Fri, 2023-09-22 at 13:12 +0200, Christian Marangi wrote:
> > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> > index 9201ed778ebc..14bf6fae6662 100644
> > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> > @@ -2994,13 +2994,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);
>
> When this function is called from within the napi poll function
> (stmmac_tx_clean()), NAPI_STATE_SCHED will always be set and so after
> this patch the "We still have pending packets, let's call for a new
> scheduling" logic will never start the timer. Was that really
> intentional?
>
No and understanding the code flow of napi and tx-coal is hard... (also
problem with tx coal arise only with real world scenario and now with
synthetic tests like iperf.
I will shortly send a v2 of this that will just move the logic of arming
the TX timer outside napi call after DMA interrupt is enabled again.
Currently testing the new version on openwrt with ipq806x hoping
everything is good.
(same perf increase observed but no queue timeout)
--
Ansuel
next prev parent reply other threads:[~2023-09-30 12:04 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-22 11:12 [net-next PATCH 1/3] net: introduce napi_is_scheduled helper Christian Marangi
2023-09-22 11:12 ` [net-next PATCH 2/3] net: stmmac: improve TX timer arm logic Christian Marangi
2023-09-29 12:38 ` Vincent Whitchurch
2023-09-30 12:04 ` Christian Marangi [this message]
2023-09-22 11:12 ` [net-next PATCH 3/3] net: stmmac: increase TX coalesce timer to 5ms Christian Marangi
2023-09-22 12:28 ` Andrew Lunn
2023-09-22 12:39 ` Christian Marangi
2023-09-22 20:02 ` Dave Taht
2023-09-29 21:03 ` [net-next PATCH 1/3] net: introduce napi_is_scheduled helper Nambiar, Amritha
2023-09-30 11:59 ` Eric Dumazet
2023-09-30 12:11 ` Christian Marangi
2023-09-30 13:42 ` Eric Dumazet
2023-10-02 12:29 ` Christian Marangi
2023-10-02 12:35 ` Eric Dumazet
2023-10-02 12:43 ` Christian Marangi
2023-10-02 12:49 ` Eric Dumazet
2023-10-02 12:54 ` Christian Marangi
2023-10-02 12:56 ` Eric Dumazet
2023-10-02 12:59 ` Eric Dumazet
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=65180ecf.050a0220.10a98.7a51@mx.google.com \
--to=ansuelsmth@gmail.com \
--cc=Vincent.Whitchurch@axis.com \
--cc=alexandre.torgue@foss.st.com \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=jiri@resnulli.us \
--cc=joabreu@synopsys.com \
--cc=kuba@kernel.org \
--cc=kvalo@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=linux-wireless@vger.kernel.org \
--cc=liuhangbin@gmail.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pkshih@realtek.com \
--cc=rajur@chelsio.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox