Re: [PATCH v3 5/5] net/mlx5: add vectorized Rx/Tx burst for SSE4.1
From: Nélio Laranjeiro <hidden>
Date: 2017-07-06 07:16:18
On Wed, Jul 05, 2017 at 11:12:28AM -0700, Yongseok Koh wrote:
quoted hunk ↗ jump to hunk
[...]diff --git a/drivers/net/mlx5/mlx5_rxtx_vec_sse.c b/drivers/net/mlx5/mlx5_rxtx_vec_sse.c new file mode 100644 index 000000000..4595f7a33 --- /dev/null +++ b/drivers/net/mlx5/mlx5_rxtx_vec_sse.c@@ -0,0 +1,1378 @@[...] + +#include <assert.h> +#include <stdint.h> +#include <string.h> +#include <stdlib.h> +#include <smmintrin.h> + +/* Verbs header. */ +#include <infiniband/verbs.h> +#include <infiniband/mlx5_hw.h> +#include <infiniband/arch.h>
Pragma on Verbs must remain, their headers are still not clear for pdentic compilation.
[...]
+/**
+ * Replenish buffers for RX in bulk.
+ *
+ * @param rxq
+ * Pointer to RX queue structure.
+ * @param n
+ * Number of buffers to be replenished.
+ */
+static inline void
+rxq_replenish_bulk_mbuf(struct rxq *rxq, uint16_t n)
+{
+ const uint16_t q_n = 1 << rxq->elts_n;
+ const uint16_t q_mask = q_n - 1;
+ const uint16_t elts_idx = rxq->rq_ci & q_mask;
+ struct rte_mbuf **elts = &(*rxq->elts)[elts_idx];
+ volatile struct mlx5_wqe_data_seg *wq = &(*rxq->wqes)[elts_idx];
+ unsigned int i;
+
+ assert(n >= MLX5_VPMD_RXQ_RPLNSH_THRESH);
+ assert(n <= (uint16_t)(q_n - (rxq->rq_ci - rxq->rq_pi)));
+ assert(MLX5_VPMD_RXQ_RPLNSH_THRESH > MLX5_VPMD_DESCS_PER_LOOP);Info: as the PMD is compiled in C11, you could use the static_assert which verifies at compilation time the constants are correct. (I am not asking to change it now, we can make a compain to change all this kind of assert at onces). Unless the pragma which must remain on Verbs header: Acked-by: Nelio Laranjeiro <redacted> Great work. Thanks, -- Nélio Laranjeiro 6WIND