path: root/drivers/net/virtio/virtio_rxtx_simple.c
diff options
authorYuanhan Liu <>2016-09-26 12:29:13 +0800
committerYuanhan Liu <>2016-09-28 02:18:39 +0200
commit0af54f09d9304bc88c869fb2772523330538db08 (patch)
tree697876818bbc142a0895e3894db23a2639eac82a /drivers/net/virtio/virtio_rxtx_simple.c
parentca8326a94365a5444098d76711d4bfb59ba28b26 (diff)
net: fix clang build
Interestingly, clang and gcc has different prototype for _mm_prefetch(). For gcc, we have _mm_prefetch (const void *__P, enum _mm_hint __I) While for clang, it's #define _mm_prefetch(a, sel) (__builtin_prefetch((void *)(a), 0, (sel))) That's how the following error comes with clang: error: cast from 'const void *' to 'void *' drops const qualifier [-Werror,-Wcast-qual] _mm_prefetch((const void *)rused, _MM_HINT_T0); /usr/lib/llvm-3.8/bin/../lib/clang/3.8.0/include/xmmintrin.h:684:58: note: expanded from macro '_mm_prefetch' #define _mm_prefetch(a, sel) (__builtin_prefetch((void *)(a), 0, (sel))) What's weird is that the build was actaully Okay before. I met it while apply Jerin's vector support for ARM patch set: he just move this piece of code to another file, nothing else changed. This patch fix the issue when Jerin's patchset is applied. Thus, I think it's still needed. Similarly, make the same change to other _mm_prefetch users, just in case this weird issue shows up again somehow later. Fixes: fc3d66212fed ("virtio: add vector Rx") Fixes: c95584dc2b18 ("ixgbe: new vectorized functions for Rx/Tx") Fixes: 9ed94e5bb04e ("i40e: add vector Rx") Fixes: 7092be8437bd ("fm10k: add vector Rx") Signed-off-by: Yuanhan Liu <> Acked-by: Jing Chen <>
Diffstat (limited to 'drivers/net/virtio/virtio_rxtx_simple.c')
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/virtio/virtio_rxtx_simple.c b/drivers/net/virtio/virtio_rxtx_simple.c
index 6517aa8..d8dd17c 100644
--- a/drivers/net/virtio/virtio_rxtx_simple.c
+++ b/drivers/net/virtio/virtio_rxtx_simple.c
@@ -200,7 +200,7 @@ virtio_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
sw_ring = &vq->sw_ring[desc_idx];
sw_ring_end = &vq->sw_ring[vq->vq_nentries];
- _mm_prefetch((const void *)rused, _MM_HINT_T0);
+ rte_prefetch0(rused);
if (vq->vq_free_cnt >= RTE_VIRTIO_VPMD_RX_REARM_THRESH) {