From: Ioana Ciornei <ioana.ciornei@nxp.com>
To: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH net-next 13/13] dpaa2-switch: do not error out when the same VLAN is installed multiple times
Date: Wed, 6 May 2026 18:15:40 +0300 [thread overview]
Message-ID: <20260506151540.1242997-14-ioana.ciornei@nxp.com> (raw)
In-Reply-To: <20260506151540.1242997-1-ioana.ciornei@nxp.com>
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@nxp.com>
---
.../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 8353d2230c72..644f720a7ec7 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
@@ -1993,13 +1991,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,
@@ -2115,7 +2108,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
prev parent reply other threads:[~2026-05-06 15:16 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-06 15:15 [PATCH net-next 00/13] dpaa2-switch: add support for LAG offload Ioana Ciornei
2026-05-06 15:15 ` [PATCH net-next 01/13] dpaa2-switch: add LAG configuration API Ioana Ciornei
2026-05-06 15:15 ` [PATCH net-next 02/13] dpaa2-switch: add support for LAG offload Ioana Ciornei
2026-05-08 12:39 ` Ioana Ciornei
2026-05-06 15:15 ` [PATCH net-next 03/13] dpaa2-switch: change dpaa2_switch_port_set_fdb() function prototype Ioana Ciornei
2026-05-08 11:00 ` Ioana Ciornei
2026-05-06 15:15 ` [PATCH net-next 04/13] dpaa2-switch: extend dpaa2_switch_port_set_fdb() to cover bond scenarios Ioana Ciornei
2026-05-08 13:50 ` Ioana Ciornei
2026-05-06 15:15 ` [PATCH net-next 05/13] dpaa2-switch: add dpaa2_switch_port_to_bridge_port() helper Ioana Ciornei
2026-05-08 14:10 ` [PATCH net-next 05/13] dpaa2-switch: add dpaa2_switch_port_to_bridge_port() helpe Ioana Ciornei
2026-05-06 15:15 ` [PATCH net-next 06/13] dpaa2-switch: create a separate dpaa2_switch_port_fdb_event() function Ioana Ciornei
2026-05-06 15:15 ` [PATCH net-next 07/13] dpaa2-switch: check early if an FDB entry should be added Ioana Ciornei
2026-05-08 14:34 ` Ioana Ciornei
2026-05-06 15:15 ` [PATCH net-next 08/13] dpaa2-switch: consolidate unicast and multicast management Ioana Ciornei
2026-05-08 14:46 ` Ioana Ciornei
2026-05-06 15:15 ` [PATCH net-next 09/13] dpaa2-switch: offload FDBs added on an upper bond device Ioana Ciornei
2026-05-08 15:20 ` Ioana Ciornei
2026-05-06 15:15 ` [PATCH net-next 10/13] dpaa2-switch: offload port objects " Ioana Ciornei
2026-05-11 9:07 ` Ioana Ciornei
2026-05-06 15:15 ` [PATCH net-next 11/13] dpaa2-switch: trap all link local reserved addresses to the CPU Ioana Ciornei
2026-05-06 15:15 ` [PATCH net-next 12/13] dpaa2-switch: add support for imprecise source port Ioana Ciornei
2026-05-07 11:42 ` Ioana Ciornei
2026-05-11 11:32 ` Ioana Ciornei
2026-05-06 15:15 ` Ioana Ciornei [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260506151540.1242997-14-ioana.ciornei@nxp.com \
--to=ioana.ciornei@nxp.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox