DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Morten Brørup" <mb@smartsharesystems.com>
To: "Shahaf Shuler" <shahafs@nvidia.com>,
	"Viacheslav Ovsiienko" <viacheslavo@nvidia.com>, <dev@dpdk.org>
Cc: "Olivier Matz" <olivier.matz@6wind.com>, <thomas@monjalon.net>
Subject: questions about pinned external buffers
Date: Thu, 9 Jan 2025 13:11:41 +0100	[thread overview]
Message-ID: <98CBD80474FA8B44BF855DF32C47DC35E9F99F@smartserver.smartshare.dk> (raw)

Pinned external buffers were introduced with this patch:
https://git.dpdk.org/dpdk/commit/lib/librte_mbuf/rte_mbuf.h?id=6ef1107ad4c6d4fcb6be627367ee0b97bb13e822

Question 1:
Please confirm that the mbuf's pinned external buffer's refcnt is supposed to be 1 when an mbuf is returned to the mempool?

If so, the below assertion should be updated for completion:

rte_mbuf_raw_free(struct rte_mbuf *m)
{
	RTE_ASSERT(!RTE_MBUF_CLONED(m) &&
-			(!RTE_MBUF_HAS_EXTBUF(m) || RTE_MBUF_HAS_PINNED_EXTBUF(m)));
+			(!RTE_MBUF_HAS_EXTBUF(m) ||
+			(RTE_MBUF_HAS_PINNED_EXTBUF(m) &&
+			rte_mbuf_ext_refcnt_read(m->shinfo) == 1)));
	__rte_mbuf_raw_sanity_check(m);
	rte_mempool_put(m->pool, m);
}

The increased performance cost should be acceptable for debug builds (i.e. with assertions enabled).

Question 2:
Could this assertion be moved to __rte_mbuf_raw_sanity_check()?

I'm working on a new rte_mbuf_raw_free_bulk() function, for use with RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE; and if the assertion is not moved to __rte_mbuf_raw_sanity_check(), it needs to be copy-pasted into the new raw_free_bulk() function too.


                 reply	other threads:[~2025-01-09 12:11 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=98CBD80474FA8B44BF855DF32C47DC35E9F99F@smartserver.smartshare.dk \
    --to=mb@smartsharesystems.com \
    --cc=dev@dpdk.org \
    --cc=olivier.matz@6wind.com \
    --cc=shahafs@nvidia.com \
    --cc=thomas@monjalon.net \
    --cc=viacheslavo@nvidia.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).