DPDK patches and discussions
 help / color / mirror / Atom feed
From: NAGENDRA BALAGANI <nagendra.balagani@oracle.com>
To: "dev@dpdk.org" <dev@dpdk.org>
Cc: Kapil Kumar Jain <kapil.k.jain@oracle.com>,
	Ramakamesh Duvvuri <kamesh.duvvuri@oracle.com>
Subject: rte_pktmbuf_alloc() is returning same address on two consecutive calls
Date: Thu, 23 Feb 2023 14:54:13 +0000	[thread overview]
Message-ID: <DM6PR10MB412447E861CE1462055DD94B96AB9@DM6PR10MB4124.namprd10.prod.outlook.com> (raw)

[-- 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 --]

             reply	other threads:[~2023-02-23 14:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-23 14:54 NAGENDRA BALAGANI [this message]
2023-02-23 18:01 ` Stephen Hemminger
2023-03-16 11:01   ` [External] : " NAGENDRA BALAGANI

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DM6PR10MB412447E861CE1462055DD94B96AB9@DM6PR10MB4124.namprd10.prod.outlook.com \
    --to=nagendra.balagani@oracle.com \
    --cc=dev@dpdk.org \
    --cc=kamesh.duvvuri@oracle.com \
    --cc=kapil.k.jain@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).