public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: mohsin.bashr@gmail.com
Cc: Jakub Kicinski <kuba@kernel.org>,
	netdev@vger.kernel.org, jacob.e.keller@intel.com,
	davem@davemloft.net, sanman.p211993@gmail.com, pabeni@redhat.com,
	andrew+netdev@lunn.ch, horms@kernel.org, alexanderduyck@fb.com,
	kernel-team@meta.com, edumazet@google.com, lee@trager.us
Subject: Re: [net-next,V0.5,4/5] eth: fbnic: Remove retry support
Date: Tue, 13 Jan 2026 19:38:14 -0800	[thread overview]
Message-ID: <20260114033814.1033266-1-kuba@kernel.org> (raw)
In-Reply-To: <20260112211925.2551576-5-mohsin.bashr@gmail.com>

This is an AI-generated review of your patch. The human sending this
email has considered the AI review valid, or at least pausible.

For local reproduction steps see https://netdev-ai.bots.linux.dev/ai-local.html
---
    eth: fbnic: Update RX mbox timeout value

This commit unifies timeout values for firmware mailbox completion waits
by introducing a wrapper function fbnic_mbx_wait_for_cmpl(). However,
there appear to be two regressions where the condition logic was
accidentally inverted.

> diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_fw.h b/drivers/net/ethernet/meta/fbnic/fbnic_fw.h
> index 1ecd777aaada..6b3fb163d381 100644
> --- a/drivers/net/ethernet/meta/fbnic/fbnic_fw.h
> +++ b/drivers/net/ethernet/meta/fbnic/fbnic_fw.h

[ ... ]

> +static inline bool fbnic_mbx_wait_for_cmpl(struct fbnic_fw_completion *cmpl)
> +{
> +	return wait_for_completion_timeout(&cmpl->done,
> +					   FBNIC_MBX_RX_TO_SEC * HZ);
> +}

The wrapper returns the same value as wait_for_completion_timeout():
non-zero on success, zero on timeout.

> diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_devlink.c b/drivers/net/ethernet/meta/fbnic/fbnic_devlink.c
> index b62b1d5b1453..193f554717b3 100644
> --- a/drivers/net/ethernet/meta/fbnic/fbnic_devlink.c
> +++ b/drivers/net/ethernet/meta/fbnic/fbnic_devlink.c
> @@ -178,7 +178,7 @@ fbnic_flash_start(struct fbnic_dev *fbd, struct pldmfw_component *component)
>  		goto cmpl_free;
>
>  	/* Wait for firmware to ack firmware upgrade start */
> -	if (wait_for_completion_timeout(&cmpl->done, 10 * HZ))
> +	if (!fbnic_mbx_wait_for_cmpl(cmpl))
>  		err = cmpl->result;
>  	else
>  		err = -ETIMEDOUT;

Was the negation here intentional? The original code sets err to
cmpl->result when the completion succeeds (wait returns non-zero). With
the added negation, it now sets err to cmpl->result when the wait times
out (returns zero), and sets err to -ETIMEDOUT when the wait succeeds.
This appears to invert the success and timeout handling.

[ ... ]

> @@ -447,7 +447,7 @@ static int fbnic_fw_reporter_dump(struct devlink_health_reporter *reporter,
>  				goto cmpl_cleanup;
>  		}
>
> -		if (wait_for_completion_timeout(&fw_cmpl->done, 2 * HZ)) {
> +		if (!fbnic_mbx_wait_for_cmpl(fw_cmpl)) {
>  			reinit_completion(&fw_cmpl->done);
>  		} else {
>  			NL_SET_ERR_MSG_FMT_MOD(extack,
>  					       "Timed out waiting on core dump (%d/%d)",

Similarly here, the original code calls reinit_completion() when the wait
succeeds (to prepare for the next iteration), and reports "Timed out" in
the else branch when it fails. With the negation added, reinit_completion()
is now called on timeout, and the "Timed out" error message is reported
when the wait actually succeeds. Should the negation be removed from this
call site as well?
-- 
pw-bot: cr

  reply	other threads:[~2026-01-14  3:38 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-12 21:19 [PATCH net-next V0.5 0/5] eth: fbnic: Update IPC mailbox support Mohsin Bashir
2026-01-12 21:19 ` [PATCH net-next V0.5 1/5] eth: fbnic: Use GFP_KERNEL to allocting mbx pages Mohsin Bashir
2026-01-12 21:19 ` [PATCH net-next V0.5 2/5] eth: fbnic: Allocate all pages for RX mailbox Mohsin Bashir
2026-01-12 21:19 ` [PATCH net-next V0.5 3/5] eth: fbnic: Reuse RX mailbox pages Mohsin Bashir
2026-01-12 21:19 ` [PATCH net-next V0.5 4/5] eth: fbnic: Remove retry support Mohsin Bashir
2026-01-14  3:38   ` Jakub Kicinski [this message]
2026-01-12 21:19 ` [PATCH net-next V0.5 5/5] eth: fbnic: Update RX mbox timeout value Mohsin Bashir
2026-01-14  3:38   ` [net-next,V0.5,5/5] " Jakub Kicinski
2026-01-12 21:55 ` [PATCH net-next V0.5 0/5] eth: fbnic: Update IPC mailbox support Mohsin Bashir

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=20260114033814.1033266-1-kuba@kernel.org \
    --to=kuba@kernel.org \
    --cc=alexanderduyck@fb.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=jacob.e.keller@intel.com \
    --cc=kernel-team@meta.com \
    --cc=lee@trager.us \
    --cc=mohsin.bashr@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sanman.p211993@gmail.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