aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/dsa/slave.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index d726307c7795..d8c3c0f00cf3 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -74,9 +74,12 @@ static inline bool dsa_port_is_bridged(struct dsa_port *dp)
74 return !!dp->bridge_dev; 74 return !!dp->bridge_dev;
75} 75}
76 76
77static void dsa_port_set_stp_state(struct dsa_switch *ds, int port, u8 state) 77static void dsa_slave_set_state(struct net_device *dev, u8 state)
78{ 78{
79 struct dsa_port *dp = &ds->ports[port]; 79 struct dsa_slave_priv *p = netdev_priv(dev);
80 struct dsa_port *dp = p->dp;
81 struct dsa_switch *ds = dp->ds;
82 int port = dp->index;
80 83
81 if (ds->ops->port_stp_state_set) 84 if (ds->ops->port_stp_state_set)
82 ds->ops->port_stp_state_set(ds, port, state); 85 ds->ops->port_stp_state_set(ds, port, state);
@@ -133,7 +136,7 @@ static int dsa_slave_open(struct net_device *dev)
133 goto clear_promisc; 136 goto clear_promisc;
134 } 137 }
135 138
136 dsa_port_set_stp_state(ds, p->dp->index, stp_state); 139 dsa_slave_set_state(dev, stp_state);
137 140
138 if (p->phy) 141 if (p->phy)
139 phy_start(p->phy); 142 phy_start(p->phy);
@@ -175,7 +178,7 @@ static int dsa_slave_close(struct net_device *dev)
175 if (ds->ops->port_disable) 178 if (ds->ops->port_disable)
176 ds->ops->port_disable(ds, p->dp->index, p->phy); 179 ds->ops->port_disable(ds, p->dp->index, p->phy);
177 180
178 dsa_port_set_stp_state(ds, p->dp->index, BR_STATE_DISABLED); 181 dsa_slave_set_state(dev, BR_STATE_DISABLED);
179 182
180 return 0; 183 return 0;
181} 184}
@@ -382,7 +385,7 @@ static int dsa_slave_stp_state_set(struct net_device *dev,
382 if (switchdev_trans_ph_prepare(trans)) 385 if (switchdev_trans_ph_prepare(trans))
383 return ds->ops->port_stp_state_set ? 0 : -EOPNOTSUPP; 386 return ds->ops->port_stp_state_set ? 0 : -EOPNOTSUPP;
384 387
385 dsa_port_set_stp_state(ds, p->dp->index, attr->u.stp_state); 388 dsa_slave_set_state(dev, attr->u.stp_state);
386 389
387 return 0; 390 return 0;
388} 391}
@@ -596,7 +599,7 @@ static void dsa_slave_bridge_port_leave(struct net_device *dev,
596 /* Port left the bridge, put in BR_STATE_DISABLED by the bridge layer, 599 /* Port left the bridge, put in BR_STATE_DISABLED by the bridge layer,
597 * so allow it to be in BR_STATE_FORWARDING to be kept functional 600 * so allow it to be in BR_STATE_FORWARDING to be kept functional
598 */ 601 */
599 dsa_port_set_stp_state(ds, p->dp->index, BR_STATE_FORWARDING); 602 dsa_slave_set_state(dev, BR_STATE_FORWARDING);
600} 603}
601 604
602static int dsa_slave_port_attr_get(struct net_device *dev, 605static int dsa_slave_port_attr_get(struct net_device *dev,