DPDK usage discussions
 help / color / mirror / Atom feed
From: "Александр Самойлов" <cidjey1991@mail.ru>
To: "\"Wiles, Keith\"" <keith.wiles@intel.com>, users <users@dpdk.org>
Subject: Re: [dpdk-users] A question about rte_pktmbuf_init() and alike functions
Date: Tue, 03 Nov 2015 22:44:22 +0300	[thread overview]
Message-ID: <1446579862.835733524@f406.i.mail.ru> (raw)
In-Reply-To: <48648717-1A5C-4292-AA60-17A08126F89D@intel.com>

 Oh, that's emberrasing. After another manual reading I found this one (in mbuf section of Programmer's Guide): 

Freeing a mbuf means returning it into its original mempool. The content of an mbuf is not modified when it is stored in a pool (as a free mbuf). Fields initialized by the constructor do not need to be re-initialized at mbuf allocation.

Should've guessed then. But still, maybe it's reasonable to highlight this part a little? Smth like "So you can't safely use a mbuf repeatedly without memzeroing its content" or smth? :)

P.S. Sorry for disturbance


>
>
>On 11/3/15, 1:23 PM, "users on behalf of Александр Самойлов" < users-bounces@dpdk.org on behalf of  cidjey1991@mail.ru > wrote:
>
>> An update. I decided to try this:
>>
>>m = rte_pktmbuf_alloc(mp);
>>if(unlikely(m == NULL))
>>{
>>    RTE_LOG(INFO, USER1, "%s: Couldn't allocate pkt_mbuf\n", __func__);
>>    return NULL;
>>}
>>rte_pktmbuf_init(mp, NULL, m, 0);
>>rte_mbuf_refcnt_set(m, 1);
>>Well, it worked out. My memory is not dirty anymore and TCP checksum is always OK. Thank you for the input.
>>But this raises another question: You said that rte_pktmbuf_alloc() implies resetting the buffer to a "sane state". 
>>So why this reset doesn't make my new "m" buffer "sane enough" to keep a new frame while rte_pktmbuf_init does?
>
>You can look at the code, but the reset tries to do the least amount work in touching the mbuf header for performance.
>>
>>
>>Alex Samoylov
>>
>>
>>
>
>
>Regards,
>Keith
>
>
>
>


  reply	other threads:[~2015-11-03 19:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-03 19:23 Александр Самойлов
2015-11-03 19:27 ` Wiles, Keith
2015-11-03 19:44   ` Александр Самойлов [this message]
  -- strict thread matches above, loose matches on Subject: below --
2015-11-03 17:49 Александр Самойлов
2015-11-03 18:52 ` Wiles, Keith
2015-11-03 18:53 ` Matt Laswell

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=1446579862.835733524@f406.i.mail.ru \
    --to=cidjey1991@mail.ru \
    --cc=keith.wiles@intel.com \
    --cc=users@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).