]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net: dsa: Keep the vlan_filtering setting in dsa_switch if it's global
authorVladimir Oltean <olteanv@gmail.com>
Sun, 28 Apr 2019 18:45:48 +0000 (21:45 +0300)
committerDavid S. Miller <davem@davemloft.net>
Wed, 1 May 2019 03:05:29 +0000 (23:05 -0400)
The current behavior is not as obvious as one would assume (which is
that, if the driver set vlan_filtering_is_global = 1, then checking any
dp->vlan_filtering would yield the same result). Only the ports which
are actively enslaved into a bridge would have vlan_filtering set.

This makes it tricky for drivers to check what the global state is.
So fix this and make the struct dsa_switch hold this global setting.

Signed-off-by: Vladimir Oltean <olteanv@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/dsa.h
net/dsa/port.c

index aab3c2029edd50fb769e04a29df133a1ccaed7f4..4e0f7e9c5aa152758a77ff1423f2a3befefe3fe0 100644 (file)
@@ -233,6 +233,11 @@ struct dsa_switch {
         */
        bool                    vlan_filtering_is_global;
 
+       /* In case vlan_filtering_is_global is set, the VLAN awareness state
+        * should be retrieved from here and not from the per-port settings.
+        */
+       bool                    vlan_filtering;
+
        unsigned long           *bitmap;
        unsigned long           _bitmap;
 
index 9a6ed138878c356fc9c088545f0d848ff02cbc57..c27c16b69ab68d114d6b3c4162419bfa9aec08d8 100644 (file)
@@ -208,7 +208,10 @@ int dsa_port_vlan_filtering(struct dsa_port *dp, bool vlan_filtering,
        if (err)
                return err;
 
-       dp->vlan_filtering = vlan_filtering;
+       if (ds->vlan_filtering_is_global)
+               ds->vlan_filtering = vlan_filtering;
+       else
+               dp->vlan_filtering = vlan_filtering;
        return 0;
 }