Commit cbf51acb authored by Johannes Nixdorf's avatar Johannes Nixdorf Committed by Jakub Kicinski

net: bridge: Set BR_FDB_ADDED_BY_USER early in fdb_add_entry

In preparation of the following fdb limit for dynamically learned entries,
allow fdb_create to detect that the entry was added by the user. This
way it can skip applying the limit in this case.
Reviewed-by: default avatarIdo Schimmel <idosch@nvidia.com>
Acked-by: default avatarNikolay Aleksandrov <razor@blackwall.org>
Signed-off-by: default avatarJohannes Nixdorf <jnixdorf-oss@avm.de>
Link: https://lore.kernel.org/r/20231016-fdb_limit-v5-1-32cddff87758@avm.deSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 56a7bb12
...@@ -1075,7 +1075,8 @@ static int fdb_add_entry(struct net_bridge *br, struct net_bridge_port *source, ...@@ -1075,7 +1075,8 @@ static int fdb_add_entry(struct net_bridge *br, struct net_bridge_port *source,
if (!(flags & NLM_F_CREATE)) if (!(flags & NLM_F_CREATE))
return -ENOENT; return -ENOENT;
fdb = fdb_create(br, source, addr, vid, 0); fdb = fdb_create(br, source, addr, vid,
BIT(BR_FDB_ADDED_BY_USER));
if (!fdb) if (!fdb)
return -ENOMEM; return -ENOMEM;
...@@ -1088,6 +1089,8 @@ static int fdb_add_entry(struct net_bridge *br, struct net_bridge_port *source, ...@@ -1088,6 +1089,8 @@ static int fdb_add_entry(struct net_bridge *br, struct net_bridge_port *source,
WRITE_ONCE(fdb->dst, source); WRITE_ONCE(fdb->dst, source);
modified = true; modified = true;
} }
set_bit(BR_FDB_ADDED_BY_USER, &fdb->flags);
} }
if (fdb_to_nud(br, fdb) != state) { if (fdb_to_nud(br, fdb) != state) {
...@@ -1119,8 +1122,6 @@ static int fdb_add_entry(struct net_bridge *br, struct net_bridge_port *source, ...@@ -1119,8 +1122,6 @@ static int fdb_add_entry(struct net_bridge *br, struct net_bridge_port *source,
if (fdb_handle_notify(fdb, notify)) if (fdb_handle_notify(fdb, notify))
modified = true; modified = true;
set_bit(BR_FDB_ADDED_BY_USER, &fdb->flags);
fdb->used = jiffies; fdb->used = jiffies;
if (modified) { if (modified) {
if (refresh) if (refresh)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment