patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH 1/2] net/bnxt: fix headroom initialization
@ 2017-12-14 14:28 Olivier Matz
  2017-12-14 17:47 ` Ajit Khaparde
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Olivier Matz @ 2017-12-14 14:28 UTC (permalink / raw)
  To: dev, Stephen Hurd, Ajit Khaparde; +Cc: stable

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>
---
 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 188df362e..3fff4d437 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 = data;
 
-	rxbd->addr = rte_cpu_to_le_64(RTE_MBUF_DATA_DMA_ADDR(rx_buf->mbuf));
+	rxbd->addr = rte_cpu_to_le_64(rte_mbuf_data_dma_addr_default(data));
 
 	return 0;
 }
@@ -102,7 +102,7 @@ static inline int bnxt_alloc_ag_data(struct bnxt_rx_queue *rxq,
 
 	rx_buf->mbuf = data;
 
-	rxbd->addr = rte_cpu_to_le_64(RTE_MBUF_DATA_DMA_ADDR(rx_buf->mbuf));
+	rxbd->addr = rte_cpu_to_le_64(rte_mbuf_data_dma_addr_default(data));
 
 	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_DMA_ADDR(mbuf));
+	prod_bd->addr = rte_cpu_to_le_64(rte_mbuf_data_dma_addr_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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-stable] [PATCH 1/2] net/bnxt: fix headroom initialization
  2017-12-14 14:28 [dpdk-stable] [PATCH 1/2] net/bnxt: fix headroom initialization Olivier Matz
@ 2017-12-14 17:47 ` Ajit Khaparde
  2017-12-16  2:30 ` Ferruh Yigit
       [not found] ` <20180103103225.7120-1-olivier.matz@6wind.com>
  2 siblings, 0 replies; 5+ messages in thread
From: Ajit Khaparde @ 2017-12-14 17:47 UTC (permalink / raw)
  To: Olivier Matz; +Cc: dev, Stephen Hurd, dpdk stable

On Thu, Dec 14, 2017 at 6:28 AM, Olivier Matz <olivier.matz@6wind.com>
wrote:

> 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>
​​

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-stable] [PATCH 1/2] net/bnxt: fix headroom initialization
  2017-12-14 14:28 [dpdk-stable] [PATCH 1/2] net/bnxt: fix headroom initialization Olivier Matz
  2017-12-14 17:47 ` Ajit Khaparde
@ 2017-12-16  2:30 ` Ferruh Yigit
  2017-12-16 17:25   ` Olivier MATZ
       [not found] ` <20180103103225.7120-1-olivier.matz@6wind.com>
  2 siblings, 1 reply; 5+ messages in thread
From: Ferruh Yigit @ 2017-12-16  2:30 UTC (permalink / raw)
  To: Olivier Matz, dev, Ajit Khaparde; +Cc: stable

On 12/14/2017 6:28 AM, Olivier Matz wrote:
> 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>
> ---
>  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 188df362e..3fff4d437 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 = data;
>  
> -	rxbd->addr = rte_cpu_to_le_64(RTE_MBUF_DATA_DMA_ADDR(rx_buf->mbuf));
> +	rxbd->addr = rte_cpu_to_le_64(rte_mbuf_data_dma_addr_default(data));

Hi Olivier,

Using deprecated rte_mbuf_data_dma_addr_default() breaks build for this commit.

What do you think using directly rte_mbuf_data_iova_default() in this patch?

Thanks,
ferruh

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-stable] [PATCH 1/2] net/bnxt: fix headroom initialization
  2017-12-16  2:30 ` Ferruh Yigit
@ 2017-12-16 17:25   ` Olivier MATZ
  0 siblings, 0 replies; 5+ messages in thread
From: Olivier MATZ @ 2017-12-16 17:25 UTC (permalink / raw)
  To: Ferruh Yigit; +Cc: dev, Ajit Khaparde, stable

Hi Ferruh,

On Fri, Dec 15, 2017 at 06:30:58PM -0800, Ferruh Yigit wrote:
> On 12/14/2017 6:28 AM, Olivier Matz wrote:
> > 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>
> > ---
> >  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 188df362e..3fff4d437 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 = data;
> >  
> > -	rxbd->addr = rte_cpu_to_le_64(RTE_MBUF_DATA_DMA_ADDR(rx_buf->mbuf));
> > +	rxbd->addr = rte_cpu_to_le_64(rte_mbuf_data_dma_addr_default(data));
> 
> Hi Olivier,
> 
> Using deprecated rte_mbuf_data_dma_addr_default() breaks build for this commit.
> 
> What do you think using directly rte_mbuf_data_iova_default() in this patch?

No problem. It was initially split in 2 patches to ease the backport for
stable versions.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [dpdk-stable] [PATCH v2 2/2] net/bnxt: fix headroom initialization
       [not found] ` <20180103103225.7120-1-olivier.matz@6wind.com>
@ 2018-01-03 10:32   ` Olivier Matz
  0 siblings, 0 replies; 5+ messages in thread
From: Olivier Matz @ 2018-01-03 10:32 UTC (permalink / raw)
  To: dev, Ajit Khaparde; +Cc: Ferruh Yigit, stable

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-01-03 10:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-14 14:28 [dpdk-stable] [PATCH 1/2] net/bnxt: fix headroom initialization Olivier Matz
2017-12-14 17:47 ` Ajit Khaparde
2017-12-16  2:30 ` Ferruh Yigit
2017-12-16 17:25   ` Olivier MATZ
     [not found] ` <20180103103225.7120-1-olivier.matz@6wind.com>
2018-01-03 10:32   ` [dpdk-stable] [PATCH v2 2/2] " Olivier Matz

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).