Skip to content

Commit ad103e0

Browse files
committed
Merge branch 'sja1105-fixes'
Vladimir Oltean says: ==================== Fix VLAN checks for SJA1105 DSA tc-flower filters This fixes a ridiculous situation where the driver, in VLAN-unaware mode, would refuse accepting any tc filter: tc filter replace dev sw1p3 ingress flower skip_sw \ dst_mac 42:be:24:9b:76:20 \ action gate (...) Error: sja1105: Can only gate based on {DMAC, VID, PCP}. tc filter replace dev sw1p3 ingress protocol 802.1Q flower skip_sw \ vlan_id 1 vlan_prio 0 dst_mac 42:be:24:9b:76:20 \ action gate (...) Error: sja1105: Can only gate based on DMAC. So, without changing the VLAN awareness state, it says it doesn't want VLAN-aware rules, and it doesn't want VLAN-unaware rules either. One would say it's in Schrodinger's state... Now, the situation has been made worse by commit 7f14937 ("net: dsa: sja1105: keep the VLAN awareness state in a driver variable"), which made VLAN awareness a ternary attribute, but after inspecting the code from before that patch with a truth table, it looks like the logical bug was there even before. While attempting to fix this, I also noticed some leftover debugging code in one of the places that needed to be fixed. It would have appeared in the context of patch 3/3 anyway, so I decided to create a patch that removes it. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents b64ee48 + 5182a62 commit ad103e0

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

drivers/net/dsa/sja1105/sja1105_vl.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,9 @@ int sja1105_vl_redirect(struct sja1105_private *priv, int port,
342342
NL_SET_ERR_MSG_MOD(extack,
343343
"Can only redirect based on DMAC");
344344
return -EOPNOTSUPP;
345-
} else if (key->type != SJA1105_KEY_VLAN_AWARE_VL) {
345+
} else if ((priv->vlan_state == SJA1105_VLAN_BEST_EFFORT ||
346+
priv->vlan_state == SJA1105_VLAN_FILTERING_FULL) &&
347+
key->type != SJA1105_KEY_VLAN_AWARE_VL) {
346348
NL_SET_ERR_MSG_MOD(extack,
347349
"Can only redirect based on {DMAC, VID, PCP}");
348350
return -EOPNOTSUPP;
@@ -588,14 +590,12 @@ int sja1105_vl_gate(struct sja1105_private *priv, int port,
588590

589591
if (priv->vlan_state == SJA1105_VLAN_UNAWARE &&
590592
key->type != SJA1105_KEY_VLAN_UNAWARE_VL) {
591-
dev_err(priv->ds->dev, "1: vlan state %d key type %d\n",
592-
priv->vlan_state, key->type);
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) {
597-
dev_err(priv->ds->dev, "2: vlan state %d key type %d\n",
598-
priv->vlan_state, key->type);
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) {
599599
NL_SET_ERR_MSG_MOD(extack,
600600
"Can only gate based on {DMAC, VID, PCP}");
601601
return -EOPNOTSUPP;

0 commit comments

Comments
 (0)