diff options
author | Vivien Didelot <vivien.didelot@savoirfairelinux.com> | 2016-04-06 11:55:03 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-04-08 16:50:40 -0400 |
commit | 43c44a9f655170fb92536167b95b1c6ae8b732cb (patch) | |
tree | f6d94e8a1a8b61bdf651bd1848961d6b1921ed07 /net/dsa/slave.c | |
parent | f453939c1a4a758312f799748b344bacd1db701f (diff) |
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 <vivien.didelot@savoirfairelinux.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dsa/slave.c')
-rw-r--r-- | net/dsa/slave.c | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/net/dsa/slave.c b/net/dsa/slave.c index a575f0350d5a..088215c3642f 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c | |||
@@ -104,8 +104,8 @@ static int dsa_slave_open(struct net_device *dev) | |||
104 | goto clear_promisc; | 104 | goto clear_promisc; |
105 | } | 105 | } |
106 | 106 | ||
107 | if (ds->drv->port_stp_update) | 107 | if (ds->drv->port_stp_state_set) |
108 | ds->drv->port_stp_update(ds, p->port, stp_state); | 108 | ds->drv->port_stp_state_set(ds, p->port, stp_state); |
109 | 109 | ||
110 | if (p->phy) | 110 | if (p->phy) |
111 | phy_start(p->phy); | 111 | phy_start(p->phy); |
@@ -147,8 +147,8 @@ static int dsa_slave_close(struct net_device *dev) | |||
147 | if (ds->drv->port_disable) | 147 | if (ds->drv->port_disable) |
148 | ds->drv->port_disable(ds, p->port, p->phy); | 148 | ds->drv->port_disable(ds, p->port, p->phy); |
149 | 149 | ||
150 | if (ds->drv->port_stp_update) | 150 | if (ds->drv->port_stp_state_set) |
151 | ds->drv->port_stp_update(ds, p->port, BR_STATE_DISABLED); | 151 | ds->drv->port_stp_state_set(ds, p->port, BR_STATE_DISABLED); |
152 | 152 | ||
153 | return 0; | 153 | return 0; |
154 | } | 154 | } |
@@ -305,16 +305,19 @@ static int dsa_slave_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | |||
305 | return -EOPNOTSUPP; | 305 | return -EOPNOTSUPP; |
306 | } | 306 | } |
307 | 307 | ||
308 | static int dsa_slave_stp_update(struct net_device *dev, u8 state) | 308 | static int dsa_slave_stp_state_set(struct net_device *dev, |
309 | const struct switchdev_attr *attr, | ||
310 | struct switchdev_trans *trans) | ||
309 | { | 311 | { |
310 | struct dsa_slave_priv *p = netdev_priv(dev); | 312 | struct dsa_slave_priv *p = netdev_priv(dev); |
311 | struct dsa_switch *ds = p->parent; | 313 | struct dsa_switch *ds = p->parent; |
312 | int ret = -EOPNOTSUPP; | ||
313 | 314 | ||
314 | if (ds->drv->port_stp_update) | 315 | if (switchdev_trans_ph_prepare(trans)) |
315 | ret = ds->drv->port_stp_update(ds, p->port, state); | 316 | return ds->drv->port_stp_state_set ? 0 : -EOPNOTSUPP; |
316 | 317 | ||
317 | return ret; | 318 | ds->drv->port_stp_state_set(ds, p->port, attr->u.stp_state); |
319 | |||
320 | return 0; | ||
318 | } | 321 | } |
319 | 322 | ||
320 | static int dsa_slave_vlan_filtering(struct net_device *dev, | 323 | 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, | |||
339 | const struct switchdev_attr *attr, | 342 | const struct switchdev_attr *attr, |
340 | struct switchdev_trans *trans) | 343 | struct switchdev_trans *trans) |
341 | { | 344 | { |
342 | struct dsa_slave_priv *p = netdev_priv(dev); | ||
343 | struct dsa_switch *ds = p->parent; | ||
344 | int ret; | 345 | int ret; |
345 | 346 | ||
346 | switch (attr->id) { | 347 | switch (attr->id) { |
347 | case SWITCHDEV_ATTR_ID_PORT_STP_STATE: | 348 | case SWITCHDEV_ATTR_ID_PORT_STP_STATE: |
348 | if (switchdev_trans_ph_prepare(trans)) | 349 | ret = dsa_slave_stp_state_set(dev, attr, trans); |
349 | ret = ds->drv->port_stp_update ? 0 : -EOPNOTSUPP; | ||
350 | else | ||
351 | ret = ds->drv->port_stp_update(ds, p->port, | ||
352 | attr->u.stp_state); | ||
353 | break; | 350 | break; |
354 | case SWITCHDEV_ATTR_ID_BRIDGE_VLAN_FILTERING: | 351 | case SWITCHDEV_ATTR_ID_BRIDGE_VLAN_FILTERING: |
355 | ret = dsa_slave_vlan_filtering(dev, attr, trans); | 352 | ret = dsa_slave_vlan_filtering(dev, attr, trans); |
@@ -468,7 +465,8 @@ static void dsa_slave_bridge_port_leave(struct net_device *dev) | |||
468 | /* Port left the bridge, put in BR_STATE_DISABLED by the bridge layer, | 465 | /* Port left the bridge, put in BR_STATE_DISABLED by the bridge layer, |
469 | * so allow it to be in BR_STATE_FORWARDING to be kept functional | 466 | * so allow it to be in BR_STATE_FORWARDING to be kept functional |
470 | */ | 467 | */ |
471 | dsa_slave_stp_update(dev, BR_STATE_FORWARDING); | 468 | if (ds->drv->port_stp_state_set) |
469 | ds->drv->port_stp_state_set(ds, p->port, BR_STATE_FORWARDING); | ||
472 | } | 470 | } |
473 | 471 | ||
474 | static int dsa_slave_port_attr_get(struct net_device *dev, | 472 | static int dsa_slave_port_attr_get(struct net_device *dev, |