Skip to content

Commit 3a17ea7

Browse files
committed
Merge branch 'mlxsw-preparations-for-support-of-cff-flood-mode'
Petr Machata says: ==================== mlxsw: Preparations for support of CFF flood mode PGT is an in-HW table that maps addresses to sets of ports. Then when some HW process needs a set of ports as an argument, instead of embedding the actual set in the dynamic configuration, what gets configured is the address referencing the set. The HW then works with the appropriate PGT entry. Among other allocations, the PGT currently contains two large blocks for bridge flooding: one for 802.1q and one for 802.1d. Within each of these blocks are three tables, for unknown-unicast, multicast and broadcast flooding: . . . | 802.1q | 802.1d | . . . | UC | MC | BC | UC | MC | BC | \______ _____/ \_____ ______/ v v FID flood vectors Thus each FID (which corresponds to an 802.1d bridge or one VLAN in an 802.1q bridge) uses three flood vectors spread across a fairly large region of PGT. This way of organizing the flood table (called "controlled") is not very flexible. E.g. to decrease a bridge scale and store more IP MC vectors, one would need to completely rewrite the bridge PGT blocks, or resort to hacks such as storing individual MC flood vectors into unused part of the bridge table. In order to address these shortcomings, Spectrum-2 and above support what is called CFF flood mode, for Compressed FID Flooding. In CFF flood mode, each FID has a little table of its own, with three entries adjacent to each other, one for unknown-UC, one for MC, one for BC. This allows for a much more fine-grained approach to PGT management, where bits of it are allocated on demand. . . . | FID | FID | FID | FID | FID | . . . |U|M|B|U|M|B|U|M|B|U|M|B|U|M|B| \_____________ _____________/ v FID flood vectors Besides the FID table organization, the CFF flood mode also impacts Router Subport (RSP) table. This table contains flood vectors for rFIDs, which are FIDs that reference front panel ports or LAGs. The RSP table contains two entries per front panel port and LAG, one for unknown-UC traffic, and one for everything else. Currently, the FW allocates and manages the table in its own part of PGT. rFIDs are marked with flood_rsp bit and managed specially. In CFF mode, rFIDs are managed as all other FIDs. The driver therefore has to allocate and maintain the flood vectors. Like with bridge FIDs, this is more work, but increases flexibility of the system. The FW currently supports both the controlled and CFF flood modes. To shed complexity, in the future it should only support CFF flood mode. Hence this patchset, which is the first in series of two to add CFF flood mode support to mlxsw. There are FW versions out there that do not support CFF flood mode, and on Spectrum-1 in particular, there is no plan to support it at all. mlxsw will therefore have to support both controlled flood mode as well as CFF. Another aspect is that at least on Spectrum-1, there are FW versions out there that claim to support CFF flood mode, but then reject or ignore configurations enabling the same. The driver thus has to have a say in whether an attempt to configure CFF flood mode should even be made. Much like with the LAG mode, the feature is therefore expressed in terms of "does the driver prefer CFF flood mode?", and "what flood mode the PCI module managed to configure the FW with". This gives to the driver a chance to determine whether CFF flood mode configuration should be attempted. In this patchset, we lay the ground with new definitions, registers and their fields, and some minor code shaping. The next patchset will be more focused on introducing necessary abstractions and implementation. - Patches #1 and #2 add CFF-related items to the command interface. - Patch #3 adds a new resource, for maximum number of flood profiles supported. (A flood profile is a mapping between traffic type and offset in the per-FID flood vector table.) - Patches #4 to #8 adjust reg.h. The SFFP register is added, which is used for configuring the abovementioned traffic-type-to-offset mapping. The SFMR, register, which serves for FID configuration, is extended with fields specific to CFF mode. And other minor adjustments. - Patches #9 and #10 add the plumbing for CFF mode: a way to request that CFF flood mode be configured, and a way to query the flood mode that was actually configured. - Patch #11 removes dead code. - Patches #12 and #13 add helpers that the next patchset will make use of. Patch #14 moves RIF setup ahead so that FID code can make use of it. ==================== Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents dd891b5 + f7ebb40 commit 3a17ea7

File tree

9 files changed

+169
-31
lines changed

9 files changed

+169
-31
lines changed

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

+11
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,12 @@ MLXSW_ITEM32(cmd_mbox, query_fw, fw_day, 0x14, 0, 8);
282282
*/
283283
MLXSW_ITEM32(cmd_mbox, query_fw, lag_mode_support, 0x18, 1, 1);
284284

