Skip to content

Commit 0033523

Browse files
committed
Merge branch 'dsa-fast-ageing'
Vladimir Oltean says: ==================== DSA fast ageing fixes/improvements These are 2 small improvements brought to the DSA fast ageing changes merged earlier today. Patch 1 restores the behavior for DSA drivers that don't implement the .port_bridge_flags function (I don't think there is any breakage due to the new behavior, but just to be sure). This came as a result of Andrew's review. Patch 2 reduces the number of fast ages of a port from 2 to 1 when it leaves a bridge. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2 parents cfe908c + bee7c57 commit 0033523

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

net/dsa/port.c

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,21 @@ static void dsa_port_fast_age(const struct dsa_port *dp)
6060
dsa_port_notify_bridge_fdb_flush(dp);
6161
}
6262

63+
static bool dsa_port_can_configure_learning(struct dsa_port *dp)
64+
{
65+
struct switchdev_brport_flags flags = {
66+
.mask = BR_LEARNING,
67+
};
68+
struct dsa_switch *ds = dp->ds;
69+
int err;
70+
71+
if (!ds->ops->port_bridge_flags || !ds->ops->port_pre_bridge_flags)
72+
return false;
73+
74+
err = ds->ops->port_pre_bridge_flags(ds, dp->index, flags, NULL);
75+
return !err;
76+
}
77+
6378
int dsa_port_set_state(struct dsa_port *dp, u8 state, bool do_fast_age)
6479
{
6580
struct dsa_switch *ds = dp->ds;
@@ -70,7 +85,8 @@ int dsa_port_set_state(struct dsa_port *dp, u8 state, bool do_fast_age)
7085

7186
ds->ops->port_stp_state_set(ds, port, state);
7287

73-
if (do_fast_age && dp->learning) {
88+
if (!dsa_port_can_configure_learning(dp) ||
89+
(do_fast_age && dp->learning)) {
7490
/* Fast age FDB entries or flush appropriate forwarding database
7591
* for the given port, if we are moving it from Learning or
7692
* Forwarding state, to Disabled or Blocking or Listening state.
@@ -683,7 +699,9 @@ int dsa_port_bridge_flags(struct dsa_port *dp,
683699
if (learning == dp->learning)
684700
return 0;
685701

686-
if (dp->learning && !learning)
702+
if ((dp->learning && !learning) &&
703+
(dp->stp_state == BR_STATE_LEARNING ||
704+
dp->stp_state == BR_STATE_FORWARDING))
687705
dsa_port_fast_age(dp);
688706

689707
dp->learning = learning;

0 commit comments

Comments
 (0)