DPDK patches and discussions
 help / color / mirror / Atom feed
From: sabu kurian <sabu2kurian@gmail.com>
To: "Richardson, Bruce" <bruce.richardson@intel.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] Packet crafting....
Date: Fri, 14 Mar 2014 17:08:01 +0530	[thread overview]
Message-ID: <CAJ2bnfBgJiGQ+VumJY6f6R8ecmvEnQ4D24TyiXWmBwQxR6jZJg@mail.gmail.com> (raw)
In-Reply-To: <59AF69C657FD0841A61C55336867B5B01A9C452F@IRSMSX103.ger.corp.intel.com>

Thanks on the reply Richardson. You did mention something like "Don't
forget that when you get the mbuf from rte_pktmbuf_alloc, you also need to
set the length value to the appropriate size." .

 Like I'm allocating the mbuf using rte_mbuf . The rte_mempool_create has
already set the maximum packet size for a mbuf and the number of mbuf's and
all. So do I really need to use rte_pktmbuf_alloc ?


On Fri, Mar 14, 2014 at 4:38 PM, Richardson, Bruce <
bruce.richardson@intel.com> wrote:

>
> > From: sabu kurian [mailto:sabu2kurian@gmail.com]
> > Sent: Friday, March 14, 2014 10:09 AM
> > To: Richardson, Bruce
> > Cc: dev@dpdk.org
> > Subject: Re: [dpdk-dev] Packet crafting....
> >
> > Thank you very much Richardson for your valuable reply. But is there
> another way of doing it using the rte_pktmbuf_append / rte_pktmbuf_prepend
> ? Can you please tell me on how to do that ?
>
> You could use pktmbuf_append and pktmbuf_prepend, but they are primarily
> designed to add headers/footers on to an existing packet that already has
> headers, so that you don't need to move the existing data. In the case of
> having to craft a packet from scratch, there is no existing data in the
> mbuf, so the whole packet can just be filled in sequentially. [Don't forget
> that when you get the mbuf from rte_pktmbuf_alloc, you also need to set the
> length value to the appropriate size.]
>
> However, if you first write the data to the mbuf and then want to add the
> headers in order, like a packet moving down through layers of a stack,  you
> can use prepend to add udp, then ip, then your ethernet header, but this
> will be no faster than just writing the data directly to the mbuf space,
> and may be slightly slower as each prepend call has to just the length
> values and data pointer values in the mbuf. Each header prepended also uses
> up headroom in the mbuf, so you can only add 128-bytes of headers by
> default to each packet.
>
> In short, if you are creating a single packet, I'd recommend just getting
> the data pointer from the returned mbuf and writing directly to that.
>
> Regards,
> /Bruce
>

  reply	other threads:[~2014-03-14 11:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-14  9:31 sabu kurian
2014-03-14  9:57 ` Richardson, Bruce
2014-03-14 10:09   ` sabu kurian
2014-03-14 11:08     ` Richardson, Bruce
2014-03-14 11:38       ` sabu kurian [this message]
2014-03-14 11:49         ` Richardson, Bruce
2014-03-14 12:04           ` sabu kurian

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=CAJ2bnfBgJiGQ+VumJY6f6R8ecmvEnQ4D24TyiXWmBwQxR6jZJg@mail.gmail.com \
    --to=sabu2kurian@gmail.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    /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).