realtek: remove redundant is_lagmember checks
All callers of the rtl83xx_mc_group_* functions already do the same
check, so these aren't needed.
For rtl83xx_mc_group_alloc, this branch also incorrectly returned 0
instead of a negative value. If the branch wasn't effectively dead code
anyway, this could potentially have caused bugs, as 0 is a valid
multicast group entry index.
Fixes: cde31976e3
("realtek: Add support for Layer 2 Multicast")
Signed-off-by: Jan Hoffmann <jan@3e8.eu>
This commit is contained in:
parent
98a3b52380
commit
a872570c04
2 changed files with 4 additions and 26 deletions
|
@ -988,11 +988,6 @@ static int rtl83xx_mc_group_alloc(struct rtl838x_switch_priv *priv, int port)
|
||||||
if (mc_group >= MAX_MC_GROUPS - 1)
|
if (mc_group >= MAX_MC_GROUPS - 1)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (priv->is_lagmember[port]) {
|
|
||||||
pr_info("%s: %d is lag slave. ignore\n", __func__, port);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
set_bit(mc_group, priv->mc_group_bm);
|
set_bit(mc_group, priv->mc_group_bm);
|
||||||
portmask = BIT_ULL(port);
|
portmask = BIT_ULL(port);
|
||||||
priv->r->write_mcast_pmask(mc_group, portmask);
|
priv->r->write_mcast_pmask(mc_group, portmask);
|
||||||
|
@ -1005,10 +1000,7 @@ static u64 rtl83xx_mc_group_add_port(struct rtl838x_switch_priv *priv, int mc_gr
|
||||||
u64 portmask = priv->r->read_mcast_pmask(mc_group);
|
u64 portmask = priv->r->read_mcast_pmask(mc_group);
|
||||||
|
|
||||||
pr_debug("%s: %d\n", __func__, port);
|
pr_debug("%s: %d\n", __func__, port);
|
||||||
if (priv->is_lagmember[port]) {
|
|
||||||
pr_info("%s: %d is lag slave. ignore\n", __func__, port);
|
|
||||||
return portmask;
|
|
||||||
}
|
|
||||||
portmask |= BIT_ULL(port);
|
portmask |= BIT_ULL(port);
|
||||||
priv->r->write_mcast_pmask(mc_group, portmask);
|
priv->r->write_mcast_pmask(mc_group, portmask);
|
||||||
|
|
||||||
|
@ -1020,10 +1012,7 @@ static u64 rtl83xx_mc_group_del_port(struct rtl838x_switch_priv *priv, int mc_gr
|
||||||
u64 portmask = priv->r->read_mcast_pmask(mc_group);
|
u64 portmask = priv->r->read_mcast_pmask(mc_group);
|
||||||
|
|
||||||
pr_debug("%s: %d\n", __func__, port);
|
pr_debug("%s: %d\n", __func__, port);
|
||||||
if (priv->is_lagmember[port]) {
|
|
||||||
pr_info("%s: %d is lag slave. ignore\n", __func__, port);
|
|
||||||
return portmask;
|
|
||||||
}
|
|
||||||
portmask &= ~BIT_ULL(port);
|
portmask &= ~BIT_ULL(port);
|
||||||
priv->r->write_mcast_pmask(mc_group, portmask);
|
priv->r->write_mcast_pmask(mc_group, portmask);
|
||||||
if (!portmask)
|
if (!portmask)
|
||||||
|
|
|
@ -975,11 +975,6 @@ static int rtl83xx_mc_group_alloc(struct rtl838x_switch_priv *priv, int port)
|
||||||
if (mc_group >= MAX_MC_GROUPS - 1)
|
if (mc_group >= MAX_MC_GROUPS - 1)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (priv->is_lagmember[port]) {
|
|
||||||
pr_info("%s: %d is lag slave. ignore\n", __func__, port);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
set_bit(mc_group, priv->mc_group_bm);
|
set_bit(mc_group, priv->mc_group_bm);
|
||||||
portmask = BIT_ULL(port);
|
portmask = BIT_ULL(port);
|
||||||
priv->r->write_mcast_pmask(mc_group, portmask);
|
priv->r->write_mcast_pmask(mc_group, portmask);
|
||||||
|
@ -992,10 +987,7 @@ static u64 rtl83xx_mc_group_add_port(struct rtl838x_switch_priv *priv, int mc_gr
|
||||||
u64 portmask = priv->r->read_mcast_pmask(mc_group);
|
u64 portmask = priv->r->read_mcast_pmask(mc_group);
|
||||||
|
|
||||||
pr_debug("%s: %d\n", __func__, port);
|
pr_debug("%s: %d\n", __func__, port);
|
||||||
if (priv->is_lagmember[port]) {
|
|
||||||
pr_info("%s: %d is lag slave. ignore\n", __func__, port);
|
|
||||||
return portmask;
|
|
||||||
}
|
|
||||||
portmask |= BIT_ULL(port);
|
portmask |= BIT_ULL(port);
|
||||||
priv->r->write_mcast_pmask(mc_group, portmask);
|
priv->r->write_mcast_pmask(mc_group, portmask);
|
||||||
|
|
||||||
|
@ -1007,10 +999,7 @@ static u64 rtl83xx_mc_group_del_port(struct rtl838x_switch_priv *priv, int mc_gr
|
||||||
u64 portmask = priv->r->read_mcast_pmask(mc_group);
|
u64 portmask = priv->r->read_mcast_pmask(mc_group);
|
||||||
|
|
||||||
pr_debug("%s: %d\n", __func__, port);
|
pr_debug("%s: %d\n", __func__, port);
|
||||||
if (priv->is_lagmember[port]) {
|
|
||||||
pr_info("%s: %d is lag slave. ignore\n", __func__, port);
|
|
||||||
return portmask;
|
|
||||||
}
|
|
||||||
portmask &= ~BIT_ULL(port);
|
portmask &= ~BIT_ULL(port);
|
||||||
priv->r->write_mcast_pmask(mc_group, portmask);
|
priv->r->write_mcast_pmask(mc_group, portmask);
|
||||||
if (!portmask)
|
if (!portmask)
|
||||||
|
|
Loading…
Reference in a new issue