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>
Subject: Re: Strange behavior with rte_pktmbuf_clone cal
Date: Fri, 23 Dec 2022 08:43:17 -0800 [thread overview]
Message-ID: <20221223084317.580f966e@hermes.local> (raw)
In-Reply-To: <DM6PR10MB4124C6E61BBC5AD77E5F206696E99@DM6PR10MB4124.namprd10.prod.outlook.com>
On Fri, 23 Dec 2022 07:00:40 +0000
NAGENDRA BALAGANI <nagendra.balagani@oracle.com> wrote:
> Hi,
>
> I am seeing strange behavior where rte_pktmbuf_clone is not giving desired result.
> Here is the detailed info, in my dpdk application , once I received the packet info in mbuf, I need to send the same packet to two destinations, the sequence I should follow is,
>
> (i) First, Tunnel the packet to one of desired destination, so I created the shallow copy using rte_pktmbuf_clone, had another mbuf for Outer IP Header for IPinIP tunnel and sent to NIC.
>
> (ii) Second, I need to modify the source and destination ip addresses of the packet and send out.
As you showed, that won't work like you think.
A shallow clone means that both versions share the same data area.
If you modify one one instance both change.
The best practice is to consider a clone (or any mbuf with refcount > 1) as read only.
prev parent reply other threads:[~2022-12-23 16:43 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-23 7:00 Strange behavior with rte_pktmbuf_clone cal NAGENDRA BALAGANI
2022-12-23 16:25 ` Konstantin Ananyev
2022-12-23 16:43 ` Stephen Hemminger [this message]
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=20221223084317.580f966e@hermes.local \
--to=stephen@networkplumber.org \
--cc=dev@dpdk.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.