Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: dsa: sja1105: stop using priv->vlan_aware

Now that the sja1105 driver is finally sane enough again to stop having
a ternary VLAN awareness state, we can remove priv->vlan_aware and query
DSA for the ds->vlan_filtering value (for SJA1105, VLAN filtering is a
global property).

Also drop the paranoid checking that DSA calls ->port_vlan_filtering
multiple times without the VLAN awareness state changing. It doesn't,
the same check is present inside dsa_port_vlan_filtering too.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Vladimir Oltean and committed by
David S. Miller
9aad3e4e 5146a574

+11 -12
-1
drivers/net/dsa/sja1105/sja1105.h
··· 226 226 bool rgmii_tx_delay[SJA1105_MAX_NUM_PORTS]; 227 227 phy_interface_t phy_mode[SJA1105_MAX_NUM_PORTS]; 228 228 bool fixed_link[SJA1105_MAX_NUM_PORTS]; 229 - bool vlan_aware; 230 229 unsigned long ucast_egress_floods; 231 230 unsigned long bcast_egress_floods; 232 231 const struct sja1105_info *info;
+3 -7
drivers/net/dsa/sja1105/sja1105_main.c
··· 1780 1780 static int sja1105_fdb_dump(struct dsa_switch *ds, int port, 1781 1781 dsa_fdb_dump_cb_t *cb, void *data) 1782 1782 { 1783 + struct dsa_port *dp = dsa_to_port(ds, port); 1783 1784 struct sja1105_private *priv = ds->priv; 1784 1785 struct device *dev = ds->dev; 1785 1786 int i; ··· 1817 1816 u64_to_ether_addr(l2_lookup.macaddr, macaddr); 1818 1817 1819 1818 /* We need to hide the dsa_8021q VLANs from the user. */ 1820 - if (!priv->vlan_aware) 1819 + if (!dsa_port_is_vlan_filtering(dp)) 1821 1820 l2_lookup.vlanid = 0; 1822 1821 rc = cb(macaddr, l2_lookup.vlanid, l2_lookup.lockeds, data); 1823 1822 if (rc) ··· 2310 2309 tpid2 = ETH_P_SJA1105; 2311 2310 } 2312 2311 2313 - if (priv->vlan_aware == enabled) 2314 - return 0; 2315 - 2316 - priv->vlan_aware = enabled; 2317 - 2318 2312 table = &priv->static_config.tables[BLK_IDX_GENERAL_PARAMS]; 2319 2313 general_params = table->entries; 2320 2314 /* EtherType used to identify inner tagged (C-tag) VLAN traffic */ ··· 2342 2346 */ 2343 2347 table = &priv->static_config.tables[BLK_IDX_L2_LOOKUP_PARAMS]; 2344 2348 l2_lookup_params = table->entries; 2345 - l2_lookup_params->shared_learn = !priv->vlan_aware; 2349 + l2_lookup_params->shared_learn = !enabled; 2346 2350 2347 2351 for (port = 0; port < ds->num_ports; port++) { 2348 2352 if (dsa_is_unused_port(ds, port))
+8 -4
drivers/net/dsa/sja1105/sja1105_vl.c
··· 494 494 bool append) 495 495 { 496 496 struct sja1105_rule *rule = sja1105_rule_find(priv, cookie); 497 + struct dsa_port *dp = dsa_to_port(priv->ds, port); 498 + bool vlan_aware = dsa_port_is_vlan_filtering(dp); 497 499 int rc; 498 500 499 - if (!priv->vlan_aware && key->type != SJA1105_KEY_VLAN_UNAWARE_VL) { 501 + if (!vlan_aware && key->type != SJA1105_KEY_VLAN_UNAWARE_VL) { 500 502 NL_SET_ERR_MSG_MOD(extack, 501 503 "Can only redirect based on DMAC"); 502 504 return -EOPNOTSUPP; 503 - } else if (priv->vlan_aware && key->type != SJA1105_KEY_VLAN_AWARE_VL) { 505 + } else if (vlan_aware && key->type != SJA1105_KEY_VLAN_AWARE_VL) { 504 506 NL_SET_ERR_MSG_MOD(extack, 505 507 "Can only redirect based on {DMAC, VID, PCP}"); 506 508 return -EOPNOTSUPP; ··· 570 568 u32 num_entries, struct action_gate_entry *entries) 571 569 { 572 570 struct sja1105_rule *rule = sja1105_rule_find(priv, cookie); 571 + struct dsa_port *dp = dsa_to_port(priv->ds, port); 572 + bool vlan_aware = dsa_port_is_vlan_filtering(dp); 573 573 int ipv = -1; 574 574 int i, rc; 575 575 s32 rem; ··· 596 592 return -ERANGE; 597 593 } 598 594 599 - if (!priv->vlan_aware && key->type != SJA1105_KEY_VLAN_UNAWARE_VL) { 595 + if (!vlan_aware && key->type != SJA1105_KEY_VLAN_UNAWARE_VL) { 600 596 NL_SET_ERR_MSG_MOD(extack, 601 597 "Can only gate based on DMAC"); 602 598 return -EOPNOTSUPP; 603 - } else if (priv->vlan_aware && key->type != SJA1105_KEY_VLAN_AWARE_VL) { 599 + } else if (vlan_aware && key->type != SJA1105_KEY_VLAN_AWARE_VL) { 604 600 NL_SET_ERR_MSG_MOD(extack, 605 601 "Can only gate based on {DMAC, VID, PCP}"); 606 602 return -EOPNOTSUPP;