diff options
author | David S. Miller <davem@davemloft.net> | 2021-08-09 09:57:53 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2021-08-09 09:57:53 +0100 |
commit | 003352377f15f0014c752a6b7edf8bd947eecc7f (patch) | |
tree | e1615de3cab87863e37662c4248757ca2a415be6 | |
parent | cfe908c11659180e336a36f6f5a1c6591cfd3fc5 (diff) | |
parent | bee7c577e6d7b51fa0d2b30747c2cd3499ef778e (diff) | |
download | linux-stable-003352377f15f0014c752a6b7edf8bd947eecc7f.tar.gz linux-stable-003352377f15f0014c752a6b7edf8bd947eecc7f.tar.bz2 linux-stable-003352377f15f0014c752a6b7edf8bd947eecc7f.zip |
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>
-rw-r--r-- | net/dsa/port.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/net/dsa/port.c b/net/dsa/port.c index 96a4de67eccb..831d50d28d59 100644 --- a/net/dsa/port.c +++ b/net/dsa/port.c @@ -60,6 +60,21 @@ static void dsa_port_fast_age(const struct dsa_port *dp) dsa_port_notify_bridge_fdb_flush(dp); } +static bool dsa_port_can_configure_learning(struct dsa_port *dp) +{ + struct switchdev_brport_flags flags = { + .mask = BR_LEARNING, + }; + struct dsa_switch *ds = dp->ds; + int err; + + if (!ds->ops->port_bridge_flags || !ds->ops->port_pre_bridge_flags) + return false; + + err = ds->ops->port_pre_bridge_flags(ds, dp->index, flags, NULL); + return !err; +} + int dsa_port_set_state(struct dsa_port *dp, u8 state, bool do_fast_age) { 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) ds->ops->port_stp_state_set(ds, port, state); - if (do_fast_age && dp->learning) { + if (!dsa_port_can_configure_learning(dp) || + (do_fast_age && dp->learning)) { /* Fast age FDB entries or flush appropriate forwarding database * for the given port, if we are moving it from Learning or * Forwarding state, to Disabled or Blocking or Listening state. @@ -683,7 +699,9 @@ int dsa_port_bridge_flags(struct dsa_port *dp, if (learning == dp->learning) return 0; - if (dp->learning && !learning) + if ((dp->learning && !learning) && + (dp->stp_state == BR_STATE_LEARNING || + dp->stp_state == BR_STATE_FORWARDING)) dsa_port_fast_age(dp); dp->learning = learning; |