diff mbox series

[v2,net-next,07/15] net: dsa: sja1105: exit sja1105_vlan_filtering when called multiple times

Message ID 20200511135338.20263-8-olteanv@gmail.com
State Changes Requested
Delegated to: David Miller
Headers show
Series Traffic support for dsa_8021q in vlan_filtering=1 mode | expand

Commit Message

Vladimir Oltean May 11, 2020, 1:53 p.m. UTC
From: Vladimir Oltean <vladimir.oltean@nxp.com>

VLAN filtering is a global property for sja1105, and that means that we
rely on the DSA core to not call us more than once.

But we need to introduce some per-port state for the tagger, namely the
xmit_tpid, and the best place to do that is where the xmit_tpid changes,
namely in sja1105_vlan_filtering. So at the moment, exit early from the
function to avoid unnecessarily resetting the switch for each port call.
Then we'll change the xmit_tpid prior to the early exit in the next
patch.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
Changes in v2:
None.

 drivers/net/dsa/sja1105/sja1105_main.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Florian Fainelli May 12, 2020, 3:32 a.m. UTC | #1
On 5/11/2020 6:53 AM, Vladimir Oltean wrote:
> From: Vladimir Oltean <vladimir.oltean@nxp.com>
> 
> VLAN filtering is a global property for sja1105, and that means that we
> rely on the DSA core to not call us more than once.
> 
> But we need to introduce some per-port state for the tagger, namely the
> xmit_tpid, and the best place to do that is where the xmit_tpid changes,
> namely in sja1105_vlan_filtering. So at the moment, exit early from the
> function to avoid unnecessarily resetting the switch for each port call.
> Then we'll change the xmit_tpid prior to the early exit in the next
> patch.
> 
> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
diff mbox series

Patch

diff --git a/drivers/net/dsa/sja1105/sja1105_main.c b/drivers/net/dsa/sja1105/sja1105_main.c
index d2755ab2853d..82b424a03658 100644
--- a/drivers/net/dsa/sja1105/sja1105_main.c
+++ b/drivers/net/dsa/sja1105/sja1105_main.c
@@ -2158,6 +2158,9 @@  static int sja1105_vlan_filtering(struct dsa_switch *ds, int port, bool enabled)
 	else
 		state = SJA1105_VLAN_FILTERING_FULL;
 
+	if (priv->vlan_state == state)
+		return 0;
+
 	priv->vlan_state = state;
 
 	table = &priv->static_config.tables[BLK_IDX_GENERAL_PARAMS];