From: Lokesh Chakka <lvenkatakumarchakka@gmail.com>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: users <users@dpdk.org>
Subject: Re: mbuf validity in conjunction with ref cnt
Date: Sat, 22 Feb 2025 10:22:51 +0530 [thread overview]
Message-ID: <CACh--siKEQFPxUuzt=QEWJSNp4_UOmb2wrFPGXP0HykSpjqDRQ@mail.gmail.com> (raw)
In-Reply-To: <20250221104606.60dafc66@hermes.local>
[-- Attachment #1: Type: text/plain, Size: 1767 bytes --]
My objective is to reuse mbuf unlimited number of times for a configurable
amount of time.
rte_pktmbuf_alloc // after here refcnt is 1
refcnt_update ( , 1) //after here refcnt is 2
while( time still exists )
{
tx_burst
}
Will this approach work with all drivers/cards ?
Thanks & Regards
--
Lokesh Chakka.
On Sat, Feb 22, 2025 at 12:16 AM Stephen Hemminger <
stephen@networkplumber.org> wrote:
> On Fri, 21 Feb 2025 13:09:34 +0530
> Lokesh Chakka <lvenkatakumarchakka@gmail.com> wrote:
>
> > Hello,
> >
> > I've created mbuf using rte_pktmbuf_alloc.
> > Just after creating mbuf rte_mbuf_refcnt_read is giving 1.
> >
> > After rte_eth_tx_burst, rte_mbuf_refcnt_read is giving 1.
> >
> > Even
> > rte_eth_tx_burst
> > sleep(10);
> > rte_mbuf_refcnt_read
> > is still giving 1
> >
> > Even
> > rte_eth_tx_burst
> > sleep(10);
> > rte_mbuf_refcnt_read // is still giving 1
> > rte_pktmbuf_free
> > sleep(10);
> > rte_mbuf_refcnt_read // is still giving 1
> >
> > Does it mean mbuf can be reused like
> > while(1)
> > {
> > rte_eth_tx_burst
> > }
> >
> >
> > Thanks & Regards
> > --
> > Lokesh Chakka.
>
> Once you gave the mbuf to the driver, with a refcnt of 1 it
> means the driver will free it. Any later reference is a use after free.
> The driver will free it at an undetermined time after sending.
> Some drivers defer the free until a later reclaim cycle (next send).
>
> When mbuf is freed, the refcnt does not
> go to zero, it just moves into the mbuf free pool.
> Read the the source for more details.
>
> There is no callback in DPDK for when mbuf is actually sent or freed.
>
>
[-- Attachment #2: Type: text/html, Size: 2767 bytes --]
next prev parent reply other threads:[~2025-02-22 4:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-21 7:39 Lokesh Chakka
2025-02-21 18:46 ` Stephen Hemminger
2025-02-22 4:52 ` Lokesh Chakka [this message]
2025-02-22 16:18 ` Stephen Hemminger
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='CACh--siKEQFPxUuzt=QEWJSNp4_UOmb2wrFPGXP0HykSpjqDRQ@mail.gmail.com' \
--to=lvenkatakumarchakka@gmail.com \
--cc=stephen@networkplumber.org \
--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).