mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nicolai Buchwitz <nb@tipi-net.de>
To: Eric Dumazet <edumazet@google.com>
Cc: Doug Berger <opendmb@gmail.com>,
	Florian Fainelli <florian.fainelli@broadcom.com>,
	Broadcom internal kernel review list
	<bcm-kernel-feedback-list@broadcom.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Justin Chen <justin.chen@broadcom.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next] net: bcmgenet: complete Tx NAPI after one reclaim pass
Date: Mon, 28 Sep 2026 15:31:35 +0200	[thread overview]
Message-ID: <d63f546d8a580cdec58d91ad06ecc26a@tipi-net.de> (raw)
In-Reply-To: <CANn89iK5RTtZLPAY+rJKCeUpLkCge+PFqfN-g_M184S9fyzSsg@mail.gmail.com>

On 28.9.2026 15:14, Eric Dumazet wrote:

> [...]

> Reviewed-by: Eric Dumazet <edumazet@google.com>
> 
> As a follow-up, you can get rid of ring->lock in the TX
> fastpath altogether (it looks like a leftover from before TX reclaim
> was moved to NAPI in commit 4092e6acf5cb ("net: bcmgenet: use NAPI for
> Tx completion")).

Thanks Eric, makes sense. I'll sent a follow up along with some some 
other findings.

> bcmgenet_xmit() is already serialized by the netdev queue lock, and
> bcmgenet_tx_poll() by NAPI. To make them lockless with respect to each
> other:
> 
> 1. Drop ring->free_bds and compute available space from
>    (READ_ONCE(ring->prod_index) - READ_ONCE(ring->c_index)) & 
> DMA_C_INDEX_MASK.
> 2. Use the lockless queue stop/wake helpers from <net/pkt_sched.h>
>    (netif_txq_maybe_stop() and __netif_txq_completed_wake()).
> 3. Ensure proper memory barriers between populating tx_cb_ptr /
>    writing TDMA_PROD_INDEX in bcmgenet_xmit() and reading
>    TDMA_CONS_INDEX / freeing tx_cbs in __bcmgenet_tx_reclaim() (since
>    bcmgenet uses readl_relaxed/writel_relaxed).
> 4. Avoid sharing ring->stats64.syncp between bcmgenet_add_tsb()
>    (tx_dropped) and __bcmgenet_tx_reclaim(), and serialize
>    bcmgenet_timeout() with napi_disable() + __netif_tx_lock_bh().

The timeout path needs rework anyway. It currently resets the ring
while TDMA is still running, which it definitely shouldn't.

> [...]

Regards,
Nicolai

      parent reply	other threads:[~2026-09-28 13:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-28 12:14 Nicolai Buchwitz
2026-09-28 13:14 ` Eric Dumazet
2026-09-28 13:24   ` Eric Dumazet
2026-09-28 13:31   ` Nicolai Buchwitz [this message]

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=d63f546d8a580cdec58d91ad06ecc26a@tipi-net.de \
    --to=nb@tipi-net.de \
    --cc=andrew+netdev@lunn.ch \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=florian.fainelli@broadcom.com \
    --cc=justin.chen@broadcom.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=opendmb@gmail.com \
    --cc=pabeni@redhat.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

all inboxes | Powered by JetHome®