|
@@ -458,12 +458,17 @@ static int dsa_slave_stp_update(struct net_device *dev, u8 state)
|
|
|
static int dsa_slave_port_attr_set(struct net_device *dev,
|
|
|
struct switchdev_attr *attr)
|
|
|
{
|
|
|
- int ret = 0;
|
|
|
+ struct dsa_slave_priv *p = netdev_priv(dev);
|
|
|
+ struct dsa_switch *ds = p->parent;
|
|
|
+ int ret;
|
|
|
|
|
|
switch (attr->id) {
|
|
|
case SWITCHDEV_ATTR_PORT_STP_STATE:
|
|
|
- if (attr->trans == SWITCHDEV_TRANS_COMMIT)
|
|
|
- ret = dsa_slave_stp_update(dev, attr->u.stp_state);
|
|
|
+ if (attr->trans == SWITCHDEV_TRANS_PREPARE)
|
|
|
+ ret = ds->drv->port_stp_update ? 0 : -EOPNOTSUPP;
|
|
|
+ else
|
|
|
+ ret = ds->drv->port_stp_update(ds, p->port,
|
|
|
+ attr->u.stp_state);
|
|
|
break;
|
|
|
default:
|
|
|
ret = -EOPNOTSUPP;
|