Skip to content

Commit 92790e6

Browse files
vladimirolteankuba-moo
authored andcommitted
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 <[email protected]> Signed-off-by: Daniel Golle <[email protected]> Link: https://patch.msgid.link/e8862239d0bb727723cf60947d2262473b46c96d.1760566491.git.daniel@makrotopia.org Signed-off-by: Jakub Kicinski <[email protected]>
1 parent e29bbd7 commit 92790e6

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

drivers/net/dsa/lantiq/lantiq_gswip.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ static int gswip_add_single_port_br(struct gswip_priv *priv, int port, bool add)
432432

433433
vlan_active.index = port + 1;
434434
vlan_active.table = GSWIP_TABLE_ACTIVE_VLAN;
435-
vlan_active.key[0] = 0; /* vid */
435+
vlan_active.key[0] = GSWIP_VLAN_UNAWARE_PVID;
436436
vlan_active.val[0] = port + 1 /* fid */;
437437
vlan_active.valid = add;
438438
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)
446446

447447
vlan_mapping.index = port + 1;
448448
vlan_mapping.table = GSWIP_TABLE_VLAN_MAPPING;
449-
vlan_mapping.val[0] = 0 /* vid */;
449+
vlan_mapping.val[0] = GSWIP_VLAN_UNAWARE_PVID;
450450
vlan_mapping.val[1] = BIT(port) | dsa_cpu_ports(priv->ds);
451451
vlan_mapping.val[2] = 0;
452452
err = gswip_pce_table_entry_write(priv, &vlan_mapping);
@@ -772,15 +772,16 @@ static int gswip_vlan_add_unaware(struct gswip_priv *priv,
772772
* entry in a free slot and prepare the VLAN mapping table entry.
773773
*/
774774
if (idx == -1) {
775-
idx = gswip_vlan_active_create(priv, bridge, -1, 0);
775+
idx = gswip_vlan_active_create(priv, bridge, -1,
776+
GSWIP_VLAN_UNAWARE_PVID);
776777
if (idx < 0)
777778
return idx;
778779
active_vlan_created = true;
779780

780781
vlan_mapping.index = idx;
781782
vlan_mapping.table = GSWIP_TABLE_VLAN_MAPPING;
782783
/* VLAN ID byte, maps to the VLAN ID of vlan active table */
783-
vlan_mapping.val[0] = 0;
784+
vlan_mapping.val[0] = GSWIP_VLAN_UNAWARE_PVID;
784785
} else {
785786
/* Read the existing VLAN mapping entry from the switch */
786787
vlan_mapping.index = idx;
@@ -977,7 +978,8 @@ static void gswip_port_bridge_leave(struct dsa_switch *ds, int port,
977978
* specific bridges. No bridge is configured here.
978979
*/
979980
if (!br_vlan_enabled(br))
980-
gswip_vlan_remove(priv, br, port, 0, true, false);
981+
gswip_vlan_remove(priv, br, port, GSWIP_VLAN_UNAWARE_PVID, true,
982+
false);
981983
}
982984

983985
static int gswip_port_vlan_prepare(struct dsa_switch *ds, int port,

drivers/net/dsa/lantiq/lantiq_gswip.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,8 @@
222222
*/
223223
#define GSWIP_MAX_PACKET_LENGTH 2400
224224

225+
#define GSWIP_VLAN_UNAWARE_PVID 0
226+
225227
struct gswip_pce_microcode {
226228
u16 val_3;
227229
u16 val_2;

0 commit comments

Comments
 (0)