DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Morten Brørup" <mb@smartsharesystems.com>
To: "Bruce Richardson" <bruce.richardson@intel.com>, <dev@dpdk.org>
Subject: RE: [PATCH 1/2] net/intel: avoid allocating from mempool directly
Date: Tue, 26 Aug 2025 09:27:30 +0200	[thread overview]
Message-ID: <98CBD80474FA8B44BF855DF32C47DC35E9FE6F@smartserver.smartshare.dk> (raw)
In-Reply-To: <20250822170656.454571-2-bruce.richardson@intel.com>

> From: Bruce Richardson [mailto:bruce.richardson@intel.com]
> Sent: Friday, 22 August 2025 19.07
> 
> Rather than calling the mempool function rte_mempool_get_bulk we update
> the code to use the mbuf function rte_mbuf_raw_alloc_bulk, which
> properly supports debug flags and checks - when enabled.
> 
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>

Acked-by: Morten Brørup <mb@smartsharesystems.com>

With a slightly unrelated comment inline below.

> ---
> 
> diff --git a/drivers/net/intel/common/rx_vec_arm.h
> b/drivers/net/intel/common/rx_vec_arm.h
> index 2e48d4b6c0..f7e7b8c396 100644
> --- a/drivers/net/intel/common/rx_vec_arm.h
> +++ b/drivers/net/intel/common/rx_vec_arm.h
> @@ -16,19 +16,19 @@
>  static inline int
>  _ci_rxq_rearm_get_bufs(struct ci_rx_queue *rxq)
>  {
> -	struct ci_rx_entry *rxp = &rxq->sw_ring[rxq->rxrearm_start];
> +	struct rte_mbuf **rxp = &rxq->sw_ring[rxq->rxrearm_start].mbuf;

A comment not directly related to this patch, and something I noticed before without mentioning it...

The "ci_rx_entry" is defined as follows [1]:
struct ci_rx_entry {
	struct rte_mbuf *mbuf; /* mbuf associated with RX descriptor. */
};

Which makes it equivalent to an mbuf pointer.
Type casting an array of "struct ci_rx_entry" to an array of "struct rte_mbuf *" relies on the "struct ci_rx_entry" not having any more fields.
Having this extra (technically superfluous) wrapper makes it somewhat difficult to review the code, and requires more type casting.
I suppose there are good reasons for having this extra wrapper. (Perhaps something like the reason for the rte_atomic32_t type being a struct with an integer counter field, instead of a simple typedef.)

Anyway, for the benefit of the reviewer, you should consider adding a "static_assert(sizeof(struct ci_rx_entry) == sizeof(struct rte_mbuf *))" and a comment when you do this type casting.

[1]: https://elixir.bootlin.com/dpdk/v25.07/source/drivers/net/intel/common/rx.h#L25


  reply	other threads:[~2025-08-26  7:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-22 17:06 [PATCH 0/2] avoid using mempool fns directly Bruce Richardson
2025-08-22 17:06 ` [PATCH 1/2] net/intel: avoid allocating from mempool directly Bruce Richardson
2025-08-26  7:27   ` Morten Brørup [this message]
2025-08-22 17:06 ` [PATCH 2/2] net/intel: avoid accessing mempool directly on free Bruce Richardson
2025-08-26  7:29   ` Morten Brørup

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=98CBD80474FA8B44BF855DF32C47DC35E9FE6F@smartserver.smartshare.dk \
    --to=mb@smartsharesystems.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    /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).