switchdev: convert STP update to switchdev attr set

STP update is just a settable port attribute, so convert
switchdev_port_stp_update to an attr set.

For DSA, the prepare phase is skipped and STP updates are only done in the
commit phase.  This is because currently the DSA drivers don't need to
allocate any memory for STP updates and the STP update will not fail to HW
(unless something horrible goes wrong on the MDIO bus, in which case the
prepare phase wouldn't have been able to predict anyway).

Signed-off-by: Scott Feldman <sfeldma@gmail.com>
Acked-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Scott Feldman
2015-05-10 09:47:51 -07:00
committed by David S. Miller
parent c4f20321d9
commit 3563606258
5 changed files with 31 additions and 50 deletions

View File

@@ -4395,14 +4395,6 @@ static int rocker_port_attr_get(struct net_device *dev,
return 0;
}
static int rocker_port_switchdev_port_stp_update(struct net_device *dev,
u8 state)
{
struct rocker_port *rocker_port = netdev_priv(dev);
return rocker_port_stp_update(rocker_port, SWITCHDEV_TRANS_NONE, state);
}
static void rocker_port_trans_abort(struct rocker_port *rocker_port)
{
struct list_head *mem, *tmp;
@@ -4431,6 +4423,10 @@ static int rocker_port_attr_set(struct net_device *dev,
}
switch (attr->id) {
case SWITCHDEV_ATTR_PORT_STP_STATE:
err = rocker_port_stp_update(rocker_port, attr->trans,
attr->stp_state);
break;
default:
err = -EOPNOTSUPP;
break;
@@ -4466,7 +4462,7 @@ static int rocker_port_switchdev_fib_ipv4_del(struct net_device *dev,
static const struct switchdev_ops rocker_port_switchdev_ops = {
.switchdev_port_attr_get = rocker_port_attr_get,
.switchdev_port_stp_update = rocker_port_switchdev_port_stp_update,
.switchdev_port_attr_set = rocker_port_attr_set,
.switchdev_fib_ipv4_add = rocker_port_switchdev_fib_ipv4_add,
.switchdev_fib_ipv4_del = rocker_port_switchdev_fib_ipv4_del,
};