rte_pktmbuf_alloc() is returning same address on two consecutive calls

NAGENDRA BALAGANI nagendra.balagani at oracle.com
Thu Feb 23 15:54:13 CET 2023


Hi Team,

In my dpdk application, I am facing an issue where rte_pktmbuf_alloc() is returning same address for two consecutive calls in a single thread context.

Following is the code snippet,

int Func(struct rte_mbuf *mblk)
{
              struct rte_mbuf *tmpbuf = nullptr;;
              struct rte_mbuf *copybuf  = nullptr;
              char  *nextPtr = NULL;

              tmpbuf = rte_pktmbuf_alloc(mbuf_pool);

              nextPtr = rte_pktmbuf_append(tmpbuf, IPV4_HDR_LEN);
              //update some info on nextptr

              copybuf = rte_pktmbuf_copy(mblk, mbuf_pool, 0, pkt_len);

              ....
              return 0;
}

With the above snippet, 'tmpbuf' and 'copybuf' which are getting allocated from same pool (mbuf_pool), pointing to same address, Due to this tmpbuf which gets allocated first, and further populated, is getting over written inside rte_pktmbuf_copy() call which is not expected .
When I further debug , rte_pktmbuf_copy() is internally using rte_pktmbuf_alloc() to get the free buffer from mbuf_pool and copy the data from mblk.

Please let us know if there is any known issue with rte_pktmbuf_alloc(), and why it may be giving same address on two consecutive calls.

Regards,
Nagendra

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mails.dpdk.org/archives/dev/attachments/20230223/2c9496f1/attachment-0001.htm>


More information about the dev mailing list