Commit 8a870178 authored by Herbert Xu's avatar Herbert Xu Committed by David S. Miller

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: default avatarHerbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 24f9cdcb
...@@ -80,7 +80,7 @@ int br_handle_frame_finish(struct sk_buff *skb) ...@@ -80,7 +80,7 @@ int br_handle_frame_finish(struct sk_buff *skb)
if (is_multicast_ether_addr(dest)) { if (is_multicast_ether_addr(dest)) {
mdst = br_mdb_get(br, skb); mdst = br_mdb_get(br, skb);
if (mdst || BR_INPUT_SKB_CB_MROUTERS_ONLY(skb)) { if (mdst || BR_INPUT_SKB_CB_MROUTERS_ONLY(skb)) {
if ((mdst && !hlist_unhashed(&mdst->mglist)) || if ((mdst && mdst->mglist) ||
br_multicast_is_router(br)) br_multicast_is_router(br))
skb2 = skb; skb2 = skb;
br_multicast_forward(mdst, skb, skb2); br_multicast_forward(mdst, skb, skb2);
......
...@@ -232,8 +232,7 @@ static void br_multicast_group_expired(unsigned long data) ...@@ -232,8 +232,7 @@ static void br_multicast_group_expired(unsigned long data)
if (!netif_running(br->dev) || timer_pending(&mp->timer)) if (!netif_running(br->dev) || timer_pending(&mp->timer))
goto out; goto out;
if (!hlist_unhashed(&mp->mglist)) mp->mglist = false;
hlist_del_init(&mp->mglist);
if (mp->ports) if (mp->ports)
goto out; goto out;
...@@ -276,7 +275,7 @@ static void br_multicast_del_pg(struct net_bridge *br, ...@@ -276,7 +275,7 @@ static void br_multicast_del_pg(struct net_bridge *br,
del_timer(&p->query_timer); del_timer(&p->query_timer);
call_rcu_bh(&p->rcu, br_multicast_free_pg); call_rcu_bh(&p->rcu, br_multicast_free_pg);
if (!mp->ports && hlist_unhashed(&mp->mglist) && if (!mp->ports && !mp->mglist &&
netif_running(br->dev)) netif_running(br->dev))
mod_timer(&mp->timer, jiffies); mod_timer(&mp->timer, jiffies);
...@@ -528,7 +527,7 @@ static void br_multicast_group_query_expired(unsigned long data) ...@@ -528,7 +527,7 @@ static void br_multicast_group_query_expired(unsigned long data)
struct net_bridge *br = mp->br; struct net_bridge *br = mp->br;
spin_lock(&br->multicast_lock); spin_lock(&br->multicast_lock);
if (!netif_running(br->dev) || hlist_unhashed(&mp->mglist) || if (!netif_running(br->dev) || !mp->mglist ||
mp->queries_sent >= br->multicast_last_member_count) mp->queries_sent >= br->multicast_last_member_count)
goto out; goto out;
...@@ -719,8 +718,7 @@ static int br_multicast_add_group(struct net_bridge *br, ...@@ -719,8 +718,7 @@ static int br_multicast_add_group(struct net_bridge *br,
goto err; goto err;
if (!port) { if (!port) {
if (hlist_unhashed(&mp->mglist)) mp->mglist = true;
hlist_add_head(&mp->mglist, &br->mglist);
mod_timer(&mp->timer, now + br->multicast_membership_interval); mod_timer(&mp->timer, now + br->multicast_membership_interval);
goto out; goto out;
} }
...@@ -1166,7 +1164,7 @@ static int br_ip4_multicast_query(struct net_bridge *br, ...@@ -1166,7 +1164,7 @@ static int br_ip4_multicast_query(struct net_bridge *br,
max_delay *= br->multicast_last_member_count; max_delay *= br->multicast_last_member_count;
if (!hlist_unhashed(&mp->mglist) && if (mp->mglist &&
(timer_pending(&mp->timer) ? (timer_pending(&mp->timer) ?
time_after(mp->timer.expires, now + max_delay) : time_after(mp->timer.expires, now + max_delay) :
try_to_del_timer_sync(&mp->timer) >= 0)) try_to_del_timer_sync(&mp->timer) >= 0))
...@@ -1237,7 +1235,7 @@ static int br_ip6_multicast_query(struct net_bridge *br, ...@@ -1237,7 +1235,7 @@ static int br_ip6_multicast_query(struct net_bridge *br,
goto out; goto out;
max_delay *= br->multicast_last_member_count; max_delay *= br->multicast_last_member_count;
if (!hlist_unhashed(&mp->mglist) && if (mp->mglist &&
(timer_pending(&mp->timer) ? (timer_pending(&mp->timer) ?
time_after(mp->timer.expires, now + max_delay) : time_after(mp->timer.expires, now + max_delay) :
try_to_del_timer_sync(&mp->timer) >= 0)) try_to_del_timer_sync(&mp->timer) >= 0))
...@@ -1284,7 +1282,7 @@ static void br_multicast_leave_group(struct net_bridge *br, ...@@ -1284,7 +1282,7 @@ static void br_multicast_leave_group(struct net_bridge *br,
br->multicast_last_member_interval; br->multicast_last_member_interval;
if (!port) { if (!port) {
if (!hlist_unhashed(&mp->mglist) && if (mp->mglist &&
(timer_pending(&mp->timer) ? (timer_pending(&mp->timer) ?
time_after(mp->timer.expires, time) : time_after(mp->timer.expires, time) :
try_to_del_timer_sync(&mp->timer) >= 0)) { try_to_del_timer_sync(&mp->timer) >= 0)) {
......
...@@ -84,13 +84,13 @@ struct net_bridge_port_group { ...@@ -84,13 +84,13 @@ struct net_bridge_port_group {
struct net_bridge_mdb_entry struct net_bridge_mdb_entry
{ {
struct hlist_node hlist[2]; struct hlist_node hlist[2];
struct hlist_node mglist;
struct net_bridge *br; struct net_bridge *br;
struct net_bridge_port_group __rcu *ports; struct net_bridge_port_group __rcu *ports;
struct rcu_head rcu; struct rcu_head rcu;
struct timer_list timer; struct timer_list timer;
struct timer_list query_timer; struct timer_list query_timer;
struct br_ip addr; struct br_ip addr;
bool mglist;
u32 queries_sent; u32 queries_sent;
}; };
...@@ -238,7 +238,6 @@ struct net_bridge ...@@ -238,7 +238,6 @@ struct net_bridge
spinlock_t multicast_lock; spinlock_t multicast_lock;
struct net_bridge_mdb_htable __rcu *mdb; struct net_bridge_mdb_htable __rcu *mdb;
struct hlist_head router_list; struct hlist_head router_list;
struct hlist_head mglist;
struct timer_list multicast_router_timer; struct timer_list multicast_router_timer;
struct timer_list multicast_querier_timer; struct timer_list multicast_querier_timer;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment