🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #14739

Re: [PATCH net-next v3 1/2] net: dsa: motorcomm: Report error when FDB fails to add

#14739
From: netdev-bot+sashiko
Date: Wed, 11 Nov 2026 22:41
122 lines
12260 bytes
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 2 · Low: 0

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] The code change is right, but the commit message gives a wrong
  reason for leaving out the Fixes: tag.
- [Medium] yt921x_fdb_add() in drivers/net/dsa/motorcomm/chip.c now
  treats only YT921X_FDB_RESULT_NOTFOUND (bit 14) as a failure of the…

--

net: dsa: motorcomm: Report error when FDB fails to add

This patch changes yt921x_fdb_add() to check the FDB result register
after the ADD operation finishes. If the hardware reports
YT921X_FDB_RESULT_NOTFOUND, the function now returns -ENOSPC instead of
success.

> Not carrying a fix tag: filling up 4096-entry table with static entries
> is just asking for trouble.

[Severity: Medium]
Is this reasoning accurate? Before this patch, a hardware ADD failure was
reported as success. DSA and the bridge then treated the entry as
offloaded even though the switch never installed it. That looks like it
dates back to 186623f4aa72 ("net: dsa: yt921x: Add support for Motorcomm
YT921x").

Admin-added static FDB entries are not the only way to fill the table.
yt921x_dsa_port_mdb_add() goes through the same path, and every entry it
writes is YT921X_FDB_IO1_STATUS_STATIC:

yt921x_dsa_port_mdb_add()
    yt921x_fdb_join()
        yt921x_fdb_add()

Bridge IGMP/MLD snooping is enabled by default. It allows up to
BR_MULTICAST_DEFAULT_HASH_MAX MDB entries, and that limit is also 4096:

net/bridge/br_private.h:
#define BR_MULTICAST_DEFAULT_HASH_MAX 4096

Those MDB entries are offloaded via switchdev into port_mdb_add. So it
seems hosts on the LAN could fill the shared hardware table just by
sending group joins. The same table also holds unicast static FDB
entries and host entries.

Also, the ADD is issued without YT921X_FDB_OP_MODE_INDEX, so the
hardware places the entry by MAC+FID. If the table uses
limited-associativity hash buckets, could ADD fail before all 4096
entries are in use? This depends on the datasheet.

Should this carry:

Fixes: 186623f4aa72 ("net: dsa: yt921x: Add support for Motorcomm YT921x")

so that stable kernels pick it up? If not, could the commit message
describe the failure conditions more precisely, and mention that MDB
entries are affected as well as unicast FDB?

> diff --git a/drivers/net/dsa/motorcomm/chip.c b/drivers/net/dsa/motorcomm/chip.c
> index 33e5fc127244d..a7a9a74393045 100644
> --- a/drivers/net/dsa/motorcomm/chip.c
> +++ b/drivers/net/dsa/motorcomm/chip.c
> @@ -725,7 +725,13 @@ yt921x_fdb_add(struct yt921x_priv *priv, const unsigned char *addr, u16 vid,
>  	if (res)
>  		return res;
>  
> -	return yt921x_fdb_wait(priv, &val);
> +	res = yt921x_fdb_wait(priv, &val);
> +	if (res)
> +		return res;
> +	if (val & YT921X_FDB_RESULT_NOTFOUND)
> +		return -ENOSPC;
> +
> +	return 0;

[Severity: Medium]
What should happen when YT921X_FDB_RESULT_OVERWRITED is set here? The
result register defines it in chip.h next to NOTFOUND:

#define  YT921X_FDB_RESULT_NOTFOUND		BIT(14)
#define  YT921X_FDB_RESULT_OVERWRITED		BIT(13)

Nothing in the driver reads it.

yt921x_fdb_join() only calls yt921x_fdb_add() after yt921x_fdb_has() has
reported the {MAC, FID} key absent, with reg_lock held:

	res = yt921x_fdb_has(priv, addr, vid, &index);
	if (res)
		return res;
	if (index >= YT921X_FDB_NUM)
		return yt921x_fdb_add(priv, addr, vid, ports_mask);

So an overwrite here probably means some other entry in the same bucket
was replaced. The exception would be a dynamic entry for this key being
learned between the two operations.

If the hardware can evict an earlier static FDB or MDB entry this way,
this would return 0 while that entry silently disappears from the
switch. A later yt921x_fdb_leave() for it would then see NOTFOUND and
also return 0.

Could OVERWRITED mean a static entry was evicted? If it only ever means
a dynamic entry was replaced, a short comment saying why it is safe to
ignore might help.

>  }
>  
>  static int

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261109163117.1792478-1-mmyangfl%40gmail.com
Technical Details
Message-ID: <179443687465.2199510.164035927002629092@kernel.org>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-361319-linux-kernel-netdev=dewy.ru
References: <20261109163117.1792478-2-mmyangfl@gmail.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-361319-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v3 1/2] net: dsa: motorcomm: Report error when
 FDB fails to add
