summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Marangi <ansuelsmth@gmail.com>2023-07-24 05:25:31 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-08-03 10:26:10 +0200
commit29cf01eed50fb7a128a442c6194494276f3c2df9 (patch)
treeb5fbef39c5c0ec01fea815ce51eb642b4c678f4b
parentbb7b454fff661bea9af0eb1fb6c63606bb0ffc0c (diff)
downloadlinux-stable-29cf01eed50fb7a128a442c6194494276f3c2df9.tar.gz
linux-stable-29cf01eed50fb7a128a442c6194494276f3c2df9.tar.bz2
linux-stable-29cf01eed50fb7a128a442c6194494276f3c2df9.zip
net: dsa: qca8k: fix mdb add/del case with 0 VID
commit dfd739f182b00b02bd7470ed94d112684cc04fa2 upstream. 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: ba8f870dfa63 ("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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/net/dsa/qca/qca8k-common.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/net/dsa/qca/qca8k-common.c b/drivers/net/dsa/qca/qca8k-common.c
index 08f560e67ec7..8536c4f6363e 100644
--- a/drivers/net/dsa/qca/qca8k-common.c
+++ b/drivers/net/dsa/qca/qca8k-common.c
@@ -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);
}
@@ -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);
}