DPDK usage discussions
 help / color / mirror / Atom feed
* Direct Mem Pool vs Indirect mem pool creation
@ 2023-09-01 12:47 omer yamac
  2023-09-01 13:08 ` Thomas Monjalon
  0 siblings, 1 reply; 4+ messages in thread
From: omer yamac @ 2023-09-01 12:47 UTC (permalink / raw)
  To: users

[-- Attachment #1: Type: text/plain, Size: 796 bytes --]

Hello,

I need clarification while creating direct/indirect buffers for mbuf. I
couldn't find exact documentation, and I just looked over the fragmentation
test case and saw that two pools were created. One is a
direct pool, and the other is an indirect pool. Here are the methods to
create pools:
direct_pool = rte_pktmbuf_pool_create("FRAG_D_MBUF_POOL",
                          NUM_MBUFS, BURST, 0,
                          RTE_MBUF_DEFAULT_BUF_SIZE,
                          SOCKET_ID_ANY);
indirect_pool = rte_pktmbuf_pool_create("FRAG_I_MBUF_POOL",
                        NUM_MBUFS, BURST, 0,
                        0, SOCKET_ID_ANY)

I couldn't see the exact difference. Just the "data_room_size" parameter is
different. If this parameter is 0, then is the pool indirect?

Thanks all

[-- Attachment #2: Type: text/html, Size: 962 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Direct Mem Pool vs Indirect mem pool creation
  2023-09-01 12:47 Direct Mem Pool vs Indirect mem pool creation omer yamac
@ 2023-09-01 13:08 ` Thomas Monjalon
  2023-09-01 13:31   ` omer yamac
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas Monjalon @ 2023-09-01 13:08 UTC (permalink / raw)
  To: omer yamac; +Cc: users

01/09/2023 14:47, omer yamac:
> Hello,
> 
> I need clarification while creating direct/indirect buffers for mbuf. I
> couldn't find exact documentation, and I just looked over the fragmentation
> test case and saw that two pools were created. One is a
> direct pool, and the other is an indirect pool. Here are the methods to
> create pools:
> direct_pool = rte_pktmbuf_pool_create("FRAG_D_MBUF_POOL",
>                           NUM_MBUFS, BURST, 0,
>                           RTE_MBUF_DEFAULT_BUF_SIZE,
>                           SOCKET_ID_ANY);
> indirect_pool = rte_pktmbuf_pool_create("FRAG_I_MBUF_POOL",
>                         NUM_MBUFS, BURST, 0,
>                         0, SOCKET_ID_ANY)
> 
> I couldn't see the exact difference. Just the "data_room_size" parameter is
> different. If this parameter is 0, then is the pool indirect?

A pool is neither direct or indirect, it is just a pool of buffers
with a defined size for all buffers of a pool.
You are free to create any pool for your needs.

Now if you create a pool of buffers with size 0,
we can expect you will save some data elsewhere,
using rte_pktmbuf_attach_extbuf() for instance.

More explanations can be found in the doc:
https://doc.dpdk.org/guides/prog_guide/mbuf_lib.html#direct-and-indirect-buffers



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Direct Mem Pool vs Indirect mem pool creation
  2023-09-01 13:08 ` Thomas Monjalon
@ 2023-09-01 13:31   ` omer yamac
  2023-09-01 21:30     ` Abdullah Ömer Yamaç
  0 siblings, 1 reply; 4+ messages in thread
From: omer yamac @ 2023-09-01 13:31 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: users

[-- Attachment #1: Type: text/plain, Size: 2004 bytes --]

Thank you for the clarification. Now, I understand more clearly. May I ask
one more question? I used the rte_pktmbuf_clone function to duplicate the
packet. Then, the new packet is cloned to the indirect memory. After the
clone, I used the RTE_MBUF_DIRECT macro to check this, which returns false.
So, to get a direct buffer, I need to use the alloc function and copy the
data. Am I right?

I just want to use the "static inline int rte_vlan_insert(struct rte_mbuf
**m)" function; a direct buffer is necessary for this function.

On Fri, Sep 1, 2023 at 4:08 PM Thomas Monjalon <thomas@monjalon.net> wrote:

