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 06/12] mlxsw: core: Modify thermal zone definition
Date: Wed, 13 Feb 2019 11:28:50 +0000 [thread overview]
Message-ID: <20190213112814.32334-7-idosch@mellanox.com> (raw)
In-Reply-To: <20190213112814.32334-1-idosch@mellanox.com>
From: Vadim Pasternak <vadimp@mellanox.com>
Modify thermal zone trip points setting for better alignment with system
thermal requirement.
Add hysteresis thresholds for thermal trips in order to avoid throttling
around thermal trip point. If hysteresis temperature is not considered,
PWM can have side effect of flip up/down on thermal trip point boundary.
Signed-off-by: Vadim Pasternak <vadimp@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
---
.../ethernet/mellanox/mlxsw/core_thermal.c | 37 ++++++++++++++-----
1 file changed, 28 insertions(+), 9 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c b/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c
index b1f9b459766c..dbf9a845084a 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c
@@ -15,6 +15,7 @@
#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_HYSTERESIS_TEMP 5000 /* 5C */
#define MLXSW_THERMAL_MAX_STATE 10
#define MLXSW_THERMAL_MAX_DUTY 255
/* Minimum and maximum fan allowed speed in percent: from 20% to 100%. Values
@@ -30,6 +31,7 @@
struct mlxsw_thermal_trip {
int type;
int temp;
+ int hyst;
int min_state;
int max_state;
};
@@ -38,25 +40,22 @@ static const struct mlxsw_thermal_trip default_thermal_trips[] = {
{ /* In range - 0-40% PWM */
.type = THERMAL_TRIP_ACTIVE,
.temp = 75000,
+ .hyst = MLXSW_THERMAL_HYSTERESIS_TEMP,
.min_state = 0,
.max_state = (4 * MLXSW_THERMAL_MAX_STATE) / 10,
},
- { /* High - 40-100% PWM */
+ {
+ /* In range - 40-100% PWM */
.type = THERMAL_TRIP_ACTIVE,
.temp = 80000,
+ .hyst = MLXSW_THERMAL_HYSTERESIS_TEMP,
.min_state = (4 * MLXSW_THERMAL_MAX_STATE) / 10,
.max_state = MLXSW_THERMAL_MAX_STATE,
},
- {
- /* Very high - 100% PWM */
- .type = THERMAL_TRIP_ACTIVE,
- .temp = 85000,
- .min_state = MLXSW_THERMAL_MAX_STATE,
- .max_state = MLXSW_THERMAL_MAX_STATE,
- },
{ /* Warning */
.type = THERMAL_TRIP_HOT,
- .temp = 105000,
+ .temp = 85000,
+ .hyst = MLXSW_THERMAL_HYSTERESIS_TEMP,
.min_state = MLXSW_THERMAL_MAX_STATE,
.max_state = MLXSW_THERMAL_MAX_STATE,
},
@@ -246,6 +245,24 @@ static int mlxsw_thermal_set_trip_temp(struct thermal_zone_device *tzdev,
return 0;
}
+static int mlxsw_thermal_get_trip_hyst(struct thermal_zone_device *tzdev,
+ int trip, int *p_hyst)
+{
+ struct mlxsw_thermal *thermal = tzdev->devdata;
+
+ *p_hyst = thermal->trips[trip].hyst;
+ return 0;
+}
+
+static int mlxsw_thermal_set_trip_hyst(struct thermal_zone_device *tzdev,
+ int trip, int hyst)
+{
+ struct mlxsw_thermal *thermal = tzdev->devdata;
+
+ thermal->trips[trip].hyst = hyst;
+ return 0;
+}
+
static struct thermal_zone_device_ops mlxsw_thermal_ops = {
.bind = mlxsw_thermal_bind,
.unbind = mlxsw_thermal_unbind,
@@ -255,6 +272,8 @@ static struct thermal_zone_device_ops mlxsw_thermal_ops = {
.get_trip_type = mlxsw_thermal_get_trip_type,
.get_trip_temp = mlxsw_thermal_get_trip_temp,
.set_trip_temp = mlxsw_thermal_set_trip_temp,
+ .get_trip_hyst = mlxsw_thermal_get_trip_hyst,
+ .set_trip_hyst = mlxsw_thermal_set_trip_hyst,
};
static int mlxsw_thermal_get_max_state(struct thermal_cooling_device *cdev,
--
2.20.1
next prev parent reply other threads:[~2019-02-13 11:29 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 ` [PATCH net-next 05/12] mlxsw: core: Set different thermal polling time based on bus frequency capability Ido Schimmel
2019-02-13 11:28 ` Ido Schimmel [this message]
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-7-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