From: Stephen Hemminger <stephen@networkplumber.org>
To: NAGENDRA BALAGANI <nagendra.balagani@oracle.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
Kapil Kumar Jain <kapil.k.jain@oracle.com>,
Ramakamesh Duvvuri <kamesh.duvvuri@oracle.com>
Subject: Re: rte_pktmbuf_alloc() is returning same address on two consecutive calls
Date: Thu, 23 Feb 2023 10:01:26 -0800 [thread overview]
Message-ID: <20230223100126.6ad6d06b@hermes.local> (raw)
In-Reply-To: <DM6PR10MB412447E861CE1462055DD94B96AB9@DM6PR10MB4124.namprd10.prod.outlook.com>
On Thu, 23 Feb 2023 14:54:13 +0000
NAGENDRA BALAGANI <nagendra.balagani@oracle.com> wrote:
> 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
>
Most likely your mbuf pool has gotten corrupted before you get to that code.
Try building with the config options for POOL and MBUF debug.
next prev parent reply other threads:[~2023-02-23 18:01 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-23 14:54 NAGENDRA BALAGANI
2023-02-23 18:01 ` Stephen Hemminger [this message]
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=20230223100126.6ad6d06b@hermes.local \
--to=stephen@networkplumber.org \
--cc=dev@dpdk.org \
--cc=kamesh.duvvuri@oracle.com \
--cc=kapil.k.jain@oracle.com \
--cc=nagendra.balagani@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).