RE: [Intel-wired-lan] [PATCH net v3 5/5] iavf: refactor virtchnl polling into single function

Loktionov, Aleksandr
2026-04-14T11:43:18Z

> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf
> Of Jose Ignacio Tornos Martinez
> Sent: Tuesday, April 14, 2026 1:00 PM
> To: netdev@vger.kernel.org
> Cc: intel-wired-lan@lists.osuosl.org; jesse.brandeburg@intel.com;
> Nguyen, Anthony L <anthony.l.nguyen@intel.com>; davem@davemloft.net;
> edumazet@google.com; kuba@kernel.org; pabeni@redhat.com; Jose Ignacio
> Tornos Martinez <jtornosm@redhat.com>; Kitszel, Przemyslaw
> <przemyslaw.kitszel@intel.com>
> Subject: [Intel-wired-lan] [PATCH net v3 5/5] iavf: refactor virtchnl
> polling into single function

For me it looks it should go to net-next as a refactoring.

>
> At this moment, the driver has two separate functions for polling
> virtchnl messages from the admin queue:
> - iavf_poll_virtchnl_msg() for init-time (no timeout, no completion
> handler)
> - iavf_poll_virtchnl_response() for runtime (with timeout, calls
> completion)
>
> Refactor by enhancing iavf_poll_virtchnl_msg() to handle both use
> cases:
> 1. Init-time mode (timeout_ms=0):
> - Polls until matching opcode found or queue empty
> - Returns raw message data without processing through completion
> handler
> - Exits immediately on empty queue (no sleep/retry) 2. Runtime mode
> (timeout_ms>0):
> - Polls with timeout using condition callback or opcode check
> - Processes all messages through iavf_virtchnl_completion()
> - Supports custom completion callback (takes priority) or falls back
> to checking adapter->current_op against expected opcode
> - Uses pending parameter to skip sleep when more messages queued
> - Uses 50-75 usec sleep (due to commit 9e3f23f44f32 ("i40e: reduce
> wait
> time for adminq command completion"))
>
> By unifying message handling, both init-time and runtime messages can
> be processed through the completion handler when appropriate, ensuring
> consistent state updates and maintaining backward compatibility with
> all existing call sites.
>
> Suggested-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
> Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
> ---
> drivers/net/ethernet/intel/iavf/iavf.h | 9 +-
> drivers/net/ethernet/intel/iavf/iavf_main.c | 13 +-
> .../net/ethernet/intel/iavf/iavf_virtchnl.c | 247 ++++++++---------

...

> --
> 2.53.0