DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Padam Jeet Singh <padam.singh@inventum.net>
Cc: "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] Packet Cloning
Date: Thu, 28 May 2015 07:52:44 -0700	[thread overview]
Message-ID: <20150528075244.469b8557@urahara> (raw)
In-Reply-To: <57F6A61F-5629-4D11-A78C-397DBB4E8381@inventum.net>

On Thu, 28 May 2015 17:15:42 +0530
Padam Jeet Singh <padam.singh@inventum.net> wrote:

> Hello,
> 
> Is there a function in DPDK to completely clone a pkt_mbuf including the segments? 
> 
> I am trying to build a packet mirroring application which sends packet out through two separate interfaces, but the packet payload needs to be altered before send.
> 
> Thanks,
> Padam
> 
> 

Isn't this what you want?

/**
 * Creates a "clone" of the given packet mbuf.
 *
 * Walks through all segments of the given packet mbuf, and for each of them:
 *  - Creates a new packet mbuf from the given pool.
 *  - Attaches newly created mbuf to the segment.
 * Then updates pkt_len and nb_segs of the "clone" packet mbuf to match values
 * from the original packet mbuf.
 *
 * @param md
 *   The packet mbuf to be cloned.
 * @param mp
 *   The mempool from which the "clone" mbufs are allocated.
 * @return
 *   - The pointer to the new "clone" mbuf on success.
 *   - NULL if allocation fails.
 */
static inline struct rte_mbuf *rte_pktmbuf_clone(struct rte_mbuf *md,
		struct rte_mempool *mp)

  reply	other threads:[~2015-05-28 14:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-28 11:45 Padam Jeet Singh
2015-05-28 14:52 ` Stephen Hemminger [this message]
2015-05-28 15:10   ` Matt Laswell
2015-05-28 15:38     ` Kyle Larose
2015-05-28 16:06       ` Matt Laswell
2015-05-28 16:13         ` Marc Sune
2015-05-29  8:34           ` Padam Jeet Singh

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=20150528075244.469b8557@urahara \
    --to=stephen@networkplumber.org \
    --cc=dev@dpdk.org \
    --cc=padam.singh@inventum.net \
    /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).