]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net: dsa: Store vlan_filtering as a property of dsa_port
authorVladimir Oltean <olteanv@gmail.com>
Sun, 28 Apr 2019 18:45:43 +0000 (21:45 +0300)
committerDavid S. Miller <davem@davemloft.net>
Wed, 1 May 2019 03:05:28 +0000 (23:05 -0400)
This allows drivers to query the VLAN setting imposed by the bridge
driver directly from DSA, instead of keeping their own state based on
the .port_vlan_filtering callback.

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

index b550f7bb53144c61486af6a0d1f1be72649b89ef..79a87913126c99832e758c79c84a36d9383805ba 100644 (file)
@@ -161,6 +161,7 @@ struct dsa_port {
        const char              *mac;
        struct device_node      *dn;
        unsigned int            ageing_time;
+       bool                    vlan_filtering;
        u8                      stp_state;
        struct net_device       *bridge_dev;
        struct devlink_port     devlink_port;
index caeef4c99dc0756154d996fda344b44127de1b63..a86fe3be126106abc6d83f47aae6b0a1c3723838 100644 (file)
@@ -158,15 +158,19 @@ int dsa_port_vlan_filtering(struct dsa_port *dp, bool vlan_filtering,
                            struct switchdev_trans *trans)
 {
        struct dsa_switch *ds = dp->ds;
+       int err;
 
        /* bridge skips -EOPNOTSUPP, so skip the prepare phase */
        if (switchdev_trans_ph_prepare(trans))
                return 0;
 
-       if (ds->ops->port_vlan_filtering)
-               return ds->ops->port_vlan_filtering(ds, dp->index,
-                                                   vlan_filtering);
-
+       if (ds->ops->port_vlan_filtering) {
+               err = ds->ops->port_vlan_filtering(ds, dp->index,
+                                                  vlan_filtering);
+               if (err)
+                       return err;
+               dp->vlan_filtering = vlan_filtering;
+       }
        return 0;
 }