提交 4329596c 编写于 作者: N Nikolay Aleksandrov 提交者: David S. Miller

net: bridge: multicast: use non-bh rcu flavor

The bridge multicast code has been using a mix of RCU and RCU-bh flavors
sometimes in questionable way. Since we've moved to rhashtable just use
non-bh RCU everywhere. In addition this simplifies freeing of objects
and allows us to remove some unnecessary callback functions.

v3: new patch
Signed-off-by: NNikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 19e3a9c9
...@@ -710,7 +710,7 @@ static int __br_mdb_del(struct net_bridge *br, struct br_mdb_entry *entry) ...@@ -710,7 +710,7 @@ static int __br_mdb_del(struct net_bridge *br, struct br_mdb_entry *entry)
rcu_assign_pointer(*pp, p->next); rcu_assign_pointer(*pp, p->next);
hlist_del_init(&p->mglist); hlist_del_init(&p->mglist);
del_timer(&p->timer); del_timer(&p->timer);
call_rcu_bh(&p->rcu, br_multicast_free_pg); kfree_rcu(p, rcu);
err = 0; err = 0;
if (!mp->ports && !mp->host_joined && if (!mp->ports && !mp->host_joined &&
......
...@@ -160,22 +160,6 @@ struct net_bridge_mdb_entry *br_mdb_get(struct net_bridge *br, ...@@ -160,22 +160,6 @@ struct net_bridge_mdb_entry *br_mdb_get(struct net_bridge *br,
return br_mdb_ip_get_rcu(br, &ip); return br_mdb_ip_get_rcu(br, &ip);
} }
void br_multicast_free_pg(struct rcu_head *head)
{
struct net_bridge_port_group *p =
container_of(head, struct net_bridge_port_group, rcu);
kfree(p);
}
static void br_multicast_free_group(struct rcu_head *head)
{
struct net_bridge_mdb_entry *mp =
container_of(head, struct net_bridge_mdb_entry, rcu);
kfree(mp);
}
static void br_multicast_group_expired(struct timer_list *t) static void br_multicast_group_expired(struct timer_list *t)
{ {
struct net_bridge_mdb_entry *mp = from_timer(mp, t, timer); struct net_bridge_mdb_entry *mp = from_timer(mp, t, timer);
...@@ -195,7 +179,7 @@ static void br_multicast_group_expired(struct timer_list *t) ...@@ -195,7 +179,7 @@ static void br_multicast_group_expired(struct timer_list *t)
br_mdb_rht_params); br_mdb_rht_params);
hlist_del_rcu(&mp->mdb_node); hlist_del_rcu(&mp->mdb_node);
call_rcu_bh(&mp->rcu, br_multicast_free_group); kfree_rcu(mp, rcu);
out: out:
spin_unlock(&br->multicast_lock); spin_unlock(&br->multicast_lock);
...@@ -223,7 +207,7 @@ static void br_multicast_del_pg(struct net_bridge *br, ...@@ -223,7 +207,7 @@ static void br_multicast_del_pg(struct net_bridge *br,
del_timer(&p->timer); del_timer(&p->timer);
br_mdb_notify(br->dev, p->port, &pg->addr, RTM_DELMDB, br_mdb_notify(br->dev, p->port, &pg->addr, RTM_DELMDB,
p->flags); p->flags);
call_rcu_bh(&p->rcu, br_multicast_free_pg); kfree_rcu(p, rcu);
if (!mp->ports && !mp->host_joined && if (!mp->ports && !mp->host_joined &&
netif_running(br->dev)) netif_running(br->dev))
...@@ -1425,7 +1409,7 @@ br_multicast_leave_group(struct net_bridge *br, ...@@ -1425,7 +1409,7 @@ br_multicast_leave_group(struct net_bridge *br,
rcu_assign_pointer(*pp, p->next); rcu_assign_pointer(*pp, p->next);
hlist_del_init(&p->mglist); hlist_del_init(&p->mglist);
del_timer(&p->timer); del_timer(&p->timer);
call_rcu_bh(&p->rcu, br_multicast_free_pg); kfree_rcu(p, rcu);
br_mdb_notify(br->dev, port, group, RTM_DELMDB, br_mdb_notify(br->dev, port, group, RTM_DELMDB,
p->flags); p->flags);
...@@ -1839,11 +1823,11 @@ void br_multicast_dev_del(struct net_bridge *br) ...@@ -1839,11 +1823,11 @@ void br_multicast_dev_del(struct net_bridge *br)
rhashtable_remove_fast(&br->mdb_hash_tbl, &mp->rhnode, rhashtable_remove_fast(&br->mdb_hash_tbl, &mp->rhnode,
br_mdb_rht_params); br_mdb_rht_params);
hlist_del_rcu(&mp->mdb_node); hlist_del_rcu(&mp->mdb_node);
call_rcu_bh(&mp->rcu, br_multicast_free_group); kfree_rcu(mp, rcu);
} }
spin_unlock_bh(&br->multicast_lock); spin_unlock_bh(&br->multicast_lock);
rcu_barrier_bh(); rcu_barrier();
} }
int br_multicast_set_router(struct net_bridge *br, unsigned long val) int br_multicast_set_router(struct net_bridge *br, unsigned long val)
......
...@@ -679,7 +679,6 @@ struct net_bridge_mdb_entry * ...@@ -679,7 +679,6 @@ struct net_bridge_mdb_entry *
br_mdb_ip_get(struct net_bridge *br, struct br_ip *dst); br_mdb_ip_get(struct net_bridge *br, struct br_ip *dst);
struct net_bridge_mdb_entry * struct net_bridge_mdb_entry *
br_multicast_new_group(struct net_bridge *br, struct br_ip *group); br_multicast_new_group(struct net_bridge *br, struct br_ip *group);
void br_multicast_free_pg(struct rcu_head *head);
struct net_bridge_port_group * struct net_bridge_port_group *
br_multicast_new_port_group(struct net_bridge_port *port, struct br_ip *group, br_multicast_new_port_group(struct net_bridge_port *port, struct br_ip *group,
struct net_bridge_port_group __rcu *next, struct net_bridge_port_group __rcu *next,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册