Skip to content

Commit

Permalink
Merge branch 'mlxsw-CFF-flood-mode'
Browse files Browse the repository at this point in the history
Petr Machata says:

====================
mlxsw: CFF flood mode: NVE underlay configuration

Recently, support for CFF flood mode (for Compressed FID Flooding) was
added to the mlxsw driver. The most recent patchset has a detailed coverage
of what CFF is and what has changed and how:

    https://lore.kernel.org/netdev/[email protected]/

In CFF flood mode, each FID allocates a handful (in our implementation two
or three) consecutive PGT entries. One entry holds the flood vector for
unknown-UC traffic, one for MC, one for BC.

To determine how to look up flood vectors, the CFF flood mode uses a
concept of flood profiles, which are IDs that reference mappings from
traffic types to offsets. In the case of CFF flood mode, the offset in
question is applied to the PGT address configured at a FID. The same
mechanism is used by NVE underlay for flooding. Again the profile ID and
the traffic type determine the offset to apply, this time to KVD address
used to look up flooding entries. Since mlxsw configures NVE underlay flood
the same regardless of traffic type, only one offset was ever needed: the
zero, which is the default, and thus no explicit configuration was needed.

Now that CFF uses profiles as well, it would be better to configure the
profile used by NVE explicitly, to make the configuration visible in the
source code.

