diff options
author | Nikolay Aleksandrov <nikolay@nvidia.com> | 2021-01-26 11:35:32 +0200 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2021-01-27 17:40:35 -0800 |
commit | 89268b056ed116e13ba39f46481ad8bf5eef7bc4 (patch) | |
tree | 257ab964c03ca0136ac4ebddf7bc78f327a36e30 /net/bridge/br_private_mcast_eht.h | |
parent | 1d96006dccf0994dd91f327f59493afd6398b01d (diff) | |
download | linux-89268b056ed116e13ba39f46481ad8bf5eef7bc4.tar.gz linux-89268b056ed116e13ba39f46481ad8bf5eef7bc4.tar.bz2 linux-89268b056ed116e13ba39f46481ad8bf5eef7bc4.zip |
net: bridge: multicast: add per-port EHT hosts limit
Add a default limit of 512 for number of tracked EHT hosts per-port.
Signed-off-by: Nikolay Aleksandrov <nikolay@nvidia.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/bridge/br_private_mcast_eht.h')
-rw-r--r-- | net/bridge/br_private_mcast_eht.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/net/bridge/br_private_mcast_eht.h b/net/bridge/br_private_mcast_eht.h index 9daffa3ad8d5..b2c8d988721f 100644 --- a/net/bridge/br_private_mcast_eht.h +++ b/net/bridge/br_private_mcast_eht.h @@ -4,6 +4,8 @@ #ifndef _BR_PRIVATE_MCAST_EHT_H_ #define _BR_PRIVATE_MCAST_EHT_H_ +#define BR_MCAST_DEFAULT_EHT_HOSTS_LIMIT 512 + union net_bridge_eht_addr { __be32 ip4; #if IS_ENABLED(CONFIG_IPV6) @@ -47,6 +49,7 @@ struct net_bridge_group_eht_set { struct net_bridge_mcast_gc mcast_gc; }; +#ifdef CONFIG_BRIDGE_IGMP_SNOOPING 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, @@ -62,4 +65,27 @@ br_multicast_eht_should_del_pg(const struct net_bridge_port_group *pg) RB_EMPTY_ROOT(&pg->eht_host_tree)); } +static inline bool +br_multicast_eht_hosts_over_limit(const struct net_bridge_port_group *pg) +{ + const struct net_bridge_port *p = pg->key.port; + + return !!(p->multicast_eht_hosts_cnt >= p->multicast_eht_hosts_limit); +} + +static inline void br_multicast_eht_hosts_inc(struct net_bridge_port_group *pg) +{ + struct net_bridge_port *p = pg->key.port; + + p->multicast_eht_hosts_cnt++; +} + +static inline void br_multicast_eht_hosts_dec(struct net_bridge_port_group *pg) +{ + struct net_bridge_port *p = pg->key.port; + + p->multicast_eht_hosts_cnt--; +} +#endif /* CONFIG_BRIDGE_IGMP_SNOOPING */ + #endif /* _BR_PRIVATE_MCAST_EHT_H_ */ |