285+
/* cmd_mbox_query_fw_cff_support
286+
* 0: CONFIG_PROFILE.flood_mode = 5 (CFF) is not supported by FW
287+
* 1: CONFIG_PROFILE.flood_mode = 5 (CFF) is supported by FW
288+
*/
289+
MLXSW_ITEM32(cmd_mbox, query_fw, cff_support, 0x18, 2, 1);
290+
285291
/* cmd_mbox_query_fw_clr_int_base_offset
286292
* Clear Interrupt register's offset from clr_int_bar register
287293
* in PCI address space.
@@ -779,6 +785,11 @@ enum mlxsw_cmd_mbox_config_profile_flood_mode {
779785
* used.
780786
*/
781787
MLXSW_CMD_MBOX_CONFIG_PROFILE_FLOOD_MODE_CONTROLLED = 4,
788+
/* CFF - Compressed FID Flood (CFF) mode.
789+
* Reserved when legacy bridge model is used.
790+
* Supported only by Spectrum-2+.
791+
*/
792+
MLXSW_CMD_MBOX_CONFIG_PROFILE_FLOOD_MODE_CFF = 5,
782793
};
783794

784795
/* cmd_mbox_config_profile_flood_mode

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

+7
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,13 @@ mlxsw_core_lag_mode(struct mlxsw_core *mlxsw_core)
211211
}
212212
EXPORT_SYMBOL(mlxsw_core_lag_mode);
213213

214+
enum mlxsw_cmd_mbox_config_profile_flood_mode
215+
mlxsw_core_flood_mode(struct mlxsw_core *mlxsw_core)
216+
{
217+
return mlxsw_core->bus->flood_mode(mlxsw_core->bus_priv);
218+
}
219+
EXPORT_SYMBOL(mlxsw_core_flood_mode);
220+
214221
void *mlxsw_core_driver_priv(struct mlxsw_core *mlxsw_core)
215222
{
216223
return mlxsw_core->driver_priv;

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

+9
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ unsigned int mlxsw_core_max_ports(const struct mlxsw_core *mlxsw_core);
3838
int mlxsw_core_max_lag(struct mlxsw_core *mlxsw_core, u16 *p_max_lag);
3939
enum mlxsw_cmd_mbox_config_profile_lag_mode
4040
mlxsw_core_lag_mode(struct mlxsw_core *mlxsw_core);
41+
enum mlxsw_cmd_mbox_config_profile_flood_mode
42+
mlxsw_core_flood_mode(struct mlxsw_core *mlxsw_core);
4143

4244
void *mlxsw_core_driver_priv(struct mlxsw_core *mlxsw_core);
4345

@@ -322,7 +324,12 @@ struct mlxsw_config_profile {
322324
u16 max_regions;
323325
u8 max_flood_tables;
324326
u8 max_vid_flood_tables;
327+
328+
/* Flood mode to use if used_flood_mode. If flood_mode_prefer_cff,
329+
* the backup flood mode (if any) when CFF unsupported.
330+
*/
325331
u8 flood_mode;
332+
326333
u8 max_fid_offset_flood_tables;
327334
u16 fid_offset_flood_table_size;
328335
u8 max_fid_flood_tables;
@@ -338,6 +345,7 @@ struct mlxsw_config_profile {
338345
u8 kvd_hash_double_parts;
339346
u8 cqe_time_stamp_type;
340347
bool lag_mode_prefer_sw;
348+
bool flood_mode_prefer_cff;
341349
struct mlxsw_swid_config swid_config[MLXSW_CONFIG_PROFILE_SWID_COUNT];
342350
};
343351

@@ -489,6 +497,7 @@ struct mlxsw_bus {
489497
u32 (*read_utc_sec)(void *bus_priv);
490498
u32 (*read_utc_nsec)(void *bus_priv);
491499
enum mlxsw_cmd_mbox_config_profile_lag_mode (*lag_mode)(void *bus_priv);
500+
enum mlxsw_cmd_mbox_config_profile_flood_mode (*flood_mode)(void *priv);
492501
u8 features;
493502
};
494503

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