> 01/09/2023 14:47, omer yamac:
> > Hello,
> >
> > I need clarification while creating direct/indirect buffers for mbuf. I
> > couldn't find exact documentation, and I just looked over the
> fragmentation
> > test case and saw that two pools were created. One is a
> > direct pool, and the other is an indirect pool. Here are the methods to
> > create pools:
> > direct_pool = rte_pktmbuf_pool_create("FRAG_D_MBUF_POOL",
> >                           NUM_MBUFS, BURST, 0,
> >                           RTE_MBUF_DEFAULT_BUF_SIZE,
> >                           SOCKET_ID_ANY);
> > indirect_pool = rte_pktmbuf_pool_create("FRAG_I_MBUF_POOL",
> >                         NUM_MBUFS, BURST, 0,
> >                         0, SOCKET_ID_ANY)
> >
> > I couldn't see the exact difference. Just the "data_room_size" parameter
> is
> > different. If this parameter is 0, then is the pool indirect?
>
> A pool is neither direct or indirect, it is just a pool of buffers
> with a defined size for all buffers of a pool.
> You are free to create any pool for your needs.
>
> Now if you create a pool of buffers with size 0,
> we can expect you will save some data elsewhere,
> using rte_pktmbuf_attach_extbuf() for instance.
>
> More explanations can be found in the doc:
>
> https://doc.dpdk.org/guides/prog_guide/mbuf_lib.html#direct-and-indirect-buffers
>
>
>

[-- Attachment #2: Type: text/html, Size: 2655 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Direct Mem Pool vs Indirect mem pool creation
  2023-09-01 13:31   ` omer yamac
@ 2023-09-01 21:30     ` Abdullah Ömer Yamaç
  0 siblings, 0 replies; 4+ messages in thread
From: Abdullah Ömer Yamaç @ 2023-09-01 21:30 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: users

[-- Attachment #1: Type: text/plain, Size: 2253 bytes --]

I found the answer in the comments: "/* Creates a shallow copy of mbuf */"
for the rte_pktmbuf_clone. Thanks

On Fri, Sep 1, 2023 at 4:31 PM omer yamac <aomeryamac@gmail.com> wrote:

> Thank you for the clarification. Now, I understand more clearly. May I ask
> one more question? I used the rte_pktmbuf_clone function to duplicate the
> packet. Then, the new packet is cloned to the indirect memory. After the
> clone, I used the RTE_MBUF_DIRECT macro to check this, which returns false.
> So, to get a direct buffer, I need to use the alloc function and copy the
> data. Am I right?
>
> I just want to use the "static inline int rte_vlan_insert(struct rte_mbuf
> **m)" function; a direct buffer is necessary for this function.
>
> On Fri, Sep 1, 2023 at 4:08 PM Thomas Monjalon <thomas@monjalon.net>
> wrote:
>
>> 01/09/2023 14:47, omer yamac:
>> > Hello,
>> >
>> > I need clarification while creating direct/indirect buffers for mbuf. I
>> > couldn't find exact documentation, and I just looked over the
>> fragmentation
>> > test case and saw that two pools were created. One is a
>> > direct pool, and the other is an indirect pool. Here are the methods to
>> > create pools:
>> > direct_pool = rte_pktmbuf_pool_create("FRAG_D_MBUF_POOL",
>> >                           NUM_MBUFS, BURST, 0,
>> >                           RTE_MBUF_DEFAULT_BUF_SIZE,
>> >                           SOCKET_ID_ANY);
>> > indirect_pool = rte_pktmbuf_pool_create("FRAG_I_MBUF_POOL",
>> >                         NUM_MBUFS, BURST, 0,
>> >                         0, SOCKET_ID_ANY)
>> >
>> > I couldn't see the exact difference. Just the "data_room_size"
>> parameter is
>> > different. If this parameter is 0, then is the pool indirect?
>>
>> A pool is neither direct or indirect, it is just a pool of buffers
>> with a defined size for all buffers of a pool.
>> You are free to create any pool for your needs.
>>
>> Now if you create a pool of buffers with size 0,
>> we can expect you will save some data elsewhere,
>> using rte_pktmbuf_attach_extbuf() for instance.
>>
>> More explanations can be found in the doc:
>>
>> https://doc.dpdk.org/guides/prog_guide/mbuf_lib.html#direct-and-indirect-buffers
>>
>>
>>

[-- Attachment #2: Type: text/html, Size: 3167 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-09-01 21:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-01 12:47 Direct Mem Pool vs Indirect mem pool creation omer yamac
2023-09-01 13:08 ` Thomas Monjalon
2023-09-01 13:31   ` omer yamac
2023-09-01 21:30     ` Abdullah Ömer Yamaç

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).