Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: dsa: Define max num of bridges in tag8021q implementation

Max number of bridges in tag8021q implementation is strictly limited
by VBID size: 3 bits. But zero is reserved and only 7 values can be used.

This patch adds define which describe maximum possible value.

Suggested-by: Vladimir Oltean <olteanv@gmail.com>
Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
Link: https://patch.msgid.link/20240713211620.1125910-10-paweldembicki@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Pawel Dembicki and committed by
Jakub Kicinski
ce20fdd6 e3386ec4

+6 -2
+1 -2
drivers/net/dsa/sja1105/sja1105_main.c
··· 3167 3167 ds->vlan_filtering_is_global = true; 3168 3168 ds->untag_bridge_pvid = true; 3169 3169 ds->fdb_isolation = true; 3170 - /* tag_8021q has 3 bits for the VBID, and the value 0 is reserved */ 3171 - ds->max_num_bridges = 7; 3170 + ds->max_num_bridges = DSA_TAG_8021Q_MAX_NUM_BRIDGES; 3172 3171 3173 3172 /* Advertise the 8 egress queues */ 3174 3173 ds->num_tx_queues = SJA1105_NUM_TC;
+5
include/linux/dsa/8021q.h
··· 8 8 #include <net/dsa.h> 9 9 #include <linux/types.h> 10 10 11 + /* VBID is limited to three bits only and zero is reserved. 12 + * Only 7 bridges can be enumerated. 13 + */ 14 + #define DSA_TAG_8021Q_MAX_NUM_BRIDGES 7 15 + 11 16 int dsa_tag_8021q_register(struct dsa_switch *ds, __be16 proto); 12 17 13 18 void dsa_tag_8021q_unregister(struct dsa_switch *ds);