+26-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,9 @@ struct mlxsw_pci {
106106
u64 utc_sec_offset;
107107
u64 utc_nsec_offset;
108108
bool lag_mode_support;
109+
bool cff_support;
109110
enum mlxsw_cmd_mbox_config_profile_lag_mode lag_mode;
111+
enum mlxsw_cmd_mbox_config_profile_flood_mode flood_mode;
110112
struct mlxsw_pci_queue_type_group queues[MLXSW_PCI_QUEUE_TYPE_COUNT];
111113
u32 doorbell_offset;
112114
struct mlxsw_core *core;
@@ -1246,11 +1248,22 @@ static int mlxsw_pci_config_profile(struct mlxsw_pci *mlxsw_pci, char *mbox,
12461248
mlxsw_cmd_mbox_config_profile_fid_flood_table_size_set(
12471249
mbox, profile->fid_flood_table_size);
12481250
}
1249-
if (profile->used_flood_mode) {
1251+
if (profile->flood_mode_prefer_cff && mlxsw_pci->cff_support) {
1252+
enum mlxsw_cmd_mbox_config_profile_flood_mode flood_mode =
1253+
MLXSW_CMD_MBOX_CONFIG_PROFILE_FLOOD_MODE_CFF;
1254+
1255+
mlxsw_cmd_mbox_config_profile_set_flood_mode_set(mbox, 1);
1256+
mlxsw_cmd_mbox_config_profile_flood_mode_set(mbox, flood_mode);
1257+
mlxsw_pci->flood_mode = flood_mode;
1258+
} else if (profile->used_flood_mode) {
12501259
mlxsw_cmd_mbox_config_profile_set_flood_mode_set(
12511260
mbox, 1);
12521261
mlxsw_cmd_mbox_config_profile_flood_mode_set(
12531262
mbox, profile->flood_mode);
1263+
mlxsw_pci->flood_mode = profile->flood_mode;
1264+
} else {
1265+
WARN_ON(1);
1266+
return -EINVAL;
12541267
}
12551268
if (profile->used_max_ib_mc) {
12561269
mlxsw_cmd_mbox_config_profile_set_max_ib_mc_set(
@@ -1654,6 +1667,9 @@ static int mlxsw_pci_init(void *bus_priv, struct mlxsw_core *mlxsw_core,
16541667

16551668
mlxsw_pci->lag_mode_support =
16561669
mlxsw_cmd_mbox_query_fw_lag_mode_support_get(mbox);
1670+
mlxsw_pci->cff_support =
1671+
mlxsw_cmd_mbox_query_fw_cff_support_get(mbox);
1672+
16571673
num_pages = mlxsw_cmd_mbox_query_fw_fw_pages_get(mbox);
16581674
err = mlxsw_pci_fw_area_init(mlxsw_pci, mbox, num_pages);
16591675
if (err)
@@ -1970,6 +1986,14 @@ mlxsw_pci_lag_mode(void *bus_priv)
19701986
return mlxsw_pci->lag_mode;
19711987
}
19721988

1989+
static enum mlxsw_cmd_mbox_config_profile_flood_mode
1990+
mlxsw_pci_flood_mode(void *bus_priv)
1991+
{
1992+
struct mlxsw_pci *mlxsw_pci = bus_priv;
1993+
1994+
return mlxsw_pci->flood_mode;
1995+
}
1996+
19731997
static const struct mlxsw_bus mlxsw_pci_bus = {
19741998
.kind = "pci",
19751999
.init = mlxsw_pci_init,
@@ -1982,6 +2006,7 @@ static const struct mlxsw_bus mlxsw_pci_bus = {
19822006
.read_utc_sec = mlxsw_pci_read_utc_sec,
19832007
.read_utc_nsec = mlxsw_pci_read_utc_nsec,
19842008
.lag_mode = mlxsw_pci_lag_mode,
2009+
.flood_mode = mlxsw_pci_flood_mode,
19852010
.features = MLXSW_BUS_F_TXRX | MLXSW_BUS_F_RESET,
19862011
};
19872012

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

+71-7
Original file line numberDiff line numberDiff line change
@@ -1024,6 +1024,8 @@ static inline void mlxsw_reg_spaft_pack(char *payload, u16 local_port,
10241024
* ------------------------------------------
10251025
* The following register controls the association of flooding tables and MIDs
10261026
* to packet types used for flooding.
1027+
*
1028+
* Reserved when CONFIG_PROFILE.flood_mode = CFF.
10271029
*/
10281030
#define MLXSW_REG_SFGC_ID 0x2011
10291031
#define MLXSW_REG_SFGC_LEN 0x14
@@ -1862,6 +1864,7 @@ MLXSW_ITEM32(reg, sfmr, fid, 0x00, 0, 16);
18621864
* Access: RW
18631865
*
18641866
* Note: Reserved when legacy bridge model is used.
1867+
* Reserved when CONFIG_PROFILE.flood_mode = CFF.
18651868
*/
18661869
MLXSW_ITEM32(reg, sfmr, flood_rsp, 0x08, 31, 1);
18671870

@@ -1872,6 +1875,7 @@ MLXSW_ITEM32(reg, sfmr, flood_rsp, 0x08, 31, 1);
18721875
* Access: RW
18731876
*
18741877
* Note: Reserved when legacy bridge model is used and when flood_rsp=1.
1878+
* Reserved when CONFIG_PROFILE.flood_mode = CFF
18751879
*/
18761880
MLXSW_ITEM32(reg, sfmr, flood_bridge_type, 0x08, 28, 1);
18771881

@@ -1880,6 +1884,8 @@ MLXSW_ITEM32(reg, sfmr, flood_bridge_type, 0x08, 28, 1);
18801884
* Used to point into the flooding table selected by SFGC register if
18811885
* the table is of type FID-Offset. Otherwise, this field is reserved.
18821886
* Access: RW
1887+
*
1888+
* Note: Reserved when CONFIG_PROFILE.flood_mode = CFF
18831889
*/
18841890
MLXSW_ITEM32(reg, sfmr, fid_offset, 0x08, 0, 16);
18851891

@@ -1938,6 +1944,26 @@ MLXSW_ITEM32(reg, sfmr, irif_v, 0x14, 24, 1);
19381944
*/
19391945
MLXSW_ITEM32(reg, sfmr, irif, 0x14, 0, 16);
19401946

1947+
/* reg_sfmr_cff_mid_base
1948+
* Pointer to PGT table.
1949+
* Range: 0..(cap_max_pgt-1)
1950+
* Access: RW
1951+
*
1952+
* Note: Reserved when SwitchX/-2 and Spectrum-1.
1953+
* Supported when CONFIG_PROFILE.flood_mode = CFF.
1954+
*/
1955+
MLXSW_ITEM32(reg, sfmr, cff_mid_base, 0x20, 0, 16);
1956+
1957+
/* reg_sfmr_cff_prf_id
1958+
* Compressed Fid Flooding profile_id
1959+
* Range 0..(max_cap_nve_flood_prf-1)
1960+
* Access: RW
1961+
*
1962+
* Note: Reserved when SwitchX/-2 and Spectrum-1
1963+
* Supported only when CONFIG_PROFLE.flood_mode = CFF.
1964+
*/
1965+
MLXSW_ITEM32(reg, sfmr, cff_prf_id, 0x24, 0, 2);
1966+
19411967
/* reg_sfmr_smpe_valid
19421968
* SMPE is valid.
19431969
* Access: RW
@@ -1959,18 +1985,11 @@ MLXSW_ITEM32(reg, sfmr, smpe, 0x28, 0, 16);
19591985

19601986
static inline void mlxsw_reg_sfmr_pack(char *payload,
19611987
enum mlxsw_reg_sfmr_op op, u16 fid,
1962-
u16 fid_offset, bool flood_rsp,
1963-
enum mlxsw_reg_bridge_type bridge_type,
19641988
bool smpe_valid, u16 smpe)
19651989
{
19661990
MLXSW_REG_ZERO(sfmr, payload);
19671991
mlxsw_reg_sfmr_op_set(payload, op);
19681992
mlxsw_reg_sfmr_fid_set(payload, fid);
1969-
mlxsw_reg_sfmr_fid_offset_set(payload, fid_offset);
1970-
mlxsw_reg_sfmr_vtfp_set(payload, false);
1971-
mlxsw_reg_sfmr_vv_set(payload, false);
1972-
mlxsw_reg_sfmr_flood_rsp_set(payload, flood_rsp);
1973-
mlxsw_reg_sfmr_flood_bridge_type_set(payload, bridge_type);
19741993
mlxsw_reg_sfmr_smpe_valid_set(payload, smpe_valid);
19751994
mlxsw_reg_sfmr_smpe_set(payload, smpe);
19761995
}
@@ -2168,6 +2187,50 @@ static inline void mlxsw_reg_spvc_pack(char *payload, u16 local_port, bool et1,
21682187
mlxsw_reg_spvc_et0_set(payload, et0);
21692188
}
21702189

2190+
/* SFFP - Switch FID Flooding Profiles Register
2191+
* --------------------------------------------
2192+
* The SFFP register populates the fid flooding profile tables used for the NVE
2193+
* flooding and Compressed-FID Flooding (CFF).
2194+
*
2195+
* Reserved on Spectrum-1.
2196+
*/
2197+
#define MLXSW_REG_SFFP_ID 0x2029
2198+
#define MLXSW_REG_SFFP_LEN 0x0C
2199+
2200+
MLXSW_REG_DEFINE(sffp, MLXSW_REG_SFFP_ID, MLXSW_REG_SFFP_LEN);
2201+
2202+
/* reg_sffp_profile_id
2203+
* Profile ID a.k.a. SFMR.nve_flood_prf_id or SFMR.cff_prf_id
2204+
* Range 0..max_cap_nve_flood_prf-1
2205+
* Access: Index
2206+
*/
2207+
MLXSW_ITEM32(reg, sffp, profile_id, 0x00, 16, 2);
2208+
2209+
/* reg_sffp_type
2210+
* The traffic type to reach the flooding table.
2211+
* Same as SFGC.type
2212+
* Access: Index
2213+
*/
2214+
MLXSW_ITEM32(reg, sffp, type, 0x00, 0, 4);
2215+
2216+
/* reg_sffp_flood_offset
2217+
* Flood offset. Offset to add to SFMR.cff_mid_base to get the final PGT address
2218+
* for FID flood; or offset to add to SFMR.nve_tunnel_flood_ptr to get KVD
2219+
* pointer for NVE underlay.
2220+
* Access: RW
2221+
*/
2222+
MLXSW_ITEM32(reg, sffp, flood_offset, 0x04, 0, 3);
2223+
2224+
static inline void mlxsw_reg_sffp_pack(char *payload, u8 profile_id,
2225+
enum mlxsw_reg_sfgc_type type,
2226+
u8 flood_offset)
2227+
{
2228+
MLXSW_REG_ZERO(sffp, payload);
2229+
mlxsw_reg_sffp_profile_id_set(payload, profile_id);
2230+
mlxsw_reg_sffp_type_set(payload, type);
2231+
mlxsw_reg_sffp_flood_offset_set(payload, flood_offset);
2232+
}
2233+
21712234
/* SPEVET - Switch Port Egress VLAN EtherType
21722235
* ------------------------------------------
21732236
* The switch port egress VLAN EtherType configures which EtherType to push at
@@ -12946,6 +13009,7 @@ static const struct mlxsw_reg_info *mlxsw_reg_infos[] = {
1294613009
MLXSW_REG(spvmlr),
1294713010
MLXSW_REG(spfsr),
1294813011
MLXSW_REG(spvc),
13012+
MLXSW_REG(sffp),
1294913013
MLXSW_REG(spevet),
1295013014
MLXSW_REG(smpe),
1295113015
MLXSW_REG(smid2),

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

+2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ enum mlxsw_res_id {
2727
MLXSW_RES_ID_FID,
2828
MLXSW_RES_ID_MAX_LAG,
2929
MLXSW_RES_ID_MAX_LAG_MEMBERS,
30+
MLXSW_RES_ID_MAX_NVE_FLOOD_PRF,
3031
MLXSW_RES_ID_GUARANTEED_SHARED_BUFFER,
3132
MLXSW_RES_ID_CELL_SIZE,
3233
MLXSW_RES_ID_MAX_HEADROOM_SIZE,
@@ -88,6 +89,7 @@ static u16 mlxsw_res_ids[] = {
8889
[MLXSW_RES_ID_FID] = 0x2512,
8990
[MLXSW_RES_ID_MAX_LAG] = 0x2520,
9091
[MLXSW_RES_ID_MAX_LAG_MEMBERS] = 0x2521,
92+
[MLXSW_RES_ID_MAX_NVE_FLOOD_PRF] = 0x2522,
9193
[MLXSW_RES_ID_GUARANTEED_SHARED_BUFFER] = 0x2805, /* Bytes */
9294
[MLXSW_RES_ID_CELL_SIZE] = 0x2803, /* Bytes */
9395
[MLXSW_RES_ID_MAX_HEADROOM_SIZE] = 0x2811, /* Bytes */

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

+2
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_fid.c

+24-20
Original file line numberDiff line numberDiff line change
@@ -424,18 +424,35 @@ static enum mlxsw_reg_sfmr_op mlxsw_sp_sfmr_op(bool valid)
424424
MLXSW_REG_SFMR_OP_DESTROY_FID;
425425
}
426426

427-
static int mlxsw_sp_fid_op(const struct mlxsw_sp_fid *fid, bool valid)
427+
static void mlxsw_sp_fid_pack(char *sfmr_pl,
428+
const struct mlxsw_sp_fid *fid,
429+
enum mlxsw_reg_sfmr_op op)
428430
{
429-
struct mlxsw_sp *mlxsw_sp = fid->fid_family->mlxsw_sp;
430-
char sfmr_pl[MLXSW_REG_SFMR_LEN];
431431
u16 smpe;
432432

433433
smpe = fid->fid_family->smpe_index_valid ? fid->fid_index : 0;
434434

435-
mlxsw_reg_sfmr_pack(sfmr_pl, mlxsw_sp_sfmr_op(valid), fid->fid_index,
436-
fid->fid_offset, fid->fid_family->flood_rsp,
437-
fid->fid_family->bridge_type,
435+
mlxsw_reg_sfmr_pack(sfmr_pl, op, fid->fid_index,
438436
fid->fid_family->smpe_index_valid, smpe);
437+
}
438+
439+
static void mlxsw_sp_fid_pack_ctl(char *sfmr_pl,
440+
const struct mlxsw_sp_fid *fid,
441+
enum mlxsw_reg_sfmr_op op)
442+
{
443+
mlxsw_sp_fid_pack(sfmr_pl, fid, op);
444+
mlxsw_reg_sfmr_fid_offset_set(sfmr_pl, fid->fid_offset);
445+
mlxsw_reg_sfmr_flood_rsp_set(sfmr_pl, fid->fid_family->flood_rsp);
446+
mlxsw_reg_sfmr_flood_bridge_type_set(sfmr_pl,
447+
fid->fid_family->bridge_type);
448+
}
449+
450+
static int mlxsw_sp_fid_op(const struct mlxsw_sp_fid *fid, bool valid)
451+
{
452+
struct mlxsw_sp *mlxsw_sp = fid->fid_family->mlxsw_sp;
453+
char sfmr_pl[MLXSW_REG_SFMR_LEN];
454+
455+
mlxsw_sp_fid_pack_ctl(sfmr_pl, fid, mlxsw_sp_sfmr_op(valid));
439456
return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sfmr), sfmr_pl);
440457
}
441458

@@ -444,15 +461,8 @@ static int mlxsw_sp_fid_edit_op(const struct mlxsw_sp_fid *fid,
444461
{
445462
struct mlxsw_sp *mlxsw_sp = fid->fid_family->mlxsw_sp;
446463
char sfmr_pl[MLXSW_REG_SFMR_LEN];
447-
u16 smpe;
448-
449-
smpe = fid->fid_family->smpe_index_valid ? fid->fid_index : 0;
450464

451-
mlxsw_reg_sfmr_pack(sfmr_pl, MLXSW_REG_SFMR_OP_CREATE_FID,
452-
fid->fid_index, fid->fid_offset,
453-
fid->fid_family->flood_rsp,
454-
fid->fid_family->bridge_type,
455-
fid->fid_family->smpe_index_valid, smpe);
465+
mlxsw_sp_fid_pack_ctl(sfmr_pl, fid, MLXSW_REG_SFMR_OP_CREATE_FID);
456466
mlxsw_reg_sfmr_vv_set(sfmr_pl, fid->vni_valid);
457467
mlxsw_reg_sfmr_vni_set(sfmr_pl, be32_to_cpu(fid->vni));
458468
mlxsw_reg_sfmr_vtfp_set(sfmr_pl, fid->nve_flood_index_valid);
@@ -1687,9 +1697,6 @@ mlxsw_sp_fid_flood_tables_init(struct mlxsw_sp_fid_family *fid_family)
16871697
int err;
16881698
int i;
16891699

1690-
if (!fid_family->nr_flood_tables)
1691-
return 0;
1692-
16931700
pgt_size = mlxsw_sp_fid_family_pgt_size(fid_family);
16941701
err = mlxsw_sp_pgt_mid_alloc_range(mlxsw_sp, &fid_family->pgt_base,
16951702
pgt_size);
@@ -1718,9 +1725,6 @@ mlxsw_sp_fid_flood_tables_fini(struct mlxsw_sp_fid_family *fid_family)
17181725
struct mlxsw_sp *mlxsw_sp = fid_family->mlxsw_sp;
17191726
u16 pgt_size;
17201727

1721-
if (!fid_family->nr_flood_tables)
1722-
return;
1723-
17241728
pgt_size = mlxsw_sp_fid_family_pgt_size(fid_family);
17251729
mlxsw_sp_pgt_mid_free_range(mlxsw_sp, fid_family->pgt_base, pgt_size);
17261730
}

0 commit comments

Comments
 (0)