Getting mbuf pointer from buf_addr pointer

Antonio Di Bacco a.dibacco.ks at gmail.com
Tue Jul 12 12:30:53 CEST 2022


I was asked to reproduce the exact same behaviour of a library that
used VMDQ queues without DPDK.
Now this library offered an API to allocate a buffer for a packet and
returned an address where the application could write its data.

void* vmdqNew (vmdqUidPOOLt* p);

I implemented the same API to allocate an MBUF from a pool and I also
return the right address as a void* but then to transmit the packet I
need the address of the MBUF for the tx_burst API and I don't have it.

On Tue, Jul 12, 2022 at 10:32 AM Dmitry Kozlyuk
<dmitry.kozliuk at gmail.com> wrote:
>
> 2022-07-11 11:21 (UTC+0200), Antonio Di Bacco:
> > Is there any API that allows me to get the MBUF pointer given its
> > buf_addr pointer?
>
> No.
>
> How did you come across this need?
> Sounds like an app design flaw.
> What is the original problem you're solving?
>
> P.S. It may be possible in specific cases when you know (from code)
> how mempool sets buf_addr for a given mbuf,
> and that PMDs don't change buf_addr with the used set of offloads.
> Apparently, this approach would be extremely brittle and dangerous.


More information about the users mailing list