mlxsw: spectrum_fid: Configure layer 3 egress VID classification
authorAmit Cohen <amcohen@nvidia.com>
Mon, 4 Jul 2022 06:11:30 +0000 (09:11 +0300)
committerDavid S. Miller <davem@davemloft.net>
Mon, 4 Jul 2022 08:56:57 +0000 (09:56 +0100)
commitd4b464d20bc122699a7258cb44158d83d7fdc0ec
treec03690a5a0dc46d56ded5c7bc7f445028cde3c41
parentfea20547d5b50017e1a0525e6788bd3db22f5ca3
mlxsw: spectrum_fid: Configure layer 3 egress VID classification

After routing, the device always consults a table that determines the
packet's egress VID based on {egress RIF, egress local port}. In the
unified bridge model, it is up to software to maintain this table via REIV
register.

The table needs to be updated in the following flows:
1. When a RIF is set on a FID, need to iterate over the FID's {Port, VID}
   list and issue REIV write to map the {RIF, Port} to the given VID.
2. When a {Port, VID} is mapped to a FID and the FID already has a RIF,
   need to issue REIV write with a single record to map the {RIF, Port}
   to the given VID.

REIV register supports a simultaneous update of 256 ports, so use this
capability for the first flow.

Handle the two above mentioned flows.

Add mlxsw_sp_fid_evid_map() function to handle egress VID classification
for both unicast and multicast. Layer 2 multicast configuration is already
done in the driver, just move it to the new function.

Signed-off-by: Amit Cohen <amcohen@nvidia.com>
Reviewed-by: Petr Machata <petrm@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_fid.c