Skip to content

Commit fd78ec3

Browse files
Kalesh APdavem330
authored andcommitted
bnxt_en: Fix invoking hwmon_notify_event
FW sends the async event to the driver when the device temperature goes above or below the threshold values. Only notify hwmon if the temperature is increasing to the next alert level, not when it is decreasing. Cc: Guenter Roeck <[email protected]> Reviewed-by: Kashyap Desai <[email protected]> Reviewed-by: Somnath Kotur <[email protected]> Signed-off-by: Kalesh AP <[email protected]> Signed-off-by: Michael Chan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 5586209 commit fd78ec3

File tree

1 file changed

+11
-5
lines changed
  • drivers/net/ethernet/broadcom/bnxt

1 file changed

+11
-5
lines changed

drivers/net/ethernet/broadcom/bnxt/bnxt.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2166,6 +2166,7 @@ static bool bnxt_event_error_report(struct bnxt *bp, u32 data1, u32 data2)
21662166
case ASYNC_EVENT_CMPL_ERROR_REPORT_BASE_EVENT_DATA1_ERROR_TYPE_THERMAL_THRESHOLD: {
21672167
u32 type = EVENT_DATA1_THERMAL_THRESHOLD_TYPE(data1);
21682168
char *threshold_type;
2169+
bool notify = false;
21692170
char *dir_str;
21702171

21712172
switch (type) {
@@ -2185,18 +2186,23 @@ static bool bnxt_event_error_report(struct bnxt *bp, u32 data1, u32 data2)
21852186
netdev_err(bp->dev, "Unknown Thermal threshold type event\n");
21862187
return false;
21872188
}
2188-
if (EVENT_DATA1_THERMAL_THRESHOLD_DIR_INCREASING(data1))
2189+
if (EVENT_DATA1_THERMAL_THRESHOLD_DIR_INCREASING(data1)) {
21892190
dir_str = "above";
2190-
else
2191+
notify = true;
2192+
} else {
21912193
dir_str = "below";
2194+
}
21922195
netdev_warn(bp->dev, "Chip temperature has gone %s the %s thermal threshold!\n",
21932196
dir_str, threshold_type);
21942197
netdev_warn(bp->dev, "Temperature (In Celsius), Current: %lu, threshold: %lu\n",
21952198
BNXT_EVENT_THERMAL_CURRENT_TEMP(data2),
21962199
BNXT_EVENT_THERMAL_THRESHOLD_TEMP(data2));
2197-
bp->thermal_threshold_type = type;
2198-
set_bit(BNXT_THERMAL_THRESHOLD_SP_EVENT, &bp->sp_event);
2199-
return true;
2200+
if (notify) {
2201+
bp->thermal_threshold_type = type;
2202+
set_bit(BNXT_THERMAL_THRESHOLD_SP_EVENT, &bp->sp_event);
2203+
return true;
2204+
}
2205+
return false;
22002206
}
22012207
default:
22022208
netdev_err(bp->dev, "FW reported unknown error type %u\n",

0 commit comments

Comments
 (0)