[dpdk-dev] net/mlx5: fix buffer address posting in vectorized Rx

Message ID 20170801163520.46022-1-yskoh@mellanox.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Yongseok Koh Aug. 1, 2017, 4:35 p.m. UTC
  The data_off field of newly allocated mbufs is stale data. This shouldn't
be used in calculating Rx address for device when posting free buffers.
RTE_PKTMBUF_HEADROOM should be used instead and data_off of a mbuf will be
reset on packet reception anyway.

Fixes: 6cb559d67b83 ("net/mlx5: add vectorized Rx/Tx burst for x86")

Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
---
 drivers/net/mlx5/mlx5_rxtx_vec_sse.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
  

Comments

Thomas Monjalon Aug. 3, 2017, 9:19 p.m. UTC | #1
01/08/2017 18:35, Yongseok Koh:
> The data_off field of newly allocated mbufs is stale data. This shouldn't
> be used in calculating Rx address for device when posting free buffers.
> RTE_PKTMBUF_HEADROOM should be used instead and data_off of a mbuf will be
> reset on packet reception anyway.
> 
> Fixes: 6cb559d67b83 ("net/mlx5: add vectorized Rx/Tx burst for x86")
> 
> Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
> Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>

Applied, thanks
  

Patch

diff --git a/drivers/net/mlx5/mlx5_rxtx_vec_sse.c b/drivers/net/mlx5/mlx5_rxtx_vec_sse.c
index 74e595386..9be48a0c9 100644
--- a/drivers/net/mlx5/mlx5_rxtx_vec_sse.c
+++ b/drivers/net/mlx5/mlx5_rxtx_vec_sse.c
@@ -568,7 +568,8 @@  rxq_replenish_bulk_mbuf(struct rxq *rxq, uint16_t n)
 		return;
 	}
 	for (i = 0; i < n; ++i)
-		wq[i].addr = htonll(rte_pktmbuf_mtod(elts[i], uintptr_t));
+		wq[i].addr = htonll((uintptr_t)elts[i]->buf_addr +
+				    RTE_PKTMBUF_HEADROOM);
 	rxq->rq_ci += n;
 	rte_wmb();
 	*rxq->rq_db = htonl(rxq->rq_ci);