summaryrefslogtreecommitdiffstats
path: root/src/plugins/rdma/input.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/rdma/input.c')
-rw-r--r--src/plugins/rdma/input.c55
1 files changed, 35 insertions, 20 deletions
diff --git a/src/plugins/rdma/input.c b/src/plugins/rdma/input.c
index 5f2c0bbf31f..827fc577484 100644
--- a/src/plugins/rdma/input.c
+++ b/src/plugins/rdma/input.c
@@ -681,51 +681,66 @@ rdma_device_mlx5dv_l3_validate_and_swap_bc (rdma_per_thread_data_t
/* verify that all ip4 packets have l3_ok flag set and convert packet
length from network to host byte order */
int skip_ip4_cksum = 1;
- int n_left = 0;
+ int n_left = n_rx_packets;
+ u16 *cqe_flags = ptd->cqe_flags;
#if defined CLIB_HAVE_VEC256
- if (n_rx_packets >= 16)
+ if (n_left >= 16)
{
u16x16 mask16 = u16x16_splat (mask);
u16x16 match16 = u16x16_splat (match);
u16x16 r16 = {};
- n_left = n_rx_packets % 16;
+ while (n_left >= 16)
+ {
+ r16 |= (*(u16x16 *) cqe_flags & mask16) != match16;
+
+ *(u32x8 *) bc = u32x8_byte_swap (*(u32x8 *) bc);
+ *(u32x8 *) (bc + 8) = u32x8_byte_swap (*(u32x8 *) (bc + 8));
- for (int i = 0; i < n_rx_packets / 16; i++)
- r16 |= (ptd->cqe_flags16[i] & mask16) != match16;
+ cqe_flags += 16;
+ bc += 16;
+ n_left -= 16;
+ }
if (!u16x16_is_all_zero (r16))
skip_ip4_cksum = 0;
-
- for (int i = 0; i < (n_rx_packets - n_left); i += 8)
- *(u32x8 *) (bc + i) = u32x8_byte_swap (*(u32x8 *) (bc + i));
}
#elif defined CLIB_HAVE_VEC128
- if (n_rx_packets >= 8)
+ if (n_left >= 8)
{
u16x8 mask8 = u16x8_splat (mask);
u16x8 match8 = u16x8_splat (match);
u16x8 r8 = {};
- n_left = n_rx_packets % 8;
+ while (n_left >= 8)
+ {
+ r8 |= (*(u16x8 *) cqe_flags & mask8) != match8;
+
+ *(u32x4 *) bc = u32x4_byte_swap (*(u32x4 *) bc);
+ *(u32x4 *) (bc + 4) = u32x4_byte_swap (*(u32x4 *) (bc + 4));
- for (int i = 0; i < n_rx_packets / 8; i++)
- r8 |= (ptd->cqe_flags8[i] & mask8) != match8;
+ cqe_flags += 8;
+ bc += 8;
+ n_left -= 8;
+ }
if (!u16x8_is_all_zero (r8))
skip_ip4_cksum = 0;
-
- for (int i = 0; i < (n_rx_packets - n_left); i += 4)
- *(u32x4 *) (bc + i) = u32x4_byte_swap (*(u32x4 *) (bc + i));
}
#endif
- for (int i = (n_rx_packets - n_left); i < n_rx_packets; i++)
- if ((ptd->cqe_flags[i] & mask) != match)
- skip_ip4_cksum = 0;
- for (int i = (n_rx_packets - n_left); i < n_rx_packets; i++)
- bc[i] = clib_net_to_host_u32 (bc[i]);
+ while (n_left >= 1)
+ {
+ if ((cqe_flags[0] & mask) != match)
+ skip_ip4_cksum = 0;
+
+ bc[0] = clib_net_to_host_u32 (bc[0]);
+
+ cqe_flags += 1;
+ bc += 1;
+ n_left -= 1;
+ }
return skip_ip4_cksum;
}