net/virtio: fix Arm build with old compiler
authorJoyce Kong <joyce.kong@arm.com>
Tue, 26 Jan 2021 09:57:43 +0000 (17:57 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 29 Jan 2021 17:16:10 +0000 (18:16 +0100)
In file included from ../drivers/net/virtio/virtio_rxtx_packed.c:22:0:
../drivers/net/virtio/virtio_rxtx_packed_neon.h:
In function ‘virtqueue_enqueue_batch_packed_vec’:
../drivers/net/virtio/virtio_rxtx_packed_neon.h:74:2: warning:
implicit declaration of function ‘vreinterpretq_p128_u32’
[-Wimplicit-function-declaration]
poly128_t cmp1 = vreinterpretq_p128_u32(~vceqq_u32(ref_seg, def_ref_seg));

The message shows ‘vreinterpretq_p128_u32’ intrinsic is not supported
because an old version gcc (gcc 4.8.5) is used. So fix the issue with
implementing the logic with other intrinsics.

Bugzilla ID: 621
Fixes: 530887469350 ("net/virtio: add vectorized packed ring NEON Tx")
Fixes: 5971ce5e2a59 ("net/virtio: add vectorized packed ring NEON Rx")

Reported-by: Subhi Masri <subhim@nvidia.com>
Signed-off-by: Joyce Kong <joyce.kong@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Tested-by: Subhi Masri <subhim@nvidia.com>
drivers/net/virtio/virtio_rxtx_packed_neon.h

index af9dede..851c81f 100644 (file)
@@ -71,8 +71,8 @@ virtqueue_enqueue_batch_packed_vec(struct virtnet_tx *txvq,
        uint32x4_t def_ref_seg = vdupq_n_u32(0x10001);
        /* Check refcnt and nb_segs. */
        uint32x4_t ref_seg = vreinterpretq_u32_u8(vqtbl2q_u8(mbuf, ref_seg_msk));
-       poly128_t cmp1 = vreinterpretq_p128_u32(~vceqq_u32(ref_seg, def_ref_seg));
-       if (unlikely(cmp1))
+       uint64x2_t cmp1 = vreinterpretq_u64_u32(~vceqq_u32(ref_seg, def_ref_seg));
+       if (unlikely(vgetq_lane_u64(cmp1, 0) || vgetq_lane_u64(cmp1, 1)))
                return -1;
 
        /* Check headroom is enough. */
@@ -225,10 +225,10 @@ virtqueue_dequeue_batch_packed_vec(struct virtnet_rx *rxvq,
        if (vq->vq_packed.used_wrap_counter)
                v_used_flag = vdupq_n_u32(PACKED_FLAGS_MASK);
 
-       poly128_t desc_stats = vreinterpretq_p128_u32(~vceqq_u32(v_flag, v_used_flag));
+       uint64x2_t desc_stats = vreinterpretq_u64_u32(~vceqq_u32(v_flag, v_used_flag));
 
        /* Check all descs are used. */
-       if (desc_stats)
+       if (unlikely(vgetq_lane_u64(desc_stats, 0) || vgetq_lane_u64(desc_stats, 1)))
                return -1;
 
        /* Load 2 mbuf pointers per time. */