Skip to content

Commit 27851df

Browse files
pmachatakuba-moo
authored andcommitted
mlxsw: spectrum_router: Add a helper to get subport number from a RIF
In the CFF flood mode, responsibility for management of the PGT entries for rFIDs is moved from FW to the driver. All rFIDs are based off either a front panel port, or a LAG port. The flood vectors for port-based rFIDs enable just the port itself, the ones for LAG-based rFIDs enable all member ports of the LAG in question. Since all rFIDs based off the same port have the same flood vector, and similarly for LAG-based rFIDs, the flood entries are shared. The PGT address of the flood vector is therefore determined based on the port (or LAG) number of the RIF connected with the rFID. Add a helper to determine subport number given a RIF, to be used in these calculations. Signed-off-by: Petr Machata <[email protected]> Reviewed-by: Amit Cohen <[email protected]> Reviewed-by: Ido Schimmel <[email protected]> Link: https://lore.kernel.org/r/d7ab43cf5b021f785f363f236e4b6780d10eea93.1700503644.git.petrm@nvidia.com Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 2b7bccd commit 27851df

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

drivers/net/ethernet/mellanox/mlxsw/spectrum.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -753,6 +753,8 @@ union mlxsw_sp_l3addr {
753753
};
754754

755755
u16 mlxsw_sp_rif_index(const struct mlxsw_sp_rif *rif);
756+
int mlxsw_sp_rif_subport_port(const struct mlxsw_sp_rif *rif,
757+
u16 *port, bool *is_lag);
756758
int mlxsw_sp_router_init(struct mlxsw_sp *mlxsw_sp,
757759
struct netlink_ext_ack *extack);
758760
void mlxsw_sp_router_fini(struct mlxsw_sp *mlxsw_sp);

drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8660,6 +8660,20 @@ mlxsw_sp_rif_subport_rif(const struct mlxsw_sp_rif *rif)
86608660
return container_of(rif, struct mlxsw_sp_rif_subport, common);
86618661
}
86628662

8663+
int mlxsw_sp_rif_subport_port(const struct mlxsw_sp_rif *rif,
8664+
u16 *port, bool *is_lag)
8665+
{
8666+
struct mlxsw_sp_rif_subport *rif_subport;
8667+
8668+
if (WARN_ON(rif->ops->type != MLXSW_SP_RIF_TYPE_SUBPORT))
8669+
return -EINVAL;
8670+
8671+
rif_subport = mlxsw_sp_rif_subport_rif(rif);
8672+
*is_lag = rif_subport->lag;
8673+
*port = *is_lag ? rif_subport->lag_id : rif_subport->system_port;
8674+
return 0;
8675+
}
8676+
86638677
static struct mlxsw_sp_rif *
86648678
mlxsw_sp_rif_subport_get(struct mlxsw_sp *mlxsw_sp,
86658679
const struct mlxsw_sp_rif_params *params,

0 commit comments

Comments
 (0)