Skip to content

Commit 5182a62

Browse files
vladimirolteandavem330
authored andcommitted
net: dsa: sja1105: fix checks for VLAN state in gate action
This action requires the VLAN awareness state of the switch to be of the same type as the key that's being added: - If the switch is unaware of VLAN, then the tc filter key must only contain the destination MAC address. - If the switch is VLAN-aware, the key must also contain the VLAN ID and PCP. But this check doesn't work unless we verify the VLAN awareness state on both the "if" and the "else" branches. Fixes: 834f893 ("net: dsa: sja1105: implement tc-gate using time-triggered virtual links") Signed-off-by: Vladimir Oltean <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent c6ae970 commit 5182a62

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/net/dsa/sja1105/sja1105_vl.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,9 @@ int sja1105_vl_gate(struct sja1105_private *priv, int port,
593593
NL_SET_ERR_MSG_MOD(extack,
594594
"Can only gate based on DMAC");
595595
return -EOPNOTSUPP;
596-
} else if (key->type != SJA1105_KEY_VLAN_AWARE_VL) {
596+
} else if ((priv->vlan_state == SJA1105_VLAN_BEST_EFFORT ||
597+
priv->vlan_state == SJA1105_VLAN_FILTERING_FULL) &&
598+
key->type != SJA1105_KEY_VLAN_AWARE_VL) {
597599
NL_SET_ERR_MSG_MOD(extack,
598600
"Can only gate based on {DMAC, VID, PCP}");
599601
return -EOPNOTSUPP;

0 commit comments

Comments
 (0)