mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Florian Fainelli <florian.fainelli@broadcom.com>
To: netdev-bot+sashiko@kernel.org
Cc: netdev@vger.kernel.org, jonas.gorski@gmail.com, andrew@lunn.ch,
	olteanv@gmail.com, davem@davemloft.net, edumazet@kernel.org,
	kuba@kernel.org, pabeni@redhat.com, vivien.didelot@gmail.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net v5 4/8] net: dsa: b53: reject conflicting mirror destinations
Date: Mon, 16 Nov 2026 12:38:37 -0800	[thread overview]
Message-ID: <95351c58-777c-439b-93d5-c07c5d91a760@broadcom.com> (raw)
In-Reply-To: <179485573878.3136.15805681245029216909@kernel.org>

On 11/16/26 11:02, netdev-bot+sashiko@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found more severe
> issue(s) in other patches of this series. This mail is only an FYI, in case
> you want to address the nit picks below when you respin.
> 
> Low priority / nit picks for your consideration:
> 
> - [Low] The commit message describes the b53_mirror_del() capture-port
>    change as a separate bug fix ("This also fixes b53_mirror_del() ... a…
> 
> --
> 
> net: dsa: b53: reject conflicting mirror destinations
> 
> This patch makes b53_mirror_add() read B53_MIR_CAP_CTL before it changes
> any source mask. While mirroring is enabled, it rejects a rule for a
> different capture port and returns an extack message. It also changes
> b53_mirror_del() so that the whole CAP_PORT_MASK field is cleared along
> with MIRROR_EN when the last source is removed.
> 
>> Clear the capture-port field when the final source is removed so a later
>> rule can select a new destination. This also fixes b53_mirror_del(),
>> which tried to clear the destination with ~mirror->to_local_port. That
>> only cleared the bits set in the port number, so a stale capture port
>> could remain after the last source was removed.
> 
> [Severity: Low]
> Is this paragraph accurate? A later rule doesn't seem to need
> b53_mirror_del() to clear CAP_PORT_MASK in order to select a new
> destination.
> 
> In drivers/net/dsa/b53/b53_common.c, the new conflict check in
> b53_mirror_add() only applies while MIRROR_EN is set:
> 
> 	if ((cap_ctl & MIRROR_EN) &&
> 	    (cap_ctl & CAP_PORT_MASK) != mirror->to_local_port) {
> 
> The add path also always rewrites the field:
> 
> 	cap_ctl &= ~CAP_PORT_MASK;
> 	cap_ctl |= mirror->to_local_port;
> 	cap_ctl |= MIRROR_EN;
> 
> b53_mirror_del() clears MIRROR_EN in the same statement. Once that bit
> is clear, leftover bits in CAP_PORT_MASK affect neither the hardware nor
> the check.
> 
> Before this patch, the old reg &= ~mirror->to_local_port could leave a
> stale value in only one case: after one rule had overwritten another
> rule's destination. This patch now rejects that case. Even then,
> MIRROR_EN was cleared at the same time, and the next add overwrote the
> field.
> 
> A later patch in this series, "net: dsa: b53: harden mirror register
> programming", describes the same change this way: "Clearing the inactive
> capture-port field is cleanup."
> 
> Could the commit message call the b53_mirror_del() change a cleanup
> instead of a separate fix?
> 

Sashiko's point is correct. b53_mirror_del() clears MIRROR_EN in the 
same write, and the add path always rewrites CAP_PORT_MASK. A stale 
capture port therefore has no effect on the hardware or on the conflict 
check. I have reworded the paragraph accordingly.

pw-bot: cr
-- 
Florian

  reply	other threads:[~2026-11-16 20:38 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-12 18:01 [PATCH net v5 0/8] net: dsa: b53: Preliminary fixes Florian Fainelli
2026-11-12 18:01 ` [PATCH net v5 1/8] net: dsa: b53: initialize the jumbo frame size register offset Florian Fainelli
2026-11-12 18:01 ` [PATCH net v5 2/8] net: dsa: b53: fix the SRAB grant timeout check Florian Fainelli
2026-11-12 18:01 ` [PATCH net v5 3/8] net: dsa: b53: clear stale state when creating an ARL entry Florian Fainelli
2026-11-16 19:02   ` netdev-bot+sashiko
2026-11-16 20:37     ` Florian Fainelli
2026-11-12 18:01 ` [PATCH net v5 4/8] net: dsa: b53: reject conflicting mirror destinations Florian Fainelli
2026-11-16 19:02   ` netdev-bot+sashiko
2026-11-16 20:38     ` Florian Fainelli [this message]
2026-11-12 18:01 ` [PATCH net v5 5/8] net: dsa: b53: use the correct override register 2 Gbps bit Florian Fainelli
2026-11-16 19:02   ` netdev-bot+sashiko
2026-11-16 20:41     ` Florian Fainelli
2026-11-12 18:02 ` [PATCH net v5 6/8] net: dsa: b53: reference count shared mirror source bits Florian Fainelli
2026-11-16 19:02   ` netdev-bot+sashiko
2026-11-16 20:42     ` Florian Fainelli
2026-11-12 18:02 ` [PATCH net v5 7/8] net: dsa: b53: harden mirror register programming Florian Fainelli
2026-11-16 19:02   ` netdev-bot+sashiko
2026-11-16 20:47     ` Florian Fainelli
2026-11-12 18:02 ` [PATCH net v5 8/8] net: dsa: b53: fix mirror port encoding on BCM5325 and BCM5365 Florian Fainelli

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=95351c58-777c-439b-93d5-c07c5d91a760@broadcom.com \
    --to=florian.fainelli@broadcom.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=jonas.gorski@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev-bot+sashiko@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=pabeni@redhat.com \
    --cc=vivien.didelot@gmail.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®