[PATCH net-next v2 13/13] dpaa2-switch: do not error out when the same VLAN is installed multiple times
From: Ioana Ciornei
Date: Tue May 12 2026 - 10:24:38 EST
With the addition of the LAG offload support it has become apparent that
depending on the order in which a bridged bond setup is created, the
driver could be requested to add the same VLAN twice, once through the
802.1q filters and then through switchdev.
This is because any VLANs already installed on the bond device when the
bond_enslave() operation happens will also be installed on the switch
port through the .ndo_vlan_rx_add_vid() callback. Once the bond device
becomes offloaded, the same VLANs will get replayed and installed
through switchdev.
$ ip link set dev eth4 master bond1
[ 165.008131] fsl_dpaa2_switch dpsw.0 eth4: configuring for inband/usxgmii link mode
[ 165.021020] 8021q: adding VLAN 0 to HW filter on device eth4
[ 165.083351] fsl_dpaa2_switch dpsw.0 eth4: VLAN 100 already configured
RTNETLINK answers: File exists
Avoid this by not erroring out when the same VLAN is installed or
removed multiple times so that we avoid the above issue. Also remove the
netdev_err() since there isn't anything that the user can do to prevent
this behavior.
Signed-off-by: Ioana Ciornei <ioana.ciornei@xxxxxxx>
---
Changes in v2:
- none
---
.../net/ethernet/freescale/dpaa2/dpaa2-switch.c | 17 +++++------------
1 file changed, 5 insertions(+), 12 deletions(-)
diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c
index 0acebb386486..b7b07ff8c60a 100644
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c
@@ -372,10 +372,8 @@ static int dpaa2_switch_port_add_vlan(struct ethsw_port_priv *port_priv,
struct dpsw_vlan_if_cfg vcfg = {0};
int err;
- if (port_priv->vlans[vid]) {
- netdev_err(netdev, "VLAN %d already configured\n", vid);
- return -EEXIST;
- }
+ if (port_priv->vlans[vid])
+ return 0;
/* If hit, this VLAN rule will lead the packet into the FDB table
* specified in the vlan configuration below
@@ -2003,13 +2001,8 @@ int dpaa2_switch_port_vlans_add(struct net_device *netdev,
struct dpsw_attr *attr = ðsw->sw_attr;
int err = 0;
- /* Make sure that the VLAN is not already configured
- * on the switch port
- */
- if (port_priv->vlans[vlan->vid] & ETHSW_VLAN_MEMBER) {
- netdev_err(netdev, "VLAN %d already configured\n", vlan->vid);
- return -EEXIST;
- }
+ if (port_priv->vlans[vlan->vid] & ETHSW_VLAN_MEMBER)
+ return 0;
/* Check if there is space for a new VLAN */
err = dpsw_get_attributes(ethsw->mc_io, 0, ethsw->dpsw_handle,
@@ -2129,7 +2122,7 @@ static int dpaa2_switch_port_del_vlan(struct ethsw_port_priv *port_priv, u16 vid
int i, err;
if (!port_priv->vlans[vid])
- return -ENOENT;
+ return 0;
if (port_priv->vlans[vid] & ETHSW_VLAN_PVID) {
/* If we are deleting the PVID of a port, use VLAN 4095 instead
--
2.25.1