From: Ido Schimmel <idosch@mellanox.com>
To: "netdev@vger.kernel.org" <netdev@vger.kernel.org>
Cc: "davem@davemloft.net" <davem@davemloft.net>,
Jiri Pirko <jiri@mellanox.com>, "andrew@lunn.ch" <andrew@lunn.ch>,
mlxsw <mlxsw@mellanox.com>, Vadim Pasternak <vadimp@mellanox.com>,
Ido Schimmel <idosch@mellanox.com>
Subject: [PATCH net-next 05/12] mlxsw: core: Set different thermal polling time based on bus frequency capability
Date: Wed, 13 Feb 2019 11:28:48 +0000 [thread overview]
Message-ID: <20190213112814.32334-6-idosch@mellanox.com> (raw)
In-Reply-To: <20190213112814.32334-1-idosch@mellanox.com>
From: Vadim Pasternak <vadimp@mellanox.com>
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>
---
drivers/net/ethernet/mellanox/mlxsw/core.h | 1 +
drivers/net/ethernet/mellanox/mlxsw/core_thermal.c | 10 ++++++++--
drivers/net/ethernet/mellanox/mlxsw/i2c.c | 1 +
3 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlxsw/core.h b/drivers/net/ethernet/mellanox/mlxsw/core.h
index c8e16a305969..cd0c6aa0dff9 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/core.h
+++ b/drivers/net/ethernet/mellanox/mlxsw/core.h
@@ -344,6 +344,7 @@ struct mlxsw_bus_info {
struct mlxsw_fw_rev fw_rev;
u8 vsd[MLXSW_CMD_BOARDINFO_VSD_LEN];
u8 psid[MLXSW_CMD_BOARDINFO_PSID_LEN];
+ u8 low_frequency;
};
struct mlxsw_hwmon;
diff --git a/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c b/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c
index 61f897b40f82..b1f9b459766c 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c
@@ -13,6 +13,7 @@
#include "core.h"
#define MLXSW_THERMAL_POLL_INT 1000 /* ms */
+#define MLXSW_THERMAL_SLOW_POLL_INT 20000 /* ms */
#define MLXSW_THERMAL_MAX_TEMP 110000 /* 110C */
#define MLXSW_THERMAL_MAX_STATE 10
#define MLXSW_THERMAL_MAX_DUTY 255
@@ -76,6 +77,7 @@ struct mlxsw_thermal {
struct mlxsw_core *core;
const struct mlxsw_bus_info *bus_info;
struct thermal_zone_device *tzdev;
+ int polling_delay;
struct thermal_cooling_device *cdevs[MLXSW_MFCR_PWMS_MAX];
u8 cooling_levels[MLXSW_THERMAL_MAX_STATE + 1];
struct mlxsw_thermal_trip trips[MLXSW_THERMAL_NUM_TRIPS];
@@ -172,7 +174,7 @@ static int mlxsw_thermal_set_mode(struct thermal_zone_device *tzdev,
mutex_lock(&tzdev->lock);
if (mode == THERMAL_DEVICE_ENABLED)
- tzdev->polling_delay = MLXSW_THERMAL_POLL_INT;
+ tzdev->polling_delay = thermal->polling_delay;
else
tzdev->polling_delay = 0;
@@ -423,13 +425,17 @@ int mlxsw_thermal_init(struct mlxsw_core *core,
thermal->cooling_levels[i] = max(MLXSW_THERMAL_SPEED_MIN_LEVEL,
i);
+ thermal->polling_delay = bus_info->low_frequency ?
+ MLXSW_THERMAL_SLOW_POLL_INT :
+ MLXSW_THERMAL_POLL_INT;
+
thermal->tzdev = thermal_zone_device_register("mlxsw",
MLXSW_THERMAL_NUM_TRIPS,
MLXSW_THERMAL_TRIP_MASK,
thermal,
&mlxsw_thermal_ops,
NULL, 0,
- MLXSW_THERMAL_POLL_INT);
+ thermal->polling_delay);
if (IS_ERR(thermal->tzdev)) {
err = PTR_ERR(thermal->tzdev);
dev_err(dev, "Failed to register thermal zone\n");
diff --git a/drivers/net/ethernet/mellanox/mlxsw/i2c.c b/drivers/net/ethernet/mellanox/mlxsw/i2c.c
index 798bd5aca384..a87ca6b6580d 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/i2c.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/i2c.c
@@ -503,6 +503,7 @@ static int mlxsw_i2c_probe(struct i2c_client *client,
mlxsw_i2c->bus_info.device_kind = id->name;
mlxsw_i2c->bus_info.device_name = client->name;
mlxsw_i2c->bus_info.dev = &client->dev;
+ mlxsw_i2c->bus_info.low_frequency = true;
mlxsw_i2c->dev = &client->dev;
err = mlxsw_core_bus_device_register(&mlxsw_i2c->bus_info,
--
2.20.1
next prev parent reply other threads:[~2019-02-13 11:28 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-13 11:28 [PATCH net-next 00/12] mlxsw: hwmon and thermal extensions Ido Schimmel
2019-02-13 11:28 ` [PATCH net-next 01/12] mlxsw: spectrum: Move QSFP EEPROM definitions to common location Ido Schimmel
2019-02-13 11:28 ` [PATCH net-next 02/12] mlxsw: reg: Add Management Temperature Bulk Register Ido Schimmel
2019-02-13 11:28 ` [PATCH net-next 03/12] mlxsw: reg: Add Fan Out of Range Event Register Ido Schimmel
2019-02-13 11:28 ` [PATCH net-next 04/12] mlxsw: core: Add API for QSFP module temperature thresholds reading Ido Schimmel
2019-02-13 11:28 ` Ido Schimmel [this message]
2019-02-13 11:28 ` [PATCH net-next 06/12] mlxsw: core: Modify thermal zone definition Ido Schimmel
2019-02-13 11:28 ` [PATCH net-next 07/12] mlxsw: core: Replace thermal temperature trips with defines Ido Schimmel
2019-02-13 11:28 ` [PATCH net-next 08/12] mlxsw: core: Rename cooling device Ido Schimmel
2019-02-13 11:28 ` [PATCH net-next 09/12] mlxsw: core: Extend hwmon interface with fan fault attribute Ido Schimmel
2019-02-13 13:53 ` Andrew Lunn
2019-02-13 15:02 ` Guenter Roeck
2019-02-14 7:06 ` Vadim Pasternak
2019-02-14 14:29 ` Guenter Roeck
2019-02-13 11:28 ` [PATCH net-next 10/12] mlxsw: core: Extend hwmon interface with QSFP module temperature attributes Ido Schimmel
2019-02-13 11:28 ` [PATCH net-next 11/12] mlxsw: core: Add QSFP module temperature label attribute to hwmon Ido Schimmel
2019-02-13 11:28 ` [PATCH net-next 12/12] mlxsw: core: Allow thermal zone binding to an external cooling device Ido Schimmel
2019-02-14 6:33 ` [PATCH net-next 00/12] mlxsw: hwmon and thermal extensions David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190213112814.32334-6-idosch@mellanox.com \
--to=idosch@mellanox.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=jiri@mellanox.com \
--cc=mlxsw@mellanox.com \
--cc=netdev@vger.kernel.org \
--cc=vadimp@mellanox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox