All of lore.kernel.org
 help / color / mirror / Atom feed
From: Olivier Matz <olivier.matz@6wind.com>
To: dev@dpdk.org, Ajit Khaparde <ajit.khaparde@broadcom.com>
Cc: Ferruh Yigit <ferruh.yigit@intel.com>, stable@dpdk.org
Subject: [PATCH v2 2/2] net/bnxt: fix headroom initialization
Date: Wed,  3 Jan 2018 11:32:25 +0100	[thread overview]
Message-ID: <20180103103225.7120-2-olivier.matz@6wind.com> (raw)
In-Reply-To: <20180103103225.7120-1-olivier.matz@6wind.com>

When allocating a new mbuf for Rx, the value of m->data_off should not
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.

Fixes: 2eb53b134aae ("net/bnxt: add initial Rx code")
Cc: stable@dpdk.org

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---

v1 -> v2:
- invert patches 1/2 and 2/2

Note for backport: the first version of this patch [1] may apply more
easily.

[1] https://dpdk.org/dev/patchwork/patch/32266/


 drivers/net/bnxt/bnxt_rxr.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_rxr.c b/drivers/net/bnxt/bnxt_rxr.c
index 89114ccb7..82c93d6dc 100644
--- a/drivers/net/bnxt/bnxt_rxr.c
+++ b/drivers/net/bnxt/bnxt_rxr.c
@@ -75,7 +75,7 @@ static inline int bnxt_alloc_rx_data(struct bnxt_rx_queue *rxq,
 
 	rx_buf->mbuf = mbuf;
 
-	rxbd->addr = rte_cpu_to_le_64(rte_mbuf_data_iova(mbuf));
+	rxbd->addr = rte_cpu_to_le_64(rte_mbuf_data_iova_default(mbuf));
 
 	return 0;
 }
@@ -102,7 +102,7 @@ static inline int bnxt_alloc_ag_data(struct bnxt_rx_queue *rxq,
 
 	rx_buf->mbuf = mbuf;
 
-	rxbd->addr = rte_cpu_to_le_64(rte_mbuf_data_iova(mbuf));
+	rxbd->addr = rte_cpu_to_le_64(rte_mbuf_data_iova_default(mbuf));
 
 	return 0;
 }
@@ -123,7 +123,7 @@ static inline void bnxt_reuse_rx_mbuf(struct bnxt_rx_ring_info *rxr,
 
 	prod_bd = &rxr->rx_desc_ring[prod];
 
-	prod_bd->addr = rte_cpu_to_le_64(rte_mbuf_data_iova(mbuf));
+	prod_bd->addr = rte_cpu_to_le_64(rte_mbuf_data_iova_default(mbuf));
 
 	rxr->rx_prod = prod;
 }
@@ -442,6 +442,7 @@ static int bnxt_rx_pkt(struct rte_mbuf **rx_pkt,
 
 	rte_prefetch0(mbuf);
 
+	mbuf->data_off = RTE_PKTMBUF_HEADROOM;
 	mbuf->nb_segs = 1;
 	mbuf->next = NULL;
 	mbuf->pkt_len = rxcmp->len;
-- 
2.11.0

  reply	other threads:[~2018-01-03 10:32 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-14 14:28 [PATCH 1/2] net/bnxt: fix headroom initialization Olivier Matz
2017-12-14 14:28 ` [PATCH 2/2] net/bnxt: use new API to get iova address Olivier Matz
2017-12-14 17:47   ` Ajit Khaparde
2017-12-14 17:47 ` [PATCH 1/2] net/bnxt: fix headroom initialization Ajit Khaparde
2017-12-16  2:30 ` [dpdk-stable] " Ferruh Yigit
2017-12-16 17:25   ` Olivier MATZ
2018-01-03 10:32 ` [PATCH v2 1/2] net/bnxt: use new API to get iova address Olivier Matz
2018-01-03 10:32   ` Olivier Matz [this message]
2018-01-10 20:49   ` 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=20180103103225.7120-2-olivier.matz@6wind.com \
    --to=olivier.matz@6wind.com \
    --cc=ajit.khaparde@broadcom.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=stable@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.