๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #26835

Re: [PATCH net-next 2/3] net: ethernet: ti: cpsw: forward unknown VLANs in promiscuous switch mode

#26835
From: netdev-bot+sashiko
Date: Fri, 04 Dec 2026 08:53
133 lines
13540 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 patch may not fix what it says it fixes.
- [Medium] Suppose the Unknown VLAN register does control forwarding of
  unknown VIDs, as the commit message assumes.

--

net: ethernet: ti: cpsw: forward unknown VLANs in promiscuous switch mode

In legacy cpsw switch mode, this commit sets the ALE unknown VLAN member
list and the unknown and registered multicast flood masks to all ports
while the interface is promiscuous. It clears them again when promiscuity
is turned off. The goal is to let frames from VLAN-tagging DSA switches
such as LAN9303 reach the host.

> diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
> index 14350ec5b7d0c..1390bf5ecba8c 100644
> --- a/drivers/net/ethernet/ti/cpsw.c
> +++ b/drivers/net/ethernet/ti/cpsw.c
> @@ -150,11 +150,27 @@ static void cpsw_set_promiscious(struct net_device *ndev, bool enable)
>  
>  			/* Flood All Unicast Packets to Host port */
>  			cpsw_ale_control_set(ale, 0, ALE_P0_UNI_FLOOD, 1);
> +
> +			/* Forward packets of VLANs unknown to the ALE */
> +			cpsw_ale_control_set(ale, 0, ALE_PORT_UNKNOWN_VLAN_MEMBER,
> +					     ALE_ALL_PORTS);
> +			cpsw_ale_control_set(ale, 0, ALE_PORT_UNKNOWN_MCAST_FLOOD,
> +					     ALE_ALL_PORTS);
> +			cpsw_ale_control_set(ale, 0,
> +					     ALE_PORT_UNKNOWN_REG_MCAST_FLOOD,
> +					     ALE_ALL_PORTS);

[Severity: Medium]

Are these writes enough on their own while the ALE is still VLAN-aware?
In switch mode, cpsw_init_host_port() does this:

drivers/net/ethernet/ti/cpsw.c:cpsw_init_host_port() {
    ...
	cpsw_ale_control_set(cpsw->ale, HOST_PORT_NUM, ALE_VLAN_AWARE,
			     CPSW_ALE_VLAN_AWARE);
    ...
}

CPSW_ALE_VLAN_AWARE is 1, and this patch does not change ALE_CONTROL
bit 2.

As I recall, the CPSW TRM describes ALE_VLAN_AWARE as "0 = flood if VLAN
not found, 1 = drop packet if VLAN not found". I have not been able to
re-check that against the TRM. If the hardware works that way, the
unknown VLAN masks only apply in the VLAN-unaware case.

The LAN9303 source port VIDs would then still be dropped while the
conduit is promiscuous. cpsw.c never sets default_vlan, so the ALE only
knows VID 0 and the VIDs the host adds.

Two other things point the same way:

- gbe_init_host_port() in netcp_ethss.c is the only other in-tree user of
  these masks. It sets ALE_PORT_UNKNOWN_VLAN_MEMBER and never sets
  ALE_VLAN_AWARE.

- The sibling commit "net: ethernet: ti: cpsw_new: bypass ALE in
  promiscuous mode" fixes the same symptom with ALE_BYPASS, which works
  whatever VLAN_AWARE is set to. That commit has a Tested-by. This one
  does not, and the rest of the series seems to have been tested in
  dual_emac mode, which never reaches this branch.

Has legacy cpsw switch mode with only this patch been shown on hardware
to receive LAN9303-tagged frames? If not, the fix may need to clear
ALE_VLAN_AWARE or enable ALE_BYPASS while promiscuous.

If so, this part of the commit message would also need updating:

  "In switch mode the ALE is VLAN-aware and the Unknown VLAN register is
  left at its reset value, so frames tagged with a VID the ALE doesn't
  know are dropped even if the interface is promiscuous."

[Severity: Medium]

If these masks do take effect, does writing ALE_ALL_PORTS here also
forward unknown-VID frames between the two external slave ports, and not
just to the host?

ALE_ALL_PORTS is 0x7, which covers the host, port 1 and port 2. The
ALE_UNKNOWNVLAN fields are global (port_offset and port_shift are 0 in
ale_controls[]), so they apply to every ingress port.

