OSDN Git Service

net: atlantic: unify MAC generation
authorMark Starovoytov <mstarovoitov@marvell.com>
Sat, 9 May 2020 06:47:00 +0000 (09:47 +0300)
committerJakub Kicinski <kuba@kernel.org>
Sat, 9 May 2020 18:47:25 +0000 (11:47 -0700)
commitb4de6c49e569c7ca91bf0d4c25cdb6eeca9c9529
treefa4de5589f90228f431513a5daab93e2798e067d
parent097d638cf4e19be208d26c6bbbca7f8da348294a
net: atlantic: unify MAC generation

This patch unifies invalid MAC address handling with other drivers.

Basically we've switched to using standard APIs (is_valid_ether_addr /
eth_hw_addr_random) where possible.
It's worth noting that some of engineering Aquantia NICs might be
provisioned with a partially zeroed out MAC, which is still invalid,
but not caught by is_valid_ether_addr(), so we've added a special
handling for this case.

Also adding a warning in case of fallback to random MAC, because
this shouldn't be needed on production NICs, they should all be
provisioned with unique MAC.

NB! Default systemd/udevd configuration is 'MACAddressPolicy=persistent'.
    This causes MAC address to be persisted across driver reloads and
    reboots. We had to change it to 'none' for verification purposes.

Signed-off-by: Mark Starovoytov <mstarovoitov@marvell.com>
Signed-off-by: Igor Russkikh <irusskikh@marvell.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/aquantia/atlantic/aq_nic.c
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils_fw2x.c
drivers/net/ethernet/aquantia/atlantic/hw_atl2/hw_atl2_utils_fw.c