diff options
author | Christophe JAILLET <christophe.jaillet@wanadoo.fr> | 2021-11-14 20:02:35 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2021-11-15 15:07:06 +0100 |
commit | cc0be1ad686fb29a4d127948486f40b17fb34b50 (patch) | |
tree | f93536bfcdeaaa445d144fddca21ad7f53ac28d4 /net/bridge/br_if.c | |
parent | net: sched: sch_netem: Refactor code in 4-state loss generator (diff) | |
download | linux-cc0be1ad686fb29a4d127948486f40b17fb34b50.tar.xz linux-cc0be1ad686fb29a4d127948486f40b17fb34b50.zip |
net: bridge: Slightly optimize 'find_portno()'
The 'inuse' bitmap is local to this function. So we can use the
non-atomic '__set_bit()' to save a few cycles.
While at it, also remove some useless {}.
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Acked-by: Nikolay Aleksandrov <nikolay@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/bridge/br_if.c')
-rw-r--r-- | net/bridge/br_if.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c index c1183fef1f21..64b2d4fb50f5 100644 --- a/net/bridge/br_if.c +++ b/net/bridge/br_if.c @@ -397,10 +397,10 @@ static int find_portno(struct net_bridge *br) if (!inuse) return -ENOMEM; - set_bit(0, inuse); /* zero is reserved */ - list_for_each_entry(p, &br->port_list, list) { - set_bit(p->port_no, inuse); - } + __set_bit(0, inuse); /* zero is reserved */ + list_for_each_entry(p, &br->port_list, list) + __set_bit(p->port_no, inuse); + index = find_first_zero_bit(inuse, BR_MAX_PORTS); bitmap_free(inuse); |