net: dsa: lantiq_gswip: define VLAN ID 0 constant

This patch adds an explicit definition for VID 0 to the Lantiq GSWIP DSA
driver, clarifying its special meaning.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Link: https://patch.msgid.link/e8862239d0bb727723cf60947d2262473b46c96d.1760566491.git.daniel@makrotopia.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Vladimir Oltean
2025-10-15 23:32:15 +01:00
committed by Jakub Kicinski
parent e29bbd73ad
commit 92790e6c11
2 changed files with 9 additions and 5 deletions

View File

@@ -432,7 +432,7 @@ static int gswip_add_single_port_br(struct gswip_priv *priv, int port, bool add)
vlan_active.index = port + 1;
vlan_active.table = GSWIP_TABLE_ACTIVE_VLAN;
vlan_active.key[0] = 0; /* vid */
vlan_active.key[0] = GSWIP_VLAN_UNAWARE_PVID;
vlan_active.val[0] = port + 1 /* fid */;
vlan_active.valid = add;
err = 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)
vlan_mapping.index = port + 1;
vlan_mapping.table = GSWIP_TABLE_VLAN_MAPPING;
vlan_mapping.val[0] = 0 /* vid */;
vlan_mapping.val[0] = GSWIP_VLAN_UNAWARE_PVID;
vlan_mapping.val[1] = BIT(port) | dsa_cpu_ports(priv->ds);
vlan_mapping.val[2] = 0;
err = gswip_pce_table_entry_write(priv, &vlan_mapping);
@@ -772,7 +772,8 @@ static int gswip_vlan_add_unaware(struct gswip_priv *priv,
* entry in a free slot and prepare the VLAN mapping table entry.
*/
if (idx == -1) {
idx = gswip_vlan_active_create(priv, bridge, -1, 0);
idx = gswip_vlan_active_create(priv, bridge, -1,
GSWIP_VLAN_UNAWARE_PVID);
if (idx < 0)
return idx;
active_vlan_created = true;
@@ -780,7 +781,7 @@ static int gswip_vlan_add_unaware(struct gswip_priv *priv,
vlan_mapping.index = idx;
vlan_mapping.table = GSWIP_TABLE_VLAN_MAPPING;
/* VLAN ID byte, maps to the VLAN ID of vlan active table */
vlan_mapping.val[0] = 0;
vlan_mapping.val[0] = GSWIP_VLAN_UNAWARE_PVID;
} else {
/* Read the existing VLAN mapping entry from the switch */
vlan_mapping.index = 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);
}
static int gswip_port_vlan_prepare(struct dsa_switch *ds, int port,

View File

@@ -222,6 +222,8 @@
*/
#define GSWIP_MAX_PACKET_LENGTH 2400
#define GSWIP_VLAN_UNAWARE_PVID 0
struct gswip_pce_microcode {
u16 val_3;
u16 val_2;