summaryrefslogtreecommitdiffstats
path: root/net/bridge/br_fdb.c
diff options
context:
space:
mode:
authorNikolay Aleksandrov <nikolay@cumulusnetworks.com>2019-11-01 13:46:38 +0100
committerDavid S. Miller <davem@davemloft.net>2019-11-01 18:32:43 +0100
commit31f1155bdc26aabd8de4bdf25e1c9ce9dbb21ff5 (patch)
tree5d49b34264f52ed9bb0b5a2795cab0dfda6e66b1 /net/bridge/br_fdb.c
parentnet: bridge: fdb: br_fdb_update can take flags directly (diff)
downloadlinux-31f1155bdc26aabd8de4bdf25e1c9ce9dbb21ff5.tar.xz
linux-31f1155bdc26aabd8de4bdf25e1c9ce9dbb21ff5.zip
net: bridge: fdb: avoid two atomic bitops in br_fdb_external_learn_add()
If we setup the fdb flags prior to calling fdb_create() we can avoid two atomic bitops when learning a new entry. Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/bridge/br_fdb.c')
-rw-r--r--net/bridge/br_fdb.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c
index b37e0f4c1b2b..7500c84fc675 100644
--- a/net/bridge/br_fdb.c
+++ b/net/bridge/br_fdb.c
@@ -1113,14 +1113,15 @@ int br_fdb_external_learn_add(struct net_bridge *br, struct net_bridge_port *p,
fdb = br_fdb_find(br, addr, vid);
if (!fdb) {
- fdb = fdb_create(br, p, addr, vid, 0);
+ unsigned long flags = BIT(BR_FDB_ADDED_BY_EXT_LEARN);
+
+ if (swdev_notify)
+ flags |= BIT(BR_FDB_ADDED_BY_USER);
+ fdb = fdb_create(br, p, addr, vid, flags);
if (!fdb) {
err = -ENOMEM;
goto err_unlock;
}
- if (swdev_notify)
- set_bit(BR_FDB_ADDED_BY_USER, &fdb->flags);
- set_bit(BR_FDB_ADDED_BY_EXT_LEARN, &fdb->flags);
fdb_notify(br, fdb, RTM_NEWNEIGH, swdev_notify);
} else {
fdb->updated = jiffies;