diff options
author | Nikolay Aleksandrov <nikolay@cumulusnetworks.com> | 2018-12-05 08:14:25 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-12-05 20:01:51 -0500 |
commit | 4329596cb10d23c9e22c78e676a3667ef28ed62f (patch) | |
tree | 5cc06a0e796073d46762c92f80e846c820102375 | |
parent | 19e3a9c90c53479fecaa02307bf2db5ab8b3ffe3 (diff) |
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: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/bridge/br_mdb.c | 2 | ||||
-rw-r--r-- | net/bridge/br_multicast.c | 26 | ||||
-rw-r--r-- | net/bridge/br_private.h | 1 |
3 files changed, 6 insertions, 23 deletions
diff --git a/net/bridge/br_mdb.c b/net/bridge/br_mdb.c index ea8abdb56df3..79d4c9d253e0 100644 --- a/net/bridge/br_mdb.c +++ b/net/bridge/br_mdb.c | |||
@@ -710,7 +710,7 @@ static int __br_mdb_del(struct net_bridge *br, struct br_mdb_entry *entry) | |||
710 | rcu_assign_pointer(*pp, p->next); | 710 | rcu_assign_pointer(*pp, p->next); |
711 | hlist_del_init(&p->mglist); | 711 | hlist_del_init(&p->mglist); |
712 | del_timer(&p->timer); | 712 | del_timer(&p->timer); |
713 | call_rcu_bh(&p->rcu, br_multicast_free_pg); | 713 | kfree_rcu(p, rcu); |
714 | err = 0; | 714 | err = 0; |
715 | 715 | ||
716 | if (!mp->ports && !mp->host_joined && | 716 | if (!mp->ports && !mp->host_joined && |
diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c index 83a5931a7784..5b8cfef8bc4d 100644 --- a/net/bridge/br_multicast.c +++ b/net/bridge/br_multicast.c | |||
@@ -160,22 +160,6 @@ struct net_bridge_mdb_entry *br_mdb_get(struct net_bridge *br, | |||
160 | return br_mdb_ip_get_rcu(br, &ip); | 160 | return br_mdb_ip_get_rcu(br, &ip); |
161 | } | 161 | } |
162 | 162 | ||
163 | void br_multicast_free_pg(struct rcu_head *head) | ||
164 | { | ||
165 | struct net_bridge_port_group *p = | ||
166 | container_of(head, struct net_bridge_port_group, rcu); | ||
167 | |||
168 | kfree(p); | ||
169 | } | ||
170 | |||
171 | static void br_multicast_free_group(struct rcu_head *head) | ||
172 | { | ||
173 | struct net_bridge_mdb_entry *mp = | ||
174 | container_of(head, struct net_bridge_mdb_entry, rcu); | ||
175 | |||
176 | kfree(mp); | ||
177 | } | ||
178 | |||
179 | static void br_multicast_group_expired(struct timer_list *t) | 163 | static void br_multicast_group_expired(struct timer_list *t) |
180 | { | 164 | { |
181 | struct net_bridge_mdb_entry *mp = from_timer(mp, t, timer); | 165 | 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 | br_mdb_rht_params); | 179 | br_mdb_rht_params); |
196 | hlist_del_rcu(&mp->mdb_node); | 180 | hlist_del_rcu(&mp->mdb_node); |
197 | 181 | ||
198 | call_rcu_bh(&mp->rcu, br_multicast_free_group); | 182 | kfree_rcu(mp, rcu); |
199 | 183 | ||
200 | out: | 184 | out: |
201 | spin_unlock(&br->multicast_lock); | 185 | spin_unlock(&br->multicast_lock); |
@@ -223,7 +207,7 @@ static void br_multicast_del_pg(struct net_bridge *br, | |||
223 | del_timer(&p->timer); | 207 | del_timer(&p->timer); |
224 | br_mdb_notify(br->dev, p->port, &pg->addr, RTM_DELMDB, | 208 | br_mdb_notify(br->dev, p->port, &pg->addr, RTM_DELMDB, |
225 | p->flags); | 209 | p->flags); |
226 | call_rcu_bh(&p->rcu, br_multicast_free_pg); | 210 | kfree_rcu(p, rcu); |
227 | 211 | ||
228 | if (!mp->ports && !mp->host_joined && | 212 | if (!mp->ports && !mp->host_joined && |
229 | netif_running(br->dev)) | 213 | netif_running(br->dev)) |
@@ -1425,7 +1409,7 @@ br_multicast_leave_group(struct net_bridge *br, | |||
1425 | rcu_assign_pointer(*pp, p->next); | 1409 | rcu_assign_pointer(*pp, p->next); |
1426 | hlist_del_init(&p->mglist); | 1410 | hlist_del_init(&p->mglist); |
1427 | del_timer(&p->timer); | 1411 | del_timer(&p->timer); |
1428 | call_rcu_bh(&p->rcu, br_multicast_free_pg); | 1412 | kfree_rcu(p, rcu); |
1429 | br_mdb_notify(br->dev, port, group, RTM_DELMDB, | 1413 | br_mdb_notify(br->dev, port, group, RTM_DELMDB, |
1430 | p->flags); | 1414 | p->flags); |
1431 | 1415 | ||
@@ -1839,11 +1823,11 @@ void br_multicast_dev_del(struct net_bridge *br) | |||
1839 | rhashtable_remove_fast(&br->mdb_hash_tbl, &mp->rhnode, | 1823 | rhashtable_remove_fast(&br->mdb_hash_tbl, &mp->rhnode, |
1840 | br_mdb_rht_params); | 1824 | br_mdb_rht_params); |
1841 | hlist_del_rcu(&mp->mdb_node); | 1825 | hlist_del_rcu(&mp->mdb_node); |
1842 | call_rcu_bh(&mp->rcu, br_multicast_free_group); | 1826 | kfree_rcu(mp, rcu); |
1843 | } | 1827 | } |
1844 | spin_unlock_bh(&br->multicast_lock); | 1828 | spin_unlock_bh(&br->multicast_lock); |
1845 | 1829 | ||
1846 | rcu_barrier_bh(); | 1830 | rcu_barrier(); |
1847 | } | 1831 | } |
1848 | 1832 | ||
1849 | int br_multicast_set_router(struct net_bridge *br, unsigned long val) | 1833 | int br_multicast_set_router(struct net_bridge *br, unsigned long val) |
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h index a0ce0822921c..cf1f7365deb3 100644 --- a/net/bridge/br_private.h +++ b/net/bridge/br_private.h | |||
@@ -679,7 +679,6 @@ struct net_bridge_mdb_entry * | |||
679 | br_mdb_ip_get(struct net_bridge *br, struct br_ip *dst); | 679 | br_mdb_ip_get(struct net_bridge *br, struct br_ip *dst); |
680 | struct net_bridge_mdb_entry * | 680 | struct net_bridge_mdb_entry * |
681 | br_multicast_new_group(struct net_bridge *br, struct br_ip *group); | 681 | br_multicast_new_group(struct net_bridge *br, struct br_ip *group); |
682 | void br_multicast_free_pg(struct rcu_head *head); | ||
683 | struct net_bridge_port_group * | 682 | struct net_bridge_port_group * |
684 | br_multicast_new_port_group(struct net_bridge_port *port, struct br_ip *group, | 683 | br_multicast_new_port_group(struct net_bridge_port *port, struct br_ip *group, |
685 | struct net_bridge_port_group __rcu *next, | 684 | struct net_bridge_port_group __rcu *next, |