[2/2] app/testpmd: fix missing prefetch in macswap mode

Message ID 20190114100022.14867-2-yskoh@mellanox.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series [1/2] app/testpmd: fix wrong pointer reference in macswap |

Checks

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

Commit Message

Yongseok Koh Jan. 14, 2019, 10 a.m. UTC
  Prefetching packet was missing when do_macswap() was optimized.

Fixes: 62b52877adbe ("app/testpmd: batch MAC swap for performance on x86")
Cc: qi.z.zhang@intel.com
Cc: stable@dpdk.org

Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
---
 app/test-pmd/macswap_sse.h | 7 +++++++
 1 file changed, 7 insertions(+)
  

Comments

Iremonger, Bernard Jan. 14, 2019, 1:40 p.m. UTC | #1
> -----Original Message-----
> From: Yongseok Koh [mailto:yskoh@mellanox.com]
> Sent: Monday, January 14, 2019 10:00 AM
> To: Lu, Wenzhuo <wenzhuo.lu@intel.com>; Wu, Jingjing
> <jingjing.wu@intel.com>; Iremonger, Bernard <bernard.iremonger@intel.com>
> Cc: dev@dpdk.org; Zhang, Qi Z <qi.z.zhang@intel.com>; stable@dpdk.org
> Subject: [PATCH 2/2] app/testpmd: fix missing prefetch in macswap mode
> 
> Prefetching packet was missing when do_macswap() was optimized.
> 
> Fixes: 62b52877adbe ("app/testpmd: batch MAC swap for performance on x86")
> Cc: qi.z.zhang@intel.com
> Cc: stable@dpdk.org
> 
> Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
  

Patch

diff --git a/app/test-pmd/macswap_sse.h b/app/test-pmd/macswap_sse.h
index 662fe79cf9..2b6e7324da 100644
--- a/app/test-pmd/macswap_sse.h
+++ b/app/test-pmd/macswap_sse.h
@@ -35,6 +35,13 @@  do_macswap(struct rte_mbuf *pkts[], uint16_t nb,
 	r = nb;
 
 	while (r >= 4) {
+		if (r >= 8) {
+			rte_prefetch0(rte_pktmbuf_mtod(pkts[i + 4], void *));
+			rte_prefetch0(rte_pktmbuf_mtod(pkts[i + 5], void *));
+			rte_prefetch0(rte_pktmbuf_mtod(pkts[i + 6], void *));
+			rte_prefetch0(rte_pktmbuf_mtod(pkts[i + 7], void *));
+		}
+
 		mb[0] = pkts[i++];
 		eth_hdr[0] = rte_pktmbuf_mtod(mb[0], struct ether_hdr *);
 		addr0 = _mm_loadu_si128((__m128i *)eth_hdr[0]);