From: Vladimir Oltean <[email protected]> Not only is it not needed to program dsa_8021q VLANs into ports that are not used, but it also makes validation impossible, given the fact that port == dsa_upstream_port(ds, port) for a port that is disabled. So when a user port wants to install its rx_vid into us (we the disabled port), think that we are in fact the CPU port, so we want the flags to be egress-tagged (which they aren't). So instead of trying to make dsa_upstream_port return something more sensible for disabled ports, skip this nonsense altogether.
Because we didn't have VID validation until now, there's no reason to treat this patch as a bugfix. Signed-off-by: Vladimir Oltean <[email protected]> --- net/dsa/tag_8021q.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/net/dsa/tag_8021q.c b/net/dsa/tag_8021q.c index 158584153e15..3958f426d60e 100644 --- a/net/dsa/tag_8021q.c +++ b/net/dsa/tag_8021q.c @@ -239,7 +239,7 @@ int dsa_port_setup_8021q_tagging(struct dsa_switch *ds, int port, bool enabled) for (i = 0; i < ds->num_ports; i++) { u16 flags; - if (i == upstream) + if (!dsa_is_user_port(ds, i)) continue; else if (i == port) /* The RX VID is pvid on this port */ @@ -302,6 +302,8 @@ int dsa_8021q_vid_validate(struct dsa_switch *ds, int port, u16 vid, u16 flags) return -EPERM; for (other_port = 0; other_port < ds->num_ports; other_port++) { + if (!dsa_is_user_port(ds, other_port)) + continue; if (vid == dsa_8021q_rx_vid(ds, other_port)) { rx_vid_of = other_port; break; -- 2.17.1
