net: bridge: multicast: add EHT host delete function
authorNikolay Aleksandrov <nikolay@nvidia.com>
Wed, 20 Jan 2021 14:51:57 +0000 (16:51 +0200)
committerJakub Kicinski <kuba@kernel.org>
Sat, 23 Jan 2021 03:39:56 +0000 (19:39 -0800)
Now that we can delete set entries, we can use that to remove EHT hosts.
Since the group's host set entries exist only when there are related
source set entries we just have to flush all source set entries
joined by the host set entry and it will be automatically removed.

Signed-off-by: Nikolay Aleksandrov <nikolay@nvidia.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/bridge/br_multicast_eht.c

index f4bbf2dc9fc84c7f19a41a080556f925298d04b1..409fced7eae231a2ce743c49969639c9111f679a 100644 (file)
@@ -434,3 +434,20 @@ static bool br_multicast_del_eht_set_entry(struct net_bridge_port_group *pg,
 out:
        return set_deleted;
 }
+
+static void br_multicast_del_eht_host(struct net_bridge_port_group *pg,
+                                     union net_bridge_eht_addr *h_addr)
+{
+       struct net_bridge_group_eht_set_entry *set_h;
+       struct net_bridge_group_eht_host *eht_host;
+       struct hlist_node *tmp;
+
+       eht_host = br_multicast_eht_host_lookup(pg, h_addr);
+       if (!eht_host)
+               return;
+
+       hlist_for_each_entry_safe(set_h, tmp, &eht_host->set_entries, host_list)
+               br_multicast_del_eht_set_entry(set_h->eht_set->pg,
+                                              &set_h->eht_set->src_addr,
+                                              &set_h->h_addr);
+}