bridge: mcast: Propagate MDB configuration structure further
authorIdo Schimmel <idosch@nvidia.com>
Tue, 6 Dec 2022 10:58:04 +0000 (12:58 +0200)
committerJakub Kicinski <kuba@kernel.org>
Thu, 8 Dec 2022 04:05:51 +0000 (20:05 -0800)
As an intermediate step towards only using the new MDB configuration
structure, pass it further in the control path instead of passing
individual attributes.

No functional changes intended.

Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Acked-by: Nikolay Aleksandrov <razor@blackwall.org>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/bridge/br_mdb.c

index 080516a3ee9c0d4a9c689c1224f0d0c0357db52e..6017bff8316afb44987e69372ddb75e5a07456b6 100644 (file)
@@ -959,17 +959,15 @@ static int br_mdb_add_group(struct net_bridge *br, struct net_bridge_port *port,
        return 0;
 }
 
-static int __br_mdb_add(struct net *net, struct net_bridge *br,
-                       struct net_bridge_port *p,
-                       struct br_mdb_entry *entry,
+static int __br_mdb_add(const struct br_mdb_config *cfg,
                        struct nlattr **mdb_attrs,
                        struct netlink_ext_ack *extack)
 {
        int ret;
 
-       spin_lock_bh(&br->multicast_lock);
-       ret = br_mdb_add_group(br, p, entry, mdb_attrs, extack);
-       spin_unlock_bh(&br->multicast_lock);
+       spin_lock_bh(&cfg->br->multicast_lock);
+       ret = br_mdb_add_group(cfg->br, cfg->p, cfg->entry, mdb_attrs, extack);
+       spin_unlock_bh(&cfg->br->multicast_lock);
 
        return ret;
 }
@@ -1120,22 +1118,22 @@ static int br_mdb_add(struct sk_buff *skb, struct nlmsghdr *nlh,
        if (br_vlan_enabled(cfg.br->dev) && vg && cfg.entry->vid == 0) {
                list_for_each_entry(v, &vg->vlan_list, vlist) {
                        cfg.entry->vid = v->vid;
-                       err = __br_mdb_add(net, cfg.br, cfg.p, cfg.entry,
-                                          mdb_attrs, extack);
+                       err = __br_mdb_add(&cfg, mdb_attrs, extack);
                        if (err)
                                break;
                }
        } else {
-               err = __br_mdb_add(net, cfg.br, cfg.p, cfg.entry, mdb_attrs,
-                                  extack);
+               err = __br_mdb_add(&cfg, mdb_attrs, extack);
        }
 
        return err;
 }
 
-static int __br_mdb_del(struct net_bridge *br, struct br_mdb_entry *entry,
+static int __br_mdb_del(const struct br_mdb_config *cfg,
                        struct nlattr **mdb_attrs)
 {
+       struct br_mdb_entry *entry = cfg->entry;
+       struct net_bridge *br = cfg->br;
        struct net_bridge_mdb_entry *mp;
        struct net_bridge_port_group *p;
        struct net_bridge_port_group __rcu **pp;
@@ -1206,10 +1204,10 @@ static int br_mdb_del(struct sk_buff *skb, struct nlmsghdr *nlh,
        if (br_vlan_enabled(cfg.br->dev) && vg && cfg.entry->vid == 0) {
                list_for_each_entry(v, &vg->vlan_list, vlist) {
                        cfg.entry->vid = v->vid;
-                       err = __br_mdb_del(cfg.br, cfg.entry, mdb_attrs);
+                       err = __br_mdb_del(&cfg, mdb_attrs);
                }
        } else {
-               err = __br_mdb_del(cfg.br, cfg.entry, mdb_attrs);
+               err = __br_mdb_del(&cfg, mdb_attrs);
        }
 
        return err;