This branch also sets ALE_PORT_NOLEARN and ALE_PORT_NO_SA_UPDATE on all
ports, so unknown-VID unicast is always flooded to every port in the
member list.

With LAN9303 on slave port 1, this seems to have three effects:

- Every frame LAN9303 sends to the CPU with a source-port VID is also
  flooded out slave port 2. DSA keeps the conduit promiscuous, so in
  practice this happens all the time.

- Host TX in switch mode is non-directed and goes through the ALE
  lookup, so DSA-tagged frames from the host also go out port 2.

- A device on slave port 2 can send frames with LAN9303 management VIDs.
  Those now reach the LAN9303 CPU port; before this patch they were
  dropped.

Some context makes this less of a change. Switch mode already gives known
VLANs ALE_ALL_PORTS membership through cpsw_add_vlan_ale_entry() and
cpsw_add_default_vlan(). Promiscuous mode already floods known-VLAN
unicast to both ports. So this extends an existing design choice.

Is it intended that VLAN filtering between the external ports stops
whenever the host is promiscuous, for example under tcpdump or DSA? If
so, could the commit message mention this side effect?

>  			dev_dbg(&ndev->dev, "promiscuity enabled\n");
>  		} else {

[ ... ]

-- 
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261203080514.577407-1-alexander.sverdlin%40siemens.com
Technical Details
Message-ID: <179637441631.3146.10682708359159776909@kernel.org>
Path: mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.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-377189-linux-kernel-netdev=dewy.ru
References: <20261203080514.577407-3-alexander.sverdlin@siemens.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.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-377189-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next 2/3] net: ethernet: ti: cpsw: forward unknown
 VLANs in promiscuous switch mode
