Skip to content

Commit 736c9ba

Browse files
committed
Merge branch 'mlxsw-enhancements'
Jiri Pirko says: ==================== mlxsw: couple of enhancements and fixes Couple of enhancements and fixes from Ido. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2 parents 67ea7ef + 523779c commit 736c9ba

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1157,6 +1157,7 @@ int mlxsw_core_bus_device_register(const struct mlxsw_bus_info *mlxsw_bus_info,
11571157
if (mlxsw_core->driver->fini)
11581158
mlxsw_core->driver->fini(mlxsw_core);
11591159
err_driver_init:
1160+
mlxsw_thermal_fini(mlxsw_core->thermal);
11601161
err_thermal_init:
11611162
err_hwmon_init:
11621163
devlink_unregister(devlink);
@@ -1187,8 +1188,8 @@ void mlxsw_core_bus_device_unregister(struct mlxsw_core *mlxsw_core)
11871188
mlxsw_thermal_fini(mlxsw_core->thermal);
11881189
devlink_unregister(devlink);
11891190
mlxsw_emad_fini(mlxsw_core);
1190-
mlxsw_core->bus->fini(mlxsw_core->bus_priv);
11911191
kfree(mlxsw_core->lag.mapping);
1192+
mlxsw_core->bus->fini(mlxsw_core->bus_priv);
11921193
free_percpu(mlxsw_core->pcpu_stats);
11931194
devlink_free(devlink);
11941195
mlxsw_core_driver_put(device_kind);

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ enum mlxsw_res_id {
4747
MLXSW_RES_ID_MAX_SYSTEM_PORT,
4848
MLXSW_RES_ID_MAX_LAG,
4949
MLXSW_RES_ID_MAX_LAG_MEMBERS,
50+
MLXSW_RES_ID_MAX_BUFFER_SIZE,
5051
MLXSW_RES_ID_MAX_CPU_POLICERS,
5152
MLXSW_RES_ID_MAX_VRS,
5253
MLXSW_RES_ID_MAX_RIFS,
@@ -70,6 +71,7 @@ static u16 mlxsw_res_ids[] = {
7071
[MLXSW_RES_ID_MAX_SYSTEM_PORT] = 0x2502,
7172
[MLXSW_RES_ID_MAX_LAG] = 0x2520,
7273
[MLXSW_RES_ID_MAX_LAG_MEMBERS] = 0x2521,
74+
[MLXSW_RES_ID_MAX_BUFFER_SIZE] = 0x2802, /* Bytes */
7375
[MLXSW_RES_ID_MAX_CPU_POLICERS] = 0x2A13,
7476
[MLXSW_RES_ID_MAX_VRS] = 0x2C01,
7577
[MLXSW_RES_ID_MAX_RIFS] = 0x2C02,

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -611,6 +611,9 @@ int mlxsw_sp_sb_pool_set(struct mlxsw_core *mlxsw_core,
611611
u32 pool_size = MLXSW_SP_BYTES_TO_CELLS(size);
612612
enum mlxsw_reg_sbpr_mode mode;
613613

614+
if (size > MLXSW_CORE_RES_GET(mlxsw_sp->core, MAX_BUFFER_SIZE))
615+
return -EINVAL;
616+
614617
mode = (enum mlxsw_reg_sbpr_mode) threshold_type;
615618
return mlxsw_sp_sb_pr_write(mlxsw_sp, pool, dir, mode, pool_size);
616619
}

0 commit comments

Comments
 (0)