Skip to content

eth: fbnic: expand hwmon sensor support

Zinc Lim linux-hwmon lkml netdev 5 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest6 patches 0 repliesNew
  2. v36 patches 0 repliesSuperseded
  3. v2 posting 2/26 patches 1 replySuperseded
Earlier versions · 2
VersionPostedPatchesRepliesStatus
v2 posting 1/26 patches1 replySuperseded
v16 patches1 replySuperseded

Changes in v4 from the cover letter

- Moved cache seeding to fbnic_mbx_init() in patch 2, so it also runs on resume and AER recovery paths rather than only on probe.
- Dropped previous patch exposing all hwmon attributes unconditionally as read-only. Thresholds the firmware does not report are now not visible in sysfs.
- Collapsed the five per-threshold alarm attributes (temp1_{min,max,crit}_alarm, in0_{min,max}_alarm) into one alarm per sensor, temp1_alarm and in0_alarm. Firmware reports which range a sensor is in rather than per-limit flags, so a single attribute matches what the hardware reports.
- That alarm now comes from the reported range rather than from a driver-side comparison of a live reading against the thresholds.
- Split the alarm work into two: patch 4 parses and caches the range, from both the unsolicited event and the sensor read response, and patch 5 exposes the attributes and notifies on each crossing. The previous "firmware notifies hwmon on sensor threshold events" patch 6 is now folded into those.
- Added patch 6 for firmware that predates range reporting, which flags only that a limit was exceeded.

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6eth: fbnic: move sensor read logic out of fbnic_macdrivers/net/ethernet/meta/fbnic/fbnic_hwmon.c drivers/net/ethernet/meta/fbnic/fbnic_mac.c drivers/net/ethernet/meta/fbnic/fbnic_mac.h+54 -590 replies
2/6eth: fbnic: cache hwmon sensor readingsdrivers/net/ethernet/meta/fbnic/fbnic.h drivers/net/ethernet/meta/fbnic/fbnic_fw.c drivers/net/ethernet/meta/fbnic/fbnic_fw.h +1 more+42 -100 replies
3/6eth: fbnic: report temperature and voltage thresholds via hwmondrivers/net/ethernet/meta/fbnic/fbnic_fw.c drivers/net/ethernet/meta/fbnic/fbnic_fw.h drivers/net/ethernet/meta/fbnic/fbnic_hwmon.c+129 -180 replies
4/6eth: fbnic: parse the alarm range reported by firmwaredrivers/net/ethernet/meta/fbnic/fbnic.h drivers/net/ethernet/meta/fbnic/fbnic_fw.c drivers/net/ethernet/meta/fbnic/fbnic_fw.h+109 -00 replies
5/6eth: fbnic: report temperature and voltage alarms via hwmondrivers/net/ethernet/meta/fbnic/fbnic.h drivers/net/ethernet/meta/fbnic/fbnic_fw.c drivers/net/ethernet/meta/fbnic/fbnic_hwmon.c+142 -130 replies
6/6eth: fbnic: derive the alarm range on older firmwaredrivers/net/ethernet/meta/fbnic/fbnic.h drivers/net/ethernet/meta/fbnic/fbnic_fw.c drivers/net/ethernet/meta/fbnic/fbnic_hwmon.c+44 -40 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v4 yet.

Read the v4 thread

Cover letter [PATCH net-next v4 0/6] eth: fbnic: expand hwmon sensor support

The firmware capability response carries per-board sensor thresholds, and the firmware reports which range a sensor has entered whenever it crosses one of them. This series surfaces both to userspace:

- Move the sensor read logic out of fbnic_mac, closer to its only caller in the hwmon code, and drop the now-unused get_sensor op.
- Cache the temperature and voltage readings for the current jiffy so a burst of attribute reads issues a single firmware round-trip.
- Parse and expose the temperature (min/max/crit) and voltage (min/max) thresholds. Thresholds the firmware does not report are not exposed.
- Parse the range firmware reports, both in the unsolicited threshold event and in the sensor read response, and cache it per sensor.
- Expose temp1_alarm and in0_alarm from that cached range, and notify on each crossing through hwmon_notify_event().
- Derive the range from the reading carried with the event, on old firmware that predates range reporting.

Changes from v3:
- Moved cache seeding to fbnic_mbx_init() in patch 2, so it also runs on resume and AER recovery paths rather than only on probe.
- Dropped previous patch exposing all hwmon attributes unconditionally as read-only. Thresholds the firmware does not report are now not visible in sysfs.
- Collapsed the five per-threshold alarm attributes (temp1_{min,max,crit}_alarm, in0_{min,max}_alarm) into one alarm per sensor, temp1_alarm and in0_alarm. Firmware reports which range a sensor is in rather than per-limit flags, so a single attribute matches what the hardware reports.
- That alarm now comes from the reported range rather than from a driver-side comparison of a live reading against the thresholds.
- Split the alarm work into two: patch 4 parses and caches the range, from both the unsolicited event and the sensor read response, and patch 5 exposes the attributes and notifies on each crossing. The previous "firmware notifies hwmon on sensor threshold events" patch 6 is now folded into those.
- Added patch 6 for firmware that predates range reporting, which flags only that a limit was exceeded.

Changes from v2:
- Addressed Jakub's patch 3 feedback on jiffy comparison when checking cache validity.

Changes from v1:
- Addressed Jakub's patch 6 feedback on including a if (!IS_REACHABLE(CONFIG_HWMON)) return; guard.

Zinc Lim (6):
eth: fbnic: move sensor read logic out of fbnic_mac
eth: fbnic: cache hwmon sensor readings
eth: fbnic: report temperature and voltage thresholds via hwmon
eth: fbnic: parse the alarm range reported by firmware
eth: fbnic: report temperature and voltage alarms via hwmon
eth: fbnic: derive the alarm range on older firmware

 drivers/net/ethernet/meta/fbnic/fbnic.h       |  11 +
 drivers/net/ethernet/meta/fbnic/fbnic_fw.c    | 140 +++++++-
 drivers/net/ethernet/meta/fbnic/fbnic_fw.h    |  44 +++
 drivers/net/ethernet/meta/fbnic/fbnic_hwmon.c | 332 ++++++++++++++++--
 drivers/net/ethernet/meta/fbnic/fbnic_mac.c   |  55 ---
 drivers/net/ethernet/meta/fbnic/fbnic_mac.h   |   2 -
 6 files changed, 500 insertions(+), 84 deletions(-)

--
2.53.0-Meta