Commit 6aa2c371 authored by Nikolay Aleksandrov's avatar Nikolay Aleksandrov Committed by David S. Miller

net: bridge: mcast: remove unreachable EHT code

In the initial EHT versions there were common functions which handled
allow/block messages for both INCLUDE and EXCLUDE modes, but later they
were separated. It seems I've left some common code which cannot be
reached because the filter mode is checked before calling the respective
functions, i.e. the host filter is always in EXCLUDE mode when using
__eht_allow_excl() and __eht_block_excl() thus we can drop the host_excl
checks inside and simplify the code a bit.
Signed-off-by: default avatarNikolay Aleksandrov <nikolay@nvidia.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5a30833b
...@@ -522,31 +522,24 @@ static bool __eht_allow_excl(struct net_bridge_port_group *pg, ...@@ -522,31 +522,24 @@ static bool __eht_allow_excl(struct net_bridge_port_group *pg,
u32 nsrcs, u32 nsrcs,
size_t addr_size) size_t addr_size)
{ {
bool changed = false, host_excl = false;
union net_bridge_eht_addr eht_src_addr; union net_bridge_eht_addr eht_src_addr;
struct net_bridge_group_src *src_ent; struct net_bridge_group_src *src_ent;
bool changed = false;
struct br_ip src_ip; struct br_ip src_ip;
u32 src_idx; u32 src_idx;
host_excl = !!(br_multicast_eht_host_filter_mode(pg, h_addr) == MCAST_EXCLUDE);
memset(&eht_src_addr, 0, sizeof(eht_src_addr)); memset(&eht_src_addr, 0, sizeof(eht_src_addr));
for (src_idx = 0; src_idx < nsrcs; src_idx++) { for (src_idx = 0; src_idx < nsrcs; src_idx++) {
memcpy(&eht_src_addr, srcs + (src_idx * addr_size), addr_size); memcpy(&eht_src_addr, srcs + (src_idx * addr_size), addr_size);
if (!host_excl) { if (!br_multicast_del_eht_set_entry(pg, &eht_src_addr,
br_multicast_create_eht_set_entry(pg, &eht_src_addr, h_addr, h_addr))
MCAST_INCLUDE, continue;
false); memcpy(&src_ip, srcs + (src_idx * addr_size), addr_size);
} else { src_ent = br_multicast_find_group_src(pg, &src_ip);
if (!br_multicast_del_eht_set_entry(pg, &eht_src_addr, if (!src_ent)
h_addr)) continue;
continue; br_multicast_del_group_src(src_ent, true);
memcpy(&src_ip, srcs + (src_idx * addr_size), addr_size); changed = true;
src_ent = br_multicast_find_group_src(pg, &src_ip);
if (!src_ent)
continue;
br_multicast_del_group_src(src_ent, true);
changed = true;
}
} }
return changed; return changed;
...@@ -602,42 +595,22 @@ static bool __eht_block_incl(struct net_bridge_port_group *pg, ...@@ -602,42 +595,22 @@ static bool __eht_block_incl(struct net_bridge_port_group *pg,
return changed; return changed;
} }
static bool __eht_block_excl(struct net_bridge_port_group *pg, static void __eht_block_excl(struct net_bridge_port_group *pg,
union net_bridge_eht_addr *h_addr, union net_bridge_eht_addr *h_addr,
void *srcs, void *srcs,
u32 nsrcs, u32 nsrcs,
size_t addr_size) size_t addr_size)
{ {
bool changed = false, host_excl = false;
union net_bridge_eht_addr eht_src_addr; union net_bridge_eht_addr eht_src_addr;
struct net_bridge_group_src *src_ent;
struct br_ip src_ip;
u32 src_idx; u32 src_idx;
host_excl = !!(br_multicast_eht_host_filter_mode(pg, h_addr) == MCAST_EXCLUDE);
memset(&eht_src_addr, 0, sizeof(eht_src_addr)); memset(&eht_src_addr, 0, sizeof(eht_src_addr));
memset(&src_ip, 0, sizeof(src_ip));
src_ip.proto = pg->key.addr.proto;
for (src_idx = 0; src_idx < nsrcs; src_idx++) { for (src_idx = 0; src_idx < nsrcs; src_idx++) {
memcpy(&eht_src_addr, srcs + (src_idx * addr_size), addr_size); memcpy(&eht_src_addr, srcs + (src_idx * addr_size), addr_size);
if (host_excl) { br_multicast_create_eht_set_entry(pg, &eht_src_addr, h_addr,
br_multicast_create_eht_set_entry(pg, &eht_src_addr, h_addr, MCAST_EXCLUDE,
MCAST_EXCLUDE, false);
false);
} else {
if (!br_multicast_del_eht_set_entry(pg, &eht_src_addr,
h_addr))
continue;
memcpy(&src_ip, srcs + (src_idx * addr_size), addr_size);
src_ent = br_multicast_find_group_src(pg, &src_ip);
if (!src_ent)
continue;
br_multicast_del_group_src(src_ent, true);
changed = true;
}
} }
return changed;
} }
static bool br_multicast_eht_block(struct net_bridge_port_group *pg, static bool br_multicast_eht_block(struct net_bridge_port_group *pg,
...@@ -653,7 +626,7 @@ static bool br_multicast_eht_block(struct net_bridge_port_group *pg, ...@@ -653,7 +626,7 @@ static bool br_multicast_eht_block(struct net_bridge_port_group *pg,
changed = __eht_block_incl(pg, h_addr, srcs, nsrcs, addr_size); changed = __eht_block_incl(pg, h_addr, srcs, nsrcs, addr_size);
break; break;
case MCAST_EXCLUDE: case MCAST_EXCLUDE:
changed = __eht_block_excl(pg, h_addr, srcs, nsrcs, addr_size); __eht_block_excl(pg, h_addr, srcs, nsrcs, addr_size);
break; break;
} }
......
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