From: "Tantilov, Emil S" <emil.s.tantilov@intel.com>
To: Brian Vazquez <brianvv@google.com>,
Brian Vazquez <brianvv.kernel@gmail.com>,
Tony Nguyen <anthony.l.nguyen@intel.com>,
"Przemek Kitszel" <przemyslaw.kitszel@intel.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
<intel-wired-lan@lists.osuosl.org>, <netdev@vger.kernel.org>
Cc: Madhu Chittim <madhu.chittim@intel.com>,
Pavan Kumar Linga <pavan.kumar.linga@intel.com>,
Joshua Hay <joshua.a.hay@intel.com>,
Shailendra Bhatnagar <shailendra.bhatnagar@intel.com>,
Sridhar Samudrala <sridhar.samudrala@intel.com>,
<linux-kernel@vger.kernel.org>,
"David Decotigny" <decot@google.com>, Li Li <boolli@google.com>
Subject: Re: [iwl-net PATCH] idpf: wait for the reset completed state in idpf_check_reset_complete()
Date: Thu, 8 Oct 2026 10:59:11 -0700 [thread overview]
Message-ID: <666d51cb-e88a-4587-b17a-ae2a041844ef@intel.com> (raw)
In-Reply-To: <20261008173334.2881475-1-brianvv@google.com>
On 10/8/2026 10:33 AM, Brian Vazquez wrote:
> PFGEN_RSTAT[1:0] / VFGEN_RSTAT[1:0] (PFR_STATE / VFR_STATE) encode the
> function reset progress as a 2-bit state, not a flag:
>
> 00b - reset in progress
> 01b - reset completed, written by the control plane
> 10b - function active, written by the control plane once the function
> has completed VIRTCHNL2_OP_VERSION
> 11b - reserved
>
> idpf_check_reset_complete() tests (reg_val & rstat_m) as a boolean, with
> rstat_m = GENMASK(1, 0), so any non-zero state is taken as "completed",
> although only 01b carries that meaning.
>
> That only works if hardware moves the field to 00b as soon as the reset
> is triggered. On the devices tested it does not: PFSWR transitions
> PFR_STATE to 00b only when the field currently reads 01b. When the
> function is active (10b) the field keeps its value until the control
> plane finishes the reset and writes 01b, which takes a few hundred
> milliseconds.
>
> Consequently, on a hard reset of an active function
> (IDPF_HR_FUNC_RESET) the first poll sees 10b, returns immediately, the
> driver re-creates the mailbox and sends VIRTCHNL2_OP_VERSION while the
> reset is still being processed. The control plane tears the mailbox
> down underneath it, VERSION is never answered, and the driver sits in a
> 60 second virtchnl timeout (-ETIME) before going through a second hard
> reset which then succeeds.
>
> Make idpf_check_reset_complete() wait for the state to be exactly 01b.
> This is the stricter reading of the register definition and it does not
> depend on how the field got to its current value: functions that are
> still in progress (00b) or active (10b) keep polling until the control
> plane reports completion.
>
> Fixes: 8077c727561a ("idpf: add controlq init and reset checks")
> Signed-off-by: Brian Vazquez <brianvv@google.com>
> ---
> drivers/net/ethernet/intel/idpf/idpf.h | 2 ++
> drivers/net/ethernet/intel/idpf/idpf_lib.c | 3 ++-
> 2 files changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/intel/idpf/idpf.h b/drivers/net/ethernet/intel/idpf/idpf.h
> index 470bc23c844c..ce8a1bd0ec8b 100644
> --- a/drivers/net/ethernet/intel/idpf/idpf.h
> +++ b/drivers/net/ethernet/intel/idpf/idpf.h
> @@ -166,6 +166,8 @@ struct idpf_netdev_priv {
> spinlock_t stats_lock;
> };
>
> +#define IDPF_RSTAT_COMPLETE 0x01
> +
> /**
> * struct idpf_reset_reg - Reset register offsets/masks
> * @rstat: Reset status register
> diff --git a/drivers/net/ethernet/intel/idpf/idpf_lib.c b/drivers/net/ethernet/intel/idpf/idpf_lib.c
> index 2c148377540c..a827e0fa67c8 100644
> --- a/drivers/net/ethernet/intel/idpf/idpf_lib.c
> +++ b/drivers/net/ethernet/intel/idpf/idpf_lib.c
> @@ -1870,7 +1870,8 @@ static int idpf_check_reset_complete(struct idpf_adapter *adapter,
> * register for us yet and 0xFFFFFFFF is not a valid value for
> * the register, so treat that as invalid.
> */
> - if (reg_val != 0xFFFFFFFF && (reg_val & reset_reg->rstat_m))
> + if (reg_val != 0xFFFFFFFF &&
> + (reg_val & reset_reg->rstat_m) == IDPF_RSTAT_COMPLETE)
> return 0;
>
> usleep_range(5000, 10000)
Reviewed-by: Emil Tantilov <emil.s.tantilov@intel.com>
next prev parent reply other threads:[~2026-10-08 17:59 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-08 17:33 Brian Vazquez
2026-10-08 17:39 ` netdev-bot+sinfo
2026-10-08 17:59 ` Tantilov, Emil S [this message]
2026-10-08 18:31 ` Paul Menzel
2026-10-08 20:43 ` Brian Vazquez
2026-10-08 19:15 ` Li Li
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=666d51cb-e88a-4587-b17a-ae2a041844ef@intel.com \
--to=emil.s.tantilov@intel.com \
--cc=andrew+netdev@lunn.ch \
--cc=anthony.l.nguyen@intel.com \
--cc=boolli@google.com \
--cc=brianvv.kernel@gmail.com \
--cc=brianvv@google.com \
--cc=davem@davemloft.net \
--cc=decot@google.com \
--cc=edumazet@kernel.org \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=joshua.a.hay@intel.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=madhu.chittim@intel.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pavan.kumar.linga@intel.com \
--cc=przemyslaw.kitszel@intel.com \
--cc=shailendra.bhatnagar@intel.com \
--cc=sridhar.samudrala@intel.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
all inboxes | Powered by JetHome®