Article View: linux.kernel.netdev
Article #22397Re: [PATCH net-next 3/5] net: dsa: lan9645x: add mac table integration
From: netdev-bot+sashiko
Date: Wed, 25 Nov 2026 08:58
Date: Wed, 25 Nov 2026 08:58
103 lines
11468 bytes
11468 bytes
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] __lan9645x_mact_learn() in
drivers/net/dsa/microchip/lan9645x/lan9645x_mac.c decides whether aโฆ
--
net: dsa: lan9645x: add mac table integration
This commit adds MAC table support to the lan9645x DSA driver and wires
up port_fast_age, port_fdb_dump, port_fdb_add and port_fdb_del. It also
enables FDB isolation and assisted learning on the CPU port. A CPU learn
failure flagged in ANA_ANEVENTS.CPU_LEARN_FAILED is reported as -ENOSPC.
> 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..9da03d0369f5d
> --- /dev/null
> +++ b/drivers/net/dsa/microchip/lan9645x/lan9645x_mac.c
[ ... ]
> +static int __lan9645x_mact_learn(struct lan9645x *lan9645x, int port,
> + const unsigned char mac[ETH_ALEN],
> + unsigned int vid,
> + enum macaccess_entry_type type,
> + bool cpu_copy)
> +{
> + int err;
> +
> + lockdep_assert_held(&lan9645x->mact_lock);
> +
> + lan9645x_mac_select(lan9645x, mac, vid);
> +
> + lan_wr(ANA_MACACCESS_VALID_SET(1) |
> + ANA_MACACCESS_DEST_IDX_SET(port) |
> + ANA_MACACCESS_MAC_CPU_COPY_SET(cpu_copy) |
> + ANA_MACACCESS_ENTRYTYPE_SET(type) |
> + ANA_MACACCESS_MAC_TABLE_CMD_SET(CMD_LEARN),
> + lan9645x, ANA_MACACCESS);
> +
> + err = lan9645x_mac_wait_for_completion(lan9645x, NULL);
> + if (err)
> + return err;
> +
> + if (ANA_ANEVENTS_CPU_LEARN_FAILED_GET(lan_rd(lan9645x, ANA_ANEVENTS))) {
> + lan_wr(ANA_ANEVENTS_CPU_LEARN_FAILED, lan9645x, ANA_ANEVENTS);
> + return -ENOSPC;
> + }
[Severity: Low]
Could a stale CPU_LEARN_FAILED bit cause a spurious -ENOSPC here?
CPU_LEARN_FAILED is a sticky write-one-to-clear bit. The only
unconditional clear is in lan9645x_mac_init(), after CMD_INIT. The only
other clear is on this failure path. Nothing clears the bit before
CMD_LEARN is written to ANA_MACACCESS.
Two cases can leave the bit set:
- An earlier learn takes the early return because
lan9645x_mac_wait_for_completion() timed out or got a read error.
That skips the ANEVENTS check. If the learn later finishes in
hardware and fails, the bit stays set.
- The lan_rd() or lan_wr() of ANA_ANEVENTS fails. Both only
WARN_ON_ONCE on regmap errors.
The next, unrelated learn under mact_lock would then see the stale bit,
clear it and return -ENOSPC. The hardware will still have installed the
new LOCKED entry.
For host addresses on the CPU port, the chain is:
lan9645x_fdb_add()
lan9645x_mact_learn()
__lan9645x_mact_learn() -> -ENOSPC
Because of that error, dsa_port_do_fdb_add() does not record the
address. A later delete gets -ENOENT from dsa_mac_addr_find() and never
calls .port_fdb_del. The LOCKED entry that points at PGID_CPU would stay
in the MAC table. It never ages out and it takes one of the four buckets
in its row.
The mdb code added later in the series ("net: dsa: lan9645x: add mdb
management") goes through the same lan9645x_mact_learn() path.
Would it help to write ANA_ANEVENTS_CPU_LEARN_FAILED just before issuing
CMD_LEARN? Then the bit would only reflect the current command.
> +
> + return 0;
> +}
[ ... ]
--
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261124-dsa-lan9645x-add-vlan-and-bridge-offload-v1-0-b930a1dae700%40microchip.com
Technical Details
Message-ID:
<179559710763.3135.13351843539834779917@kernel.org>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-371147-linux-kernel-netdev=dewy.ruReferences:
<20261124-dsa-lan9645x-add-vlan-and-bridge-offload-v1-3-b930a1dae700@microchip.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-371147-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net-next 3/5] net: dsa: lan9645x: add mac table integration Date: Wed, 25 Nov 2026 08:58:27 +0000 Organization: Usenet Network Message-ID: <179559710763.3135.13351843539834779917@kernel.org> References: <20261124-dsa-lan9645x-add-vlan-and-bridge-offload-v1-3-b930a1dae700@microchip.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="160671"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:LvxmTHBY4u1DUMB4+/N9fMHS15s= sha256:y/VJxiTRH0hMNKJyNGet//ujyAOPBuRUDXawHWBYfrE= sha1:1CtXYQZQPhqiCh9JMgyFGBXLZtw= sha256:ZI5lO8Ey50OMOVg3I6ZRuwlnMwXqtM2C2YWroe4YAYY= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 9AE7E125E42; Wed, 25 Nov 2026 11:58:45 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.4 X-Spam-Status: No, score=-3.4 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 9LXW8-GhzyU5; Wed, 25 Nov 2026 11:58:41 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-371147-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id E0DBB125E35; Wed, 25 Nov 2026 11:58:32 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by tor.lore.kernel.org (Postfix) with ESMTP id B602638F6A; Wed, 25 Nov 2026 08:58:30 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1795597109; b=2RtydZZHYLM+OjMqQYC0z6jNoacX3BV+c0dK7iAWQ9n6LrLdRW2szzg9Mj6Z1UKjRcvq sHWc2c4FGGiY3UuqWc0vTJODu6RXeYAt8C2XBnqNHOQnD9Tw7Se/6jIZpaQS40fBRQy4f i7bIE0J2VaFNJ7lRIhfhN0wEC1mpTg7RJgIVDOzvQpN+oh1k55FYr4sQttvhnDWhalFWh 6swK8KOVSHJBfzyvzkkkYFr+zXtQvq1N5G4gbKwHmzX/rH/LR9DXr7R5+/alEyWZWPpG5 KvR5arGD/jVNO2oA3aq+GJKr4KmFvuU72C3DIqORSzKniNaufQCvB35oURrCKOwGnDw== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795597109; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=mRP9hIoi3pw5vrZtCIj+mOt5jd3Zzi4d0ov9dcY//Xo=; b=A8UE9OuAbFnVJfNsVBr1yGku4bWpe/RL7Ad0ktJfHGHeepY+wEfDL7GapfL8tcZu8LGY vUzIPdTOU1SGmBCELh6yLU8zKPQ23U7fVuP7H35FeGxNR1Sp55H7Mllg8CaMWhf93zmWF 1I9U2l9EGOXdBMXgtEKYq6baCG1x9pm901ltI0Ou+gwB4HIzIFEERYUJeLEBNJwQoq6lL prhWMZh8dI6df4837x9pssmWynjXzR0oB61X256ZXXRs0Bzf7RqNARKZS8sbmNWU/0Gmf CQTKBekmyxxx9CGdvSs4FZ/GUgQCLk3qDynSUiEtkXUSt0Zt+3PN4FNg66L1vBbSYCw== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=RvGwR+y6; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BD02C606A333; Wed, 25 Nov 2026 08:58:29 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=RvGwR+y6 X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795597108; b=U2QROst98tQ29WIbcA5ErrqaLjGfKEW1ehQ9HtmHxnUMEF4g+Ldmh42WWBE9bkKeAa1k SOI4g3IVKhnwIM+7NK1j4ccgiJ6ov/nyNftRjAp6dEiC0raxSPVmJvv5xxWwBV3jrsEVA nvIprfOcqQs9qrSS3rQVkYCa5jPNkxpPit4mGvv5eEH17w2OzBcQze1NkhQOSJQ9WLsE2 qifhIIo0QSWmnHUlho4VA8ob1SwRFn3UJmMMV/sM7af262852AABpUbWuRACPhQ9ydMak 4m+93FGl1KEoMeduVk4AS1gCq93C9r9WEjPD32SJuUPBI7nGkGyTQEqnR9IZQOTyu5Q== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795597108; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=mRP9hIoi3pw5vrZtCIj+mOt5jd3Zzi4d0ov9dcY//Xo=; b=tHHx4dcjv5JNfGOZSeOBtNiFYCjGyO8bonHrm4trAGkFpL/XakH1bDFoM+t7q2cmGx5D 78KPy7LJYjDWr/SgEmPZq1CxCK34JdmVK39ClMXuPq4zxQjPbWX2fJubq1TzTyop0cjfQ 81/W96Vlb413/IB6kPHjqTaZXiY/VwoIU+vhqNlRt8VvCtsTIEy04gbYKKKjUG0cts2gn 4nkmIWKiZ59TRHWK+CVON2XmvnPO8ki1KnSlIc9DwJ8GmPBSKt8Xm0UvGj/2PJKEefK+4 KClso50IMrbHJ4SSNyFV+tfWHcIVvWBcFRoPsfUfYaG/u4X2dhCbKQ/tMJVEq11Z+Zg== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=RvGwR+y6; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D8BE1606A31E; Wed, 25 Nov 2026 08:58:28 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 15AF41F000C4; Wed, 25 Nov 2026 08:58:28 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795597108; bh=mRP9hIoi3pw5vrZtCIj+mOt5jd3Zzi4d0ov9dcY//Xo=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=RvGwR+y6KMgRRTxkENtPUydm1MWOMeDw4ePB9hbtv6a3YWBXbY/Wf47kACgDd2ZyQ IoAqc1Jmuk8UFd0z/uRK9M+i4Yt7N2BNPFZTWNotSNxDShYiQ/QJB+ANwboBeCdhYY +uH8T2PA6lFduSW6LjFJnvY/atuR/4DgZK+7BpJV9nI2YF1MlQt3+2TQQZh5sM4pVo 7/+l8xwXzxVMIG4Z+j7dnn+WXysCj15rT2AmJu1bDnJaziyKg8p9lPuzyDs8JS3hUQ c83693Hd5N3+1mSVQws/fx7hSRe4922nkXjxt9sJ5VkUDOiiicUa2oJ09j0kfxi2Vh skLobAIECEOyw== X-Cc: UNGLinuxDriver@microchip.com, andrew@lunn.ch, olteanv@gmail.com, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, linux@armlinux.org.uk, linux-kernel@vger.kernel.org, netdev@vger.kernel.org X-In-Reply-To: <20261124-dsa-lan9645x-add-vlan-and-bridge-offload-v1-3-b930a1dae700@microchip.com> X-sashiko-severity: Low X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list