Skip to contentSkip to conversation

net: dsa: mv88e6xxx: check for address type in port_db_load_purge

PATCH In review DENG Qingfang 2 participants 2 messages Jul 20, 2021

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: dsa: mv88e6xxx: check for address type in port_db_load_purge

The same state value of an ATU entry can mean different states, depending on the entry's address type.
Check for its address type instead of state, to determine if its portvec should be overridden.

Fixes f72f2fb8fb6b ("net: dsa: mv88e6xxx: override existent unicast portvec in port_fdb_add")
---
 drivers/net/dsa/mv88e6xxx/chip.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/dsa/mv88e6xxx/chip.c +1 -1
index beb41572d04e..dd4d7fa0da8e 100644
@@ -1741,7 +1741,7 @@ static int mv88e6xxx_port_db_load_purge(struct mv88e6xxx_chip *chip, int port,
 		if (!entry.portvec)
 			entry.state = 0;
 	} else {
-		if (state == MV88E6XXX_G1_ATU_DATA_STATE_UC_STATIC)
+		if (is_unicast_ether_addr(addr))
 			entry.portvec = BIT(port);
 		else
 			entry.portvec |= BIT(port);
Signature · 1 line
2.25.1
maintainer
#1 lore raw
Quoted 4 lines · DENG Qingfang

The same state value of an ATU entry can mean different states, depending on the entry's address type.
Check for its address type instead of state, to determine if its portvec should be overridden.

Please could you expand this description. It is not obvious to me this change correct.

Quoted 12 lines
Fixes f72f2fb8fb6b ("net: dsa: mv88e6xxx: override existent unicast portvec in port_fdb_add")
---
 drivers/net/dsa/mv88e6xxx/chip.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/dsa/mv88e6xxx/chip.c +0 -0
index beb41572d04e..dd4d7fa0da8e 100644

drivers/net/dsa/mv88e6xxx/chip.c static int mv88e6xxx_port_db_load_purge(struct mv88e6xxx_chip *chip, int port, · line 1747

Quoted 8 lines
drivers/net/dsa/mv88e6xxx/chip.c +1 -1
@@ -1741,7 +1741,7 @@ static int mv88e6xxx_port_db_load_purge(struct mv88e6xxx_chip *chip, int port,
 		if (!entry.portvec)
 			entry.state = 0;
 	} else {
-		if (state == MV88E6XXX_G1_ATU_DATA_STATE_UC_STATIC)
+		if (is_unicast_ether_addr(addr))
 			entry.portvec = BIT(port);
 		else
 			entry.portvec |= BIT(port);

I agree that MV88E6XXX_G1_ATU_DATA_STATE_UC_STATIC should only be used with an address which is know to be unicast. If the address is multicast, it means it should be considered as a management frame, and given priority override.

But what exactly are we interested in here? The old code looked like it wanted to match on static unicast entries. Your change will make it match on static and dynamic unicast? Do we want dynamic as well? Why is the fix not this?

drivers/net/dsa/mv88e6xxx/chip.c

Quoted 2 lines
drivers/net/dsa/mv88e6xxx/chip.c +1 -1
-		if (state == MV88E6XXX_G1_ATU_DATA_STATE_UC_STATIC)
+		if (is_unicast_ether_addr(addr) && state == MV88E6XXX_G1_ATU_DATA_STATE_UC_STATIC)

which fixes the problem you describe in the commit message.

Thanks
Andrew