net: bridge: add bitfield for options and convert vlan opts
Bridge options have usually been added as separate fields all over the net_bridge struct taking up space and ending up in different cache lines. Let's move them to a single bitfield to save up space and speedup lookups. This patch adds a simple API for option modifying and retrieving using bitops and converts the first user of the API - the bridge vlan options (vlan_enabled and vlan_stats_enabled). Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com> Reviewed-by: Stephen Hemminger <stephen@networkplumber.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
1c1cb6d032
commit
ae75767ec2
@@ -175,6 +175,22 @@ static struct notifier_block br_switchdev_notifier = {
|
||||
.notifier_call = br_switchdev_event,
|
||||
};
|
||||
|
||||
void br_opt_toggle(struct net_bridge *br, enum net_bridge_opts opt, bool on)
|
||||
{
|
||||
bool cur = !!br_opt_get(br, opt);
|
||||
|
||||
br_debug(br, "toggle option: %d state: %d -> %d\n",
|
||||
opt, cur, on);
|
||||
|
||||
if (cur == on)
|
||||
return;
|
||||
|
||||
if (on)
|
||||
set_bit(opt, &br->options);
|
||||
else
|
||||
clear_bit(opt, &br->options);
|
||||
}
|
||||
|
||||
static void __net_exit br_net_exit(struct net *net)
|
||||
{
|
||||
struct net_device *dev;
|
||||
|
Reference in New Issue
Block a user