[6/7] regex/mlx5: improve constants type in QP buffers creation
diff mbox series

Message ID 1605718811-18652-6-git-send-email-michaelba@nvidia.com
State Accepted
Delegated to: Thomas Monjalon
Headers show
Series
  • [1/7] regex/mlx5: fix jump to the wrong label
Related show

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Michael Baum Nov. 18, 2020, 5 p.m. UTC
The constant representing the size of the metadata is defined as a
regular number (32-bit signed), even though all of its uses request an
unsigned int variable.
Similarly the constant representing the maximal output is also defined
as a regular number, even though all of its uses request an unsigned int
variable.

Change the type of the above constants to unsigned.

Fixes: 5f41b66d12cd ("regex/mlx5: setup fast path")
Cc: stable@dpdk.org

Signed-off-by: Michael Baum <michaelba@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
---
 drivers/regex/mlx5/mlx5_regex_fastpath.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Thomas Monjalon Nov. 22, 2020, 1:58 p.m. UTC | #1
18/11/2020 18:00, Michael Baum:
> -#define MLX5_REGEX_MAX_OUTPUT (1 << 11)
> +#define MLX5_REGEX_MAX_OUTPUT (UINT32_C(1) << 11)

Even better: RTE_BIT32(11)

I will change it while merging.

Patch
diff mbox series

diff --git a/drivers/regex/mlx5/mlx5_regex_fastpath.c b/drivers/regex/mlx5/mlx5_regex_fastpath.c
index 2549547..32ba19f 100644
--- a/drivers/regex/mlx5/mlx5_regex_fastpath.c
+++ b/drivers/regex/mlx5/mlx5_regex_fastpath.c
@@ -3,6 +3,8 @@ 
  */
 
 #include <unistd.h>
+#include <strings.h>
+#include <stdint.h>
 #include <sys/mman.h>
 
 #include <rte_malloc.h>
@@ -17,15 +19,14 @@ 
 #include <mlx5_glue.h>
 #include <mlx5_common.h>
 #include <mlx5_prm.h>
-#include <strings.h>
 
 #include "mlx5_regex_utils.h"
 #include "mlx5_rxp.h"
 #include "mlx5_regex.h"
 
 #define MLX5_REGEX_MAX_WQE_INDEX 0xffff
-#define MLX5_REGEX_METADATA_SIZE 64
-#define MLX5_REGEX_MAX_OUTPUT (1 << 11)
+#define MLX5_REGEX_METADATA_SIZE UINT32_C(64)
+#define MLX5_REGEX_MAX_OUTPUT (UINT32_C(1) << 11)
 #define MLX5_REGEX_WQE_CTRL_OFFSET 12
 #define MLX5_REGEX_WQE_METADATA_OFFSET 16
 #define MLX5_REGEX_WQE_GATHER_OFFSET 32