Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Jens Emil Schulz Østergaard" <jensemil.schulzostergaard@microchip.com>
Cc: conor+dt@kernel.org, devicetree@vger.kernel.org, robh@kernel.org
Subject: Re: [PATCH net-next v7 7/9] net: dsa: lan9645x: add mac table integration
Date: Thu, 04 Jun 2026 07:26:44 +0000	[thread overview]
Message-ID: <20260604072644.C2EFE1F00899@smtp.kernel.org> (raw)
In-Reply-To: <20260603-dsa_lan9645x_switch_driver_base-v7-7-b2f90e676707@microchip.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] User-added static FDB entries are incorrectly filtered from FDB dumps
--

commit 0adfca5c0335ae394efbf6c915f6b33bdc9c1eee
Author: Jens Emil Schulz Østergaard <jensemil.schulzostergaard@microchip.com>

net: dsa: lan9645x: add mac table integration

This commit adds MAC table support and DSA FDB callback integration for
the lan9645x driver. It implements learning, flushing, and dumping of
MAC table entries.

> diff --git a/drivers/net/dsa/microchip/lan9645x/lan9645x_mac.c b/drivers/net/dsa/microchip/lan9645x/lan9645x_mac.c
> new file mode 100644
> index 0000000000000..1079e49f62718
> --- /dev/null
> +++ b/drivers/net/dsa/microchip/lan9645x/lan9645x_mac.c

[ ... ]

> +int lan9645x_mact_dsa_dump(struct lan9645x *lan9645x, int port,
> +			   dsa_fdb_dump_cb_t *cb, void *data)
> +{

[ ... ]

> +	while (1) {
> +		/* NOTE: we rely on mach, macl and type being set correctly in
> +		 * the registers from previous round, vis a vis the GET_NEXT
> +		 * semantics, so locking entire loop is important.
> +		 */
> +		lan_wr(ANA_MACACCESS_MAC_TABLE_CMD_SET(CMD_GET_NEXT) |
> +		       ANA_MACACCESS_ENTRYTYPE_SET(type),
> +		       lan9645x, ANA_MACACCESS);

[ ... ]

> +		/* Only dynamic entries are surfaced through the user port dump.
> +		 * ENTRYTYPE_LOCKED entries are already reported by the bridge
> +		 * master's ndo_fdb_dump as NTF_MASTER, so we avoid duplicating
> +		 * them as NTF_SELF.
> +		 * Entries toward the host (NTF_SELF) have DEST_IDX == CPU_PORT
> +		 * and are filtered out by the DEST_IDX check.
> +		 */
> +		if (ANA_MACACCESS_DEST_IDX_GET(maca) == port &&
> +		    type == ENTRYTYPE_NORMAL) {

[Severity: Medium]
Will this unconditional filter for ENTRYTYPE_NORMAL hide static FDB entries
from userspace?

The comment suggests ENTRYTYPE_LOCKED entries are skipped because they are
already reported by the bridge master. However:

1. Standalone DSA ports have no bridge master, yet users can add static FDB
entries to them (which are stored as ENTRYTYPE_LOCKED).

2. Entries explicitly added to the hardware table via "bridge fdb add ... self"
are not tracked by the software bridge.

If we filter out all ENTRYTYPE_LOCKED entries, won't these manually added
static MAC addresses become entirely invisible? Should this dump those entries
and pass true for the is_static argument to the callback instead, allowing the
DSA core to handle deduplication?

> +			addr = (u64)ANA_MACHDATA_MACHDATA_GET(mach) << 32 |
> +			       macl;
> +			u64_to_ether_addr(addr, mac);
> +			vid = ANA_MACHDATA_VID_GET(mach);
> +			if (vid > VLAN_MAX)
> +				vid = 0;
> +
> +			err = cb(mac, vid, false, data);
> +			if (err)
> +				break;
> +		}
> +	}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260603-dsa_lan9645x_switch_driver_base-v7-0-b2f90e676707@microchip.com?part=7

  reply	other threads:[~2026-06-04  7:26 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-03  7:25 [PATCH net-next v7 0/9] net: dsa: add DSA support for the LAN9645x switch chip family Jens Emil Schulz Østergaard
2026-06-03  7:25 ` [PATCH net-next v7 1/9] net: dsa: add tag driver for LAN9645X Jens Emil Schulz Østergaard
2026-06-03  7:25 ` [PATCH net-next v7 2/9] dt-bindings: net: lan9645x: add LAN9645X switch bindings Jens Emil Schulz Østergaard
2026-06-04  7:26   ` sashiko-bot
2026-06-03  7:25 ` [PATCH net-next v7 3/9] net: dsa: lan9645x: add autogenerated register macros Jens Emil Schulz Østergaard
2026-06-03  7:25 ` [PATCH net-next v7 4/9] net: dsa: lan9645x: add basic dsa driver for LAN9645X Jens Emil Schulz Østergaard
2026-06-03 12:37   ` Andrew Lunn
2026-06-04  7:26   ` sashiko-bot
2026-06-03  7:25 ` [PATCH net-next v7 5/9] net: dsa: lan9645x: add bridge support Jens Emil Schulz Østergaard
2026-06-03  7:25 ` [PATCH net-next v7 6/9] net: dsa: lan9645x: add vlan support Jens Emil Schulz Østergaard
2026-06-03  7:25 ` [PATCH net-next v7 7/9] net: dsa: lan9645x: add mac table integration Jens Emil Schulz Østergaard
2026-06-04  7:26   ` sashiko-bot [this message]
2026-06-03  7:25 ` [PATCH net-next v7 8/9] net: dsa: lan9645x: add mdb management Jens Emil Schulz Østergaard
2026-06-03  7:25 ` [PATCH net-next v7 9/9] net: dsa: lan9645x: add port statistics Jens Emil Schulz Østergaard
2026-06-04  7:26   ` sashiko-bot

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=20260604072644.C2EFE1F00899@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=jensemil.schulzostergaard@microchip.com \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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