DPDK usage discussions
 help / color / mirror / Atom feed
From: David Marchand <david.marchand@redhat.com>
To: Alan Beadle <ab.beadle@gmail.com>
Cc: users@dpdk.org, Thomas Monjalon <thomas@monjalon.net>,
	 Ferruh Yigit <ferruh.yigit@amd.com>,
	Stephen Hemminger <stephen@networkplumber.org>
Subject: Re: DPDK Memory Management Help
Date: Tue, 1 Oct 2024 16:12:59 +0200	[thread overview]
Message-ID: <CAJFAV8zwT1UCvatx3tMo3Tkg0n47rVDgdaD8=saKVQh8Q5awJg@mail.gmail.com> (raw)
In-Reply-To: <CANTAOdxfH1X+FTcpnNzeNvspvj3gip4YVVzwg2eXgTRE+UzpZw@mail.gmail.com>

On Tue, Oct 1, 2024 at 2:26 PM Alan Beadle <ab.beadle@gmail.com> wrote:
>
> Hi everyone,
>
> I'm working with DPDK and could use some advice about memory
> management of the DPDK heap.
>
> I need to prevent DPDK from freeing the rte_mbuf buffers once the
> corresponding packets have been sent with rte_eth_tx_burst(). My
> application has local readers as well, and so I want to keep that data
> around for them to read via shared memory. I would prefer to rely on
> explicit calls to free any of these buffers. I can find plenty of
> sources about rte_eth_tx_burst() freeing messages once they are sent,
> but cannot find a way to override this behavior, or any mention of an
> alternate call to send without freeing.
>
> This would let me avoid copying the data into a separate buffer just
> for local readers and to let them read from the same buffers that DPDK
> already requires., leading to a significant performance gain (less
> memcpy). This seems like something that should be possible *without*
> modifying DPDK, but I haven't figured out how yet. I know that I would
> need to take care that the buffers are not freed prior to sending.

This is a frequent question, so maybe we should update the doc.

You can increment the refcnt on the mbuf in your application before
calling rte_eth_tx_burst().
See rte_mbuf_refcnt_update(m, 1).
It is then your application responsibility to call rte_pktmbuf_free()
once it is done with the mbuf.


-- 
David Marchand


      reply	other threads:[~2024-10-01 14:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-01 12:25 Alan Beadle
2024-10-01 14:12 ` David Marchand [this message]

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='CAJFAV8zwT1UCvatx3tMo3Tkg0n47rVDgdaD8=saKVQh8Q5awJg@mail.gmail.com' \
    --to=david.marchand@redhat.com \
    --cc=ab.beadle@gmail.com \
    --cc=ferruh.yigit@amd.com \
    --cc=stephen@networkplumber.org \
    --cc=thomas@monjalon.net \
    --cc=users@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).