OSDN Git Service

mlxsw: spectrum_router: Add RIF MAC profiles support
authorDanielle Ratson <danieller@nvidia.com>
Tue, 26 Oct 2021 09:42:20 +0000 (12:42 +0300)
committerDavid S. Miller <davem@davemloft.net>
Tue, 26 Oct 2021 12:35:57 +0000 (13:35 +0100)
commit605d25cd782a67f0c9d871096ee04acfe14f89ca
tree3cc7efc778ec2fa18357995000df545d968f4475
parent26029225d9927b75cd26cdccc1d0b766e47b9647
mlxsw: spectrum_router: Add RIF MAC profiles support

Currently, mlxsw enforces that all the router interfaces (RIFs) have the
same MAC prefix.

Relax this limitation by using RIF MAC profiles. Each profile is
associated with a particular MAC prefix and multiple RIFs can use the
same profile. Therefore, the number of possible MAC prefixes is no
longer one, but the number of profiles supported by the device.

Store the profiles in an IDR and reference count them according to the
number of RIFs using them.

Associate a RIF with a profile when the RIF is created and remove the
association when the RIF is deleted.

Change the association following 'NETDEV_CHANGEADDR' events, except when
only one RIF is using the profile. In which case, change the MAC prefix
of the profile itself instead of associating the RIF with a new profile.

Signed-off-by: Danielle Ratson <danieller@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.h