linux-hwmon.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: limzhineng2@gmail.com
Cc: alexanderduyck@fb.com, kuba@kernel.org, andrew+netdev@lunn.ch,
	davem@davemloft.net, edumazet@google.com, pabeni@redhat.com,
	linux@roeck-us.net, horms@kernel.org, mohsin.bashr@gmail.com,
	kernel-team@meta.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org,
	zinclim@meta.com
Subject: Re: [PATCH net-next v3 3/6] eth: fbnic: cache hwmon sensor readings
Date: Fri, 11 Sep 2026 04:58:35 +0000	[thread overview]
Message-ID: <178910271541.219967.12326431015095958990@kernel.org> (raw)
In-Reply-To: <20260908225737.3034403-4-limzhineng2@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider:

Critical: 0 · High: 0 · Medium: 0 · Low: 1

- [Low] Forward-referencing comment on the newly added
  FBNIC_SENSOR_NO_DATA macro in…

--

eth: fbnic: cache hwmon sensor readings

The patch caches the last TSENE temperature and voltage reading in
struct fbnic_dev and serves hwmon reads from that cache for the
remainder of the current jiffy, so a single firmware round-trip can
satisfy a batch of attribute reads. The cache is seeded at registration
with a new FBNIC_SENSOR_NO_DATA sentinel so the first read always
refreshes.

> diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_fw.h b/drivers/net/ethernet/meta/fbnic/fbnic_fw.h
> index d84723e4cfa3..42a5f83ddb45 100644
> --- a/drivers/net/ethernet/meta/fbnic/fbnic_fw.h
> +++ b/drivers/net/ethernet/meta/fbnic/fbnic_fw.h

[ ... ]

> @@ -44,6 +45,12 @@ struct fbnic_fw_ver {
>  	char commit[FBNIC_FW_CAP_RESP_COMMIT_MAX_SIZE];
>  };
>  
> +/* Sentinel for a sensor value the driver does not have: a threshold the
> + * firmware never populated (older firmware) or a cache entry not yet
> + * refreshed.
> + */
> +#define FBNIC_SENSOR_NO_DATA			S32_MIN
> +

[Severity: Low]

This isn't a bug, but does the comment describe more than this patch
implements?

At this commit the only users of FBNIC_SENSOR_NO_DATA are the cache seed
in fbnic_hwmon_register():

	fbd->hwmon_cache.temp_mdeg = FBNIC_SENSOR_NO_DATA;
	fbd->hwmon_cache.volt_mv = FBNIC_SENSOR_NO_DATA;

and the cache-validity test in fbnic_hwmon_sensor_read():

	if (*cached != FBNIC_SENSOR_NO_DATA && cache->last_read == jiffies) {

There is no threshold concept yet: struct fbnic_fw_cap has no temperature
or voltage threshold fields, and fbnic_hwmon_info[] registers only
temp1_input and in0_input.

The "a threshold the firmware never populated (older firmware)" wording
only becomes accurate later in the series, once the capability parser
starts using fbnic_tlv_attr_get_signed(..., FBNIC_SENSOR_NO_DATA) and
fbnic_hwmon_read_threshold()/fbnic_hwmon_read_alarm() compare against it.

Would it be clearer to restrict the comment to the cache semantics here
and extend it in the patch that adds the threshold handling?

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260908225737.3034403-1-limzhineng2%40gmail.com

  parent reply	other threads:[~2026-09-11  4:58 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-08 22:57 [PATCH net-next v3 0/6] eth: fbnic: expand hwmon sensor support Zinc Lim
2026-09-08 22:57 ` [PATCH net-next v3 1/6] eth: fbnic: move sensor read logic out of fbnic_mac Zinc Lim
2026-09-09 22:57   ` sashiko-bot
2026-09-08 22:57 ` [PATCH net-next v3 2/6] eth: fbnic: expose all hwmon attributes unconditionally as read-only Zinc Lim
2026-09-09 22:57   ` sashiko-bot
2026-09-11  4:58   ` netdev-bot+sashiko
2026-09-08 22:57 ` [PATCH net-next v3 3/6] eth: fbnic: cache hwmon sensor readings Zinc Lim
2026-09-09 22:57   ` sashiko-bot
2026-09-11  4:58   ` netdev-bot+sashiko [this message]
2026-09-08 22:57 ` [PATCH net-next v3 4/6] eth: fbnic: report temperature and voltage thresholds via hwmon Zinc Lim
2026-09-09 22:57   ` sashiko-bot
2026-09-11  4:58   ` netdev-bot+sashiko
2026-09-08 22:57 ` [PATCH net-next v3 5/6] eth: fbnic: report temperature and voltage alarms " Zinc Lim
2026-09-09 22:57   ` sashiko-bot
2026-09-11  4:58   ` netdev-bot+sashiko
2026-09-08 22:57 ` [PATCH net-next v3 6/6] eth: fbnic: firmware notifies hwmon on sensor threshold events Zinc Lim
2026-09-09 22:58   ` sashiko-bot
2026-09-11  4:58   ` netdev-bot+sashiko

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=178910271541.219967.12326431015095958990@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=alexanderduyck@fb.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kernel-team@meta.com \
    --cc=kuba@kernel.org \
    --cc=limzhineng2@gmail.com \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=mohsin.bashr@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=zinclim@meta.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;
as well as URLs for NNTP newsgroup(s).