From: Vladimir Oltean Date: Mon, 19 Jul 2021 13:51:38 +0000 (+0300) Subject: net: switchdev: introduce helper for checking dynamically learned FDB entries X-Git-Tag: accepted/tizen/unified/20230118.172025~6527^2~453^2~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c6451cda100d4ebbc3f6819e1161ce0e38ce7746;p=platform%2Fkernel%2Flinux-rpi.git net: switchdev: introduce helper for checking dynamically learned FDB entries It is a bit difficult to understand what DSA checks when it tries to avoid installing dynamically learned addresses on foreign interfaces as local host addresses, so create a generic switchdev helper that can be reused and is generally more readable. Signed-off-by: Vladimir Oltean Signed-off-by: David S. Miller --- diff --git a/include/net/switchdev.h b/include/net/switchdev.h index e4cac92..745eb25 100644 --- a/include/net/switchdev.h +++ b/include/net/switchdev.h @@ -238,6 +238,12 @@ switchdev_notifier_info_to_extack(const struct switchdev_notifier_info *info) return info->extack; } +static inline bool +switchdev_fdb_is_dynamically_learned(const struct switchdev_notifier_fdb_info *fdb_info) +{ + return !fdb_info->added_by_user && !fdb_info->is_local; +} + #ifdef CONFIG_NET_SWITCHDEV void switchdev_deferred_process(void); diff --git a/net/dsa/slave.c b/net/dsa/slave.c index ffbba1e..feb64f5 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c @@ -2438,7 +2438,7 @@ static int dsa_slave_switchdev_event(struct notifier_block *unused, * On the other hand, FDB entries for local termination * should always be installed. */ - if (!fdb_info->added_by_user && !fdb_info->is_local && + if (switchdev_fdb_is_dynamically_learned(fdb_info) && !dp->ds->assisted_learning_on_cpu_port) return NOTIFY_DONE;