DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 1/4] net/mlx5: fix offset calculation of Multi-Packet Rx
@ 2018-05-12  1:35 Yongseok Koh
  2018-05-12  1:35 ` [dpdk-dev] [PATCH 2/4] net/mlx5: fix potential buffer overflow Yongseok Koh
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Yongseok Koh @ 2018-05-12  1:35 UTC (permalink / raw)
  To: shahafs, adrien.mazarguil, nelio.laranjeiro; +Cc: dev, Yongseok Koh

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

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;
-- 
2.11.0

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

end of thread, other threads:[~2018-05-14 12:04 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-12  1:35 [dpdk-dev] [PATCH 1/4] net/mlx5: fix offset calculation of Multi-Packet Rx Yongseok Koh
2018-05-12  1:35 ` [dpdk-dev] [PATCH 2/4] net/mlx5: fix potential buffer overflow Yongseok Koh
2018-05-14 12:03   ` Ferruh Yigit
2018-05-12  1:35 ` [dpdk-dev] [PATCH 3/4] net/mlx5: use coherent I/O memory barrier Yongseok Koh
2018-05-12  1:35 ` [dpdk-dev] [PATCH 4/4] net/mlx5: use correct field in a union structure Yongseok Koh
2018-05-13  6:42 ` [dpdk-dev] [PATCH 1/4] net/mlx5: fix offset calculation of Multi-Packet Rx Shahaf Shuler
2018-05-14 12:04 ` Ferruh Yigit

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