linux-next/net/bridge/br_private_mcast_eht.h
Nikolay Aleksandrov ddc255d993 net: bridge: multicast: add EHT include and exclude handling
Add support for IGMPv3/MLDv2 include and exclude EHT handling. Similar to
how the reports are processed we have 2 cases when the group is in include
or exclude mode, these are processed as follows:
 - group include
  - is_include: create missing entries
  - to_include: flush existing entries and create a new set from the
    report, obviously if the src set is empty then we delete the group

 - group exclude
  - is_exclude: create missing entries
  - to_exclude: flush existing entries and create a new set from the
    report, any empty source set entries are removed

If the group is in a different mode then we just flush all entries reported
by the host and we create a new set with the new mode entries created from
the report. If the report is include type, the source list is empty and
the group has empty sources' set then we remove it. Any source set entries
which are empty are removed as well. If the group is in exclude mode it
can exist without any S,G entries (allowing for all traffic to pass).

Signed-off-by: Nikolay Aleksandrov <nikolay@nvidia.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2021-01-22 19:39:57 -08:00

66 lines
1.7 KiB
C

/* SPDX-License-Identifier: GPL-2.0-or-later
* Copyright (c) 2020, Nikolay Aleksandrov <nikolay@nvidia.com>
*/
#ifndef _BR_PRIVATE_MCAST_EHT_H_
#define _BR_PRIVATE_MCAST_EHT_H_
union net_bridge_eht_addr {
__be32 ip4;
#if IS_ENABLED(CONFIG_IPV6)
struct in6_addr ip6;
#endif
};
/* single host's list of set entries and filter_mode */
struct net_bridge_group_eht_host {
struct rb_node rb_node;
union net_bridge_eht_addr h_addr;
struct hlist_head set_entries;
unsigned int num_entries;
unsigned char filter_mode;
struct net_bridge_port_group *pg;
};
/* (host, src entry) added to a per-src set and host's list */
struct net_bridge_group_eht_set_entry {
struct rb_node rb_node;
struct hlist_node host_list;
union net_bridge_eht_addr h_addr;
struct timer_list timer;
struct net_bridge *br;
struct net_bridge_group_eht_set *eht_set;
struct net_bridge_group_eht_host *h_parent;
struct net_bridge_mcast_gc mcast_gc;
};
/* per-src set */
struct net_bridge_group_eht_set {
struct rb_node rb_node;
union net_bridge_eht_addr src_addr;
struct rb_root entry_tree;
struct timer_list timer;
struct net_bridge_port_group *pg;
struct net_bridge *br;
struct net_bridge_mcast_gc mcast_gc;
};
void br_multicast_eht_clean_sets(struct net_bridge_port_group *pg);
bool br_multicast_eht_handle(struct net_bridge_port_group *pg,
void *h_addr,
void *srcs,
u32 nsrcs,
size_t addr_size,
int grec_type);
static inline bool
br_multicast_eht_should_del_pg(const struct net_bridge_port_group *pg)
{
return !!((pg->key.port->flags & BR_MULTICAST_FAST_LEAVE) &&
RB_EMPTY_ROOT(&pg->eht_host_tree));
}
#endif /* _BR_PRIVATE_MCAST_EHT_H_ */