Commit c02c4175 authored by Vivien Didelot's avatar Vivien Didelot Committed by David S. Miller

net: dsa: change scope of VLAN filtering setter

Change the scope of the switchdev VLAN filtering attribute setter from
the DSA slave device to the generic DSA port, so that the future
port-wide API can also be used for other port types, such as CPU and DSA
links.
Signed-off-by: default avatarVivien Didelot <vivien.didelot@savoirfairelinux.com>
Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 01676d12
...@@ -388,20 +388,18 @@ static int dsa_slave_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) ...@@ -388,20 +388,18 @@ static int dsa_slave_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
static int dsa_slave_vlan_filtering(struct net_device *dev, static int dsa_port_vlan_filtering(struct dsa_port *dp, bool vlan_filtering,
const struct switchdev_attr *attr, struct switchdev_trans *trans)
struct switchdev_trans *trans)
{ {
struct dsa_slave_priv *p = netdev_priv(dev); struct dsa_switch *ds = dp->ds;
struct dsa_switch *ds = p->dp->ds;
/* bridge skips -EOPNOTSUPP, so skip the prepare phase */ /* bridge skips -EOPNOTSUPP, so skip the prepare phase */
if (switchdev_trans_ph_prepare(trans)) if (switchdev_trans_ph_prepare(trans))
return 0; return 0;
if (ds->ops->port_vlan_filtering) if (ds->ops->port_vlan_filtering)
return ds->ops->port_vlan_filtering(ds, p->dp->index, return ds->ops->port_vlan_filtering(ds, dp->index,
attr->u.vlan_filtering); vlan_filtering);
return 0; return 0;
} }
...@@ -461,7 +459,8 @@ static int dsa_slave_port_attr_set(struct net_device *dev, ...@@ -461,7 +459,8 @@ static int dsa_slave_port_attr_set(struct net_device *dev,
ret = dsa_port_set_state(dp, attr->u.stp_state, trans); ret = dsa_port_set_state(dp, attr->u.stp_state, trans);
break; break;
case SWITCHDEV_ATTR_ID_BRIDGE_VLAN_FILTERING: case SWITCHDEV_ATTR_ID_BRIDGE_VLAN_FILTERING:
ret = dsa_slave_vlan_filtering(dev, attr, trans); ret = dsa_port_vlan_filtering(dp, attr->u.vlan_filtering,
trans);
break; break;
case SWITCHDEV_ATTR_ID_BRIDGE_AGEING_TIME: case SWITCHDEV_ATTR_ID_BRIDGE_AGEING_TIME:
ret = dsa_slave_ageing_time(dev, attr, trans); ret = dsa_slave_ageing_time(dev, attr, trans);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment