Skip to content

Commit ab3ce58

Browse files
vladimirolteankuba-moo
authored andcommitted
net: dsa: lantiq_gswip: permit dynamic changes to VLAN filtering state
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 <[email protected]> Signed-off-by: Daniel Golle <[email protected]> Link: https://patch.msgid.link/c58759074fb699581336dc2c2c6bf106257b134e.1760566491.git.daniel@makrotopia.org Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 21c3237 commit ab3ce58

File tree

2 files changed

+12
-27
lines changed

2 files changed

+12
-27
lines changed

drivers/net/dsa/lantiq/lantiq_gswip.c

Lines changed: 12 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -590,16 +590,8 @@ static int gswip_port_vlan_filtering(struct dsa_switch *ds, int port,
590590
bool vlan_filtering,
591591
struct netlink_ext_ack *extack)
592592
{
593-
struct net_device *bridge = dsa_port_bridge_dev_get(dsa_to_port(ds, port));
594593
struct gswip_priv *priv = ds->priv;
595594

596-
/* Do not allow changing the VLAN filtering options while in bridge */
597-
if (bridge && !!(priv->port_vlan_filter & BIT(port)) != vlan_filtering) {
598-
NL_SET_ERR_MSG_MOD(extack,
599-
"Dynamic toggling of vlan_filtering not supported");
600-
return -EIO;
601-
}
602-
603595
if (vlan_filtering) {
604596
/* Use tag based VLAN */
605597
gswip_switch_mask(priv,
@@ -927,18 +919,15 @@ static int gswip_port_bridge_join(struct dsa_switch *ds, int port,
927919
struct gswip_priv *priv = ds->priv;
928920
int err;
929921

930-
/* When the bridge uses VLAN filtering we have to configure VLAN
931-
* specific bridges. No bridge is configured here.
922+
/* Set up the VLAN for VLAN-unaware bridging for this port, and remove
923+
* it from the "single-port bridge" through which it was operating as
924+
* standalone.
932925
*/
933-
if (!br_vlan_enabled(br)) {
934-
err = gswip_vlan_add(priv, br, port, GSWIP_VLAN_UNAWARE_PVID,
935-
true, true, false);
936-
if (err)
937-
return err;
938-
priv->port_vlan_filter &= ~BIT(port);
939-
} else {
940-
priv->port_vlan_filter |= BIT(port);
941-
}
926+
err = gswip_vlan_add(priv, br, port, GSWIP_VLAN_UNAWARE_PVID,
927+
true, true, false);
928+
if (err)
929+
return err;
930+
942931
return gswip_add_single_port_br(priv, port, false);
943932
}
944933

@@ -948,14 +937,11 @@ static void gswip_port_bridge_leave(struct dsa_switch *ds, int port,
948937
struct net_device *br = bridge.dev;
949938
struct gswip_priv *priv = ds->priv;
950939

951-
gswip_add_single_port_br(priv, port, true);
952-
953-
/* When the bridge uses VLAN filtering we have to configure VLAN
954-
* specific bridges. No bridge is configured here.
940+
/* Add the port back to the "single-port bridge", and remove it from
941+
* the VLAN-unaware PVID created for this bridge.
955942
*/
956-
if (!br_vlan_enabled(br))
957-
gswip_vlan_remove(priv, br, port, GSWIP_VLAN_UNAWARE_PVID, true,
958-
false);
943+
gswip_add_single_port_br(priv, port, true);
944+
gswip_vlan_remove(priv, br, port, GSWIP_VLAN_UNAWARE_PVID, true, false);
959945
}
960946

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

drivers/net/dsa/lantiq/lantiq_gswip.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,6 @@ struct gswip_priv {
270270
struct gswip_vlan vlans[64];
271271
int num_gphy_fw;
272272
struct gswip_gphy_fw *gphy_fw;
273-
u32 port_vlan_filter;
274273
struct mutex pce_table_lock;
275274
u16 version;
276275
};

0 commit comments

Comments
 (0)