From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-io0-f196.google.com (mail-io0-f196.google.com [209.85.223.196]) by dpdk.org (Postfix) with ESMTP id 274914CA6 for ; Thu, 8 Mar 2018 06:57:20 +0100 (CET) Received: by mail-io0-f196.google.com with SMTP id e7so5785129ioj.1 for ; Wed, 07 Mar 2018 21:57:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=xEZoYmpvTxsPek+TzzZaw27bdAuRHWykFxhl3AIKQgc=; b=F+D+HXFTbyz20+o/4tBDxDld30hYfzKbT/p9E6cihDFA7l7qnZCasLu4G3T7ybbh4A w15GFwcyMYqnuIZZ1dM5e+3BqrfwKU0EqEvX3dP7TQhUBC9PZTX7j8SjXsWDovCAnB5f lTEQY5C0aUBxvRmorOdjEZoj4mTENY5aHXT0XmirjeYUG/RjgbjOhavTs3wybJ6Jlxg6 gHpFAfbnvCEk7jCVn2FgUeQptZ0gwDAt1LdEyn9j5aYxop+qqMvIwZNlxeKQCWhht8ww xwExbHE6+FnJUh/qkOUQ1JTrGkO8X0FgG+4vDyttGvQ7fbKEMX/ytKMcOlkNJVf/vE8M KstQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=xEZoYmpvTxsPek+TzzZaw27bdAuRHWykFxhl3AIKQgc=; b=LqrFCddHH/IvMBOf4r7J6K36BJTaANgIhwuz80EMAWOAcc4/siqXwSzlNRF1wzopp2 vr5CPG5sC+EidNEDFoDl5MoMnkZ2nmr1gzRhueI73Dpw/A7NuhX027TxeoZS1+hkWxlc nKCyGggMA3EP3u9s/Nr0RDhLHiioj5cADqvUFKhu5Dm3mwgZVHqfaDduq/b+MyM1+/fd 1OqgLa4cXCiIXb1ZHSsZUA1xeJ82kMdh4Yh1evvphHK3Hk+S8I474vaerq4A5WJWFmfQ c+DHsCj1bQ5FmSw5LfoDvLAacR2mEvTUAnvjwXugvu15Erb+5f6uHg21SzsZIxSLN+Cq iysA== X-Gm-Message-State: APf1xPB+ybwd0oIH4eYLrCG5IqiivE0U3fhUgu/m/LrVsWLd49ejGzmh i+EreGGxGjTCSWUXhg+4vhSYpmSArz8Zn5OEVQk= X-Google-Smtp-Source: AG47ELsLwB3Nzvaib3xcFCNVqcFfIOfFiWdvpihZxOzRK254NwDryCUCo6Cb1KIqylnYvqQISq8ioEShIMifjEe/DW0= X-Received: by 10.107.181.2 with SMTP id e2mr29515908iof.188.1520488639425; Wed, 07 Mar 2018 21:57:19 -0800 (PST) MIME-Version: 1.0 References: <6fd6d52e-a756-45ad-9666-60fa7ca676cd@zyc-PC.local> <4a1a34a8-87a9-5776-dfeb-1be4fe59eb12@intel.com> In-Reply-To: <4a1a34a8-87a9-5776-dfeb-1be4fe59eb12@intel.com> From: zhouyangchao Date: Thu, 08 Mar 2018 05:57:09 +0000 Message-ID: To: Ferruh Yigit Cc: dev@dpdk.org, harish.patil@cavium.com, rasesh.mody@cavium.com Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] [PATCH] net/bnx2x: reserve enough headroom for mbuf prepend X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Mar 2018 05:57:20 -0000 When allocating a new mbuf for Rx, the value of m->data_off should be reset to its default value (RTE_PKTMBUF_HEADROOM), instead of reusing the previous undefined value, which could cause the packet to have a too small or too high headroom. On Mon, Mar 5, 2018 at 11:28 PM Ferruh Yigit wrote: > On 2/6/2018 11:21 AM, zhouyangchao wrote: > > Can you please provide more information why this patch is needed? > > > Signed-off-by: Yangchao Zhou > > --- > > drivers/net/bnx2x/bnx2x_rxtx.c | 8 +++++--- > > 1 file changed, 5 insertions(+), 3 deletions(-) > > > > diff --git a/drivers/net/bnx2x/bnx2x_rxtx.c > b/drivers/net/bnx2x/bnx2x_rxtx.c > > index a0d4ac9..d8a3225 100644 > > --- a/drivers/net/bnx2x/bnx2x_rxtx.c > > +++ b/drivers/net/bnx2x/bnx2x_rxtx.c > > @@ -140,7 +140,8 @@ bnx2x_dev_rx_queue_setup(struct rte_eth_dev *dev, > > return -ENOMEM; > > } > > rxq->sw_ring[idx] = mbuf; > > - rxq->rx_ring[idx] = mbuf->buf_iova; > > + rxq->rx_ring[idx] = > > + rte_cpu_to_le_64(rte_mbuf_data_iova_default(mbuf)); > > } > > rxq->pkt_first_seg = NULL; > > rxq->pkt_last_seg = NULL; > > @@ -400,7 +401,8 @@ bnx2x_recv_pkts(void *p_rxq, struct rte_mbuf > **rx_pkts, uint16_t nb_pkts) > > > > rx_mb = rxq->sw_ring[bd_cons]; > > rxq->sw_ring[bd_cons] = new_mb; > > - rxq->rx_ring[bd_prod] = new_mb->buf_iova; > > + rxq->rx_ring[bd_prod] = > > + > rte_cpu_to_le_64(rte_mbuf_data_iova_default(new_mb)); > > > > rx_pref = NEXT_RX_BD(bd_cons) & MAX_RX_BD(rxq); > > rte_prefetch0(rxq->sw_ring[rx_pref]); > > @@ -409,7 +411,7 @@ bnx2x_recv_pkts(void *p_rxq, struct rte_mbuf > **rx_pkts, uint16_t nb_pkts) > > rte_prefetch0(&rxq->sw_ring[rx_pref]); > > } > > > > - rx_mb->data_off = pad; > > + rx_mb->data_off = pad + RTE_PKTMBUF_HEADROOM; > > rx_mb->nb_segs = 1; > > rx_mb->next = NULL; > > rx_mb->pkt_len = rx_mb->data_len = len; > > > >