Skip to content

Commit ce20fdd

Browse files
CHKDSK88kuba-moo
authored andcommitted
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 <[email protected]> Signed-off-by: Pawel Dembicki <[email protected]> Reviewed-by: Florian Fainelli <[email protected]> Reviewed-by: Linus Walleij <[email protected]> Reviewed-by: Vladimir Oltean <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent e3386ec commit ce20fdd

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

drivers/net/dsa/sja1105/sja1105_main.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3167,8 +3167,7 @@ static int sja1105_setup(struct dsa_switch *ds)
31673167
ds->vlan_filtering_is_global = true;
31683168
ds->untag_bridge_pvid = true;
31693169
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;
31723171

31733172
/* Advertise the 8 egress queues */
31743173
ds->num_tx_queues = SJA1105_NUM_TC;

include/linux/dsa/8021q.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88
#include <net/dsa.h>
99
#include <linux/types.h>
1010

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+
1116
int dsa_tag_8021q_register(struct dsa_switch *ds, __be16 proto);
1217

1318
void dsa_tag_8021q_unregister(struct dsa_switch *ds);

0 commit comments

Comments
 (0)