<div dir="ltr"><div dir="ltr">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? <br><br>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.<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Sep 1, 2023 at 4:08 PM Thomas Monjalon <<a href="mailto:thomas@monjalon.net">thomas@monjalon.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">01/09/2023 14:47, omer yamac:<br>
> Hello,<br>
> <br>
> I need clarification while creating direct/indirect buffers for mbuf. I<br>
> couldn't find exact documentation, and I just looked over the fragmentation<br>
> test case and saw that two pools were created. One is a<br>
> direct pool, and the other is an indirect pool. Here are the methods to<br>
> create pools:<br>
> direct_pool = rte_pktmbuf_pool_create("FRAG_D_MBUF_POOL",<br>
> NUM_MBUFS, BURST, 0,<br>
> RTE_MBUF_DEFAULT_BUF_SIZE,<br>
> SOCKET_ID_ANY);<br>
> indirect_pool = rte_pktmbuf_pool_create("FRAG_I_MBUF_POOL",<br>
> NUM_MBUFS, BURST, 0,<br>
> 0, SOCKET_ID_ANY)<br>
> <br>
> I couldn't see the exact difference. Just the "data_room_size" parameter is<br>
> different. If this parameter is 0, then is the pool indirect?<br>
<br>
A pool is neither direct or indirect, it is just a pool of buffers<br>
with a defined size for all buffers of a pool.<br>
You are free to create any pool for your needs.<br>
<br>
Now if you create a pool of buffers with size 0,<br>
we can expect you will save some data elsewhere,<br>
using rte_pktmbuf_attach_extbuf() for instance.<br>
<br>
More explanations can be found in the doc:<br>
<a href="https://doc.dpdk.org/guides/prog_guide/mbuf_lib.html#direct-and-indirect-buffers" rel="noreferrer" target="_blank">https://doc.dpdk.org/guides/prog_guide/mbuf_lib.html#direct-and-indirect-buffers</a><br>
<br>
<br>
</blockquote></div></div>