Skip to content

Commit

Permalink
net: dsa: qca8k: fix mdb add/del case with 0 VID
Browse files Browse the repository at this point in the history
The qca8k switch doesn't support using 0 as VID and require a default
VID to be always set. MDB add/del function doesn't currently handle
this and are currently setting the default VID.

Fix this by correctly handling this corner case and internally use the
default VID for VID 0 case.

Fixes: ba8f870 ("net: dsa: qca8k: add support for mdb_add/del")
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Christian Marangi authored and David S. Miller committed Jul 26, 2023
1 parent ae70dcb commit dfd739f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/net/dsa/qca/qca8k-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -816,6 +816,9 @@ int qca8k_port_mdb_add(struct dsa_switch *ds, int port,
const u8 *addr = mdb->addr;
u16 vid = mdb->vid;

if (!vid)
vid = QCA8K_PORT_VID_DEF;

return qca8k_fdb_search_and_insert(priv, BIT(port), addr, vid,
QCA8K_ATU_STATUS_STATIC);
}
Expand All @@ -828,6 +831,9 @@ int qca8k_port_mdb_del(struct dsa_switch *ds, int port,
const u8 *addr = mdb->addr;
u16 vid = mdb->vid;

if (!vid)
vid = QCA8K_PORT_VID_DEF;

return qca8k_fdb_search_and_del(priv, BIT(port), addr, vid);
}

Expand Down

0 comments on commit dfd739f

Please sign in to comment.