From: "Tantilov, Emil S" <emil.s.tantilov@intel.com>
To: Larysa Zaremba <larysa.zaremba@intel.com>,
<intel-wired-lan@lists.osuosl.org>,
Tony Nguyen <anthony.l.nguyen@intel.com>
Cc: "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Simon Horman <horms@kernel.org>, Jonathan Corbet <corbet@lwn.net>,
Przemek Kitszel <przemyslaw.kitszel@intel.com>,
Jiri Pirko <jiri@resnulli.us>,
Tatyana Nikolova <tatyana.e.nikolova@intel.com>,
"Andrew Lunn" <andrew+netdev@lunn.ch>,
Alexander Lobakin <aleksander.lobakin@intel.com>,
Michael Ellerman <mpe@ellerman.id.au>,
"Maciej Fijalkowski" <maciej.fijalkowski@intel.com>,
Lee Trager <lee@trager.us>,
Madhavan Srinivasan <maddy@linux.ibm.com>,
Sridhar Samudrala <sridhar.samudrala@intel.com>,
Jacob Keller <jacob.e.keller@intel.com>,
Michal Swiatkowski <michal.swiatkowski@linux.intel.com>,
Mateusz Polchlopek <mateusz.polchlopek@intel.com>,
Ahmed Zaki <ahmed.zaki@intel.com>, <netdev@vger.kernel.org>,
<linux-doc@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
"Karlsson, Magnus" <magnus.karlsson@intel.com>,
Madhu Chittim <madhu.chittim@intel.com>,
"Josh Hay" <joshua.a.hay@intel.com>,
Milena Olech <milena.olech@intel.com>,
<pavan.kumar.linga@intel.com>,
"Singhai, Anjali" <anjali.singhai@intel.com>,
Michal Kubiak <michal.kubiak@intel.com>
Subject: Re: [PATCH iwl-next v4 09/15] idpf: refactor idpf to use libie control queues
Date: Tue, 17 Jun 2025 17:04:55 -0700 [thread overview]
Message-ID: <16644b14-2101-4e95-a9b8-d1226d52da27@intel.com> (raw)
In-Reply-To: <20250516145814.5422-10-larysa.zaremba@intel.com>
On 5/16/2025 7:58 AM, Larysa Zaremba wrote:
> From: Pavan Kumar Linga <pavan.kumar.linga@intel.com>
>
> Support to initialize and configure controlqs, and manage their
> transactions was introduced in libie. As part of it, most of the existing
> controlq structures are renamed and modified. Use those APIs in idpf and
> make all the necessary changes.
>
> Previously for the send and receive virtchnl messages, there used to be a
> memcpy involved in controlq code to copy the buffer info passed by the send
> function into the controlq specific buffers. There was no restriction to
> use automatic memory in that case. The new implementation in libie removed
> copying of the send buffer info and introduced DMA mapping of the send
> buffer itself. To accommodate it, use dynamic memory for the larger send
> buffers. For smaller ones (<= 128 bytes) libie still can copy them into the
> pre-allocated message memory.
>
> In case of receive, idpf receives a page pool buffer allocated by the libie
> and care should be taken to release it after use in the idpf.
>
> The changes are fairly trivial and localized, with a notable exception
> being the consolidation of idpf_vc_xn_shutdown and idpf_deinit_dflt_mbx
> under the latter name. This has some additional consequences that are
> addressed in the following patches.
There is an issue with this approach that impacts the ability of the
driver to force a reset. See below ...
>
> This refactoring introduces roughly additional 40KB of module storage used
> for systems that only run idpf, so idpf + libie_cp + libie_pci takes about
> 7% more storage than just idpf before refactoring.
>
> We now pre-allocate small TX buffers, so that does increase the memory
> usage, but reduces the need to allocate. This results in additional 256 *
> 128B of memory permanently used, increasing the worst-case memory usage by
> 32KB but our ctlq RX buffers need to be of size 4096B anyway (not changed
> by the patchset), so this is hardly noticeable.
>
> As for the timings, the fact that we are mostly limited by the HW response
> time which is far from instant, is not changed by this refactor.
>
> Reviewed-by: Michal Kubiak <michal.kubiak@intel.com>
> Signed-off-by: Pavan Kumar Linga <pavan.kumar.linga@intel.com>
> Co-developed-by: Larysa Zaremba <larysa.zaremba@intel.com>
> Signed-off-by: Larysa Zaremba <larysa.zaremba@intel.com>
> ---
> drivers/net/ethernet/intel/idpf/Kconfig | 2 +-
> drivers/net/ethernet/intel/idpf/Makefile | 2 -
> drivers/net/ethernet/intel/idpf/idpf.h | 27 +-
> .../net/ethernet/intel/idpf/idpf_controlq.c | 624 -------
> .../net/ethernet/intel/idpf/idpf_controlq.h | 130 --
> .../ethernet/intel/idpf/idpf_controlq_api.h | 177 --
> .../ethernet/intel/idpf/idpf_controlq_setup.c | 171 --
> drivers/net/ethernet/intel/idpf/idpf_dev.c | 54 +-
> .../net/ethernet/intel/idpf/idpf_ethtool.c | 37 +-
> drivers/net/ethernet/intel/idpf/idpf_lib.c | 44 +-
> drivers/net/ethernet/intel/idpf/idpf_main.c | 4 -
> drivers/net/ethernet/intel/idpf/idpf_mem.h | 20 -
> drivers/net/ethernet/intel/idpf/idpf_txrx.h | 2 +-
> drivers/net/ethernet/intel/idpf/idpf_vf_dev.c | 60 +-
> .../net/ethernet/intel/idpf/idpf_virtchnl.c | 1617 ++++++-----------
> .../net/ethernet/intel/idpf/idpf_virtchnl.h | 90 +-
> .../ethernet/intel/idpf/idpf_virtchnl_ptp.c | 204 +--
> 17 files changed, 765 insertions(+), 2500 deletions(-)
> delete mode 100644 drivers/net/ethernet/intel/idpf/idpf_controlq.c
> delete mode 100644 drivers/net/ethernet/intel/idpf/idpf_controlq.h
> delete mode 100644 drivers/net/ethernet/intel/idpf/idpf_controlq_api.h
> delete mode 100644 drivers/net/ethernet/intel/idpf/idpf_controlq_setup.c
> delete mode 100644 drivers/net/ethernet/intel/idpf/idpf_mem.h
>
<snip>
> diff --git a/drivers/net/ethernet/intel/idpf/idpf_lib.c b/drivers/net/ethernet/intel/idpf/idpf_lib.c
> index 68330b884967..500bff1091d9 100644
> --- a/drivers/net/ethernet/intel/idpf/idpf_lib.c
> +++ b/drivers/net/ethernet/intel/idpf/idpf_lib.c
> @@ -1190,6 +1190,7 @@ void idpf_statistics_task(struct work_struct *work)
> */
> void idpf_mbx_task(struct work_struct *work)
> {
> + struct libie_ctlq_xn_recv_params xn_params = {};
> struct idpf_adapter *adapter;
>
> adapter = container_of(work, struct idpf_adapter, mbx_task.work);
> @@ -1200,7 +1201,11 @@ void idpf_mbx_task(struct work_struct *work)
> queue_delayed_work(adapter->mbx_wq, &adapter->mbx_task,
> msecs_to_jiffies(300));
>
> - idpf_recv_mb_msg(adapter, adapter->hw.arq);
> + xn_params.xnm = adapter->xn_init_params.xnm;
> + xn_params.ctlq = adapter->arq;
> + xn_params.ctlq_msg_handler = idpf_recv_event_msg;
> +
> + libie_ctlq_xn_recv(&xn_params);
> }
>
> /**
> @@ -1757,7 +1762,6 @@ static int idpf_init_hard_reset(struct idpf_adapter *adapter)
> idpf_vc_core_deinit(adapter);
> if (!is_reset)
Since one of the checks in idpf_is_reset_detected() is !adapter->arq,
this will never be possible through the event task. I think we may be
able to remove this check altogether, but as-is this patch introduces
large delays in the Tx hang recovery and depending on the cause may not
recover at all.
> reg_ops->trigger_reset(adapter, IDPF_HR_FUNC_RESET);
> - idpf_deinit_dflt_mbx(adapter);
> } else {
> dev_err(dev, "Unhandled hard reset cause\n");
> err = -EBADRQC;
> @@ -1825,7 +1829,7 @@ void idpf_vc_event_task(struct work_struct *work)
> return;
>
> func_reset:
> - idpf_vc_xn_shutdown(adapter->vcxn_mngr);
> + idpf_deinit_dflt_mbx(adapter);
This is not a straightforward swap, whereas previously we just discard
messages knowing that we cannot communicate with the CP in a reset, this
goes much further as it dismantles the MBX resources, and as a result
the check `if (!is_reset)` in idpf_init_hard_reset() will never be true.
<snip>
Thanks,
Emil
next prev parent reply other threads:[~2025-06-18 0:05 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-16 14:57 [PATCH iwl-next v4 00/15] Introduce iXD driver Larysa Zaremba
2025-05-16 14:57 ` [PATCH iwl-next v4 01/15] virtchnl: create 'include/linux/intel' and move necessary header files Larysa Zaremba
2025-05-16 14:57 ` [PATCH iwl-next v4 02/15] virtchnl: introduce control plane version fields Larysa Zaremba
2025-05-16 14:58 ` [PATCH iwl-next v4 03/15] libie: add PCI device initialization helpers to libie Larysa Zaremba
2025-05-16 14:58 ` [PATCH iwl-next v4 04/15] libeth: allow to create fill queues without NAPI Larysa Zaremba
2025-05-16 14:58 ` [PATCH iwl-next v4 05/15] libie: add control queue support Larysa Zaremba
2025-05-16 14:58 ` [PATCH iwl-next v4 06/15] libie: add bookkeeping support for control queue messages Larysa Zaremba
2025-05-16 14:58 ` [PATCH iwl-next v4 07/15] idpf: remove 'vport_params_reqd' field Larysa Zaremba
2025-06-10 21:50 ` [Intel-wired-lan] " Salin, Samuel
2025-05-16 14:58 ` [PATCH iwl-next v4 08/15] idpf: refactor idpf to use libie_pci APIs Larysa Zaremba
2025-06-10 21:51 ` [Intel-wired-lan] " Salin, Samuel
2025-05-16 14:58 ` [PATCH iwl-next v4 09/15] idpf: refactor idpf to use libie control queues Larysa Zaremba
2025-06-10 21:51 ` [Intel-wired-lan] " Salin, Samuel
2025-06-18 0:04 ` Tantilov, Emil S [this message]
2025-06-18 7:54 ` Larysa Zaremba
2025-06-19 2:57 ` Tantilov, Emil S
2025-05-16 14:58 ` [PATCH iwl-next v4 10/15] idpf: make mbx_task queueing and cancelling more consistent Larysa Zaremba
2025-06-10 21:51 ` [Intel-wired-lan] " Salin, Samuel
2025-05-16 14:58 ` [PATCH iwl-next v4 11/15] idpf: print a debug message and bail in case of non-event ctlq message Larysa Zaremba
2025-06-10 21:53 ` [Intel-wired-lan] " Salin, Samuel
2025-05-16 14:58 ` [PATCH iwl-next v4 12/15] ixd: add basic driver framework for Intel(R) Control Plane Function Larysa Zaremba
2025-05-16 14:58 ` [PATCH iwl-next v4 13/15] ixd: add reset checks and initialize the mailbox Larysa Zaremba
2025-05-16 14:58 ` [PATCH iwl-next v4 14/15] ixd: add the core initialization Larysa Zaremba
2025-05-16 14:58 ` [PATCH iwl-next v4 15/15] ixd: add devlink support Larysa Zaremba
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=16644b14-2101-4e95-a9b8-d1226d52da27@intel.com \
--to=emil.s.tantilov@intel.com \
--cc=ahmed.zaki@intel.com \
--cc=aleksander.lobakin@intel.com \
--cc=andrew+netdev@lunn.ch \
--cc=anjali.singhai@intel.com \
--cc=anthony.l.nguyen@intel.com \
--cc=corbet@lwn.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=jacob.e.keller@intel.com \
--cc=jiri@resnulli.us \
--cc=joshua.a.hay@intel.com \
--cc=kuba@kernel.org \
--cc=larysa.zaremba@intel.com \
--cc=lee@trager.us \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maciej.fijalkowski@intel.com \
--cc=maddy@linux.ibm.com \
--cc=madhu.chittim@intel.com \
--cc=magnus.karlsson@intel.com \
--cc=mateusz.polchlopek@intel.com \
--cc=michal.kubiak@intel.com \
--cc=michal.swiatkowski@linux.intel.com \
--cc=milena.olech@intel.com \
--cc=mpe@ellerman.id.au \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pavan.kumar.linga@intel.com \
--cc=przemyslaw.kitszel@intel.com \
--cc=sridhar.samudrala@intel.com \
--cc=tatyana.e.nikolova@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;
as well as URLs for NNTP newsgroup(s).