net: lan966x: Fix assignment of the MAC address
authorHoratiu Vultur <horatiu.vultur@microchip.com>
Fri, 13 May 2022 18:00:30 +0000 (20:00 +0200)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 17 May 2022 08:03:14 +0000 (10:03 +0200)
commitaf8ca6eaa9b24a90484218e356f959a94bff22fa
tree74b49b894d1f47cb4c4aa41e6cb592d394bd7dc5
parentda2172a9bfec858ceeb0271b9d444378490398c8
net: lan966x: Fix assignment of the MAC address

The following two scenarios were failing for lan966x.
1. If the port had the address X and then trying to assign the same
   address, then the HW was just removing this address because first it
   tries to learn new address and then delete the old one. As they are
   the same the HW remove it.
2. If the port eth0 was assigned the same address as one of the other
   ports eth1 then when assigning back the address to eth0 then the HW
   was deleting the address of eth1.

The case 1. is fixed by checking if the port has already the same
address while case 2. is fixed by checking if the address is used by any
other port.

Fixes: e18aba8941b40b ("net: lan966x: add mactable support")
Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
Link: https://lore.kernel.org/r/20220513180030.3076793-1-horatiu.vultur@microchip.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/ethernet/microchip/lan966x/lan966x_main.c