Skip to content

Commit 6d94449

Browse files
vadimp-nvidiadavem330
authored andcommitted
mlxsw: core_thermal: Add line card id prefix to line card thermal zone name
Add prefix "lc#n" to thermal zones associated with the thermal objects found on line cards. For example thermal zone for module #9 located at line card #7 will have type: mlxsw-lc7-module9. And thermal zone for gearbox #3 located at line card #5 will have type: mlxsw-lc5-gearbox3. Signed-off-by: Vadim Pasternak <[email protected]> Reviewed-by: Jiri Pirko <[email protected]> Signed-off-by: Ido Schimmel <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent ef0df4f commit 6d94449

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

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

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -685,8 +685,12 @@ mlxsw_thermal_module_tz_init(struct mlxsw_thermal_module *module_tz)
685685
char tz_name[MLXSW_THERMAL_ZONE_MAX_NAME];
686686
int err;
687687

688-
snprintf(tz_name, sizeof(tz_name), "mlxsw-module%d",
689-
module_tz->module + 1);
688+
if (module_tz->slot_index)
689+
snprintf(tz_name, sizeof(tz_name), "mlxsw-lc%d-module%d",
690+
module_tz->slot_index, module_tz->module + 1);
691+
else
692+
snprintf(tz_name, sizeof(tz_name), "mlxsw-module%d",
693+
module_tz->module + 1);
690694
module_tz->tzdev = thermal_zone_device_register(tz_name,
691695
MLXSW_THERMAL_NUM_TRIPS,
692696
MLXSW_THERMAL_TRIP_MASK,
@@ -820,8 +824,12 @@ mlxsw_thermal_gearbox_tz_init(struct mlxsw_thermal_module *gearbox_tz)
820824
char tz_name[MLXSW_THERMAL_ZONE_MAX_NAME];
821825
int ret;
822826

823-
snprintf(tz_name, sizeof(tz_name), "mlxsw-gearbox%d",
824-
gearbox_tz->module + 1);
827+
if (gearbox_tz->slot_index)
828+
snprintf(tz_name, sizeof(tz_name), "mlxsw-lc%d-gearbox%d",
829+
gearbox_tz->slot_index, gearbox_tz->module + 1);
830+
else
831+
snprintf(tz_name, sizeof(tz_name), "mlxsw-gearbox%d",
832+
gearbox_tz->module + 1);
825833
gearbox_tz->tzdev = thermal_zone_device_register(tz_name,
826834
MLXSW_THERMAL_NUM_TRIPS,
827835
MLXSW_THERMAL_TRIP_MASK,

0 commit comments

Comments
 (0)