DPDK patches and discussions
 help / color / mirror / Atom feed
From: Olivier Matz <olivier.matz@6wind.com>
To: Ferruh Yigit <ferruh.yigit@intel.com>
Cc: Shijith Thotton <shijith.thotton@caviumnetworks.com>, dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH] net/liquidio: do not touch mbuf initialized fields
Date: Fri, 9 Jun 2017 13:59:40 +0200	[thread overview]
Message-ID: <20170609135940.0c20c0e6@platinum> (raw)
In-Reply-To: <8a2d812e-846b-73fd-4418-6da5738005d5@intel.com>

Hi Ferruh,

On Fri, 9 Jun 2017 12:24:56 +0100, Ferruh Yigit <ferruh.yigit@intel.com> wrote:
> On 6/8/2017 12:22 PM, Shijith Thotton wrote:
> > Avoid re-initializing of mbuf fields which are set while in pool.
> > Replaced lio_recv_buffer_alloc with rte_pktmbuf_alloc.
> > 
> > See commit 8f094a9ac5d7 ("mbuf: set mbuf fields while in pool").
> > 
> > Signed-off-by: Shijith Thotton <shijith.thotton@caviumnetworks.com>  
> 
> <...>
> 
> > @@ -489,9 +466,6 @@
> >  			droq->refill_count++;
> >  
> >  			if (likely(nicbuf != NULL)) {
> > -				nicbuf->data_off = RTE_PKTMBUF_HEADROOM;  
> 
> Hi Shijith, Olivier,
> 
> nb_segs and next are initialized properly when mbuf allocated, but is
> "data_off = RTE_PKTMBUF_HEADROOM" guaranteed?
> 
> > -				nicbuf->nb_segs = 1;
> > -				nicbuf->next = NULL;
> >  				/* We don't have a way to pass flags yet */
> >  				nicbuf->ol_flags = 0;
> >  				if (rh->r_dh.has_hash) {  
> 
> <...>

It's not guaranteed when using a raw allocation, i.e. rte_mbuf_raw_alloc()
or rte_mempool_get(). The PMD usually use these functions in Rx path to
fully initialize the mbuf fields on their own.

In this driver, it looks it uses rte_pktmbuf_alloc(), which calls
rte_pktmbuf_reset(), fully initializing the mbuf struct. So data_off is
properly set.


As a side note, I wonder if lio_recv_buffer_alloc() replaced by
rte_pktmbuf_alloc() everywhere in the code.


Olivier

  reply	other threads:[~2017-06-09 11:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-08 11:22 Shijith Thotton
2017-06-09 11:24 ` Ferruh Yigit
2017-06-09 11:59   ` Olivier Matz [this message]
2017-06-09 13:24 ` Ferruh Yigit

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=20170609135940.0c20c0e6@platinum \
    --to=olivier.matz@6wind.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=shijith.thotton@caviumnetworks.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).