From: "Niklas Söderlund" <niklas.soderlund+renesas@ragnatech.se>
To: Paul Barker <paul.barker.ct@bp.renesas.com>
Cc: Sergey Shtylyov <s.shtylyov@omp.ru>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Geert Uytterhoeven <geert+renesas@glider.be>,
netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [net-next RFC v3 2/7] net: ravb: Align poll function with NAPI docs
Date: Mon, 15 Apr 2024 13:44:19 +0200 [thread overview]
Message-ID: <20240415114419.GG3156415@ragnatech.se> (raw)
In-Reply-To: <20240415094804.8016-3-paul.barker.ct@bp.renesas.com>
Hi Paul,
Thanks for your work.
On 2024-04-15 10:47:59 +0100, Paul Barker wrote:
> Call napi_complete_done() in accordance with the documentation in
> `Documentation/networking/napi.rst`.
The way I understand it napi_complete() is still OK to use, it's just a
wrapper for napi_complete_done(napi, 0). But of course using
napi_complete_done() is better if you want to use the busypolling status
returned. Maybe the commit message can be updated to reflect this
change, how about?
net: ravb: Consider busypolling status when re-enabling interrupts
Make use of the busypolling status returned from NAPI complete to decide
if interrupts shall be re-enabled or not. This is useful to reduce the
interrupt overhead.
While at it switch to using napi_complete_done() as it take into account
the work done when providing the busypolling status.
>
> Signed-off-by: Paul Barker <paul.barker.ct@bp.renesas.com>
> ---
> drivers/net/ethernet/renesas/ravb_main.c | 26 ++++++++++--------------
> 1 file changed, 11 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
> index 33f8043143c1..1ac599a044b2 100644
> --- a/drivers/net/ethernet/renesas/ravb_main.c
> +++ b/drivers/net/ethernet/renesas/ravb_main.c
> @@ -1340,23 +1340,19 @@ static int ravb_poll(struct napi_struct *napi, int budget)
> if (priv->rx_fifo_errors != ndev->stats.rx_fifo_errors)
> ndev->stats.rx_fifo_errors = priv->rx_fifo_errors;
>
> - if (work_done == budget)
> - goto out;
> -
> - napi_complete(napi);
> -
> - /* Re-enable RX/TX interrupts */
> - spin_lock_irqsave(&priv->lock, flags);
> - if (!info->irq_en_dis) {
> - ravb_modify(ndev, RIC0, mask, mask);
> - ravb_modify(ndev, TIC, mask, mask);
> - } else {
> - ravb_write(ndev, mask, RIE0);
> - ravb_write(ndev, mask, TIE);
> + if (work_done < budget && napi_complete_done(napi, work_done)) {
> + /* Re-enable RX/TX interrupts */
> + spin_lock_irqsave(&priv->lock, flags);
> + if (!info->irq_en_dis) {
> + ravb_modify(ndev, RIC0, mask, mask);
> + ravb_modify(ndev, TIC, mask, mask);
> + } else {
> + ravb_write(ndev, mask, RIE0);
> + ravb_write(ndev, mask, TIE);
> + }
> + spin_unlock_irqrestore(&priv->lock, flags);
> }
> - spin_unlock_irqrestore(&priv->lock, flags);
>
> -out:
> return work_done;
> }
>
> --
> 2.39.2
>
--
Kind Regards,
Niklas Söderlund
next prev parent reply other threads:[~2024-04-15 11:44 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-15 9:47 [net-next RFC v3 0/7] Improve GbEth performance on Renesas RZ/G2L and related SoCs Paul Barker
2024-04-15 9:47 ` [net-next RFC v3 1/7] net: ravb: Simplify poll & receive functions Paul Barker
2024-04-15 11:23 ` Niklas Söderlund
2024-04-15 11:31 ` Paul Barker
2024-04-15 9:47 ` [net-next RFC v3 2/7] net: ravb: Align poll function with NAPI docs Paul Barker
2024-04-15 11:44 ` Niklas Söderlund [this message]
2024-04-15 12:08 ` Paul Barker
2024-04-15 9:48 ` [net-next RFC v3 3/7] net: ravb: Refactor RX ring refill Paul Barker
2024-04-15 11:57 ` Niklas Söderlund
2024-04-15 12:18 ` Paul Barker
2024-04-15 12:30 ` Niklas Söderlund
2024-04-15 9:48 ` [net-next RFC v3 4/7] net: ravb: Refactor GbEth RX code path Paul Barker
2024-04-19 20:03 ` Sergey Shtylyov
2024-04-21 15:49 ` Paul Barker
2024-04-21 20:23 ` Sergey Shtylyov
2024-04-15 9:48 ` [net-next RFC v3 5/7] net: ravb: Enable SW IRQ Coalescing for GbEth Paul Barker
2024-04-19 20:26 ` Sergey Shtylyov
2024-04-15 9:48 ` [net-next RFC v3 6/7] net: ravb: Use NAPI threaded mode on 1-core CPUs with GbEth IP Paul Barker
2024-04-19 20:32 ` Sergey Shtylyov
2024-04-15 9:48 ` [net-next RFC v3 7/7] net: ravb: Allocate RX buffers via page pool Paul Barker
2024-04-15 12:16 ` Niklas Söderlund
2024-04-19 8:02 ` Paul Barker
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=20240415114419.GG3156415@ragnatech.se \
--to=niklas.soderlund+renesas@ragnatech.se \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=geert+renesas@glider.be \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=paul.barker.ct@bp.renesas.com \
--cc=s.shtylyov@omp.ru \
/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
all inboxes | Powered by JetHome®