DPDK patches and discussions
 help / color / mirror / Atom feed
* rte_pktmbuf_alloc() is returning same address on two consecutive calls
@ 2023-02-23 14:54 NAGENDRA BALAGANI
  2023-02-23 18:01 ` Stephen Hemminger
  0 siblings, 1 reply; 3+ messages in thread
From: NAGENDRA BALAGANI @ 2023-02-23 14:54 UTC (permalink / raw)
  To: dev; +Cc: Kapil Kumar Jain, Ramakamesh Duvvuri

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

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


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

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

end of thread, other threads:[~2023-03-16 11:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-23 14:54 rte_pktmbuf_alloc() is returning same address on two consecutive calls NAGENDRA BALAGANI
2023-02-23 18:01 ` Stephen Hemminger
2023-03-16 11:01   ` [External] : " NAGENDRA BALAGANI

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