[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250421141937.GI2789685@horms.kernel.org>
Date: Mon, 21 Apr 2025 15:19:37 +0100
From: Simon Horman <horms@...nel.org>
To: Larysa Zaremba <larysa.zaremba@...el.com>
Cc: intel-wired-lan@...ts.osuosl.org,
Tony Nguyen <anthony.l.nguyen@...el.com>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Jonathan Corbet <corbet@....net>,
Przemek Kitszel <przemyslaw.kitszel@...el.com>,
Jiri Pirko <jiri@...nulli.us>,
Mustafa Ismail <mustafa.ismail@...el.com>,
Tatyana Nikolova <tatyana.e.nikolova@...el.com>,
Andrew Lunn <andrew+netdev@...n.ch>,
Alexander Lobakin <aleksander.lobakin@...el.com>,
Michael Ellerman <mpe@...erman.id.au>,
Maciej Fijalkowski <maciej.fijalkowski@...el.com>,
Lee Trager <lee@...ger.us>,
Madhavan Srinivasan <maddy@...ux.ibm.com>,
Sridhar Samudrala <sridhar.samudrala@...el.com>,
Jacob Keller <jacob.e.keller@...el.com>,
Michal Swiatkowski <michal.swiatkowski@...ux.intel.com>,
Mateusz Polchlopek <mateusz.polchlopek@...el.com>,
Wenjun Wu <wenjun1.wu@...el.com>, Ahmed Zaki <ahmed.zaki@...el.com>,
netdev@...r.kernel.org, linux-doc@...r.kernel.org,
linux-kernel@...r.kernel.org,
"Karlsson, Magnus" <magnus.karlsson@...el.com>,
Emil Tantilov <emil.s.tantilov@...el.com>,
Madhu Chittim <madhu.chittim@...el.com>,
Josh Hay <joshua.a.hay@...el.com>,
Milena Olech <milena.olech@...el.com>, pavan.kumar.linga@...el.com,
"Singhai, Anjali" <anjali.singhai@...el.com>,
Phani R Burra <phani.r.burra@...el.com>
Subject: Re: [PATCH iwl-next 06/14] libeth: add bookkeeping support for
control queue messages
On Tue, Apr 08, 2025 at 02:47:52PM +0200, Larysa Zaremba wrote:
> From: Phani R Burra <phani.r.burra@...el.com>
>
> All send control queue messages are allocated/freed in libeth itself
> and tracked with the unique transaction (Xn) ids until they receive
> response or time out. Responses can be received out of order, therefore
> transactions are stored in an array and tracked though a bitmap.
>
> Pre-allocated DMA memory is used where possible. It reduces the driver
> overhead in handling memory allocation/free and message timeouts.
>
> Reviewed-by: Maciej Fijalkowski <maciej.fijalkowski@...el.com>
> Signed-off-by: Phani R Burra <phani.r.burra@...el.com>
> Co-developed-by: Victor Raj <victor.raj@...el.com>
> Signed-off-by: Victor Raj <victor.raj@...el.com>
> Co-developed-by: Pavan Kumar Linga <pavan.kumar.linga@...el.com>
> Signed-off-by: Pavan Kumar Linga <pavan.kumar.linga@...el.com>
> Co-developed-by: Larysa Zaremba <larysa.zaremba@...el.com>
> Signed-off-by: Larysa Zaremba <larysa.zaremba@...el.com>
> ---
> drivers/net/ethernet/intel/libeth/controlq.c | 578 +++++++++++++++++++
> include/net/libeth/controlq.h | 169 ++++++
> 2 files changed, 747 insertions(+)
>
> diff --git a/drivers/net/ethernet/intel/libeth/controlq.c b/drivers/net/ethernet/intel/libeth/controlq.c
...
> +/**
> + * libeth_ctlq_xn_deinit - deallocate and free the transaction manager resources
> + * @xnm: pointer to the transaction manager
> + * @ctx: controlq context structure
> + *
> + * All Rx processing must be stopped beforehand.
> + */
> +void libeth_ctlq_xn_deinit(struct libeth_ctlq_xn_manager *xnm,
> + struct libeth_ctlq_ctx *ctx)
> +{
> + bool must_wait = false;
> + u32 i;
> +
> + /* Should be no new clear bits after this */
> + spin_lock(&xnm->free_xns_bm_lock);
> + xnm->shutdown = true;
nit: The line above is not correctly indented.
Flagged by Smatch.
> +
> + for_each_clear_bit(i, xnm->free_xns_bm, LIBETH_CTLQ_MAX_XN_ENTRIES) {
> + struct libeth_ctlq_xn *xn = &xnm->ring[i];
> +
> + spin_lock(&xn->xn_lock);
> +
> + if (xn->state == LIBETH_CTLQ_XN_WAITING ||
> + xn->state == LIBETH_CTLQ_XN_IDLE) {
> + complete(&xn->cmd_completion_event);
> + must_wait = true;
> + } else if (xn->state == LIBETH_CTLQ_XN_ASYNC) {
> + __libeth_ctlq_xn_push_free(xnm, xn);
> + }
> +
> + spin_unlock(&xn->xn_lock);
> + }
> +
> + spin_unlock(&xnm->free_xns_bm_lock);
> +
> + if (must_wait)
> + wait_for_completion(&xnm->can_destroy);
> +
> + libeth_ctlq_xn_deinit_dma(&ctx->mmio_info.pdev->dev, xnm,
> + LIBETH_CTLQ_MAX_XN_ENTRIES);
> + kfree(xnm);
> + libeth_ctlq_deinit(ctx);
> +}
> +EXPORT_SYMBOL_NS_GPL(libeth_ctlq_xn_deinit, "LIBETH_CP");
...
Powered by blists - more mailing lists