From: Vladimir Oltean Date: Sun, 28 Apr 2019 18:45:43 +0000 (+0300) Subject: net: dsa: Store vlan_filtering as a property of dsa_port X-Git-Tag: v5.4-rc1~1056^2~75^2~11 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=33162e9a0590f16e1b21be764caae517e2bb310c;p=platform%2Fkernel%2Flinux-rpi.git net: dsa: Store vlan_filtering as a property of dsa_port 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 Reviewed-by: Florian Fainelli Signed-off-by: David S. Miller --- diff --git a/include/net/dsa.h b/include/net/dsa.h index b550f7b..79a8791 100644 --- a/include/net/dsa.h +++ b/include/net/dsa.h @@ -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; diff --git a/net/dsa/port.c b/net/dsa/port.c index caeef4c..a86fe3b 100644 --- a/net/dsa/port.c +++ b/net/dsa/port.c @@ -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; }