Date: Fri, 04 Dec 2026 08:53:36 +0000
Organization: Usenet Network
Message-ID: <179637441631.3146.10682708359159776909@kernel.org>
References: <20261203080514.577407-3-alexander.sverdlin@siemens.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="2720943"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:pj1fp62A7Ez/xYrWKV4xSW+RlL4= sha256:3+cLCM7LNy5mD1TFql8PNuP/8eBR4rH7s9RfCTGw8C8=
	sha1:GKrIeGKgrOhb6ib+MG2L1mEwLEk= sha256:9HIuhm4G1dBXvwGWcq44nZx9TtN7G0VU/zwFo47ocD8=
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 B0407117B6C; Fri,  4 Dec 2026 11:53:57 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.639
X-Spam-Status: No, score=-3.639 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.24, 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 1XegWD3nfkEt;
	Fri,  4 Dec 2026 11:53:54 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-377189-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 5A4AA117B69; Fri,  4 Dec 2026 11:53:44 +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 CA7AA20C91; Fri,  4 Dec 2026 08:53:40 +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=1796374418;
	b=UI4OA+VjkvEj63Oc4YlQg/S84vWiaAXm7zBXnHQ8Mb5zmYnY1eo9AgaT9LGMDPIZcF4r
	 38cNDv95GdWYYnrJ/tnGKZPAXw5m1IkCmbEtV3H+Z2vtxCpzd9TssPAL6Dujky75baAOi
	 kGqdyttH/9LKl1oamsi8+c7D1ztRIMXB7OrySNA5UobNZST9680+TpQ8XExaC6/qyK5+J
	 s25lS6QVbpBkNW9ju8/GcdDIywIfgJpBpaPLgbzyV8C42M+MaFAWPpFxZromGbITwHpFI
	 2Sk1QBGJmoRLFH/HE720tLtLEMGHuKK1SpqwMZ8oVDI+x5Wr7/otkmsYG+g5x/riaLw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796374418;
	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=UF/IgZxEwtImoVRWhODP2cujyUKLLZ5VTjGFH9F+uQk=;
	b=LgGSLQrjLR1UrcgOqKQqptTMKuMXUucYqiydYVRg2bbL8vUq4dJzXm5W+mU/7wZNJ7wv
	 wIozQMEm3DQyLoSLZuuirrvHR1l3XT+tj+VVRE1YOxSI3PgC/yvxnY5kZyTJRVAf5dva1
	 AcpqR90hooM7qrVQi7uijGU4w+VRUYxx+DbrmreEZ/uxZUQK9m0mg9qbKWwtN0QVixsS/
	 StMjzCtuqVVtab9y2e6wX2g9lIvV+Mff1scAjujNou5Elh2z2Y+3PX4j7IGMlpRhiExi6
	 tnV0MBrh5/Pe0l0X0orcZUiayccxbZTZJ1iZRVOPt7y0ICt8AYkan1Rw2TUMKNGX9JQ==
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=NiQb1cos;
	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 AD00A606A322;
	Fri,  4 Dec 2026 08:53:38 +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=NiQb1cos
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=1796374417;
	b=R26yBg8ad5pYa52jtsHwUxmkrY0cS7nsKOQgkgYg5Qy5IUjWM4/UKuiDqzwxxhgAEutz
	 1AaQfpqbBt7dljo3WSwLXj8UN+0RCljLiOGigNwTU4yJRovBesZJySKLTH+U/lz0J3tng
	 LtCzPQ/QRYzMzU5kX8PjBL6i7QG95HyWdZgOmuaooWq1esW6HtZWSYbjMvBfo5lOQrbyJ
	 iLCPNQVxTzGmF8lY+SGGy9umdwa2pxlft6E/gbdG/5p7Ozz5fMIGTQVms0bg+B2fFrvs0
	 vqD4n1UmS00z/AJby2pE8ksr2mprMNTYin6dPUfjy+CjvR6rdUfenPpKrGIL7lohfXw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796374417;
	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=UF/IgZxEwtImoVRWhODP2cujyUKLLZ5VTjGFH9F+uQk=;
	b=ijb81JpGh8hhwxI1pORqknIuVVZ6rPMMJ2NhRNDk6segR7paMzpWtgMT2rD3zkUTmq9w
	 wJ3Nx5YQKdZREWK4hO95Nr2Gw6vzOAbcNAEB9LlgRMrbr0yYS1f9saPVGhPD0G0c0uHh1
	 XR/UCTbRJIoh3aVgabzgHo/+HMLoJLdV45HEWctihCB4CdVg8dF1dzrWBvdvxELGnE8jS
	 Y8TK+JQ+Op1QCsMSovF0gxLU5AhSosdPLobo3wDokiOM57axwdzX18atjP3EPwBAIjxpz
	 eJzMNBMex9ri4piBhOZQor6gTJkZctZuUm9PqAjjlv1sFwERCAXO7u8kPQTwmjCBbrA==
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=NiQb1cos;
	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 CCE43606A33C;
	Fri,  4 Dec 2026 08:53:37 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id B5C001F000CE;
	Fri,  4 Dec 2026 08:53:36 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1796374417;
	bh=UF/IgZxEwtImoVRWhODP2cujyUKLLZ5VTjGFH9F+uQk=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=NiQb1cosZXcsnyQN6lWDPoQAWSsGLf9zgXtlb3QesEExwgbludKOLvzv5igQ5p2Me
	 FwY6KBqoT1BiMbzcIWJNVKP3Gd5Q+rRm+L4ICFJP2CF8aWLYfWV4U9F7fZSrU6NPvD
	 By5U5oOdQpcbQvtYfHEzRpKupthSWWad5Fe0M7I0dxA/1ue1bD52QRj6EL4nzl5X0Q
	 Jiv8JyWgE2XslKruHst0cMvOipLKTINbr/aeYa/iPhgZ9D1gM6VYE9RdDzWK0aEXhr
	 8NOSIQp9+TL18ai2IzioNJ3NI8A7a/C0hjNn+g0IfaQPgmI0XOMfzaf4z2hikv/cNI
	 gLEWeuv4zzMSg==
X-Cc: netdev@vger.kernel.org, s-vadapalli@ti.com, rogerq@kernel.org,
 andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org,
 kuba@kernel.org, pabeni@redhat.com, kmehltretter@gmail.com,
 haokexin@gmail.com, lgs201920130244@gmail.com, aleksandr.loktionov@intel.com,
 ilias.apalodimas@linaro.org, m-karicheri2@ti.com, grygorii.strashko@ti.com,
 mugunthanvnm@ti.com, linux-omap@vger.kernel.org, lukas.stockmann@siemens.com
X-In-Reply-To: <20261203080514.577407-3-alexander.sverdlin@siemens.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