Skip to content

Commit 80638da

Browse files
pmachatakuba-moo
authored andcommitted
mlxsw: spectrum_fid: Add an op for flood table initialization
In controlled flood mode, for each bridge FID family (i.e., 802.1Q and 802.1D) and packet type (i.e., UUC/MC/BC), the hardware needs to be told which PGT address to use as the base address for the flood table and how to determine the offset from the base for each FID. The above is not needed in CFF mode where each FID has its own flood table instead of the FID family itself. Therefore, create a new FID family operation for the above configuration and only implement it for the 802.1Q and 802.1D families in controlled flood mode. No functional changes intended. Signed-off-by: Petr Machata <petrm@nvidia.com> Reviewed-by: Ido Schimmel <idosch@nvidia.com> Link: https://lore.kernel.org/r/06f71415eec75811585ec597e1dd101b6dff77e7.1701183892.git.petrm@nvidia.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 1d07911 commit 80638da

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

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

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ struct mlxsw_sp_fid_ops {
9595
const struct net_device *nve_dev);
9696
int (*vid_to_fid_rif_update)(const struct mlxsw_sp_fid *fid,
9797
const struct mlxsw_sp_rif *rif);
98+
int (*flood_table_init)(struct mlxsw_sp_fid_family *fid_family,
99+
const struct mlxsw_sp_flood_table *flood_table);
98100
};
99101

100102
struct mlxsw_sp_fid_family {
@@ -1078,8 +1080,8 @@ mlxsw_sp_fid_8021d_vid_to_fid_rif_update(const struct mlxsw_sp_fid *fid,
10781080
}
10791081

10801082
static int
1081-
mlxsw_sp_fid_flood_table_init(struct mlxsw_sp_fid_family *fid_family,
1082-
const struct mlxsw_sp_flood_table *flood_table)
1083+
mlxsw_sp_fid_flood_table_init_ctl(struct mlxsw_sp_fid_family *fid_family,
1084+
const struct mlxsw_sp_flood_table *flood_table)
10831085
{
10841086
enum mlxsw_sp_flood_type packet_type = flood_table->packet_type;
10851087
struct mlxsw_sp *mlxsw_sp = fid_family->mlxsw_sp;
@@ -1121,6 +1123,7 @@ static const struct mlxsw_sp_fid_ops mlxsw_sp_fid_8021d_ops_ctl = {
11211123
.nve_flood_index_clear = mlxsw_sp_fid_8021d_nve_flood_index_clear,
11221124
.fdb_clear_offload = mlxsw_sp_fid_8021d_fdb_clear_offload,
11231125
.vid_to_fid_rif_update = mlxsw_sp_fid_8021d_vid_to_fid_rif_update,
1126+
.flood_table_init = mlxsw_sp_fid_flood_table_init_ctl,
11241127
};
11251128

11261129
#define MLXSW_SP_FID_8021Q_MAX (VLAN_N_VID - 2)
@@ -1462,6 +1465,7 @@ static const struct mlxsw_sp_fid_ops mlxsw_sp_fid_8021q_ops_ctl = {
14621465
.nve_flood_index_clear = mlxsw_sp_fid_8021d_nve_flood_index_clear,
14631466
.fdb_clear_offload = mlxsw_sp_fid_8021q_fdb_clear_offload,
14641467
.vid_to_fid_rif_update = mlxsw_sp_fid_8021q_vid_to_fid_rif_update,
1468+
.flood_table_init = mlxsw_sp_fid_flood_table_init_ctl,
14651469
};
14661470

14671471
/* There are 4K-2 802.1Q FIDs */
@@ -1723,9 +1727,12 @@ mlxsw_sp_fid_flood_tables_init(struct mlxsw_sp_fid_family *fid_family)
17231727
const struct mlxsw_sp_flood_table *flood_table;
17241728

17251729
flood_table = &fid_family->flood_tables[i];
1726-
err = mlxsw_sp_fid_flood_table_init(fid_family, flood_table);
1727-
if (err)
1728-
goto err_flood_table_init;
1730+
if (fid_family->ops->flood_table_init) {
1731+
err = fid_family->ops->flood_table_init(fid_family,
1732+
flood_table);
1733+
if (err)
1734+
goto err_flood_table_init;
1735+
}
17291736
}
17301737

17311738
return 0;

0 commit comments

Comments
 (0)