[dpdk-dev,1/4] net/mlx5: fix offset calculation of Multi-Packet Rx

Message ID 20180512013545.22279-1-yskoh@mellanox.com (mailing list archive)
State Accepted, archived
Delegated to: Shahaf Shuler
Headers

Checks

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

Commit Message

Yongseok Koh May 12, 2018, 1:35 a.m. UTC
  Offset in a MPRQ buffer must be calculated before updating the stride
index.

Fixes: f0d61f8f8953 ("net/mlx5: add Multi-Packet Rx support")

Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
---
 drivers/net/mlx5/mlx5_rxtx.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
  

Comments

Shahaf Shuler May 13, 2018, 6:42 a.m. UTC | #1
Saturday, May 12, 2018 4:36 AM, Yongseok Koh:
> Cc: dev@dpdk.org; Yongseok Koh <yskoh@mellanox.com>
> Subject: [PATCH 1/4] net/mlx5: fix offset calculation of Multi-Packet Rx
> 
> Offset in a MPRQ buffer must be calculated before updating the stride index.
> 
> Fixes: f0d61f8f8953 ("net/mlx5: add Multi-Packet Rx support")
> 
> Signed-off-by: Yongseok Koh <yskoh@mellanox.com>

Series applied to next-net-mlx, thanks.
  
Ferruh Yigit May 14, 2018, 12:04 p.m. UTC | #2
On 5/12/2018 2:35 AM, Yongseok Koh wrote:
> Offset in a MPRQ buffer must be calculated before updating the stride
> index.
> 
> Fixes: f0d61f8f8953 ("net/mlx5: add Multi-Packet Rx support")
> 
> Signed-off-by: Yongseok Koh <yskoh@mellanox.com>

Squashed into relevant commit in next-net, thanks.
  

Patch

diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c
index d960a73d5..387463792 100644
--- a/drivers/net/mlx5/mlx5_rxtx.c
+++ b/drivers/net/mlx5/mlx5_rxtx.c
@@ -2146,6 +2146,8 @@  mlx5_rx_burst_mprq(void *dpdk_rxq, struct rte_mbuf **pkts, uint16_t pkts_n)
 		consumed_strd = (byte_cnt & MLX5_MPRQ_STRIDE_NUM_MASK) >>
 				MLX5_MPRQ_STRIDE_NUM_SHIFT;
 		assert(consumed_strd);
+		/* Calculate offset before adding up stride index. */
+		offset = strd_idx * strd_sz + strd_shift;
 		strd_idx += consumed_strd;
 		if (byte_cnt & MLX5_MPRQ_FILLER_MASK)
 			continue;
@@ -2169,7 +2171,6 @@  mlx5_rx_burst_mprq(void *dpdk_rxq, struct rte_mbuf **pkts, uint16_t pkts_n)
 		assert((int)len >= (rxq->crc_present << 2));
 		if (rxq->crc_present)
 			len -= ETHER_CRC_LEN;
-		offset = strd_idx * strd_sz + strd_shift;
 		addr = RTE_PTR_ADD(mlx5_mprq_buf_addr(buf), offset);
 		/* Initialize the offload flag. */
 		pkt->ol_flags = 0;