summaryrefslogtreecommitdiffstats
path: root/include/net/switchdev.h
diff options
context:
space:
mode:
authorVladimir Oltean <vladimir.oltean@nxp.com>2021-07-19 15:51:38 +0200
committerDavid S. Miller <davem@davemloft.net>2021-07-20 16:04:27 +0200
commitc6451cda100d4ebbc3f6819e1161ce0e38ce7746 (patch)
tree70e29f32a10094a1bf3ae8b07f8c4e117a1b7809 /include/net/switchdev.h
parentnet: phy: add Maxlinear GPY115/21x/24x driver (diff)
downloadlinux-c6451cda100d4ebbc3f6819e1161ce0e38ce7746.tar.xz
linux-c6451cda100d4ebbc3f6819e1161ce0e38ce7746.zip
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 <vladimir.oltean@nxp.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/switchdev.h')
-rw-r--r--include/net/switchdev.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/net/switchdev.h b/include/net/switchdev.h
index e4cac9218ce1..745eb25fb8c4 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);