Nikolay Aleksandrov
2015-Jul-15 14:16 UTC
[Bridge] [PATCH net-next 0/2] bridge: multicast: temp and perm entries behaviour enhancements
Hi, Patch 01 adds a notify when a group is deleted via br_multicast_del_pg() (on expire, on device delete or on device down). Patch 02 changes how bridge device and bridge port delete and down/up are handled. Until now on bridge down all groups were flushed, now only the temp ones are (same for port), perm entries are flushed only on port or bridge removal. Best regards, Nikolay Aleksandrov Nikolay Aleksandrov (2): bridge: multicast: notify on group delete bridge: multicast: fix handling of temp and perm entries net/bridge/br_if.c | 1 + net/bridge/br_multicast.c | 29 ++++++++++++++++++++++------- net/bridge/br_private.h | 1 + 3 files changed, 24 insertions(+), 7 deletions(-) -- 1.9.3
Nikolay Aleksandrov
2015-Jul-15 14:16 UTC
[Bridge] [PATCH net-next 1/2] bridge: multicast: notify on group delete
Group notifications were not sent when a group expired or was deleted due to bridge/port device being deleted. So add br_mdb_notify() to br_multicast_del_pg(). Signed-off-by: Nikolay Aleksandrov <nikolay at cumulusnetworks.com> --- net/bridge/br_multicast.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c index 5a44cd9473f2..55903d91d0a8 100644 --- a/net/bridge/br_multicast.c +++ b/net/bridge/br_multicast.c @@ -273,6 +273,8 @@ static void br_multicast_del_pg(struct net_bridge *br, rcu_assign_pointer(*pp, p->next); hlist_del_init(&p->mglist); del_timer(&p->timer); + br_mdb_notify(br->dev, p->port, &pg->addr, RTM_DELMDB, + p->state); call_rcu_bh(&p->rcu, br_multicast_free_pg); if (!mp->ports && !mp->mglist && -- 1.9.3
Nikolay Aleksandrov
2015-Jul-15 14:16 UTC
[Bridge] [PATCH net-next 2/2] bridge: multicast: fix handling of temp and perm entries
From: Satish Ashok <sashok at cumulusnetworks.com> When the bridge (or port) is brought down/up flush only temp entries and leave the perm ones. Flush perm entries only when deleting the bridge device or the associated port. Signed-off-by: Satish Ashok <sashok at cumulusnetworks.com> Signed-off-by: Nikolay Aleksandrov <nikolay at cumulusnetworks.com> --- net/bridge/br_if.c | 1 + net/bridge/br_multicast.c | 27 ++++++++++++++++++++------- net/bridge/br_private.h | 1 + 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c index a538cb1199a3..45e4757c6fd2 100644 --- a/net/bridge/br_if.c +++ b/net/bridge/br_if.c @@ -281,6 +281,7 @@ void br_dev_delete(struct net_device *dev, struct list_head *head) br_fdb_delete_by_port(br, NULL, 0, 1); br_vlan_flush(br); + br_multicast_dev_del(br); del_timer_sync(&br->gc_timer); br_sysfs_delbr(br->dev); diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c index 55903d91d0a8..0dd3cd90962c 100644 --- a/net/bridge/br_multicast.c +++ b/net/bridge/br_multicast.c @@ -916,6 +916,15 @@ void br_multicast_add_port(struct net_bridge_port *port) void br_multicast_del_port(struct net_bridge_port *port) { + struct net_bridge *br = port->br; + struct net_bridge_port_group *pg; + struct hlist_node *n; + + /* Take care of the remaining groups, only perm ones should be left */ + spin_lock_bh(&br->multicast_lock); + hlist_for_each_entry_safe(pg, n, &port->mglist, mglist) + br_multicast_del_pg(br, pg); + spin_unlock_bh(&br->multicast_lock); del_timer_sync(&port->multicast_router_timer); } @@ -955,7 +964,8 @@ void br_multicast_disable_port(struct net_bridge_port *port) spin_lock(&br->multicast_lock); hlist_for_each_entry_safe(pg, n, &port->mglist, mglist) - br_multicast_del_pg(br, pg); + if (pg->state == MDB_TEMPORARY) + br_multicast_del_pg(br, pg); if (!hlist_unhashed(&port->rlist)) hlist_del_init_rcu(&port->rlist); @@ -1732,12 +1742,6 @@ void br_multicast_open(struct net_bridge *br) void br_multicast_stop(struct net_bridge *br) { - struct net_bridge_mdb_htable *mdb; - struct net_bridge_mdb_entry *mp; - struct hlist_node *n; - u32 ver; - int i; - del_timer_sync(&br->multicast_router_timer); del_timer_sync(&br->ip4_other_query.timer); del_timer_sync(&br->ip4_own_query.timer); @@ -1745,6 +1749,15 @@ void br_multicast_stop(struct net_bridge *br) del_timer_sync(&br->ip6_other_query.timer); del_timer_sync(&br->ip6_own_query.timer); #endif +} + +void br_multicast_dev_del(struct net_bridge *br) +{ + struct net_bridge_mdb_htable *mdb; + struct net_bridge_mdb_entry *mp; + struct hlist_node *n; + u32 ver; + int i; spin_lock_bh(&br->multicast_lock); mdb = mlock_dereference(br->mdb, br); diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h index c73fd785654d..2bada2279721 100644 --- a/net/bridge/br_private.h +++ b/net/bridge/br_private.h @@ -466,6 +466,7 @@ void br_multicast_disable_port(struct net_bridge_port *port); void br_multicast_init(struct net_bridge *br); void br_multicast_open(struct net_bridge *br); void br_multicast_stop(struct net_bridge *br); +void br_multicast_dev_del(struct net_bridge *br); void br_multicast_deliver(struct net_bridge_mdb_entry *mdst, struct sk_buff *skb); void br_multicast_forward(struct net_bridge_mdb_entry *mdst, -- 1.9.3
David Miller
2015-Jul-20 19:49 UTC
[Bridge] [PATCH net-next 0/2] bridge: multicast: temp and perm entries behaviour enhancements
From: Nikolay Aleksandrov <nikolay at cumulusnetworks.com> Date: Wed, 15 Jul 2015 07:16:49 -0700> Hi, > Patch 01 adds a notify when a group is deleted via br_multicast_del_pg() > (on expire, on device delete or on device down). > Patch 02 changes how bridge device and bridge port delete and down/up are > handled. Until now on bridge down all groups were flushed, now only the > temp ones are (same for port), perm entries are flushed only on port or > bridge removal.Series applied, but if patch #2 breaks things for anyone depending upon the old behavior of flushing all entries I will have to revert.