aboutsummaryrefslogtreecommitdiffstats
path: root/net/bridge/br_multicast.c
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2011-02-12 04:05:42 -0500
committerDavid S. Miller <davem@davemloft.net>2011-02-12 04:05:42 -0500
commit8a870178c0ad1bae9994c99bd01eb10c9903e616 (patch)
treee850d082e5aef4f436867a3301d1bf15fda80d06 /net/bridge/br_multicast.c
parent24f9cdcbd743fd6adb8fb83688d8d86dcccde662 (diff)
bridge: Replace mp->mglist hlist with a bool
As it turns out we never need to walk through the list of multicast groups subscribed by the bridge interface itself (the only time we'd want to do that is when we shut down the bridge, in which case we simply walk through all multicast groups), we don't really need to keep an hlist for mp->mglist. This means that we can replace it with just a single bit to indicate whether the bridge interface is subscribed to a group. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/bridge/br_multicast.c')
-rw-r--r--net/bridge/br_multicast.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c
index c558274051e..09d5c098792 100644
--- a/net/bridge/br_multicast.c
+++ b/net/bridge/br_multicast.c
@@ -232,8 +232,7 @@ static void br_multicast_group_expired(unsigned long data)
232 if (!netif_running(br->dev) || timer_pending(&mp->timer)) 232 if (!netif_running(br->dev) || timer_pending(&mp->timer))
233 goto out; 233 goto out;
234 234
235 if (!hlist_unhashed(&mp->mglist)) 235 mp->mglist = false;
236 hlist_del_init(&mp->mglist);
237 236
238 if (mp->ports) 237 if (mp->ports)
239 goto out; 238 goto out;
@@ -276,7 +275,7 @@ static void br_multicast_del_pg(struct net_bridge *br,
276 del_timer(&p->query_timer); 275 del_timer(&p->query_timer);
277 call_rcu_bh(&p->rcu, br_multicast_free_pg); 276 call_rcu_bh(&p->rcu, br_multicast_free_pg);
278 277
279 if (!mp->ports && hlist_unhashed(&mp->mglist) && 278 if (!mp->ports && !mp->mglist &&
280 netif_running(br->dev)) 279 netif_running(br->dev))
281 mod_timer(&mp->timer, jiffies); 280 mod_timer(&mp->timer, jiffies);
282 281
@@ -528,7 +527,7 @@ static void br_multicast_group_query_expired(unsigned long data)
528 struct net_bridge *br = mp->br; 527 struct net_bridge *br = mp->br;
529 528
530 spin_lock(&br->multicast_lock); 529 spin_lock(&br->multicast_lock);
531 if (!netif_running(br->dev) || hlist_unhashed(&mp->mglist) || 530 if (!netif_running(br->dev) || !mp->mglist ||
532 mp->queries_sent >= br->multicast_last_member_count) 531 mp->queries_sent >= br->multicast_last_member_count)
533 goto out; 532 goto out;
534 533
@@ -719,8 +718,7 @@ static int br_multicast_add_group(struct net_bridge *br,
719 goto err; 718 goto err;
720 719
721 if (!port) { 720 if (!port) {
722 if (hlist_unhashed(&mp->mglist)) 721 mp->mglist = true;
723 hlist_add_head(&mp->mglist, &br->mglist);
724 mod_timer(&mp->timer, now + br->multicast_membership_interval); 722 mod_timer(&mp->timer, now + br->multicast_membership_interval);
725 goto out; 723 goto out;
726 } 724 }
@@ -1166,7 +1164,7 @@ static int br_ip4_multicast_query(struct net_bridge *br,
1166 1164
1167 max_delay *= br->multicast_last_member_count; 1165 max_delay *= br->multicast_last_member_count;
1168 1166
1169 if (!hlist_unhashed(&mp->mglist) && 1167 if (mp->mglist &&
1170 (timer_pending(&mp->timer) ? 1168 (timer_pending(&mp->timer) ?
1171 time_after(mp->timer.expires, now + max_delay) : 1169 time_after(mp->timer.expires, now + max_delay) :
1172 try_to_del_timer_sync(&mp->timer) >= 0)) 1170 try_to_del_timer_sync(&mp->timer) >= 0))
@@ -1237,7 +1235,7 @@ static int br_ip6_multicast_query(struct net_bridge *br,
1237 goto out; 1235 goto out;
1238 1236
1239 max_delay *= br->multicast_last_member_count; 1237 max_delay *= br->multicast_last_member_count;
1240 if (!hlist_unhashed(&mp->mglist) && 1238 if (mp->mglist &&
1241 (timer_pending(&mp->timer) ? 1239 (timer_pending(&mp->timer) ?
1242 time_after(mp->timer.expires, now + max_delay) : 1240 time_after(mp->timer.expires, now + max_delay) :
1243 try_to_del_timer_sync(&mp->timer) >= 0)) 1241 try_to_del_timer_sync(&mp->timer) >= 0))
@@ -1284,7 +1282,7 @@ static void br_multicast_leave_group(struct net_bridge *br,
1284 br->multicast_last_member_interval; 1282 br->multicast_last_member_interval;
1285 1283
1286 if (!port) { 1284 if (!port) {
1287 if (!hlist_unhashed(&mp->mglist) && 1285 if (mp->mglist &&
1288 (timer_pending(&mp->timer) ? 1286 (timer_pending(&mp->timer) ?
1289 time_after(mp->timer.expires, time) : 1287 time_after(mp->timer.expires, time) :
1290 try_to_del_timer_sync(&mp->timer) >= 0)) { 1288 try_to_del_timer_sync(&mp->timer) >= 0)) {