From mboxrd@z Thu Jan 1 00:00:00 1970 From: Olivier Matz Subject: Re: [PATCH] net/liquidio: do not touch mbuf initialized fields Date: Fri, 9 Jun 2017 13:59:40 +0200 Message-ID: <20170609135940.0c20c0e6@platinum> References: <1496920971-9400-1-git-send-email-shijith.thotton@caviumnetworks.com> <8a2d812e-846b-73fd-4418-6da5738005d5@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: Shijith Thotton , dev@dpdk.org To: Ferruh Yigit Return-path: Received: from mail-wr0-f169.google.com (mail-wr0-f169.google.com [209.85.128.169]) by dpdk.org (Postfix) with ESMTP id A5B0E2BB9 for ; Fri, 9 Jun 2017 13:59:43 +0200 (CEST) Received: by mail-wr0-f169.google.com with SMTP id q97so30581446wrb.2 for ; Fri, 09 Jun 2017 04:59:43 -0700 (PDT) In-Reply-To: <8a2d812e-846b-73fd-4418-6da5738005d5@intel.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hi Ferruh, On Fri, 9 Jun 2017 12:24:56 +0100, Ferruh Yigit 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 > > <...> > > > @@ -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