From nobody Fri Dec 19 20:50:59 2025 Received: from pidgin.makrotopia.org (pidgin.makrotopia.org [185.142.180.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 70DC230C341; Wed, 15 Oct 2025 22:32:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.142.180.65 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760567534; cv=none; b=kqGHU92EInosh5yo+PzLJrC2P5r1fS8+UBzBofoA0sDV78jOV/ZIwJ7O9zuZJtCAOlHaOfvwdlMGxgeBn1GOyyBJIzlth3KN8DuGfIIDcLkihEa2VtnWMbPkuye+3O3PYxSunvwSk2onBtNtM7F/FMlTqN+hVArPl0qprKQiDvM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760567534; c=relaxed/simple; bh=i4MtLydCOkah6LEWx1Hc9n1iNqvBqkn1EqVksiJBB5w=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Xc5yr+3rWUIsulpNdkSCxyzrizv/W4QhAr5cBqMEyRVd+5mHHSdX1OsOoq3OWba9UlhyOsay8Ldu15htgliBoyG2uj+ayybLLqOOBPXZpPRaQt6qJDLa6ejfeLGSMfMoj9oh2LX7F2M/K6Z/wbzz1oeEe5c9MtrYfSC7LnzMiUU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org; spf=pass smtp.mailfrom=makrotopia.org; arc=none smtp.client-ip=185.142.180.65 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=makrotopia.org Received: from local by pidgin.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.98.2) (envelope-from ) id 1v9A2S-000000006UK-3f4Q; Wed, 15 Oct 2025 22:32:08 +0000 Date: Wed, 15 Oct 2025 23:32:05 +0100 From: Daniel Golle To: Hauke Mehrtens , Andrew Lunn , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Andreas Schirm , Lukas Stockmann , Alexander Sverdlin , Peter Christen , Avinash Jayaraman , Bing tao Xu , Liang Xu , Juraj Povazanec , "Fanni (Fang-Yi) Chan" , "Benny (Ying-Tsan) Weng" , "Livia M. Rosu" , John Crispin Subject: [PATCH net-next 01/11] net: dsa: lantiq_gswip: support bridge FDB entries on the CPU port Message-ID: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Vladimir Oltean Currently, the driver takes the bridge from dsa_port_bridge_dev_get(), which only works for user ports. This is why it has to ignore FDB entries installed on the CPU port. Commit c26933639b54 ("net: dsa: request drivers to perform FDB isolation") introduced the possibility of getting the originating bridge from the passed dsa_db argument, so let's do that instead. This way, we can act on the local FDB entries coming from the bridge. Note that we do not expect FDB events for the DSA_DB_PORT database, because this driver doesn't fulfill the dsa_switch_supports_uc_filtering() requirements. So we can just return -EOPNOTSUPP and expect it will never be triggered. Signed-off-by: Vladimir Oltean Signed-off-by: Daniel Golle --- drivers/net/dsa/lantiq/lantiq_gswip.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/net/dsa/lantiq/lantiq_gswip.c b/drivers/net/dsa/lantiq= /lantiq_gswip.c index 2169c0814a48..91755a5972fa 100644 --- a/drivers/net/dsa/lantiq/lantiq_gswip.c +++ b/drivers/net/dsa/lantiq/lantiq_gswip.c @@ -1140,9 +1140,9 @@ static void gswip_port_stp_state_set(struct dsa_switc= h *ds, int port, u8 state) } =20 static int gswip_port_fdb(struct dsa_switch *ds, int port, - const unsigned char *addr, u16 vid, bool add) + struct net_device *bridge, const unsigned char *addr, + u16 vid, bool add) { - struct net_device *bridge =3D dsa_port_bridge_dev_get(dsa_to_port(ds, por= t)); struct gswip_priv *priv =3D ds->priv; struct gswip_pce_table_entry mac_bridge =3D {0,}; unsigned int max_ports =3D priv->hw_info->max_ports; @@ -1150,10 +1150,6 @@ static int gswip_port_fdb(struct dsa_switch *ds, int= port, int i; int err; =20 - /* Operation not supported on the CPU port, don't throw errors */ - if (!bridge) - return 0; - for (i =3D max_ports; i < ARRAY_SIZE(priv->vlans); i++) { if (priv->vlans[i].bridge =3D=3D bridge) { fid =3D priv->vlans[i].fid; @@ -1188,14 +1184,20 @@ static int gswip_port_fdb_add(struct dsa_switch *ds= , int port, const unsigned char *addr, u16 vid, struct dsa_db db) { - return gswip_port_fdb(ds, port, addr, vid, true); + if (db.type !=3D DSA_DB_BRIDGE) + return -EOPNOTSUPP; + + return gswip_port_fdb(ds, port, db.bridge.dev, addr, vid, true); } =20 static int gswip_port_fdb_del(struct dsa_switch *ds, int port, const unsigned char *addr, u16 vid, struct dsa_db db) { - return gswip_port_fdb(ds, port, addr, vid, false); + if (db.type !=3D DSA_DB_BRIDGE) + return -EOPNOTSUPP; + + return gswip_port_fdb(ds, port, db.bridge.dev, addr, vid, false); } =20 static int gswip_port_fdb_dump(struct dsa_switch *ds, int port, --=20 2.51.0 From nobody Fri Dec 19 20:50:59 2025 Received: from pidgin.makrotopia.org (pidgin.makrotopia.org [185.142.180.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AFC0B19F48D; Wed, 15 Oct 2025 22:32:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.142.180.65 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760567545; cv=none; b=WVfXZj+l8BPFVx8wa9560Z1NhiWpgpDBDH6LTPeKZxKNYTLcobGS0IGwp6L7oQKXobjzGuA3J81EV8ATOcbH4uB40WrY+Z6s4m8ZEEeI7RUOKreS3MOowYeajBY1TevMjUHbrCJkiQ1aKZCrx+l5D0xFxjMgM5Xjls1wN9uItS0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760567545; c=relaxed/simple; bh=U9blwsk4OVt9UrRakM3tsBcbBMnypAVW5Y1XkJY1u5k=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=OHzA5/xYfWJ/p1hD4BElxf3qnd3/Rs6ALAnRqSlPkGBEda+dV3+Ky4t7vIoaBqAi4I98fmV4bOmVuDby8Qu0sNV+oFNJaX2T8A9sqg8PAX/heqWrRrmsfIud9Py3LxrgRI/cCxiqWlgIZgvEV1M8aaKizrRW8vjeAIBnfkzD9mk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org; spf=pass smtp.mailfrom=makrotopia.org; arc=none smtp.client-ip=185.142.180.65 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=makrotopia.org Received: from local by pidgin.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.98.2) (envelope-from ) id 1v9A2c-000000006Ub-3iD1; Wed, 15 Oct 2025 22:32:18 +0000 Date: Wed, 15 Oct 2025 23:32:15 +0100 From: Daniel Golle To: Hauke Mehrtens , Andrew Lunn , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Andreas Schirm , Lukas Stockmann , Alexander Sverdlin , Peter Christen , Avinash Jayaraman , Bing tao Xu , Liang Xu , Juraj Povazanec , "Fanni (Fang-Yi) Chan" , "Benny (Ying-Tsan) Weng" , "Livia M. Rosu" , John Crispin Subject: [PATCH net-next 02/11] net: dsa: lantiq_gswip: define VLAN ID 0 constant Message-ID: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Vladimir Oltean This patch adds an explicit definition for VID 0 to the Lantiq GSWIP DSA driver, clarifying its special meaning. Signed-off-by: Vladimir Oltean Signed-off-by: Daniel Golle --- drivers/net/dsa/lantiq/lantiq_gswip.c | 12 +++++++----- drivers/net/dsa/lantiq/lantiq_gswip.h | 2 ++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/net/dsa/lantiq/lantiq_gswip.c b/drivers/net/dsa/lantiq= /lantiq_gswip.c index 91755a5972fa..9526317443a1 100644 --- a/drivers/net/dsa/lantiq/lantiq_gswip.c +++ b/drivers/net/dsa/lantiq/lantiq_gswip.c @@ -432,7 +432,7 @@ static int gswip_add_single_port_br(struct gswip_priv *= priv, int port, bool add) =20 vlan_active.index =3D port + 1; vlan_active.table =3D GSWIP_TABLE_ACTIVE_VLAN; - vlan_active.key[0] =3D 0; /* vid */ + vlan_active.key[0] =3D GSWIP_VLAN_UNAWARE_PVID; vlan_active.val[0] =3D port + 1 /* fid */; vlan_active.valid =3D add; err =3D gswip_pce_table_entry_write(priv, &vlan_active); @@ -446,7 +446,7 @@ static int gswip_add_single_port_br(struct gswip_priv *= priv, int port, bool add) =20 vlan_mapping.index =3D port + 1; vlan_mapping.table =3D GSWIP_TABLE_VLAN_MAPPING; - vlan_mapping.val[0] =3D 0 /* vid */; + vlan_mapping.val[0] =3D GSWIP_VLAN_UNAWARE_PVID; vlan_mapping.val[1] =3D BIT(port) | dsa_cpu_ports(priv->ds); vlan_mapping.val[2] =3D 0; err =3D gswip_pce_table_entry_write(priv, &vlan_mapping); @@ -772,7 +772,8 @@ static int gswip_vlan_add_unaware(struct gswip_priv *pr= iv, * entry in a free slot and prepare the VLAN mapping table entry. */ if (idx =3D=3D -1) { - idx =3D gswip_vlan_active_create(priv, bridge, -1, 0); + idx =3D gswip_vlan_active_create(priv, bridge, -1, + GSWIP_VLAN_UNAWARE_PVID); if (idx < 0) return idx; active_vlan_created =3D true; @@ -780,7 +781,7 @@ static int gswip_vlan_add_unaware(struct gswip_priv *pr= iv, vlan_mapping.index =3D idx; vlan_mapping.table =3D GSWIP_TABLE_VLAN_MAPPING; /* VLAN ID byte, maps to the VLAN ID of vlan active table */ - vlan_mapping.val[0] =3D 0; + vlan_mapping.val[0] =3D GSWIP_VLAN_UNAWARE_PVID; } else { /* Read the existing VLAN mapping entry from the switch */ vlan_mapping.index =3D idx; @@ -977,7 +978,8 @@ static void gswip_port_bridge_leave(struct dsa_switch *= ds, int port, * specific bridges. No bridge is configured here. */ if (!br_vlan_enabled(br)) - gswip_vlan_remove(priv, br, port, 0, true, false); + gswip_vlan_remove(priv, br, port, GSWIP_VLAN_UNAWARE_PVID, true, + false); } =20 static int gswip_port_vlan_prepare(struct dsa_switch *ds, int port, diff --git a/drivers/net/dsa/lantiq/lantiq_gswip.h b/drivers/net/dsa/lantiq= /lantiq_gswip.h index 2df9c8e8cfd0..6aae1ff2f130 100644 --- a/drivers/net/dsa/lantiq/lantiq_gswip.h +++ b/drivers/net/dsa/lantiq/lantiq_gswip.h @@ -222,6 +222,8 @@ */ #define GSWIP_MAX_PACKET_LENGTH 2400 =20 +#define GSWIP_VLAN_UNAWARE_PVID 0 + struct gswip_pce_microcode { u16 val_3; u16 val_2; --=20 2.51.0 From nobody Fri Dec 19 20:50:59 2025 Received: from pidgin.makrotopia.org (pidgin.makrotopia.org [185.142.180.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 175AF308F1E; Wed, 15 Oct 2025 22:32:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.142.180.65 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760567558; cv=none; b=mfU5Ytdy6JhwEHYsCFo/gRe+itCqDTu7sJzBeUFVS070nGO8jvVx34V3w+4vFsWr46eM3tFJZ1VmL0IGX++f4JUXtAwS1jsgep9UW4K4ESVFrpquIOpUhspCFCA3/Ap1v2yBJroUPzH/pO9IVof4kSR9SaNF5YxQ0n/JS87ZXcs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760567558; c=relaxed/simple; bh=50jMK7HPDX4QlUAOSngHbbnQ2ea6CfN56CWfStl4I4A=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=bpjwcSy10DzppqQoA9Xc8dDMaU1niPqlQocjpEJa29+K8ARmkFkG13bfjFQeJbrGj4QOsDZecvZgk1WT5JuORi13MCskXhimQ6qfda+DA1IRZVsKExgJS6V6k8VJoH7CTuIZTc8n4PeSuB4cEZi0PC8Fvj6CBRhoYnV6c5sB+U0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org; spf=pass smtp.mailfrom=makrotopia.org; arc=none smtp.client-ip=185.142.180.65 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=makrotopia.org Received: from local by pidgin.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.98.2) (envelope-from ) id 1v9A2r-000000006V1-48qk; Wed, 15 Oct 2025 22:32:34 +0000 Date: Wed, 15 Oct 2025 23:32:30 +0100 From: Daniel Golle To: Hauke Mehrtens , Andrew Lunn , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Andreas Schirm , Lukas Stockmann , Alexander Sverdlin , Peter Christen , Avinash Jayaraman , Bing tao Xu , Liang Xu , Juraj Povazanec , "Fanni (Fang-Yi) Chan" , "Benny (Ying-Tsan) Weng" , "Livia M. Rosu" , John Crispin Subject: [PATCH net-next 03/11] net: dsa: lantiq_gswip: remove duplicate assignment to vlan_mapping.val[0] Message-ID: <039ecb48e038cea856a9a6230ad1543db2bc382d.1760566491.git.daniel@makrotopia.org> References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Vladimir Oltean When idx =3D=3D -1 in gswip_vlan_add(), we set vlan_mapping.val[0] =3D vid, even though we do the exact same thing again outside the if/else block. Remove the duplicate assignment. Signed-off-by: Vladimir Oltean Signed-off-by: Daniel Golle --- drivers/net/dsa/lantiq/lantiq_gswip.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/dsa/lantiq/lantiq_gswip.c b/drivers/net/dsa/lantiq= /lantiq_gswip.c index 9526317443a1..e41d67ea89c5 100644 --- a/drivers/net/dsa/lantiq/lantiq_gswip.c +++ b/drivers/net/dsa/lantiq/lantiq_gswip.c @@ -848,8 +848,6 @@ static int gswip_vlan_add_aware(struct gswip_priv *priv, =20 vlan_mapping.index =3D idx; vlan_mapping.table =3D GSWIP_TABLE_VLAN_MAPPING; - /* VLAN ID byte, maps to the VLAN ID of vlan active table */ - vlan_mapping.val[0] =3D vid; } else { /* Read the existing VLAN mapping entry from the switch */ vlan_mapping.index =3D idx; @@ -862,6 +860,7 @@ static int gswip_vlan_add_aware(struct gswip_priv *priv, } } =20 + /* VLAN ID byte, maps to the VLAN ID of vlan active table */ vlan_mapping.val[0] =3D vid; /* Update the VLAN mapping entry and write it to the switch */ vlan_mapping.val[1] |=3D cpu_ports; --=20 2.51.0 From nobody Fri Dec 19 20:50:59 2025 Received: from pidgin.makrotopia.org (pidgin.makrotopia.org [185.142.180.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0A45230DD23; Wed, 15 Oct 2025 22:32:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.142.180.65 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760567569; cv=none; b=qljuJKsP98Au7l44aYJXTOOrLaEcDRdOgpH7xgi6tbazS6hp3fT2fNqT/AjSr6fEuIsiafQpPcfXC4QujCofZdiL/FXOnejLOTqsmBfxAZz2OAp7e7Xu961CXdU/DNr68ZSX9sqCowFl7GmN8HavtTOWrtLT2CsTsO6+N6jHPu8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760567569; c=relaxed/simple; bh=eaf3eoV7n8HxG7X3tAFDvc8QVrG6j3F90sKRY1iV2T4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=JokOcBWyNrX1+1GQUGSJqsTQwWU8XJqiqFnL+K2TburU01+cmUIChVcaAWKkfHZWARtj3QlyFG5A0UTL6NPy0MbNrncA/EN1Arskrap8ybj32ojOO7BGBKA+nXNQWk5Afgtt/kNBhEyXeXusV2g0DuEBJ/t9709zt2JsxECmkaI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org; spf=pass smtp.mailfrom=makrotopia.org; arc=none smtp.client-ip=185.142.180.65 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=makrotopia.org Received: from local by pidgin.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.98.2) (envelope-from ) id 1v9A32-000000006VP-2to0; Wed, 15 Oct 2025 22:32:44 +0000 Date: Wed, 15 Oct 2025 23:32:41 +0100 From: Daniel Golle To: Hauke Mehrtens , Andrew Lunn , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Andreas Schirm , Lukas Stockmann , Alexander Sverdlin , Peter Christen , Avinash Jayaraman , Bing tao Xu , Liang Xu , Juraj Povazanec , "Fanni (Fang-Yi) Chan" , "Benny (Ying-Tsan) Weng" , "Livia M. Rosu" , John Crispin Subject: [PATCH net-next 04/11] net: dsa: lantiq_gswip: merge gswip_vlan_add_unaware() and gswip_vlan_add_aware() Message-ID: <2be190701d4c17038ce4b8047f9fb0bdf8abdf6e.1760566491.git.daniel@makrotopia.org> References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Vladimir Oltean The two functions largely duplicate functionality. The differences consist in: - the "fid" passed to gswip_vlan_active_create(). The unaware variant always passes -1, the aware variant passes fid =3D priv->vlans[i].fid, where i is an index into priv->vlans[] for which priv->vlans[i].bridge is equal to the given bridge. - the "vid" is not passed to gswip_vlan_add_unaware(). It is implicitly GSWIP_VLAN_UNAWARE_PVID (zero). - The "untagged" is not passed to gswip_vlan_add_unaware(). It is implicitly true. Also, the CPU port must not be a tag member of the PVID used for VLAN-unaware bridging. - The "pvid" is not passed to gswip_vlan_add_unaware(). It is implicitly true. - The GSWIP_PCE_DEFPVID(port) register is written by the aware variant with an "idx", but with a hardcoded 0 by the unaware variant. Merge the two functions into a single unified function without any functional changes. Signed-off-by: Vladimir Oltean Signed-off-by: Daniel Golle --- drivers/net/dsa/lantiq/lantiq_gswip.c | 94 +++++---------------------- 1 file changed, 17 insertions(+), 77 deletions(-) diff --git a/drivers/net/dsa/lantiq/lantiq_gswip.c b/drivers/net/dsa/lantiq= /lantiq_gswip.c index e41d67ea89c5..6cbcb54a5ed0 100644 --- a/drivers/net/dsa/lantiq/lantiq_gswip.c +++ b/drivers/net/dsa/lantiq/lantiq_gswip.c @@ -750,86 +750,25 @@ static int gswip_vlan_active_remove(struct gswip_priv= *priv, int idx) return err; } =20 -static int gswip_vlan_add_unaware(struct gswip_priv *priv, - struct net_device *bridge, int port) -{ - struct gswip_pce_table_entry vlan_mapping =3D {0,}; - unsigned int max_ports =3D priv->hw_info->max_ports; - bool active_vlan_created =3D false; - int idx =3D -1; - int i; - int err; - - /* Check if there is already a page for this bridge */ - for (i =3D max_ports; i < ARRAY_SIZE(priv->vlans); i++) { - if (priv->vlans[i].bridge =3D=3D bridge) { - idx =3D i; - break; - } - } - - /* If this bridge is not programmed yet, add a Active VLAN table - * entry in a free slot and prepare the VLAN mapping table entry. - */ - if (idx =3D=3D -1) { - idx =3D gswip_vlan_active_create(priv, bridge, -1, - GSWIP_VLAN_UNAWARE_PVID); - if (idx < 0) - return idx; - active_vlan_created =3D true; - - vlan_mapping.index =3D idx; - vlan_mapping.table =3D GSWIP_TABLE_VLAN_MAPPING; - /* VLAN ID byte, maps to the VLAN ID of vlan active table */ - vlan_mapping.val[0] =3D GSWIP_VLAN_UNAWARE_PVID; - } else { - /* Read the existing VLAN mapping entry from the switch */ - vlan_mapping.index =3D idx; - vlan_mapping.table =3D GSWIP_TABLE_VLAN_MAPPING; - err =3D gswip_pce_table_entry_read(priv, &vlan_mapping); - if (err) { - dev_err(priv->dev, "failed to read VLAN mapping: %d\n", - err); - return err; - } - } - - /* Update the VLAN mapping entry and write it to the switch */ - vlan_mapping.val[1] |=3D dsa_cpu_ports(priv->ds); - vlan_mapping.val[1] |=3D BIT(port); - err =3D gswip_pce_table_entry_write(priv, &vlan_mapping); - if (err) { - dev_err(priv->dev, "failed to write VLAN mapping: %d\n", err); - /* In case an Active VLAN was creaetd delete it again */ - if (active_vlan_created) - gswip_vlan_active_remove(priv, idx); - return err; - } - - gswip_switch_w(priv, 0, GSWIP_PCE_DEFPVID(port)); - return 0; -} - -static int gswip_vlan_add_aware(struct gswip_priv *priv, - struct net_device *bridge, int port, - u16 vid, bool untagged, - bool pvid) +static int gswip_vlan_add(struct gswip_priv *priv, struct net_device *brid= ge, + int port, u16 vid, bool untagged, bool pvid, + bool vlan_aware) { struct gswip_pce_table_entry vlan_mapping =3D {0,}; unsigned int max_ports =3D priv->hw_info->max_ports; unsigned int cpu_ports =3D dsa_cpu_ports(priv->ds); bool active_vlan_created =3D false; - int idx =3D -1; - int fid =3D -1; - int i; - int err; + int fid =3D -1, idx =3D -1; + int i, err; =20 /* Check if there is already a page for this bridge */ for (i =3D max_ports; i < ARRAY_SIZE(priv->vlans); i++) { if (priv->vlans[i].bridge =3D=3D bridge) { - if (fid !=3D -1 && fid !=3D priv->vlans[i].fid) - dev_err(priv->dev, "one bridge with multiple flow ids\n"); - fid =3D priv->vlans[i].fid; + if (vlan_aware) { + if (fid !=3D -1 && fid !=3D priv->vlans[i].fid) + dev_err(priv->dev, "one bridge with multiple flow ids\n"); + fid =3D priv->vlans[i].fid; + } if (priv->vlans[i].vid =3D=3D vid) { idx =3D i; break; @@ -864,8 +803,9 @@ static int gswip_vlan_add_aware(struct gswip_priv *priv, vlan_mapping.val[0] =3D vid; /* Update the VLAN mapping entry and write it to the switch */ vlan_mapping.val[1] |=3D cpu_ports; - vlan_mapping.val[2] |=3D cpu_ports; vlan_mapping.val[1] |=3D BIT(port); + if (vlan_aware) + vlan_mapping.val[2] |=3D cpu_ports; if (untagged) vlan_mapping.val[2] &=3D ~BIT(port); else @@ -879,8 +819,7 @@ static int gswip_vlan_add_aware(struct gswip_priv *priv, return err; } =20 - if (pvid) - gswip_switch_w(priv, idx, GSWIP_PCE_DEFPVID(port)); + gswip_switch_w(priv, vlan_aware ? idx : 0, GSWIP_PCE_DEFPVID(port)); =20 return 0; } @@ -955,7 +894,8 @@ static int gswip_port_bridge_join(struct dsa_switch *ds= , int port, * specific bridges. No bridge is configured here. */ if (!br_vlan_enabled(br)) { - err =3D gswip_vlan_add_unaware(priv, br, port); + err =3D gswip_vlan_add(priv, br, port, GSWIP_VLAN_UNAWARE_PVID, + true, true, false); if (err) return err; priv->port_vlan_filter &=3D ~BIT(port); @@ -1049,8 +989,8 @@ static int gswip_port_vlan_add(struct dsa_switch *ds, = int port, if (dsa_is_cpu_port(ds, port)) return 0; =20 - return gswip_vlan_add_aware(priv, bridge, port, vlan->vid, - untagged, pvid); + return gswip_vlan_add(priv, bridge, port, vlan->vid, untagged, pvid, + true); } =20 static int gswip_port_vlan_del(struct dsa_switch *ds, int port, --=20 2.51.0 From nobody Fri Dec 19 20:50:59 2025 Received: from pidgin.makrotopia.org (pidgin.makrotopia.org [185.142.180.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A1349306D52; Wed, 15 Oct 2025 22:32:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.142.180.65 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760567578; cv=none; b=KMb+/NoVjLTDxVb1So0y0snqyNWe+w4ExNAgpqtBgig2VFeJkE+7nRq7pQUSpglPRlSmZ3Ns3Fz7EDrdq0LnPV6xLg84zlPBmTklcMGO/ROKJVa8V0vsBMIkadR24P7iVozYz4x1DUwzCmhzQuVEEIJX03Opi440YqHMbRBk3SA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760567578; c=relaxed/simple; bh=Y1e50Af7RMYLivtC3BAqV/29GtuZ0+gHs/jlHeTLEYQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=MZ14728LK1RAg1ofF8yUHgvnsOVRh6TfC6ilbrl8Mf9r52zD79txf5tpU3ikg4+1ZqFx77AanXnf0hYjUObZqKdywKEulzBsV3tS0VHTKvgei/yBP3f+dPAvP+vXFjoRXBM3AiCkddbxculhvgrreGElIUjrOzrmCI/3gUxlfCE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org; spf=pass smtp.mailfrom=makrotopia.org; arc=none smtp.client-ip=185.142.180.65 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=makrotopia.org Received: from local by pidgin.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.98.2) (envelope-from ) id 1v9A3B-000000006Vd-1JRV; Wed, 15 Oct 2025 22:32:53 +0000 Date: Wed, 15 Oct 2025 23:32:50 +0100 From: Daniel Golle To: Hauke Mehrtens , Andrew Lunn , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Andreas Schirm , Lukas Stockmann , Alexander Sverdlin , Peter Christen , Avinash Jayaraman , Bing tao Xu , Liang Xu , Juraj Povazanec , "Fanni (Fang-Yi) Chan" , "Benny (Ying-Tsan) Weng" , "Livia M. Rosu" , John Crispin Subject: [PATCH net-next 05/11] net: dsa: lantiq_gswip: remove legacy configure_vlan_while_not_filtering option Message-ID: <47dab8a8b69ebb92624b9795b723114475d3fe4e.1760566491.git.daniel@makrotopia.org> References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Vladimir Oltean This driver doesn't support dynamic VLAN filtering changes, for simplicity. It expects that on a port, either gswip_vlan_add_unaware() or gswip_vlan_add_aware() is called, but not both. When !br_vlan_enabled(), the configure_vlan_while_not_filtering =3D false option is exactly what will prevent calls to gswip_port_vlan_add() from being issued by DSA. In fact, at the time these features were submitted: https://patchwork.ozlabs.org/project/netdev/patch/20190501204506.21579-3-ha= uke@hauke-m.de/ "configure_vlan_while_not_filtering =3D false" did not even have a name, it was implicit behaviour. It only became legacy in commit 54a0ed0df496 ("net: dsa: provide an option for drivers to always receive bridge VLANs"). Section "Bridge VLAN filtering" of Documentation/networking/switchdev.rst describes the exact set of rules. Notably, the PVID of the port must follow the VLAN awareness state of the bridge port. A VLAN-unaware bridge port should not respond to the addition of a bridge VLAN with the PVID flag. In fact, the pvid_change() test in tools/testing/selftests/net/forwarding/bridge_vlan_unaware.sh tests exactly this. The lantiq_gswip driver indeed does not respond to the addition of PVID VLANs while VLAN-unaware in the way described above, but only because of configure_vlan_while_not_filtering. Our purpose here is to get rid of configure_vlan_while_not_filtering, so we must add more complex logic which follows the VLAN awareness state and walks through the Active VLAN table entries, to find the index of the PVID register that should be committed to hardware on each port. As a side-effect of now having a proper implementation to assign the PVID all the "VLAN upper: ..." tests of the local_termination.sh self- tests which would previously all FAIL now all PASS (or XFAIL, but that's ok). Signed-off-by: Vladimir Oltean Signed-off-by: Daniel Golle Tested-by: Daniel Golle --- drivers/net/dsa/lantiq/lantiq_gswip.c | 49 +++++++++++++++++++++++---- 1 file changed, 43 insertions(+), 6 deletions(-) diff --git a/drivers/net/dsa/lantiq/lantiq_gswip.c b/drivers/net/dsa/lantiq= /lantiq_gswip.c index 6cbcb54a5ed0..30cff623bec0 100644 --- a/drivers/net/dsa/lantiq/lantiq_gswip.c +++ b/drivers/net/dsa/lantiq/lantiq_gswip.c @@ -547,6 +547,45 @@ static int gswip_pce_load_microcode(struct gswip_priv = *priv) return 0; } =20 +static void gswip_port_commit_pvid(struct gswip_priv *priv, int port) +{ + struct dsa_port *dp =3D dsa_to_port(priv->ds, port); + struct net_device *br =3D dsa_port_bridge_dev_get(dp); + int idx; + + if (!dsa_port_is_user(dp)) + return; + + if (br) { + u16 pvid =3D GSWIP_VLAN_UNAWARE_PVID; + + if (br_vlan_enabled(br)) + br_vlan_get_pvid(br, &pvid); + + /* VLAN-aware bridge ports with no PVID will use Active VLAN + * index 0. The expectation is that this drops all untagged and + * VID-0 tagged ingress traffic. + */ + idx =3D 0; + for (int i =3D priv->hw_info->max_ports; + i < ARRAY_SIZE(priv->vlans); i++) { + if (priv->vlans[i].bridge =3D=3D br && + priv->vlans[i].vid =3D=3D pvid) { + idx =3D i; + break; + } + } + } else { + /* The Active VLAN table index as configured by + * gswip_add_single_port_br() + */ + idx =3D port + 1; + } + + /* GSWIP 2.2 (GRX300) and later program here the VID directly. */ + gswip_switch_w(priv, idx, GSWIP_PCE_DEFPVID(port)); +} + static int gswip_port_vlan_filtering(struct dsa_switch *ds, int port, bool vlan_filtering, struct netlink_ext_ack *extack) @@ -581,6 +620,8 @@ static int gswip_port_vlan_filtering(struct dsa_switch = *ds, int port, GSWIP_PCE_PCTRL_0p(port)); } =20 + gswip_port_commit_pvid(priv, port); + return 0; } =20 @@ -677,8 +718,6 @@ static int gswip_setup(struct dsa_switch *ds) =20 ds->mtu_enforcement_ingress =3D true; =20 - ds->configure_vlan_while_not_filtering =3D false; - return 0; } =20 @@ -819,7 +858,7 @@ static int gswip_vlan_add(struct gswip_priv *priv, stru= ct net_device *bridge, return err; } =20 - gswip_switch_w(priv, vlan_aware ? idx : 0, GSWIP_PCE_DEFPVID(port)); + gswip_port_commit_pvid(priv, port); =20 return 0; } @@ -874,9 +913,7 @@ static int gswip_vlan_remove(struct gswip_priv *priv, } } =20 - /* GSWIP 2.2 (GRX300) and later program here the VID directly. */ - if (pvid) - gswip_switch_w(priv, 0, GSWIP_PCE_DEFPVID(port)); + gswip_port_commit_pvid(priv, port); =20 return 0; } --=20 2.51.0 From nobody Fri Dec 19 20:50:59 2025 Received: from pidgin.makrotopia.org (pidgin.makrotopia.org [185.142.180.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E5EB430E849; Wed, 15 Oct 2025 22:33:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.142.180.65 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760567587; cv=none; b=cYQa5AENgmeCT+ADsK6TEBPhQ3Qozn+7xxKySMk3vLpvRwC+5xicjdpHHxf3NDTDkXBfMw8WWBSDw8ziSN0sZmv3Ou2R4m5LC5jmhwQxtUpbUhvGxr7i3Ql6L7uWHWHerE82NFKX9qDjCl6zsxbdJeJefDb//scX8mZ6CbIqW1E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760567587; c=relaxed/simple; bh=5uGUhoeLDDjoubEihAHKJx1uoA3bgc8l2z6IzQxE4Rc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=P4HOZk0PU2J2msUfeVbW/W9CuaGDd7lYnNWGCF4hEW7WYL80kJRKEoyE648GcwNL0bGXxQuohO6+MBFPB3f8x5puJlu38lbbbFydzU+IfvjgJAy2AkKBxYEJGg7mrI/xGYEZk5yuFPRuy3X9rO13rgGz6u4vaqqrRcr7PmOnYAM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org; spf=pass smtp.mailfrom=makrotopia.org; arc=none smtp.client-ip=185.142.180.65 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=makrotopia.org Received: from local by pidgin.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.98.2) (envelope-from ) id 1v9A3J-000000006W1-2U2Y; Wed, 15 Oct 2025 22:33:01 +0000 Date: Wed, 15 Oct 2025 23:32:58 +0100 From: Daniel Golle To: Hauke Mehrtens , Andrew Lunn , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Andreas Schirm , Lukas Stockmann , Alexander Sverdlin , Peter Christen , Avinash Jayaraman , Bing tao Xu , Liang Xu , Juraj Povazanec , "Fanni (Fang-Yi) Chan" , "Benny (Ying-Tsan) Weng" , "Livia M. Rosu" , John Crispin Subject: [PATCH net-next 06/11] net: dsa: lantiq_gswip: permit dynamic changes to VLAN filtering state Message-ID: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Vladimir Oltean The driver should now tolerate these changes, now that the PVID is automatically recalculated on a VLAN awareness state change. The VLAN-unaware PVID must be installed to hardware even if the joined bridge is currently VLAN-aware. Otherwise, when the bridge VLAN filtering state dynamically changes to VLAN-unaware later, this PVID will be missing. Signed-off-by: Vladimir Oltean Signed-off-by: Daniel Golle --- drivers/net/dsa/lantiq/lantiq_gswip.c | 38 +++++++++------------------ drivers/net/dsa/lantiq/lantiq_gswip.h | 1 - 2 files changed, 12 insertions(+), 27 deletions(-) diff --git a/drivers/net/dsa/lantiq/lantiq_gswip.c b/drivers/net/dsa/lantiq= /lantiq_gswip.c index 30cff623bec0..58fdd54094d6 100644 --- a/drivers/net/dsa/lantiq/lantiq_gswip.c +++ b/drivers/net/dsa/lantiq/lantiq_gswip.c @@ -590,16 +590,8 @@ static int gswip_port_vlan_filtering(struct dsa_switch= *ds, int port, bool vlan_filtering, struct netlink_ext_ack *extack) { - struct net_device *bridge =3D dsa_port_bridge_dev_get(dsa_to_port(ds, por= t)); struct gswip_priv *priv =3D ds->priv; =20 - /* Do not allow changing the VLAN filtering options while in bridge */ - if (bridge && !!(priv->port_vlan_filter & BIT(port)) !=3D vlan_filtering)= { - NL_SET_ERR_MSG_MOD(extack, - "Dynamic toggling of vlan_filtering not supported"); - return -EIO; - } - if (vlan_filtering) { /* Use tag based VLAN */ gswip_switch_mask(priv, @@ -927,18 +919,15 @@ static int gswip_port_bridge_join(struct dsa_switch *= ds, int port, struct gswip_priv *priv =3D ds->priv; int err; =20 - /* When the bridge uses VLAN filtering we have to configure VLAN - * specific bridges. No bridge is configured here. + /* Set up the VLAN for VLAN-unaware bridging for this port, and remove + * it from the "single-port bridge" through which it was operating as + * standalone. */ - if (!br_vlan_enabled(br)) { - err =3D gswip_vlan_add(priv, br, port, GSWIP_VLAN_UNAWARE_PVID, - true, true, false); - if (err) - return err; - priv->port_vlan_filter &=3D ~BIT(port); - } else { - priv->port_vlan_filter |=3D BIT(port); - } + err =3D gswip_vlan_add(priv, br, port, GSWIP_VLAN_UNAWARE_PVID, + true, true, false); + if (err) + return err; + return gswip_add_single_port_br(priv, port, false); } =20 @@ -948,14 +937,11 @@ static void gswip_port_bridge_leave(struct dsa_switch= *ds, int port, struct net_device *br =3D bridge.dev; struct gswip_priv *priv =3D ds->priv; =20 - gswip_add_single_port_br(priv, port, true); - - /* When the bridge uses VLAN filtering we have to configure VLAN - * specific bridges. No bridge is configured here. + /* Add the port back to the "single-port bridge", and remove it from + * the VLAN-unaware PVID created for this bridge. */ - if (!br_vlan_enabled(br)) - gswip_vlan_remove(priv, br, port, GSWIP_VLAN_UNAWARE_PVID, true, - false); + gswip_add_single_port_br(priv, port, true); + gswip_vlan_remove(priv, br, port, GSWIP_VLAN_UNAWARE_PVID, true, false); } =20 static int gswip_port_vlan_prepare(struct dsa_switch *ds, int port, diff --git a/drivers/net/dsa/lantiq/lantiq_gswip.h b/drivers/net/dsa/lantiq= /lantiq_gswip.h index 6aae1ff2f130..4590a1a7dbd9 100644 --- a/drivers/net/dsa/lantiq/lantiq_gswip.h +++ b/drivers/net/dsa/lantiq/lantiq_gswip.h @@ -270,7 +270,6 @@ struct gswip_priv { struct gswip_vlan vlans[64]; int num_gphy_fw; struct gswip_gphy_fw *gphy_fw; - u32 port_vlan_filter; struct mutex pce_table_lock; u16 version; }; --=20 2.51.0 From nobody Fri Dec 19 20:50:59 2025 Received: from pidgin.makrotopia.org (pidgin.makrotopia.org [185.142.180.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C2AFB2727F5; Wed, 15 Oct 2025 22:33:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.142.180.65 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760567613; cv=none; b=TXQ7ruYhROuZRKVgbzb9UZutbLDKVEWkEhqVrPfO7tnrZNCyNq378yXl8vBJp5spzsZoAoxruHnlaYr1D1aQubiI0jWD3yHfEt3UVZPFuiBBqoMNhTu7ebtPqwogxxqFW3ENXJ5ZUSIEvJb/etG/3TygIenG2DPGQfW2xmIBAQI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760567613; c=relaxed/simple; bh=JH2NJd4eSOR+np8+3szqii0tcMn3rn0h5zf22tg0u68=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=tvoRd8iRtnOIJIiKlX/x4T/Yvt/NcCg/q5MH7G7RMnCODksCshMZttnGjsC4HrqamPny9nmbPjd7Rjm8uVKaPXfJVuCCwqRyjbXdiHxzuf2xaupzp2llw/VcOMGq1oNqNB5qvCR0QTmI7lmAWZbQMVIEEcy1I6dDsRXetHUSKVM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org; spf=pass smtp.mailfrom=makrotopia.org; arc=none smtp.client-ip=185.142.180.65 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=makrotopia.org Received: from local by pidgin.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.98.2) (envelope-from ) id 1v9A3k-000000006WR-2rNM; Wed, 15 Oct 2025 22:33:28 +0000 Date: Wed, 15 Oct 2025 23:33:25 +0100 From: Daniel Golle To: Hauke Mehrtens , Andrew Lunn , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Andreas Schirm , Lukas Stockmann , Alexander Sverdlin , Peter Christen , Avinash Jayaraman , Bing tao Xu , Liang Xu , Juraj Povazanec , "Fanni (Fang-Yi) Chan" , "Benny (Ying-Tsan) Weng" , "Livia M. Rosu" , John Crispin Subject: [PATCH net-next 07/11] net: dsa: lantiq_gswip: disallow changes to privately set up VID 0 Message-ID: <9f68340c34b5312c3b8c6c7ecf3cfce574a3f65d.1760566491.git.daniel@makrotopia.org> References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Vladimir Oltean User space can force the altering of VID 0 as it was privately set up by this driver. For example, when the port joins a VLAN-aware bridge, dsa_user_manage_vlan_filtering() will set NETIF_F_HW_VLAN_CTAG_FILTER. If the port is subsequently brought up and CONFIG_VLAN_8021Q is enabled, the vlan_vid0_add() function will want to make sure we are capable of accepting packets tagged with VID 0. Generally, DSA/switchdev drivers want to suppress that bit of help from the 8021q layer, and handle VID 0 filters themselves. The 8021q layer might actually be even detrimential, because VLANs added through vlan_vid_add() pass through dsa_user_vlan_rx_add_vid(), which is documented as this: /* This API only allows programming tagged, non-PVID VIDs */ .flags =3D 0, so it will force VID 0 to be reconfigured as egress-tagged, non-PVID. Whereas the driver configures it as PVID and egress-untagged, the exact opposite. Signed-off-by: Vladimir Oltean Signed-off-by: Daniel Golle --- drivers/net/dsa/lantiq/lantiq_gswip.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/dsa/lantiq/lantiq_gswip.c b/drivers/net/dsa/lantiq= /lantiq_gswip.c index 58fdd54094d6..26e963840f3b 100644 --- a/drivers/net/dsa/lantiq/lantiq_gswip.c +++ b/drivers/net/dsa/lantiq/lantiq_gswip.c @@ -1000,6 +1000,9 @@ static int gswip_port_vlan_add(struct dsa_switch *ds,= int port, bool pvid =3D vlan->flags & BRIDGE_VLAN_INFO_PVID; int err; =20 + if (vlan->vid =3D=3D GSWIP_VLAN_UNAWARE_PVID) + return 0; + err =3D gswip_port_vlan_prepare(ds, port, vlan, extack); if (err) return err; @@ -1023,6 +1026,9 @@ static int gswip_port_vlan_del(struct dsa_switch *ds,= int port, struct gswip_priv *priv =3D ds->priv; bool pvid =3D vlan->flags & BRIDGE_VLAN_INFO_PVID; =20 + if (vlan->vid =3D=3D GSWIP_VLAN_UNAWARE_PVID) + return 0; + /* We have to receive all packets on the CPU port and should not * do any VLAN filtering here. This is also called with bridge * NULL and then we do not know for which bridge to configure --=20 2.51.0 From nobody Fri Dec 19 20:50:59 2025 Received: from pidgin.makrotopia.org (pidgin.makrotopia.org [185.142.180.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5C9EC2727F5; Wed, 15 Oct 2025 22:33:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.142.180.65 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760567621; cv=none; b=A5pkIfibX8I0Png/oPr1J9rJlWFLjGOZlD0i0xXozwOisV32LyUO5YnJ3fZf130IC3pR5yYpt3+VU69jP50RCqGQ/LBMlTKt/5R/vy203853eKfawToQsGiPe5LnMtWsHQmGVY+Jl9z3UhWBym9Kl9+7Qf58pxnv6P8YmNFPEG4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760567621; c=relaxed/simple; bh=Tv2jDXVJeFkxrlKV4Om3KHslkHp7oFfNMbd5MAfa0gQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=D9MTQV4xrsVtTrklciHaPywabG6+mRw5OMza6BmdXT/OX/2AFbIrso2+KLmD5Pzjjhsbp0kzqrneYNdnCL8I49Lgh+a820RvAmYG97v2XoaXpuXagrl5qiMkEGJT3tiPEelwz2CeEQtQ5MeO4OTgGYmcbgj+kC/uubz2PJj26nA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org; spf=pass smtp.mailfrom=makrotopia.org; arc=none smtp.client-ip=185.142.180.65 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=makrotopia.org Received: from local by pidgin.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.98.2) (envelope-from ) id 1v9A3t-000000006Wp-0Xq6; Wed, 15 Oct 2025 22:33:37 +0000 Date: Wed, 15 Oct 2025 23:33:33 +0100 From: Daniel Golle To: Hauke Mehrtens , Andrew Lunn , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Andreas Schirm , Lukas Stockmann , Alexander Sverdlin , Peter Christen , Avinash Jayaraman , Bing tao Xu , Liang Xu , Juraj Povazanec , "Fanni (Fang-Yi) Chan" , "Benny (Ying-Tsan) Weng" , "Livia M. Rosu" , John Crispin Subject: [PATCH net-next 08/11] net: dsa: lantiq_gswip: remove vlan_aware and pvid arguments from gswip_vlan_remove() Message-ID: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Vladimir Oltean "bool pvid" is unused since commit "net: dsa: lantiq_gswip: remove legacy configure_vlan_while_not_filtering option". "bool vlan_aware" shouldn't have a role in finding the bridge VLAN. It should be identified by VID regardless of VLAN-aware or VLAN-unaware. The driver sets up VID 0 for the VLAN-unaware PVID. Signed-off-by: Vladimir Oltean Signed-off-by: Daniel Golle --- drivers/net/dsa/lantiq/lantiq_gswip.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/net/dsa/lantiq/lantiq_gswip.c b/drivers/net/dsa/lantiq= /lantiq_gswip.c index 26e963840f3b..d9a7a004f9eb 100644 --- a/drivers/net/dsa/lantiq/lantiq_gswip.c +++ b/drivers/net/dsa/lantiq/lantiq_gswip.c @@ -857,7 +857,7 @@ static int gswip_vlan_add(struct gswip_priv *priv, stru= ct net_device *bridge, =20 static int gswip_vlan_remove(struct gswip_priv *priv, struct net_device *bridge, int port, - u16 vid, bool pvid, bool vlan_aware) + u16 vid) { struct gswip_pce_table_entry vlan_mapping =3D {0,}; unsigned int max_ports =3D priv->hw_info->max_ports; @@ -868,7 +868,7 @@ static int gswip_vlan_remove(struct gswip_priv *priv, /* Check if there is already a page for this bridge */ for (i =3D max_ports; i < ARRAY_SIZE(priv->vlans); i++) { if (priv->vlans[i].bridge =3D=3D bridge && - (!vlan_aware || priv->vlans[i].vid =3D=3D vid)) { + priv->vlans[i].vid =3D=3D vid) { idx =3D i; break; } @@ -941,7 +941,7 @@ static void gswip_port_bridge_leave(struct dsa_switch *= ds, int port, * the VLAN-unaware PVID created for this bridge. */ gswip_add_single_port_br(priv, port, true); - gswip_vlan_remove(priv, br, port, GSWIP_VLAN_UNAWARE_PVID, true, false); + gswip_vlan_remove(priv, br, port, GSWIP_VLAN_UNAWARE_PVID); } =20 static int gswip_port_vlan_prepare(struct dsa_switch *ds, int port, @@ -1024,7 +1024,6 @@ static int gswip_port_vlan_del(struct dsa_switch *ds,= int port, { struct net_device *bridge =3D dsa_port_bridge_dev_get(dsa_to_port(ds, por= t)); struct gswip_priv *priv =3D ds->priv; - bool pvid =3D vlan->flags & BRIDGE_VLAN_INFO_PVID; =20 if (vlan->vid =3D=3D GSWIP_VLAN_UNAWARE_PVID) return 0; @@ -1037,7 +1036,7 @@ static int gswip_port_vlan_del(struct dsa_switch *ds,= int port, if (dsa_is_cpu_port(ds, port)) return 0; =20 - return gswip_vlan_remove(priv, bridge, port, vlan->vid, pvid, true); + return gswip_vlan_remove(priv, bridge, port, vlan->vid); } =20 static void gswip_port_fast_age(struct dsa_switch *ds, int port) --=20 2.51.0 From nobody Fri Dec 19 20:50:59 2025 Received: from pidgin.makrotopia.org (pidgin.makrotopia.org [185.142.180.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8C56330DD0D; Wed, 15 Oct 2025 22:33:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.142.180.65 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760567630; cv=none; b=CToOGGjlmb1xhZvrmFMZjw1Vx5zHnQaMhLmHALO5sIkErL/BANT4lA7dLNtuok36trrPSA/PDfXXRNUmaLrILAn/TuH8/djN1mvqoywq35m+9wrLhvrRGyI8qeEirM0AFx/cdL51fO/uBuRgfM2NcCpPwUVJ/8t/FuOTWtGbiAc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760567630; c=relaxed/simple; bh=ydN0CQk9eCQObKh2zNgXLlMg5I8r3uoaYzkJUDBSmDk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ELKmOukqdhKyUngU2b79IKsCRGtN3rAT5pQ19HlmfjIeDDklQ1iaCk43ouJmparcBz/IhlYR68MhwYn5Dh4DRw4vFMPS/XpckQ+P31X5te5QYXH45RAZ8ml1xOB4POHiOpW/Bpl70b+sKkevoIG5ilsuN6Sw//wBcfeeG3p7DZM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org; spf=pass smtp.mailfrom=makrotopia.org; arc=none smtp.client-ip=185.142.180.65 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=makrotopia.org Received: from local by pidgin.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.98.2) (envelope-from ) id 1v9A41-000000006X2-160l; Wed, 15 Oct 2025 22:33:45 +0000 Date: Wed, 15 Oct 2025 23:33:41 +0100 From: Daniel Golle To: Hauke Mehrtens , Andrew Lunn , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Andreas Schirm , Lukas Stockmann , Alexander Sverdlin , Peter Christen , Avinash Jayaraman , Bing tao Xu , Liang Xu , Juraj Povazanec , "Fanni (Fang-Yi) Chan" , "Benny (Ying-Tsan) Weng" , "Livia M. Rosu" , John Crispin Subject: [PATCH net-next 09/11] net: dsa: lantiq_gswip: put a more descriptive error print in gswip_vlan_remove() Message-ID: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Vladimir Oltean Improve the error message printed in case of a port VLAN entry not being found upon removal. Signed-off-by: Vladimir Oltean Signed-off-by: Daniel Golle --- drivers/net/dsa/lantiq/lantiq_gswip.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/dsa/lantiq/lantiq_gswip.c b/drivers/net/dsa/lantiq= /lantiq_gswip.c index d9a7a004f9eb..cfdeb8148500 100644 --- a/drivers/net/dsa/lantiq/lantiq_gswip.c +++ b/drivers/net/dsa/lantiq/lantiq_gswip.c @@ -875,7 +875,8 @@ static int gswip_vlan_remove(struct gswip_priv *priv, } =20 if (idx =3D=3D -1) { - dev_err(priv->dev, "bridge to leave does not exists\n"); + dev_err(priv->dev, "Port %d cannot find VID %u of bridge %s\n", + port, vid, bridge ? bridge->name : "(null)"); return -ENOENT; } =20 --=20 2.51.0 From nobody Fri Dec 19 20:50:59 2025 Received: from pidgin.makrotopia.org (pidgin.makrotopia.org [185.142.180.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 216CE30CD9F; Wed, 15 Oct 2025 22:33:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.142.180.65 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760567638; cv=none; b=QhPHC0sKf+wS9ojI7/QRnnMrmq4No4zBnfkf36v0Rh7v02Km2+jjXKhtT0CqGD0nIOR2fun2vqFZT+6ncPudXMgLBdsLYMkhnZCoLrASPdoS5Wj874+RGk3qExYtJR+KIRToE3RMoRpAziNp3TUG6N/Ttctoj4RXKKapYdsJ7SI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760567638; c=relaxed/simple; bh=hI6zhUaPUnSyYaYYUOCoj1r0gchkEgn6E8nlapACsZ4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=NpIcI+uIM5DKtgVoaQopikXnY5/ulaYkXfSW++fe/1v9rKxOeP1VdQUKOt+4HzMWIvQFFuz5S4CBtTtk0nM8RnePjn5+35eBZAc6XNC3OfB8PshbxTCqk7SPSiwmnRwh+uQ7iDh9e6+sV+MDXFh1KaujTRBQT30jUdraMg7xSUk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org; spf=pass smtp.mailfrom=makrotopia.org; arc=none smtp.client-ip=185.142.180.65 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=makrotopia.org Received: from local by pidgin.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.98.2) (envelope-from ) id 1v9A49-000000006XG-38pp; Wed, 15 Oct 2025 22:33:53 +0000 Date: Wed, 15 Oct 2025 23:33:50 +0100 From: Daniel Golle To: Hauke Mehrtens , Andrew Lunn , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Andreas Schirm , Lukas Stockmann , Alexander Sverdlin , Peter Christen , Avinash Jayaraman , Bing tao Xu , Liang Xu , Juraj Povazanec , "Fanni (Fang-Yi) Chan" , "Benny (Ying-Tsan) Weng" , "Livia M. Rosu" , John Crispin Subject: [PATCH net-next 10/11] net: dsa: lantiq_gswip: drop untagged on VLAN-aware bridge ports with no PVID Message-ID: <787aa807d00b726d75db2a40add215c8b8ba7466.1760566491.git.daniel@makrotopia.org> References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Vladimir Oltean Implement the required functionality, as written in Documentation/networking/switchdev.rst section "Bridge VLAN filtering", by using the "VLAN Ingress Tag Rule" feature of the switch. The bit field definitions for this were found while browsing the Intel dual BSD/GPLv2 licensed drivers for this switch IP. Signed-off-by: Vladimir Oltean Signed-off-by: Daniel Golle --- drivers/net/dsa/lantiq/lantiq_gswip.c | 6 ++++++ drivers/net/dsa/lantiq/lantiq_gswip.h | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/drivers/net/dsa/lantiq/lantiq_gswip.c b/drivers/net/dsa/lantiq= /lantiq_gswip.c index cfdeb8148500..1ff0932dae31 100644 --- a/drivers/net/dsa/lantiq/lantiq_gswip.c +++ b/drivers/net/dsa/lantiq/lantiq_gswip.c @@ -551,6 +551,7 @@ static void gswip_port_commit_pvid(struct gswip_priv *p= riv, int port) { struct dsa_port *dp =3D dsa_to_port(priv->ds, port); struct net_device *br =3D dsa_port_bridge_dev_get(dp); + u32 vinr; int idx; =20 if (!dsa_port_is_user(dp)) @@ -582,6 +583,11 @@ static void gswip_port_commit_pvid(struct gswip_priv *= priv, int port) idx =3D port + 1; } =20 + vinr =3D idx ? GSWIP_PCE_VCTRL_VINR_ALL : GSWIP_PCE_VCTRL_VINR_TAGGED; + gswip_switch_mask(priv, GSWIP_PCE_VCTRL_VINR, + FIELD_PREP(GSWIP_PCE_VCTRL_VINR, vinr), + GSWIP_PCE_VCTRL(port)); + /* GSWIP 2.2 (GRX300) and later program here the VID directly. */ gswip_switch_w(priv, idx, GSWIP_PCE_DEFPVID(port)); } diff --git a/drivers/net/dsa/lantiq/lantiq_gswip.h b/drivers/net/dsa/lantiq= /lantiq_gswip.h index 4590a1a7dbd9..69c8d2deff2d 100644 --- a/drivers/net/dsa/lantiq/lantiq_gswip.h +++ b/drivers/net/dsa/lantiq/lantiq_gswip.h @@ -159,6 +159,10 @@ #define GSWIP_PCE_PCTRL_0_PSTATE_MASK GENMASK(2, 0) #define GSWIP_PCE_VCTRL(p) (0x485 + ((p) * 0xA)) #define GSWIP_PCE_VCTRL_UVR BIT(0) /* Unknown VLAN Rule */ +#define GSWIP_PCE_VCTRL_VINR GENMASK(2, 1) /* VLAN Ingress Tag Rule */ +#define GSWIP_PCE_VCTRL_VINR_ALL 0 /* Admit tagged and untagged packets */ +#define GSWIP_PCE_VCTRL_VINR_TAGGED 1 /* Admit only tagged packets */ +#define GSWIP_PCE_VCTRL_VINR_UNTAGGED 2 /* Admit only untagged packets */ #define GSWIP_PCE_VCTRL_VIMR BIT(3) /* VLAN Ingress Member violation rul= e */ #define GSWIP_PCE_VCTRL_VEMR BIT(4) /* VLAN Egress Member violation rule= */ #define GSWIP_PCE_VCTRL_VSR BIT(5) /* VLAN Security */ --=20 2.51.0 From nobody Fri Dec 19 20:50:59 2025 Received: from pidgin.makrotopia.org (pidgin.makrotopia.org [185.142.180.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1F38D30BB84; Wed, 15 Oct 2025 22:34:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.142.180.65 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760567649; cv=none; b=GMJluY+RrMxmW0xkVmAc8XRCDASZvUqMSLJWNdftI7VK0PSe+S+RCkpOxhrY2q7kcdPkOXEXSdKDIhPo02EXc/CFHbOvufBceo9t4Rg7XrdqM4zyt9w6DigPNd7tMCBqmIibHQ3IxhnKJ+N7JG7KDFDFnbmRE/vxlDbBWv5B3ew= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760567649; c=relaxed/simple; bh=f3ZXJTPXaLUSOHR0DUO+dULY39lV+saUqdm+RMnvqdU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=nOdH4S4hI+WadpgJFu870QxKTx7kOTZwjzOJSclyt3VrdPzLZ9+m9PDcpcUY0qjMWM1fAuk9glkzLA8pOXv1fo241HEKljNXPpFHUJDjE967/gVMCCDhhr98x/6Oj87cg6G503HS3Xd9Flwuk/U+E6hmZCK+4rvCQdn1IAUpp1E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org; spf=pass smtp.mailfrom=makrotopia.org; arc=none smtp.client-ip=185.142.180.65 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=makrotopia.org Received: from local by pidgin.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.98.2) (envelope-from ) id 1v9A4K-000000006Xf-310e; Wed, 15 Oct 2025 22:34:04 +0000 Date: Wed, 15 Oct 2025 23:34:01 +0100 From: Daniel Golle To: Hauke Mehrtens , Andrew Lunn , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Andreas Schirm , Lukas Stockmann , Alexander Sverdlin , Peter Christen , Avinash Jayaraman , Bing tao Xu , Liang Xu , Juraj Povazanec , "Fanni (Fang-Yi) Chan" , "Benny (Ying-Tsan) Weng" , "Livia M. Rosu" , John Crispin Subject: [PATCH net-next 11/11] net: dsa: lantiq_gswip: treat VID 0 like the PVID Message-ID: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Vladimir Oltean Documentation/networking/switchdev.rst says that VLAN-aware bridges must treat packets tagged with VID 0 the same as untagged. It appears from the documentation that setting the GSWIP_PCE_VCTRL_VID0 flag (which this driver already had defined) might achieve this. Signed-off-by: Vladimir Oltean Signed-off-by: Daniel Golle --- drivers/net/dsa/lantiq/lantiq_gswip.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/dsa/lantiq/lantiq_gswip.c b/drivers/net/dsa/lantiq= /lantiq_gswip.c index 1ff0932dae31..25f6b46957a0 100644 --- a/drivers/net/dsa/lantiq/lantiq_gswip.c +++ b/drivers/net/dsa/lantiq/lantiq_gswip.c @@ -603,7 +603,7 @@ static int gswip_port_vlan_filtering(struct dsa_switch = *ds, int port, gswip_switch_mask(priv, GSWIP_PCE_VCTRL_VSR, GSWIP_PCE_VCTRL_UVR | GSWIP_PCE_VCTRL_VIMR | - GSWIP_PCE_VCTRL_VEMR, + GSWIP_PCE_VCTRL_VEMR | GSWIP_PCE_VCTRL_VID0, GSWIP_PCE_VCTRL(port)); gswip_switch_mask(priv, GSWIP_PCE_PCTRL_0_TVM, 0, GSWIP_PCE_PCTRL_0p(port)); @@ -611,7 +611,7 @@ static int gswip_port_vlan_filtering(struct dsa_switch = *ds, int port, /* Use port based VLAN */ gswip_switch_mask(priv, GSWIP_PCE_VCTRL_UVR | GSWIP_PCE_VCTRL_VIMR | - GSWIP_PCE_VCTRL_VEMR, + GSWIP_PCE_VCTRL_VEMR | GSWIP_PCE_VCTRL_VID0, GSWIP_PCE_VCTRL_VSR, GSWIP_PCE_VCTRL(port)); gswip_switch_mask(priv, 0, GSWIP_PCE_PCTRL_0_TVM, --=20 2.51.0