Skip to content

Commit 597698f

Browse files
viviendavem330
authored andcommitted
net: dsa: b53: implement DSA port fast ageing
Remove the fast ageing logic from b53_br_set_stp_state and implement the new DSA switch port_fast_age operation instead. Signed-off-by: Vivien Didelot <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 732f794 commit 597698f

File tree

1 file changed

+11
-20
lines changed

1 file changed

+11
-20
lines changed

drivers/net/dsa/b53/b53_common.c

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1402,16 +1402,12 @@ static void b53_br_leave(struct dsa_switch *ds, int port)
14021402
}
14031403
}
14041404

1405-
static void b53_br_set_stp_state(struct dsa_switch *ds, int port,
1406-
u8 state)
1405+
static void b53_br_set_stp_state(struct dsa_switch *ds, int port, u8 state)
14071406
{
14081407
struct b53_device *dev = ds->priv;
1409-
u8 hw_state, cur_hw_state;
1408+
u8 hw_state;
14101409
u8 reg;
14111410

1412-
b53_read8(dev, B53_CTRL_PAGE, B53_PORT_CTRL(port), &reg);
1413-
cur_hw_state = reg & PORT_CTRL_STP_STATE_MASK;
1414-
14151411
switch (state) {
14161412
case BR_STATE_DISABLED:
14171413
hw_state = PORT_CTRL_DIS_STATE;
@@ -1433,26 +1429,20 @@ static void b53_br_set_stp_state(struct dsa_switch *ds, int port,
14331429
return;
14341430
}
14351431

1436-
/* Fast-age ARL entries if we are moving a port from Learning or
1437-
* Forwarding (cur_hw_state) state to Disabled, Blocking or Listening
1438-
* state (hw_state)
1439-
*/
1440-
if (cur_hw_state != hw_state) {
1441-
if (cur_hw_state >= PORT_CTRL_LEARN_STATE &&
1442-
hw_state <= PORT_CTRL_LISTEN_STATE) {
1443-
if (b53_fast_age_port(dev, port)) {
1444-
dev_err(ds->dev, "fast ageing failed\n");
1445-
return;
1446-
}
1447-
}
1448-
}
1449-
14501432
b53_read8(dev, B53_CTRL_PAGE, B53_PORT_CTRL(port), &reg);
14511433
reg &= ~PORT_CTRL_STP_STATE_MASK;
14521434
reg |= hw_state;
14531435
b53_write8(dev, B53_CTRL_PAGE, B53_PORT_CTRL(port), reg);
14541436
}
14551437

1438+
static void b53_br_fast_age(struct dsa_switch *ds, int port)
1439+
{
1440+
struct b53_device *dev = ds->priv;
1441+
1442+
if (b53_fast_age_port(dev, port))
1443+
dev_err(ds->dev, "fast ageing failed\n");
1444+
}
1445+
14561446
static enum dsa_tag_protocol b53_get_tag_protocol(struct dsa_switch *ds)
14571447
{
14581448
return DSA_TAG_PROTO_NONE;
@@ -1472,6 +1462,7 @@ static struct dsa_switch_ops b53_switch_ops = {
14721462
.port_bridge_join = b53_br_join,
14731463
.port_bridge_leave = b53_br_leave,
14741464
.port_stp_state_set = b53_br_set_stp_state,
1465+
.port_fast_age = b53_br_fast_age,
14751466
.port_vlan_filtering = b53_vlan_filtering,
14761467
.port_vlan_prepare = b53_vlan_prepare,
14771468
.port_vlan_add = b53_vlan_add,

0 commit comments

Comments
 (0)