linux-stable/net/dsa
Vladimir Oltean 09fdb6747b net: dsa: tag_8021q: fix the VLAN IDs used for encoding sub-VLANs
[ Upstream commit 4ef8d857b5 ]

When using sub-VLANs in the range of 1-7, the resulting value from:

	rx_vid = dsa_8021q_rx_vid_subvlan(ds, port, subvlan);

is wrong according to the description from tag_8021q.c:

 | 11  | 10  |  9  |  8  |  7  |  6  |  5  |  4  |  3  |  2  |  1  |  0  |
 +-----------+-----+-----------------+-----------+-----------------------+
 |    DIR    | SVL |    SWITCH_ID    |  SUBVLAN  |          PORT         |
 +-----------+-----+-----------------+-----------+-----------------------+

For example, when ds->index == 0, port == 3 and subvlan == 1,
dsa_8021q_rx_vid_subvlan() returns 1027, same as it returns for
subvlan == 0, but it should have returned 1043.

This is because the low portion of the subvlan bits are not masked
properly when writing into the 12-bit VLAN value. They are masked into
bits 4:3, but they should be masked into bits 5:4.

Fixes: 3eaae1d05f ("net: dsa: tag_8021q: support up to 8 VLANs per port using sub-VLANs")
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-06-10 13:39:17 +02:00
..
dsa.c net: dsa: Add devlink port regions support to DSA 2020-10-04 14:38:53 -07:00
dsa2.c net: dsa: Fix type was not set for devlink port 2021-04-14 08:42:07 +02:00
dsa_priv.h net: dsa: Utilize __vlan_find_dev_deep_rcu() 2020-10-02 13:36:07 -07:00
Kconfig net: dsa: tag_rtl4_a: Implement Realtek 4 byte A tag 2020-07-08 15:36:19 -07:00
Makefile net: dsa: tag_rtl4_a: Implement Realtek 4 byte A tag 2020-07-08 15:36:19 -07:00
master.c net: dsa: fix a crash if ->get_sset_count() fails 2021-06-03 09:00:38 +02:00
port.c net: dsa: propagate switchdev vlan_filtering prepare phase to drivers 2020-10-05 05:56:48 -07:00
slave.c net: dsa: fix error code getting shifted with 4 in dsa_slave_get_sset_count 2021-06-03 09:00:45 +02:00
switch.c net: dsa: propagate switchdev vlan_filtering prepare phase to drivers 2020-10-05 05:56:48 -07:00
tag_8021q.c net: dsa: tag_8021q: fix the VLAN IDs used for encoding sub-VLANs 2021-06-10 13:39:17 +02:00
tag_ar9331.c net: dsa: tag_ar9331: let DSA core deal with TX reallocation 2021-03-17 17:06:22 +01:00
tag_brcm.c net: dsa: tag_brcm: let DSA core deal with TX reallocation 2021-03-17 17:06:21 +01:00
tag_dsa.c net: dsa: tag_dsa: let DSA core deal with TX reallocation 2021-03-17 17:06:21 +01:00
tag_edsa.c net: dsa: tag_edsa: let DSA core deal with TX reallocation 2021-03-17 17:06:21 +01:00
tag_gswip.c net: dsa: tag_gswip: let DSA core deal with TX reallocation 2021-03-17 17:06:22 +01:00
tag_ksz.c net: dsa: tag_ksz: don't allocate additional memory for padding/tagging 2021-03-17 17:06:21 +01:00
tag_lan9303.c net: dsa: tag_lan9303: let DSA core deal with TX reallocation 2021-03-17 17:06:21 +01:00
tag_mtk.c net: dsa: tag_mtk: fix 802.1ad VLAN egress 2021-03-17 17:06:22 +01:00
tag_ocelot.c net: dsa: tag_ocelot: let DSA core deal with TX reallocation 2021-03-17 17:06:21 +01:00
tag_qca.c net: dsa: tag_qca: let DSA core deal with TX reallocation 2021-03-17 17:06:21 +01:00
tag_rtl4_a.c net: dsa: tag_rtl4_a: fix egress tags 2021-03-17 17:06:13 +01:00
tag_sja1105.c net: dsa: tag_sja1105: use a custom flow dissector procedure 2020-09-26 14:17:59 -07:00
tag_trailer.c net: dsa: trailer: don't allocate additional memory for padding/tagging 2021-03-17 17:06:21 +01:00