🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #21347

Re: [PATCH net v3 2/3] net: dsa: motorcomm: Do not inherit ports from dynamic FDB entries

#21347
From: netdev-bot+sashiko
Date: Mon, 23 Nov 2026 22:11
98 lines
11608 bytes
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · 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] When yt921x_fdb_join() (drivers/net/dsa/motorcomm/chip.c)
  finds an existing non-static (hardware-learned) entry for the (addr,…

--

net: dsa: motorcomm: Do not inherit ports from dynamic FDB entries

This patch changes yt921x_fdb_join() so that an existing non-static
(hardware-learned) entry for the same (address, VID) key has its egress
port mask replaced, not merged, when it is converted into a static
fdb/mdb entry.

> diff --git a/drivers/net/dsa/motorcomm/chip.c b/drivers/net/dsa/motorcomm/chip.c
> index 9a9e8ed76e01f..ea305159cd5e7 100644
> --- a/drivers/net/dsa/motorcomm/chip.c
> +++ b/drivers/net/dsa/motorcomm/chip.c
> @@ -799,7 +799,10 @@ yt921x_fdb_join(struct yt921x_priv *priv, const unsigned char *addr, u16 vid,
>  
>  	ctrl1 = val1 & ~YT921X_FDB_IO1_STATUS_M;
>  	ctrl1 |= YT921X_FDB_IO1_STATUS_STATIC;
> -	ctrl2 = val2 | YT921X_FDB_IO2_EGR_PORTS(ports_mask);
> +	ctrl2 = val2;
> +	if (ctrl1 != val1)
> +		ctrl2 &= ~YT921X_FDB_IO2_EGR_PORTS_M;
> +	ctrl2 |= YT921X_FDB_IO2_EGR_PORTS(ports_mask);

[Severity: Medium]
When a learned entry is turned into a static one here, only
YT921X_FDB_IO2_EGR_PORTS_M is cleared. Should the other attributes of the
learned entry be cleared as well?

The remaining OUT2 bits are written back through
yt921x_fdb_add_index_in12():

  YT921X_FDB_IO2_MOVE_AGING_STATUS_M   GENMASK(31, 30)
  YT921X_FDB_IO2_IGR_DROP              BIT(29)
  YT921X_FDB_IO2_EGR_DROP              BIT(17)
  YT921X_FDB_IO2_COPY_TO_CPU           BIT(16)
  YT921X_FDB_IO2_IGR_PRIO_EN           BIT(15)
  YT921X_FDB_IO2_PRIO_M                GENMASK(14, 12)
  YT921X_FDB_IO2_NEW_VID_M             GENMASK(11, 0)

YT921X_FDB_IO1_EGR_PRIO_EN in ctrl1 is kept as well, because only
YT921X_FDB_IO1_STATUS_M is replaced.

The other path that creates a static entry, yt921x_fdb_add(), writes
only the port mask to IN2:

	ctrl = YT921X_FDB_IO2_EGR_PORTS(ports_mask);
	res = yt921x_reg_write(priv, YT921X_FDB_IN2, ctrl);

The driver never sets any of the other IO1/IO2 attribute bits. That
means the contents of a static entry added through port_fdb_add or
port_mdb_add now depend on whether the switch learned the address
first. If the hardware fills in MOVE_AGING_STATUS or any of the drop,
copy or priority bits on a learned entry, the static entry inherits
them. yt921x_fdb_leave() also writes OUT1/OUT2 back with only the
egress ports changed, so nothing later clears that state.

This looks like the same kind of problem the commit message describes,
untracked hardware state carried into a DSA-installed static entry, but
handled only for the port mask.

The later patch in this series, "net: dsa: motorcomm: Rewrite FDB entry
on port migration", moves this logic into yt921x_fdb_update() and keeps
the same partial mask:

	if (join_ports_mask) {
		ctrl1 &= ~YT921X_FDB_IO1_STATUS_M;
		ctrl1 |= YT921X_FDB_IO1_STATUS_STATIC;
		if (ctrl1 != val1)
			ctrl2 &= ~YT921X_FDB_IO2_EGR_PORTS_M;
	}

So the issue is still present at the end of the series.

For the non-static case, could ctrl1/ctrl2 be rebuilt the way
yt921x_fdb_add() builds them (STATUS_STATIC plus FID and address in
IN1, only EGR_PORTS in IN2), instead of masking out a single field?

>  	if (ctrl1 == val1 && ctrl2 == val2)
>  		return 0;
>

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261119221110.1123578-1-mmyangfl%40gmail.com
Technical Details
Message-ID: <179547187187.3135.17425549919833355866@kernel.org>
Path: mbox-mo1.pugleaf.net!news-wdc.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-369810-linux-kernel-netdev=dewy.ru
References: <20261119221110.1123578-3-mmyangfl@gmail.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-wdc.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-369810-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net v3 2/3] net: dsa: motorcomm: Do not inherit ports from
 dynamic FDB entries
Date: Mon, 23 Nov 2026 22:11:11 +0000
Organization: Usenet Network
Message-ID: <179547187187.3135.17425549919833355866@kernel.org>
References: <20261119221110.1123578-3-mmyangfl@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="3996250"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:J6bnnWeRn5H0laJ5lPPA2csL8cc= sha256:WeUYoE+imebd+Dwy48UK0A4I8ejXkC3ghtoQWnmAGts=
	sha1:jjoN6szxeo1XUmzR/lWynfHJey0= sha256:XeTUHTsiSwoowW/0UElyNKxldoPTH9vVoOsqKIcETVQ=
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 53F5E125DC7; Tue, 24 Nov 2026 01:11:31 +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 IOEgvUmRTnVZ;
	Tue, 24 Nov 2026 01:11:27 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-369810-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 7480D125DC9; Tue, 24 Nov 2026 01:11:18 +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 10C6D29E3E; Mon, 23 Nov 2026 22:11:16 +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=1795471874;
	b=EIX8Wwp5l9Ooh6yK5RP+kRIQGDKXrHJRYYVXsHkOz27RxLkfN2TBcro9xhPdAQJtLzIh
	 NBwP1/lmsLOKqSyR0r+5B7MlnkHXCHaCzrWoWs8CqlBDtDyiphyVTsCw5LV6kET5hBiIv
	 1NdYorHBuKd7NnO5yjaJa5GcepdlG5N5w9nF6HHv8qzz3coorlTxLfcE/JJ1pNWE/+y+2
	 QEOkNZ/yASccpZ4zExHSOTZ0aXxkcgVKi7SPGzrX4jV5ENvumANXx/9/S9XGJ2xB95mOj
	 ivjNtpy2sPX9cP03TQtSiU5io1WPfg3RkTpRyMCwVxCmFoNX/+Vjh6tFt5O/Zcg1ciQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795471874;
	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=4gwJugCmV4Jl56bEvoUZykXNr9VR7iCQ2K2cfxnOECs=;
	b=kFMECxxQTPWg4Ib/1EA5VjinS+JvsrFZvwDAZRtZW9T1sB+wNRSjpWSqiYoXcgevcw64
	 RGpDB70qe4q8WGuPYEdnU5YsqVJ1b7XXMWLr8z/35OmEGlyI2cbZCKju28lt1pXsj6lAa
	 uf4uyRXk1JFevQOpcISdeVzoZG/GT16odYcnR4E/oje7q1IaBJH5SWPgltzUkC6flO+VJ
	 ooBIG6y2pkOl24JS56MygqlsuWl9ifT8/odQ2d8wDvlo2xEe2Q2d1S0il681vrNXpykOR
	 vtK7aIXnhkno+Mp3n30MQ+/5ObB6+u0Q5cGorgaeYIzqZh8m5VQpV3x25b0kVO0AoGg==
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=fzSJo8mL;
	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 7DBD6606A33A;
	Mon, 23 Nov 2026 22:11:14 +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=fzSJo8mL
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=1795471873;
	b=jGJfRnDxWj1N5Fp8BSaQQMB0fJ3HYo4RK6CbL/hHMZU+xaaQKg2Myf6lLnvGYufQp2FR
	 4Mgjvlefmf/wOTFzf1tDyy+/Ctg5XJeRiqvqiO1taz1vbvIG6PuOIVXraB4sB8Klf4eLI
	 tus0QyetQh69IknfXr5gLy7X5DVx5KY2sQwhZTAlU08qroN+LO1iGv4+7Hcij/8hbDTPE
	 iMCz2A+KCoNq1u1NHYr0oZik2mS8dd18qVRgFE8IicN2dYt05F9//Usd3+OfM8upUKb6o
	 nagHHfJm5uGfAjlOOXZiRs2erBr7dkZpJnb5rJCLCDmEHkmX7gBsfnSQngUA+g4PldA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795471873;
	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=4gwJugCmV4Jl56bEvoUZykXNr9VR7iCQ2K2cfxnOECs=;
	b=EItxyjTf/i4brdUTC3cBnLj4XtZuvme1LbuM6O9vDH3cXaU35qeKaDrvTYlFTZ9RJCCm
	 XGVCWYJyCYFJxx6VRwCu06F/MersH3koMwKNZMJkPnN8Oln7BtNDwrlrWKRIGjNciA4ln
	 BUaeoW1K0HQhmzEgXAAk38hYnIk1QB+FTfFrIFMVGr47pMaOlRnpqk9GU8He5uw3xJJZr
	 aCRnH9u6s+B2Y7Hpvwvg3OPd9Nn5QEQ5gIy9a3HPg+gmgfee3GolRI6g6g6e7dMnAZDxh
	 hhXZ4by271SXu0yysqUyK5H0WFmGKvBZ1Yo+KR2ogFQ1sfEZ5rcsJbNvJlC+AUvpn0w==
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=fzSJo8mL;
	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 9DD0B606A321
	for <netdev@vger.kernel.org>; Mon, 23 Nov 2026 22:11:12 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 51A821F000C0;
	Mon, 23 Nov 2026 22:11:12 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1795471872;
	bh=4gwJugCmV4Jl56bEvoUZykXNr9VR7iCQ2K2cfxnOECs=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=fzSJo8mLQ1ijHo9J2VDlKRn/CtcqEyV19WSq/l1pCqM4lfBGnv/qLFWnO53SqNlQ1
	 MqD+JOJP5JUxpIUgkp4q8LeEVJsKHXqqUIymI9rWw7tS5MqFn52klgTpbmRUxTLPaV
	 vmth04ptbJ3RsLOtpBHedNdehQbqCnp0ob2RNl113+ypmXA6MfMVMMjNWBJP3jg8A3
	 HPtD8G3P+F74mM1/Fsoo5fAtRK+VqKS0O3cA3+AvEC0Fb5nIYkTOgCOxfDELj5Bjnt
	 FanHwOXlR/RfvNz2jXH0AnpwD/dLbXuNf8VJCFH0FBWJGJSP4nL4dB/NFYq09GBORr
	 3oymWj5g4Nk8Q==
X-Cc: netdev@vger.kernel.org, andrew@lunn.ch, olteanv@gmail.com,
 davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com
X-In-Reply-To: <20261119221110.1123578-3-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