Skip to content

Commit ab68bd7

Browse files
pmachatakuba-moo
authored andcommitted
mlxsw: spectrum_fid: Rename FID ops, families, arrays
Currently, mlxsw always uses a "controlled" flood mode on all Nvidia Spectrum generations. The following patches will however introduce a possibility to run a "CFF" (for Compressed FID Flooding) mode on newer machines, if the FW supports it. To reflect that, label all FID ops, FID families and FID family arrays with a _ctl suffix. This will make it clearer what is what when the CFF families are introduced in later patches. Keep the dummy family intact. Since the dummy family has no flood tables in either CTL or CFF mode, there are no flood-mode-specific callbacks. Additionally, add a remark at two fields that they are only relevant when flood mode is not CFF. Signed-off-by: Petr Machata <petrm@nvidia.com> Reviewed-by: Amit Cohen <amcohen@nvidia.com> Reviewed-by: Ido Schimmel <idosch@nvidia.com> Link: https://lore.kernel.org/r/96b6da5439bb662fa86e795bbcec9dc3ccfa59fd.1701183892.git.petrm@nvidia.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 01de00f commit ab68bd7

File tree

1 file changed

+25
-23
lines changed

1 file changed

+25
-23
lines changed

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

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ static const struct rhashtable_params mlxsw_sp_fid_vni_ht_params = {
7171

7272
struct mlxsw_sp_flood_table {
7373
enum mlxsw_sp_flood_type packet_type;
74-
enum mlxsw_flood_table_type table_type;
74+
enum mlxsw_flood_table_type table_type; /* For flood_mode!=CFF. */
7575
int table_index;
7676
};
7777

@@ -109,7 +109,7 @@ struct mlxsw_sp_fid_family {
109109
enum mlxsw_sp_rif_type rif_type;
110110
const struct mlxsw_sp_fid_ops *ops;
111111
struct mlxsw_sp *mlxsw_sp;
112-
bool flood_rsp;
112+
bool flood_rsp; /* For flood_mode!=CFF. */
113113
enum mlxsw_reg_bridge_type bridge_type;
114114
u16 pgt_base;
115115
bool smpe_index_valid;
@@ -1068,7 +1068,7 @@ mlxsw_sp_fid_8021d_vid_to_fid_rif_update(const struct mlxsw_sp_fid *fid,
10681068
return 0;
10691069
}
10701070

1071-
static const struct mlxsw_sp_fid_ops mlxsw_sp_fid_8021d_ops = {
1071+
static const struct mlxsw_sp_fid_ops mlxsw_sp_fid_8021d_ops_ctl = {
10721072
.setup = mlxsw_sp_fid_8021d_setup,
10731073
.configure = mlxsw_sp_fid_8021d_configure,
10741074
.deconfigure = mlxsw_sp_fid_8021d_deconfigure,
@@ -1120,8 +1120,10 @@ mlxsw_sp_fid_8021q_fdb_clear_offload(const struct mlxsw_sp_fid *fid,
11201120
br_fdb_clear_offload(nve_dev, mlxsw_sp_fid_8021q_vid(fid));
11211121
}
11221122

1123-
static void mlxsw_sp_fid_rfid_setup(struct mlxsw_sp_fid *fid, const void *arg)
1123+
static void mlxsw_sp_fid_rfid_setup_ctl(struct mlxsw_sp_fid *fid,
1124+
const void *arg)
11241125
{
1126+
/* In controlled mode, the FW takes care of FID placement. */
11251127
fid->fid_offset = 0;
11261128
}
11271129

@@ -1248,8 +1250,8 @@ mlxsw_sp_fid_rfid_vid_to_fid_rif_update(const struct mlxsw_sp_fid *fid,
12481250
return 0;
12491251
}
12501252

1251-
static const struct mlxsw_sp_fid_ops mlxsw_sp_fid_rfid_ops = {
1252-
.setup = mlxsw_sp_fid_rfid_setup,
1253+
static const struct mlxsw_sp_fid_ops mlxsw_sp_fid_rfid_ops_ctl = {
1254+
.setup = mlxsw_sp_fid_rfid_setup_ctl,
12531255
.configure = mlxsw_sp_fid_rfid_configure,
12541256
.deconfigure = mlxsw_sp_fid_rfid_deconfigure,
12551257
.index_alloc = mlxsw_sp_fid_rfid_index_alloc,
@@ -1405,7 +1407,7 @@ mlxsw_sp_fid_8021q_port_vid_unmap(struct mlxsw_sp_fid *fid,
14051407
__mlxsw_sp_fid_port_vid_map(fid, local_port, vid, false);
14061408
}
14071409

1408-
static const struct mlxsw_sp_fid_ops mlxsw_sp_fid_8021q_ops = {
1410+
static const struct mlxsw_sp_fid_ops mlxsw_sp_fid_8021q_ops_ctl = {
14091411
.setup = mlxsw_sp_fid_8021q_setup,
14101412
.configure = mlxsw_sp_fid_8021q_configure,
14111413
.deconfigure = mlxsw_sp_fid_8021q_deconfigure,
@@ -1447,7 +1449,7 @@ static const struct mlxsw_sp_fid_family mlxsw_sp1_fid_8021q_family = {
14471449
.flood_tables = mlxsw_sp_fid_8021d_flood_tables,
14481450
.nr_flood_tables = ARRAY_SIZE(mlxsw_sp_fid_8021d_flood_tables),
14491451
.rif_type = MLXSW_SP_RIF_TYPE_VLAN,
1450-
.ops = &mlxsw_sp_fid_8021q_ops,
1452+
.ops = &mlxsw_sp_fid_8021q_ops_ctl,
14511453
.flood_rsp = false,
14521454
.bridge_type = MLXSW_REG_BRIDGE_TYPE_0,
14531455
.smpe_index_valid = false,
@@ -1461,7 +1463,7 @@ static const struct mlxsw_sp_fid_family mlxsw_sp1_fid_8021d_family = {
14611463
.flood_tables = mlxsw_sp_fid_8021d_flood_tables,
14621464
.nr_flood_tables = ARRAY_SIZE(mlxsw_sp_fid_8021d_flood_tables),
14631465
.rif_type = MLXSW_SP_RIF_TYPE_FID,
1464-
.ops = &mlxsw_sp_fid_8021d_ops,
1466+
.ops = &mlxsw_sp_fid_8021d_ops_ctl,
14651467
.bridge_type = MLXSW_REG_BRIDGE_TYPE_1,
14661468
.smpe_index_valid = false,
14671469
};
@@ -1475,13 +1477,13 @@ static const struct mlxsw_sp_fid_family mlxsw_sp1_fid_dummy_family = {
14751477
.smpe_index_valid = false,
14761478
};
14771479

1478-
static const struct mlxsw_sp_fid_family mlxsw_sp_fid_rfid_family = {
1480+
static const struct mlxsw_sp_fid_family mlxsw_sp_fid_rfid_family_ctl = {
14791481
.type = MLXSW_SP_FID_TYPE_RFID,
14801482
.fid_size = sizeof(struct mlxsw_sp_fid),
14811483
.start_index = MLXSW_SP_RFID_START,
14821484
.end_index = MLXSW_SP_RFID_END,
14831485
.rif_type = MLXSW_SP_RIF_TYPE_SUBPORT,
1484-
.ops = &mlxsw_sp_fid_rfid_ops,
1486+
.ops = &mlxsw_sp_fid_rfid_ops_ctl,
14851487
.flood_rsp = true,
14861488
.smpe_index_valid = false,
14871489
};
@@ -1490,32 +1492,32 @@ static const struct mlxsw_sp_fid_family *mlxsw_sp1_fid_family_arr[] = {
14901492
[MLXSW_SP_FID_TYPE_8021Q] = &mlxsw_sp1_fid_8021q_family,
14911493
[MLXSW_SP_FID_TYPE_8021D] = &mlxsw_sp1_fid_8021d_family,
14921494
[MLXSW_SP_FID_TYPE_DUMMY] = &mlxsw_sp1_fid_dummy_family,
1493-
[MLXSW_SP_FID_TYPE_RFID] = &mlxsw_sp_fid_rfid_family,
1495+
[MLXSW_SP_FID_TYPE_RFID] = &mlxsw_sp_fid_rfid_family_ctl,
14941496
};
14951497

1496-
static const struct mlxsw_sp_fid_family mlxsw_sp2_fid_8021q_family = {
1498+
static const struct mlxsw_sp_fid_family mlxsw_sp2_fid_8021q_family_ctl = {
14971499
.type = MLXSW_SP_FID_TYPE_8021Q,
14981500
.fid_size = sizeof(struct mlxsw_sp_fid_8021q),
14991501
.start_index = MLXSW_SP_FID_8021Q_START,
15001502
.end_index = MLXSW_SP_FID_8021Q_END,
15011503
.flood_tables = mlxsw_sp_fid_8021d_flood_tables,
15021504
.nr_flood_tables = ARRAY_SIZE(mlxsw_sp_fid_8021d_flood_tables),
15031505
.rif_type = MLXSW_SP_RIF_TYPE_VLAN,
1504-
.ops = &mlxsw_sp_fid_8021q_ops,
1506+
.ops = &mlxsw_sp_fid_8021q_ops_ctl,
15051507
.flood_rsp = false,
15061508
.bridge_type = MLXSW_REG_BRIDGE_TYPE_0,
15071509
.smpe_index_valid = true,
15081510
};
15091511

1510-
static const struct mlxsw_sp_fid_family mlxsw_sp2_fid_8021d_family = {
1512+
static const struct mlxsw_sp_fid_family mlxsw_sp2_fid_8021d_family_ctl = {
15111513
.type = MLXSW_SP_FID_TYPE_8021D,
15121514
.fid_size = sizeof(struct mlxsw_sp_fid_8021d),
15131515
.start_index = MLXSW_SP_FID_8021D_START,
15141516
.end_index = MLXSW_SP_FID_8021D_END,
15151517
.flood_tables = mlxsw_sp_fid_8021d_flood_tables,
15161518
.nr_flood_tables = ARRAY_SIZE(mlxsw_sp_fid_8021d_flood_tables),
15171519
.rif_type = MLXSW_SP_RIF_TYPE_FID,
1518-
.ops = &mlxsw_sp_fid_8021d_ops,
1520+
.ops = &mlxsw_sp_fid_8021d_ops_ctl,
15191521
.bridge_type = MLXSW_REG_BRIDGE_TYPE_1,
15201522
.smpe_index_valid = true,
15211523
};
@@ -1529,11 +1531,11 @@ static const struct mlxsw_sp_fid_family mlxsw_sp2_fid_dummy_family = {
15291531
.smpe_index_valid = false,
15301532
};
15311533

1532-
static const struct mlxsw_sp_fid_family *mlxsw_sp2_fid_family_arr[] = {
1533-
[MLXSW_SP_FID_TYPE_8021Q] = &mlxsw_sp2_fid_8021q_family,
1534-
[MLXSW_SP_FID_TYPE_8021D] = &mlxsw_sp2_fid_8021d_family,
1534+
static const struct mlxsw_sp_fid_family *mlxsw_sp2_fid_family_arr_ctl[] = {
1535+
[MLXSW_SP_FID_TYPE_8021Q] = &mlxsw_sp2_fid_8021q_family_ctl,
1536+
[MLXSW_SP_FID_TYPE_8021D] = &mlxsw_sp2_fid_8021d_family_ctl,
15351537
[MLXSW_SP_FID_TYPE_DUMMY] = &mlxsw_sp2_fid_dummy_family,
1536-
[MLXSW_SP_FID_TYPE_RFID] = &mlxsw_sp_fid_rfid_family,
1538+
[MLXSW_SP_FID_TYPE_RFID] = &mlxsw_sp_fid_rfid_family_ctl,
15371539
};
15381540

15391541
static struct mlxsw_sp_fid *mlxsw_sp_fid_lookup(struct mlxsw_sp *mlxsw_sp,
@@ -1877,12 +1879,12 @@ const struct mlxsw_sp_fid_core_ops mlxsw_sp1_fid_core_ops = {
18771879
.fini = mlxsw_sp_fids_fini,
18781880
};
18791881

1880-
static int mlxsw_sp2_fids_init(struct mlxsw_sp *mlxsw_sp)
1882+
static int mlxsw_sp2_fids_init_ctl(struct mlxsw_sp *mlxsw_sp)
18811883
{
1882-
return mlxsw_sp_fids_init(mlxsw_sp, mlxsw_sp2_fid_family_arr);
1884+
return mlxsw_sp_fids_init(mlxsw_sp, mlxsw_sp2_fid_family_arr_ctl);
18831885
}
18841886

18851887
const struct mlxsw_sp_fid_core_ops mlxsw_sp2_fid_core_ops = {
1886-
.init = mlxsw_sp2_fids_init,
1888+
.init = mlxsw_sp2_fids_init_ctl,
18871889
.fini = mlxsw_sp_fids_fini,
18881890
};

0 commit comments

Comments
 (0)