提交 c6451cda 编写于 作者: V Vladimir Oltean 提交者: David S. Miller

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: NVladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 7d901a1e
...@@ -238,6 +238,12 @@ switchdev_notifier_info_to_extack(const struct switchdev_notifier_info *info) ...@@ -238,6 +238,12 @@ switchdev_notifier_info_to_extack(const struct switchdev_notifier_info *info)
return info->extack; 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 #ifdef CONFIG_NET_SWITCHDEV
void switchdev_deferred_process(void); void switchdev_deferred_process(void);
......
...@@ -2438,7 +2438,7 @@ static int dsa_slave_switchdev_event(struct notifier_block *unused, ...@@ -2438,7 +2438,7 @@ static int dsa_slave_switchdev_event(struct notifier_block *unused,
* On the other hand, FDB entries for local termination * On the other hand, FDB entries for local termination
* should always be installed. * 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) !dp->ds->assisted_learning_on_cpu_port)
return NOTIFY_DONE; return NOTIFY_DONE;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册