In this patchset, add the register support (in patch #1), add a new traffic
type to refer to "any traffic at all" (in patch #2) and finally configure
the NVE profile explicitly for FIDs (in patch #3).

So far, the implicitly configured flood profile was the ID 0. With this
patchset, it changes to 3, leaving the 0 free to allow us to spot missed
configuration.
====================

Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
davem330 committed Dec 15, 2023
2 parents 523e1f5 + 6dab408 commit e16064c
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
9 changes: 9 additions & 0 deletions drivers/net/ethernet/mellanox/mlxsw/reg.h
Original file line number Diff line number Diff line change
Expand Up @@ -1954,6 +1954,15 @@ MLXSW_ITEM32(reg, sfmr, irif, 0x14, 0, 16);
*/
MLXSW_ITEM32(reg, sfmr, cff_mid_base, 0x20, 0, 16);

/* reg_sfmr_nve_flood_prf_id
* FID flooding profile_id for NVE Encap
* Range 0..(max_cap_nve_flood_prf-1)
* Access: RW
*
* Note: Reserved when SwitchX/-2 and Spectrum-1
*/
MLXSW_ITEM32(reg, sfmr, nve_flood_prf_id, 0x24, 8, 2);

/* reg_sfmr_cff_prf_id
* Compressed Fid Flooding profile_id
* Range 0..(max_cap_nve_flood_prf-1)
Expand Down
2 changes: 2 additions & 0 deletions drivers/net/ethernet/mellanox/mlxsw/spectrum.h
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,8 @@ enum mlxsw_sp_flood_type {
MLXSW_SP_FLOOD_TYPE_MC,
/* For RSP FIDs in CFF mode. */
MLXSW_SP_FLOOD_TYPE_NOT_UC,
/* For NVE traffic. */
MLXSW_SP_FLOOD_TYPE_ANY,
};

int mlxsw_sp_port_get_stats_raw(struct net_device *dev, int grp,
Expand Down
29 changes: 29 additions & 0 deletions drivers/net/ethernet/mellanox/mlxsw/spectrum_fid.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ struct mlxsw_sp_fid_ops {
enum mlxsw_sp_fid_flood_profile_id {
MLXSW_SP_FID_FLOOD_PROFILE_ID_BRIDGE = 1,
MLXSW_SP_FID_FLOOD_PROFILE_ID_RSP,
MLXSW_SP_FID_FLOOD_PROFILE_ID_NVE,
};

struct mlxsw_sp_fid_flood_profile {
Expand Down Expand Up @@ -167,11 +168,22 @@ static const int mlxsw_sp_sfgc_not_uc_packet_types[MLXSW_REG_SFGC_TYPE_MAX] = {
[MLXSW_REG_SFGC_TYPE_UNREGISTERED_MULTICAST_IPV4] = 1,
};

static const int mlxsw_sp_sfgc_any_packet_types[MLXSW_REG_SFGC_TYPE_MAX] = {
[MLXSW_REG_SFGC_TYPE_UNKNOWN_UNICAST] = 1,
[MLXSW_REG_SFGC_TYPE_BROADCAST] = 1,
[MLXSW_REG_SFGC_TYPE_UNREGISTERED_MULTICAST_NON_IP] = 1,
[MLXSW_REG_SFGC_TYPE_IPV4_LINK_LOCAL] = 1,
[MLXSW_REG_SFGC_TYPE_IPV6_ALL_HOST] = 1,
[MLXSW_REG_SFGC_TYPE_UNREGISTERED_MULTICAST_IPV6] = 1,
[MLXSW_REG_SFGC_TYPE_UNREGISTERED_MULTICAST_IPV4] = 1,
};

static const int *mlxsw_sp_packet_type_sfgc_types[] = {
[MLXSW_SP_FLOOD_TYPE_UC] = mlxsw_sp_sfgc_uc_packet_types,
[MLXSW_SP_FLOOD_TYPE_BC] = mlxsw_sp_sfgc_bc_packet_types,
[MLXSW_SP_FLOOD_TYPE_MC] = mlxsw_sp_sfgc_mc_packet_types,
[MLXSW_SP_FLOOD_TYPE_NOT_UC] = mlxsw_sp_sfgc_not_uc_packet_types,
[MLXSW_SP_FLOOD_TYPE_ANY] = mlxsw_sp_sfgc_any_packet_types,
};

struct mlxsw_sp_fid *mlxsw_sp_fid_lookup_by_index(struct mlxsw_sp *mlxsw_sp,
Expand Down Expand Up @@ -549,6 +561,8 @@ static void mlxsw_sp_fid_fid_pack_cff(char *sfmr_pl,
mlxsw_reg_sfmr_cff_mid_base_set(sfmr_pl, pgt_base);
mlxsw_reg_sfmr_cff_prf_id_set(sfmr_pl,
fid_family->flood_profile->profile_id);
mlxsw_reg_sfmr_nve_flood_prf_id_set(sfmr_pl,
MLXSW_SP_FID_FLOOD_PROFILE_ID_NVE);
}

static u16 mlxsw_sp_fid_rfid_fid_offset_cff(struct mlxsw_sp *mlxsw_sp,
Expand Down Expand Up @@ -1310,6 +1324,20 @@ struct mlxsw_sp_fid_flood_profile mlxsw_sp_fid_rsp_flood_profile_cff = {
.profile_id = MLXSW_SP_FID_FLOOD_PROFILE_ID_RSP,
};

static const struct mlxsw_sp_flood_table mlxsw_sp_fid_nve_flood_tables_cff[] = {
{
.packet_type = MLXSW_SP_FLOOD_TYPE_ANY,
.table_index = 0,
},
};

static const
struct mlxsw_sp_fid_flood_profile mlxsw_sp_fid_nve_flood_profile_cff = {
.flood_tables = mlxsw_sp_fid_nve_flood_tables_cff,
.nr_flood_tables = ARRAY_SIZE(mlxsw_sp_fid_nve_flood_tables_cff),
.profile_id = MLXSW_SP_FID_FLOOD_PROFILE_ID_NVE,
};

static bool
mlxsw_sp_fid_8021q_compare(const struct mlxsw_sp_fid *fid, const void *arg)
{
Expand Down Expand Up @@ -2411,6 +2439,7 @@ static const
struct mlxsw_sp_fid_flood_profile *mlxsw_sp_fid_flood_profiles[] = {
&mlxsw_sp_fid_8021d_flood_profile,
&mlxsw_sp_fid_rsp_flood_profile_cff,
&mlxsw_sp_fid_nve_flood_profile_cff,
};

static int
Expand Down

0 comments on commit e16064c

Please sign in to comment.