mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
net: dsa: make the STP state function return void
The DSA layer doesn't care about the return code of the port_stp_update routine, so make it void in the layer and the DSA drivers. Replace the useless dsa_slave_stp_update function with a dsa_slave_stp_state function used to reply to the switchdev SWITCHDEV_ATTR_ID_PORT_STP_STATE attribute. In the meantime, rename port_stp_update to port_stp_state_set to explicit the state change. Signed-off-by: Vivien Didelot <[email protected]> Signed-off-by: David S. Miller <[email protected]>
This commit is contained in:
parent
f453939c1a
commit
43c44a9f65
8 changed files with 29 additions and 37 deletions
|
|
@ -104,8 +104,8 @@ static int dsa_slave_open(struct net_device *dev)
|
|||
goto clear_promisc;
|
||||
}
|
||||
|
||||
if (ds->drv->port_stp_update)
|
||||
ds->drv->port_stp_update(ds, p->port, stp_state);
|
||||
if (ds->drv->port_stp_state_set)
|
||||
ds->drv->port_stp_state_set(ds, p->port, stp_state);
|
||||
|
||||
if (p->phy)
|
||||
phy_start(p->phy);
|
||||
|
|
@ -147,8 +147,8 @@ static int dsa_slave_close(struct net_device *dev)
|
|||
if (ds->drv->port_disable)
|
||||
ds->drv->port_disable(ds, p->port, p->phy);
|
||||
|
||||
if (ds->drv->port_stp_update)
|
||||
ds->drv->port_stp_update(ds, p->port, BR_STATE_DISABLED);
|
||||
if (ds->drv->port_stp_state_set)
|
||||
ds->drv->port_stp_state_set(ds, p->port, BR_STATE_DISABLED);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -305,16 +305,19 @@ static int dsa_slave_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
|
|||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
static int dsa_slave_stp_update(struct net_device *dev, u8 state)
|
||||
static int dsa_slave_stp_state_set(struct net_device *dev,
|
||||
const struct switchdev_attr *attr,
|
||||
struct switchdev_trans *trans)
|
||||
{
|
||||
struct dsa_slave_priv *p = netdev_priv(dev);
|
||||
struct dsa_switch *ds = p->parent;
|
||||
int ret = -EOPNOTSUPP;
|
||||
|
||||
if (ds->drv->port_stp_update)
|
||||
ret = ds->drv->port_stp_update(ds, p->port, state);
|
||||
if (switchdev_trans_ph_prepare(trans))
|
||||
return ds->drv->port_stp_state_set ? 0 : -EOPNOTSUPP;
|
||||
|
||||
return ret;
|
||||
ds->drv->port_stp_state_set(ds, p->port, attr->u.stp_state);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dsa_slave_vlan_filtering(struct net_device *dev,
|
||||
|
|
@ -339,17 +342,11 @@ static int dsa_slave_port_attr_set(struct net_device *dev,
|
|||
const struct switchdev_attr *attr,
|
||||
struct switchdev_trans *trans)
|
||||
{
|
||||
struct dsa_slave_priv *p = netdev_priv(dev);
|
||||
struct dsa_switch *ds = p->parent;
|
||||
int ret;
|
||||
|
||||
switch (attr->id) {
|
||||
case SWITCHDEV_ATTR_ID_PORT_STP_STATE:
|
||||
if (switchdev_trans_ph_prepare(trans))
|
||||
ret = ds->drv->port_stp_update ? 0 : -EOPNOTSUPP;
|
||||
else
|
||||
ret = ds->drv->port_stp_update(ds, p->port,
|
||||
attr->u.stp_state);
|
||||
ret = dsa_slave_stp_state_set(dev, attr, trans);
|
||||
break;
|
||||
case SWITCHDEV_ATTR_ID_BRIDGE_VLAN_FILTERING:
|
||||
ret = dsa_slave_vlan_filtering(dev, attr, trans);
|
||||
|
|
@ -468,7 +465,8 @@ static void dsa_slave_bridge_port_leave(struct net_device *dev)
|
|||
/* Port left the bridge, put in BR_STATE_DISABLED by the bridge layer,
|
||||
* so allow it to be in BR_STATE_FORWARDING to be kept functional
|
||||
*/
|
||||
dsa_slave_stp_update(dev, BR_STATE_FORWARDING);
|
||||
if (ds->drv->port_stp_state_set)
|
||||
ds->drv->port_stp_state_set(ds, p->port, BR_STATE_FORWARDING);
|
||||
}
|
||||
|
||||
static int dsa_slave_port_attr_get(struct net_device *dev,
|
||||
|
|
|
|||
Loading…
Reference in a new issue