aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/generic/files/drivers/net/phy/ar8216.c
diff options
context:
space:
mode:
authorGünther Kelleter <guenther.kelleter@devolo.de>2018-11-26 15:44:31 +0100
committerJohn Crispin <john@phrozen.org>2018-11-26 18:41:21 +0100
commit33878b0a40707a53920ec72a92430ab420b0893f (patch)
tree913763fe9579e7d3186a237e07e5dea2e9905926 /target/linux/generic/files/drivers/net/phy/ar8216.c
parentbe3e69d99189636d5f0854bd3a91e004b2c370e0 (diff)
downloadupstream-33878b0a40707a53920ec72a92430ab420b0893f.tar.gz
upstream-33878b0a40707a53920ec72a92430ab420b0893f.tar.bz2
upstream-33878b0a40707a53920ec72a92430ab420b0893f.zip
kernel: ar8xxx: get_arl_table now shows all ports of an entry
Multicast ARL entries can have multiple destination ports. Get and dump all destination ports of each entry, not just the lowest. Signed-off-by: Günther Kelleter <guenther.kelleter@devolo.de>
Diffstat (limited to 'target/linux/generic/files/drivers/net/phy/ar8216.c')
-rw-r--r--target/linux/generic/files/drivers/net/phy/ar8216.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/target/linux/generic/files/drivers/net/phy/ar8216.c b/target/linux/generic/files/drivers/net/phy/ar8216.c
index 6869e1ff19..68754e6096 100644
--- a/target/linux/generic/files/drivers/net/phy/ar8216.c
+++ b/target/linux/generic/files/drivers/net/phy/ar8216.c
@@ -749,7 +749,6 @@ static void ar8216_get_arl_entry(struct ar8xxx_priv *priv,
u16 r2, page;
u16 r1_func0, r1_func1, r1_func2;
u32 t, val0, val1, val2;
- int i;
split_addr(AR8216_REG_ATU_FUNC0, &r1_func0, &r2, &page);
r2 |= 0x10;
@@ -785,12 +784,7 @@ static void ar8216_get_arl_entry(struct ar8xxx_priv *priv,
if (!*status)
break;
- i = 0;
- t = AR8216_ATU_PORT0;
- while (!(val2 & t) && ++i < priv->dev.ports)
- t <<= 1;
-
- a->port = i;
+ a->portmap = (val2 & AR8216_ATU_PORTS) >> AR8216_ATU_PORTS_S;
a->mac[0] = (val0 & AR8216_ATU_ADDR5) >> AR8216_ATU_ADDR5_S;
a->mac[1] = (val0 & AR8216_ATU_ADDR4) >> AR8216_ATU_ADDR4_S;
a->mac[2] = (val1 & AR8216_ATU_ADDR3) >> AR8216_ATU_ADDR3_S;
@@ -1516,8 +1510,12 @@ ar8xxx_sw_get_arl_table(struct switch_dev *dev,
*/
for (j = 0; j < i; ++j) {
a1 = &priv->arl_table[j];
- if (a->port == a1->port && !memcmp(a->mac, a1->mac, sizeof(a->mac)))
- goto duplicate;
+ if (!memcmp(a->mac, a1->mac, sizeof(a->mac))) {
+ /* ignore ports already seen in former entry */
+ a->portmap &= ~a1->portmap;
+ if (!a->portmap)
+ goto duplicate;
+ }
}
}
@@ -1534,7 +1532,7 @@ ar8xxx_sw_get_arl_table(struct switch_dev *dev,
for (j = 0; j < priv->dev.ports; ++j) {
for (k = 0; k < i; ++k) {
a = &priv->arl_table[k];
- if (a->port != j)
+ if (!(a->portmap & BIT(j)))
continue;
len += snprintf(buf + len, sizeof(priv->arl_buf) - len,
"Port %d: MAC %02x:%02x:%02x:%02x:%02x:%02x\n",