Article View: linux.kernel.netdev
Article #3382[PATCH net-next v4 6/6] eth: fbnic: derive the alarm range on older firmware
From: Zinc Lim
Date: Wed, 14 Oct 2026 22:22
Date: Wed, 14 Oct 2026 22:22
118 lines
12771 bytes
12771 bytes
Firmware that predates range reporting uses the threshold event to flag
that a limit was exceeded, with the attribute hardcoded to 1, rather than
reporting which range the sensor entered. The range enum reserves that
value as FBNIC_FW_TSENE_ALARM_DEPRECATED. It does not indicate which
limit was crossed, so it is not cached and the alarm classifies a fresh
reading on every sysfs read.
Such firmware re-arms the trip points around the range the reading
landed in, so every crossing interrupts, including the one back to
normal. The event carries the reading that tripped it, so derive the
range from that, against the same capability response thresholds and
boundaries firmware uses. The alarm then tracks crossings there too, and
wakes anything polling the sysfs attribute.
An event can arrive before the capability response that carries those
thresholds, since rx messages are parsed while polling for it. There is
nothing to classify against yet, so the reading would come back as the
normal range and stick there. Leave the range unknown and let the read
path derive it once the thresholds are in.
Signed-off-by: Zinc Lim <limzhineng2@gmail.com>
---
drivers/net/ethernet/meta/fbnic/fbnic.h | 1 +
drivers/net/ethernet/meta/fbnic/fbnic_fw.c | 18 +++++++++---
drivers/net/ethernet/meta/fbnic/fbnic_hwmon.c | 29 +++++++++++++++++++
3 files changed, 44 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/meta/fbnic/fbnic.h b/drivers/net/ethernet/meta/fbnic/fbnic.h
index 90e54cffe6a9..8180028b20a2 100644
--- a/drivers/net/ethernet/meta/fbnic/fbnic.h
+++ b/drivers/net/ethernet/meta/fbnic/fbnic.h
@@ -201,6 +201,7 @@ void fbnic_fw_free_mbx(struct fbnic_dev *fbd);
void fbnic_hwmon_register(struct fbnic_dev *fbd);
void fbnic_hwmon_unregister(struct fbnic_dev *fbd);
void fbnic_hwmon_notify_event(struct fbnic_dev *fbd, int id);
+void fbnic_hwmon_old_notify_event(struct fbnic_dev *fbd, int id, s32 value);
int fbnic_mac_request_irq(struct fbnic_dev *fbd);
void fbnic_mac_free_irq(struct fbnic_dev *fbd);
diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_fw.c b/drivers/net/ethernet/meta/fbnic/fbnic_fw.c
index 9485665cba46..cfec30e5cb98 100644
--- a/drivers/net/ethernet/meta/fbnic/fbnic_fw.c
+++ b/drivers/net/ethernet/meta/fbnic/fbnic_fw.c
@@ -1737,8 +1737,13 @@ static int fbnic_fw_parse_threshold_exceeded_resp(void *opaque,
dev_err(fbd->dev, "Thermal alarm %u, temperature is currently %dmC!\n",
alarm, value);
- /* Old firmware reports no range, leave the cache alone */
- if (alarm != FBNIC_FW_TSENE_ALARM_DEPRECATED) {
+ if (alarm == FBNIC_FW_TSENE_ALARM_DEPRECATED) {
+ /* Nothing to derive the range from, so do not guess */
+ if (have_temp)
+ fbnic_hwmon_old_notify_event(fbd,
+ FBNIC_SENSOR_TEMP,
+ value);
+ } else {
WRITE_ONCE(fbd->hwmon_cache.temp_alarm, alarm);
fbnic_hwmon_notify_event(fbd, FBNIC_SENSOR_TEMP);
}
@@ -1757,8 +1762,13 @@ static int fbnic_fw_parse_threshold_exceeded_resp(void *opaque,
dev_err(fbd->dev, "Voltage alarm %u, voltage is currently %dmV!\n",
alarm, value);
- /* Old firmware reports no range, leave the cache alone */
- if (alarm != FBNIC_FW_TSENE_ALARM_DEPRECATED) {
+ if (alarm == FBNIC_FW_TSENE_ALARM_DEPRECATED) {
+ /* Nothing to derive the range from, so do not guess */
+ if (have_volt)
+ fbnic_hwmon_old_notify_event(fbd,
+ FBNIC_SENSOR_VOLTAGE,
+ value);
+ } else {
WRITE_ONCE(fbd->hwmon_cache.volt_alarm, alarm);
fbnic_hwmon_notify_event(fbd, FBNIC_SENSOR_VOLTAGE);
}
diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_hwmon.c b/drivers/net/ethernet/meta/fbnic/fbnic_hwmon.c
index 310a2c52bb4d..9fa9eb843c68 100644
--- a/drivers/net/ethernet/meta/fbnic/fbnic_hwmon.c
+++ b/drivers/net/ethernet/meta/fbnic/fbnic_hwmon.c
@@ -302,6 +302,35 @@ void fbnic_hwmon_unregister(struct fbnic_dev *fbd)
hwmon_device_unregister(hwmon);
}
+void fbnic_hwmon_old_notify_event(struct fbnic_dev *fbd, int id, s32 value)
+{
+ const struct fbnic_threshold *thr;
+ u8 *cached;
+
+ switch (id) {
+ case FBNIC_SENSOR_TEMP:
+ thr = &fbd->fw_cap.temp;
+ cached = &fbd->hwmon_cache.temp_alarm;
+ break;
+ case FBNIC_SENSOR_VOLTAGE:
+ thr = &fbd->fw_cap.volt;
+ cached = &fbd->hwmon_cache.volt_alarm;
+ break;
+ default:
+ return;
+ }
+
+ /* Event arrived before the capability response containing
+ * the thresholds.
+ */
+ if (thr->min == FBNIC_SENSOR_NO_DATA ||
+ thr->max == FBNIC_SENSOR_NO_DATA)
+ return;
+
+ WRITE_ONCE(*cached, fbnic_hwmon_classify(thr, value));
+ fbnic_hwmon_notify_event(fbd, id);
+}
+
void fbnic_hwmon_notify_event(struct fbnic_dev *fbd, int id)
{
enum hwmon_sensor_types type;
--
2.53.0-Meta
Technical Details
Message-ID:
<20261014222225.2803660-7-limzhineng2@gmail.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-346467-linux-kernel-netdev=dewy.ruReferences:
<20261014222225.2803660-1-limzhineng2@gmail.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-346467-linux-kernel-netdev=dewy.ru
From: limzhineng2@gmail.com (Zinc Lim)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net-next v4 6/6] eth: fbnic: derive the alarm range on older firmware
Date: Wed, 14 Oct 2026 15:22:24 -0700
Organization: Usenet Network
Message-ID: <20261014222225.2803660-7-limzhineng2@gmail.com>
References: <20261014222225.2803660-1-limzhineng2@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
logging-data="2401103"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:irAbNKVbypKPRQRTSyERUS67IUs= sha256:lNV1uBOEllMEGrz/qvpJ7dlrVTKcXvEhiInY1ksugHk=
sha1:Bc96kfCXbOLjfSW5AkOJpGVKd/I= sha256:vynrf8TC7qsutL/xkN2MhgzoRjakS9wMDk/q4tBIFqI=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
by mail.dewy.ru (Postfix) with ESMTP id 27CD91101F4; Thu, 15 Oct 2026 01:27:49 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -0.748
X-Spam-Status: No, score=-0.748 tagged_above=-9999 required=6.31
tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
DKIM_VALID_AU=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001,
FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25,
MAILING_LIST_MULTI=-1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001]
autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
header.d=gmail.com
X-Received: from mail.dewy.ru ([127.0.0.1])
by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id mMX_9waw6efG;
Thu, 15 Oct 2026 01:27:46 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-346467-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4])
by mail.dewy.ru (Postfix) with ESMTPS id 19D981101E6; Thu, 15 Oct 2026 01:27:38 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1])
by sin.lore.kernel.org (Postfix) with ESMTP id 0F3043222A; Wed, 14 Oct 2026 22:23:28 +0000 (UTC)
X-Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id B22FF4C1505;
Wed, 14 Oct 2026 22:22:42 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="eof+hDF4"
X-Received: from mail-dl1-f41.google.com (mail-dl1-f41.google.com [74.125.82.41])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 068B84C14F3
for <netdev@vger.kernel.org>; Wed, 14 Oct 2026 22:22:39 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.41
X-ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1792016562; cv=none; b=PUBC9it4rEWaiTey0kHfVS0i/80Zf9UTipigPi3QoqTlbDVtO0CAyqNmCQvMzV4OaWFK3hXqNy74CUtq56b9qSCfmDx3O4g2eO3hj//K7dHj4PFN/J6gtRvmR9fGpbku89gNoXX7RdlIfnlWtrZ2AnhaW/UCvrL7lYAfXgPMoSY=
X-ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1792016562; c=relaxed/simple;
bh=yHLMDM/48dcDq/Dd2thjDfocEkPnBBmEY6ZjqusswBU=;
h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version; b=qEAh7gx//BlxDdVGvYrvMRYPm+xrwXWbcc92JxcPPpWwVGEiVd6Q908vsNT1r1IrpwnYO21SjwwwrS1kIVUuWF1Mlp6wR69gB2ESqw6WaXAv4bFB3xODbveHMWo6NlA3GFFLntPvEoqfOmSDF0xdlOawLtrpGeLvHrpmJMkbpE0=
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=eof+hDF4; arc=none smtp.client-ip=74.125.82.41
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-dl1-f41.google.com with SMTP id a92af1059eb24-17bc533fda3so1580122c88.1
for <netdev@vger.kernel.org>; Wed, 14 Oct 2026 15:22:39 -0700 (PDT)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20251104; t=1792016559; x=1792621359; darn=vger.kernel.org;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:from:to:cc:subject:date
:message-id:reply-to:content-type;
bh=W2+TdeI/FqKLxgmSZUeosOnsLC255UKO2RqcJWHBdyk=;
b=eof+hDF4EuNCH+ObZmq77+1Iw9ZNd/zQ+I3oz6w3OVOO1DUI+y+ZOOxjv8wXlC+7Ru
7d3Ynnzo8jTHbtV7D0EAH5HrIleBWcLLS5+2qDSEY/Nb4D0I/7bN7yjF+6VhGE83rFpt
NjiFX9yZPAMXczZ8VTKUM5AyW5B30wl1yOIVgYaFyTc+uIwBvEgj7NPrAItdfLSOQh+A
xOwu0srD9o12u8INwxvKpnQapQ4BZl3mzMaubnjr5Rou+ip9j2vrnp936EXGoj0TLwq+
cah0brhJ4OQYCIxo/fgmF614pIRk/mGnX4O6cfzRB+5GJ+QircpcngF2EPx5JU5nxjWy
5i7g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1792016559; x=1792621359;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from
:to:cc:subject:date:message-id:reply-to:content-type;
bh=W2+TdeI/FqKLxgmSZUeosOnsLC255UKO2RqcJWHBdyk=;
b=V4scTYeDsK3mZMeeGMcP7qC5D/XLOvqIS0rHVvH1aHw4gFmGrsZfLuV0X6wKdh3AB6
MLHARwrN1qv1PXTCtTe07e5zxm+B7sxMVjjdeEnm2HdpoNz+03ond6ttNKRCtN1uqYVx
yAMt2yhUVWxaEi/2ht+XZu4Lo7tyaKxZD+E6B8lWSsJcGanbKEkEWn/XQcOwj8NSIeLO
ReYXxVZ3PY1OA3HSZ6ToQjkIG3ix94PrlfhZEF2ioTskqPu2yxg6UVwKeYZ+R6kXZY3a
wHladgAOZ0neZq5bLn7ru/IgENV5DSt11HzUYBiYzy3tpRk7GbNIBkeGZrgt4RrxVxXp
tt6Q==
X-Forwarded-Encrypted: i=1; AKwUvBwmzkdwFtyf2ipILwwRG2wBzMw3TXjBmxRl94LBompfR8zxbFJ9pa30noI/YPWOI+vX8XdnosI=@vger.kernel.org
X-Gm-Message-State: AFq9FYKvPp1APERqYcI1hTpg2Bngtgn549f4XP1LZq4XazFNN/edSaFL
+ddOailkYwWzHr1I2Ya4TdKU3NatRvaq/EE1wsZguEcj90GdJvDZtaHB
X-Gm-Gg: AYBFou3UuGPmCt7KgwoRLEOqyOrzvDV033OmRoWxLhhvJ6c4+dcZYh+q0HCAloHcuwN
MNPvZkdy0ur2hhWrgUFxucFr9Y44BY+Gcv/nrFkVLjueXemlOFdBunllBSujtM8nJLn4Rm1NNma
ECn2jUT0ox9GCncNABIXnAV9VKWAJFw0Fjs1O5i6EnQJU2iBdTQji1euWokYGKZOY9s5OO9+Hxb
aOsZUeQs6o7V7UyrEBUPU247Ea9vwg+2hmYu9xGgrbEz+y91oIQjKcPH13uLFz6+MyA2mEEeep5
6ipS2uvnwdBzHdRsiRUOTSsFS8qpQQztCvZKA614GYl/TI/mBjsAeKRmZP4P8O6tdMG/t6alcUg
WwvusDKh52JSl9qH5u48a9qclbnEC/eXthllnGXhdDWVsA62J+T3pA38K+OA8Z2i/fvpKZ0c9/W
1H4rDWF8J0XHvP9YR99J3LkuESZY4GS+OgyshOYcx/RUHaBy9lef2a8J40/r+aVrxRL6oe221j7
PvfAQ==
X-Received: by 2002:a05:7022:eb53:20b0:170:64b:b388 with SMTP id a92af1059eb24-170064bb41amr18274573c88.46.1792016558840;
Wed, 14 Oct 2026 15:22:38 -0700 (PDT)
X-Received: from localhost ([2620:10d:c090:500::5:7561])
by smtp.gmail.com with ESMTPSA id a92af1059eb24-1761ed641ddsm24225058c88.1.2026.10.14.15.22.37
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Wed, 14 Oct 2026 15:22:38 -0700 (PDT)
X-Cc: kernel-team@meta.com,
netdev@vger.kernel.org,
linux-kernel@vger.kernel.org,
linux-hwmon@vger.kernel.org,
zinclim@meta.com,
limzhineng2@gmail.com
X-Mailer: git-send-email 2.53.0
X-In-Reply-To: <20261014222225.2803660-1-limzhineng2@gmail.com>
X-Precedence: bulk
X-Mailing-List: netdev@vger.kernel.org
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>