Skip to contentSkip to conversation

net/fm10k: fix descriptor filling in vector Tx

PATCH Applied Xiao Wang 2 participants 2 messages Jul 3, 2019 – Jul 8, 2019 Network drivers

lore
Share & tools
lore

Xiao Wang

author
#0 lore raw

PATCH 1/1 net/fm10k: fix descriptor filling in vector Tx

The shift left operation "pkt->vlan_tci << 16" gets vlan_tci extended to signed type and may cause invalid descriptor. Also the same issue for the "data_len" field. This patch fixes it by casting them to uint64_t.

Fixes 21f13c541eb0 ("fm10k: add vector Tx")
---
 drivers/net/fm10k/fm10k_rxtx_vec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/fm10k/fm10k_rxtx_vec.c +1 -1
index 96b46a2bd..788e2484a 100644
@@ -711,7 +711,7 @@ vtx1(volatile struct fm10k_tx_desc *txdp,
 		struct rte_mbuf *pkt, uint64_t flags)
 {
 	__m128i descriptor = _mm_set_epi64x(flags << 56 |
-			pkt->vlan_tci << 16 | pkt->data_len,
+			(uint64_t)pkt->vlan_tci << 16 | (uint64_t)pkt->data_len,
 			MBUF_DMA_ADDR(pkt));
 	_mm_store_si128((__m128i *)txdp, descriptor);
 }
Signature · 1 line
2.15.1
Acked-by on v1 1/1 Applied
#1 lore raw
Quoted 10 lines

-----Original Message-----
From: Wang, Xiao W
Sent: Wednesday, July 3, 2019 10:54 AM
To: Zhang, Qi Z <[email protected]>
Cc: [email protected]; Kiejdo, Marek <[email protected]>; Wang, Xiao W <[email protected]>; [email protected]
Subject: [PATCH] net/fm10k: fix descriptor filling in vector Tx

Quoted 8 lines

The shift left operation "pkt->vlan_tci << 16" gets vlan_tci extended to signed type and may cause invalid descriptor. Also the same issue for the "data_len" field. This patch fixes it by casting them to uint64_t.

Fixes 21f13c541eb0 ("fm10k: add vector Tx")

Applied to dpdk-next-net-intel.

Thanks
Qi