From: Dekel Peled Date: Wed, 15 May 2019 10:11:38 +0000 (+0300) Subject: net/mlx5: remove redundant size calculation macro X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=73f008334ff427ec6ff680600bcf3ebb57459752;p=dpdk.git net/mlx5: remove redundant size calculation macro Patch [1] added, among other definitions, the macro MLX5_ST_SZ_DB. Patch [2] added later the macro MLX5_ST_SZ_BYTES, which is exactly the same macro with a different name. Each of these macros was used in very few places. This patch removes the definition of MLX5_ST_SZ_DB, and replaces it with MLX5_ST_SZ_BYTES wherever it was used. Macro MLX5_ST_SZ_BYTES was preffered since it is the same macro name used in kernel code, see [3]. [1] http://patches.dpdk.org/patch/45254/ [2] http://patches.dpdk.org/patch/49403/ [3] https://lists.openwall.net/netdev/2014/10/02/75 Signed-off-by: Dekel Peled Acked-by: Shahaf Shuler --- diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index ad19d78675..d096b02bba 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -2493,7 +2493,7 @@ flow_dv_prepare(const struct rte_flow_attr *attr __rte_unused, "not enough memory to create flow"); return NULL; } - flow->dv.value.size = MLX5_ST_SZ_DB(fte_match_param); + flow->dv.value.size = MLX5_ST_SZ_BYTES(fte_match_param); return flow; } @@ -2517,7 +2517,7 @@ flow_dv_check_valid_spec(void *match_mask, void *match_value) uint8_t *v = match_value; unsigned int i; - for (i = 0; i < MLX5_ST_SZ_DB(fte_match_param); ++i) { + for (i = 0; i < MLX5_ST_SZ_BYTES(fte_match_param); ++i) { if (v[i] & ~m[i]) { DRV_LOG(ERR, "match_value differs from match_criteria" diff --git a/drivers/net/mlx5/mlx5_prm.h b/drivers/net/mlx5/mlx5_prm.h index 8c42380537..602a5ac891 100644 --- a/drivers/net/mlx5/mlx5_prm.h +++ b/drivers/net/mlx5/mlx5_prm.h @@ -378,7 +378,6 @@ typedef uint8_t u8; #define __mlx5_mask16(typ, fld) ((u16)((1ull << __mlx5_bit_sz(typ, fld)) - 1)) #define MLX5_ST_SZ_BYTES(typ) (sizeof(struct mlx5_ifc_##typ##_bits) / 8) #define MLX5_ST_SZ_DW(typ) (sizeof(struct mlx5_ifc_##typ##_bits) / 32) -#define MLX5_ST_SZ_DB(typ) (sizeof(struct mlx5_ifc_##typ##_bits) / 8) #define MLX5_BYTE_OFF(typ, fld) (__mlx5_bit_off(typ, fld) / 8) #define MLX5_ADDR_OF(typ, p, fld) ((char *)(p) + MLX5_BYTE_OFF(typ, fld))