Skip to content

Commit 3dcfe17

Browse files
mellanoxbmcdavem330
authored andcommitted
mlxsw: core: Set different thermal polling time based on bus frequency capability
Add low frequency bus capability in order to allow core functionality separation based on bus type. Driver could run over PCIe, which is considered as high frequency bus or I2C, which is considered as low frequency bus. In the last case time setting, for example, for thermal polling interval, should be increased. Use different thermal monitoring based on bus type. For I2C bus time is set to 20 seconds, while for PCIe 1 second polling interval is used. Signed-off-by: Vadim Pasternak <vadimp@mellanox.com> Reviewed-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: Ido Schimmel <idosch@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent d93c19a commit 3dcfe17

3 files changed

Lines changed: 10 additions & 2 deletions

File tree

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,7 @@ struct mlxsw_bus_info {
344344
struct mlxsw_fw_rev fw_rev;
345345
u8 vsd[MLXSW_CMD_BOARDINFO_VSD_LEN];
346346
u8 psid[MLXSW_CMD_BOARDINFO_PSID_LEN];
347+
u8 low_frequency;
347348
};
348349

349350
struct mlxsw_hwmon;

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "core.h"
1414

1515
#define MLXSW_THERMAL_POLL_INT 1000 /* ms */
16+
#define MLXSW_THERMAL_SLOW_POLL_INT 20000 /* ms */
1617
#define MLXSW_THERMAL_MAX_TEMP 110000 /* 110C */
1718
#define MLXSW_THERMAL_MAX_STATE 10
1819
#define MLXSW_THERMAL_MAX_DUTY 255
@@ -76,6 +77,7 @@ struct mlxsw_thermal {
7677
struct mlxsw_core *core;
7778
const struct mlxsw_bus_info *bus_info;
7879
struct thermal_zone_device *tzdev;
80+
int polling_delay;
7981
struct thermal_cooling_device *cdevs[MLXSW_MFCR_PWMS_MAX];
8082
u8 cooling_levels[MLXSW_THERMAL_MAX_STATE + 1];
8183
struct mlxsw_thermal_trip trips[MLXSW_THERMAL_NUM_TRIPS];
@@ -172,7 +174,7 @@ static int mlxsw_thermal_set_mode(struct thermal_zone_device *tzdev,
172174
mutex_lock(&tzdev->lock);
173175

174176
if (mode == THERMAL_DEVICE_ENABLED)
175-
tzdev->polling_delay = MLXSW_THERMAL_POLL_INT;
177+
tzdev->polling_delay = thermal->polling_delay;
176178
else
177179
tzdev->polling_delay = 0;
178180

@@ -423,13 +425,17 @@ int mlxsw_thermal_init(struct mlxsw_core *core,
423425
thermal->cooling_levels[i] = max(MLXSW_THERMAL_SPEED_MIN_LEVEL,
424426
i);
425427

428+
thermal->polling_delay = bus_info->low_frequency ?
429+
MLXSW_THERMAL_SLOW_POLL_INT :
430+
MLXSW_THERMAL_POLL_INT;
431+
426432
thermal->tzdev = thermal_zone_device_register("mlxsw",
427433
MLXSW_THERMAL_NUM_TRIPS,
428434
MLXSW_THERMAL_TRIP_MASK,
429435
thermal,
430436
&mlxsw_thermal_ops,
431437
NULL, 0,
432-
MLXSW_THERMAL_POLL_INT);
438+
thermal->polling_delay);
433439
if (IS_ERR(thermal->tzdev)) {
434440
err = PTR_ERR(thermal->tzdev);
435441
dev_err(dev, "Failed to register thermal zone\n");

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,7 @@ static int mlxsw_i2c_probe(struct i2c_client *client,
503503
mlxsw_i2c->bus_info.device_kind = id->name;
504504
mlxsw_i2c->bus_info.device_name = client->name;
505505
mlxsw_i2c->bus_info.dev = &client->dev;
506+
mlxsw_i2c->bus_info.low_frequency = true;
506507
mlxsw_i2c->dev = &client->dev;
507508

508509
err = mlxsw_core_bus_device_register(&mlxsw_i2c->bus_info,

0 commit comments

Comments
 (0)