Date: Wed, 11 Nov 2026 22:41:14 +0000
Organization: Usenet Network
Message-ID: <179443687465.2199510.164035927002629092@kernel.org>
References: <20261109163117.1792478-2-mmyangfl@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="960292"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:s+0rgDOVl1j29BE92ZBuvCe+nK0= sha256:KLFHXRihYMyNR1WhAXvkZxx9Z2MSEAZwOID0yhWSVkA=
	sha1:AHzh1rrx/8HujRJgLtoAqHKEkcA= sha256:9Jj4Nlyqqj2eXxqbMrDOtXfJZ6VdODyfHV/lI5KFPiU=
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 07F7111403D; Thu, 12 Nov 2026 02:10:04 +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 u1t_8z2B5TJy;
	Thu, 12 Nov 2026 02:10:00 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-361319-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 sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4])
	by mail.dewy.ru (Postfix) with ESMTPS id BA053114040; Thu, 12 Nov 2026 02:09:49 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sin.lore.kernel.org (Postfix) with ESMTP id 82682A27D4; Wed, 11 Nov 2026 22:41:19 +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=1794436876;
	b=eduOYtw2pRwVjGLIiwGIFWc6/K8xw7LyGVb+xQ5MlFtgbhq61B6xIQBQx0tL2o2nAXxo
	 tdK+/tDoKT0xIvcHIC/R96RXX24YGhZy48KltwvokCU2mWnmVTUt7NcQJ3AMfscrEkd6q
	 yBdLJIlQoq7Q0K/QfpMVykD3fat8xix4vk6itWfOO7vVirG9xIMMVKoFh+6gpwOOd79HQ
	 yO8lxpduimNhL/zGDO6RGvKa6sDynEDtTpGZLbaVHAT10PmOI8r8bLU6W3CrVndY/5jtc
	 jZwsO7sSjzhvbUf7CV+gWVJ8mnh2Rgk+FsmLduSEzlws+HV/J1zeNYM8uQ3Aee2nj4w==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794436876;
	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=KjPWGZ6X8LI0nWH7eBTwaOpqqKITpEprmePla9/9J4Y=;
	b=YNylMn5qAIbK+mL7fePMeAnqxbX5wYDaG3PV9qAPyXcR9l3WgdKKLYc1ZQYTd5gi83QA
	 hKbQKk2Hf87nLdtgqqlXXhzc5fseKUzo7t+QgHt1DQxJGzTcRlT6HTtrauWwO3ShxkECd
	 x/2evrSpgfgEL3EwRcANFzbRXYJCjIRKoiJC8P9zUzGi/Pf9qAQn9yvsQl3zqm7Q7lTs4
	 tZ0O+zSfgQSdreQvoSjHMk4UGyBW/Rrxlnm7vgBb9I2jmhbuLzrhlM+aYa854u0UdWClX
	 2RueYLK2pR/zqrhHemJkpqVz6yhAxlnmhQEQK8DBW3nKYv7YmxtFJxv04ptB8d4LeAg==
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=D9BSCHj6;
	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 C346F606A334;
	Wed, 11 Nov 2026 22:41:16 +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=D9BSCHj6
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=1794436876;
	b=3rajCSzIGxY5uNLxi7hpeepyOqmiftVYn/pmSznlsMKBoyBcMoA6CDJ8xhpQ8MEzNzmH
	 0XIq6Qs9B/hQ5sLS6aPaxUEpJ6YoFmMDMGC05rBzwv5F0tsrWt7i72XxpLDykLeZXvoYz
	 6YTkVYK9BzLRnYM2uRDl8ecB3mi6/5LeFwxgBF5lwo8NMN1mK/6bNDe7fXDksuEsr8dSn
	 B9kNdXaPkWkHntvgy2LGxJFgQRuPHAQJ84yz7NW3h1I48he5w/AUjcDb8HLUaySLq5NaZ
	 7Onn+CJyDDdX2XklUhxud0H+g7IGq2SnSDvdaHNMKgoH6rfeYLa6xq91oYiYe6n4/JA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794436876;
	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=KjPWGZ6X8LI0nWH7eBTwaOpqqKITpEprmePla9/9J4Y=;
	b=iiwcYAafVWRjcrWJrhdgpZ2KPHJDqLhTUT6kgIdKJVTMRp8G753dcG9fqNWN6CjaNZvH
	 suWG7IS3exhtz15ZIz5MmpaXJ/SDh6zayNAIbQ/xoySscvSfCawp0MQbEPQEGEZMgb3fN
	 f39HQnaLtYNVAXoYiyHRvPk8uaNcGpVB8xwcVnlCWvhjGM91gidPvI8eUmqm1Pd+y9OrH
	 s57bv+ERSJDF5lmaibYlbE/S2I0+RnS6KIZvXf4BcoNtIECFskSxmr5QrpHHbxrGDf0JI
	 L0ZMf0vRSEmEzmkHXuPG/AAWfJ4SzNLI6sbpzqkcv2DjZUT8Gg1Ul/f8Q4d+DLVCkpA==
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=D9BSCHj6;
	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 E22B2606A31C;
	Wed, 11 Nov 2026 22:41:15 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 20B3D1F00A05;
	Wed, 11 Nov 2026 22:41:15 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1794436875;
	bh=KjPWGZ6X8LI0nWH7eBTwaOpqqKITpEprmePla9/9J4Y=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=D9BSCHj6ygOt+zV5A9LFVhRKoVP+9idURa9MD/hNbbO7IOXVbS2r7TLtktOlaurDV
	 kRazBAykt2la0ESAw7xHOnXQyezTOSgh/PkILJgcilfKCcHrclZpyzjwdZ2XWAN+xM
	 scZHfkSabSVJO/adW54wJwYwmrp+N0+ac+aX4ndbY1LP1aDpZoDf+9VMjy5B4VqwCr
	 EqNCUww+RubaC9uqgf9yUbyX+E4IsRKZ3rQKLxftDgBDNPTFdndo3r+7ZpSZQprHvj
	 jhShirE046o9aopOoSMFxGy8hnEPE8oEpNqXW17GwLMLwBZsFYllc21lqgrY5QX7yb
	 jWdOmKnK0CBVg==
X-Cc: netdev@vger.kernel.org, andrew@lunn.ch, olteanv@gmail.com,
 davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com,
 linux-kernel@vger.kernel.org
X-In-Reply-To: <20261109163117.1792478-2-mmyangfl@gmail.com>
X-sashiko-severity: Medium
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