[PATCH 5/5] net/mlx5: remove useless constants

Thomas Monjalon
2025-11-02T15:57:22Z

- MLX5_VEC_TX_CKSUM_OFFLOAD_CAP became unused when Tx metadata moved
to a dynamic field.
- MLX5_ALARM_TIMEOUT_US became unused when reworking link status wait.
- MLX5_FLOW_SFT_HLIST_ARRAY_SIZE was never used in hash list handling.
- MLX5_FLOW_MIN_ID_POOL_SIZE and MLX5_ID_GENERATION_ARRAY_FACTOR became
unused when the flow ID generator was replaced by ipool.
- IS_BATCH_CNT became unused when removing a flow counter container.
- MLX5_RSSQ_DEFAULT_NUM was used in the old per-thread flow workspace.
- MLX5_FLOW_TABLE_HWS_POLICY became unused because meter is not supported
in HWS.
- IPPROTO_MPLS became unused because MPLS over IP is not supported.
- MLX5_L4_RSS_TYPES has never been used.
- MLX5_ETHER_TYPE_FROM_HEADER was used in the first integrity item check.
- ETH_TYPE_IPV4/V6_VXLAN were never used in HWS.
- PCI_DRV_FLAGS became unused when migrating to bus-agnostic probing.
- ERRNO_SAFE was used in the old logging macros.

Fixes: 9bf26e1318e3 ("ethdev: move egress metadata to dynamic field")
Fixes: cfee94752b8f ("net/mlx5: fix link status to use wait to complete")
Fixes: f3020a331dca ("net/mlx5: optimize hash list table allocate on demand")
Fixes: 4ae8825c5085 ("net/mlx5: use indexed pool as id generator")
Fixes: 994829e695c0 ("net/mlx5: remove single counter container")
Fixes: dc7c5e0aa905 ("net/mlx5: fix flow workspace destruction")
Fixes: 645f240d1cd5 ("net/mlx5: remove unsupported flow meter action in HWS")
Fixes: 14ad99d78a46 ("net/mlx5: remove unsupported flow item MPLS over IP")
Fixes: ae67e3c43dd5 ("net/mlx5: support RSS expansion in non-template HWS setup")
Fixes: 23b0a8b298b1 ("net/mlx5: fix integrity item validation and translation")
Fixes: c55c2bf35333 ("net/mlx5/hws: add definer layer")
Fixes: a7f34989e9ad ("net/mlx5: migrate to bus-agnostic common interface")
Fixes: a170a30d22a8 ("net/mlx5: use dynamic logging")
Cc: stable@dpdk.org

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
drivers/net/mlx5/hws/mlx5dr_definer.c | 2 --
drivers/net/mlx5/mlx5.c | 3 ---
drivers/net/mlx5/mlx5.h | 3 ---
drivers/net/mlx5/mlx5_defs.h | 6 ------
drivers/net/mlx5/mlx5_flow.h | 17 -----------------
drivers/net/mlx5/mlx5_rxtx_vec.h | 7 -------
drivers/net/mlx5/mlx5_utils.h | 3 ---
drivers/net/mlx5/windows/mlx5_os.h | 2 --
8 files changed, 43 deletions(-)

diff --git a/drivers/net/mlx5/hws/mlx5dr_definer.c b/drivers/net/mlx5/hws/mlx5dr_definer.c
index 1c6b3e38c4..afa70bf793 100644
--- a/drivers/net/mlx5/hws/mlx5dr_definer.c
+++ b/drivers/net/mlx5/hws/mlx5dr_definer.c
@@ -9,8 +9,6 @@
#define GTP_PDU_SC 0x85
#define BAD_PORT 0xBAD
#define BAD_SQN 0xBAD
-#define ETH_TYPE_IPV4_VXLAN 0x0800
-#define ETH_TYPE_IPV6_VXLAN 0x86DD
#define UDP_VXLAN_PORT 4789
#define UDP_VXLAN_GPE_PORT 4790
#define UDP_GTPU_PORT 2152
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index b018a4f0e2..4705c30801 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -394,9 +394,6 @@ static const struct mlx5_indexed_pool_config mlx5_ipool_cfg[] = {
},
};

-#define MLX5_FLOW_MIN_ID_POOL_SIZE 512
-#define MLX5_ID_GENERATION_ARRAY_FACTOR 16
-
#define MLX5_FLOW_TABLE_HLIST_ARRAY_SIZE 1024

#define MLX5_RXQ_ENH_CQE_COMP_MASK 0x80
diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h
index 07418b0922..4d9cf6b70b 100644
--- a/drivers/net/mlx5/mlx5.h
+++ b/drivers/net/mlx5/mlx5.h
@@ -509,8 +509,6 @@ struct __rte_cache_aligned mlx5_hw_q {
#define MLX5_MAX_PENDING_QUERIES 4
#define MLX5_CNT_MR_ALLOC_BULK 64
#define MLX5_CNT_SHARED_OFFSET 0x80000000
-#define IS_BATCH_CNT(cnt) (((cnt) & (MLX5_CNT_SHARED_OFFSET - 1)) >= \
- MLX5_CNT_BATCH_OFFSET)
#define MLX5_CNT_SIZE (sizeof(struct mlx5_flow_counter))
#define MLX5_AGE_SIZE (sizeof(struct mlx5_age_param))

@@ -1259,7 +1257,6 @@ struct mlx5_flow_tbl_resource {
#define MLX5_FLOW_TABLE_LEVEL_METER (MLX5_MAX_TABLES - 3)
#define MLX5_FLOW_TABLE_LEVEL_POLICY (MLX5_MAX_TABLES - 4)
#define MLX5_MAX_TABLES_EXTERNAL MLX5_FLOW_TABLE_LEVEL_POLICY
-#define MLX5_FLOW_TABLE_HWS_POLICY (MLX5_MAX_TABLES - 10)
#define MLX5_MAX_TABLES_FDB UINT16_MAX
#define MLX5_FLOW_TABLE_PTYPE_RSS_NUM 1024
#define MLX5_FLOW_TABLE_PTYPE_RSS_LAST (MLX5_MAX_TABLES - 11)
diff --git a/drivers/net/mlx5/mlx5_defs.h b/drivers/net/mlx5/mlx5_defs.h
index d326fec000..b8e5122323 100644
--- a/drivers/net/mlx5/mlx5_defs.h
+++ b/drivers/net/mlx5/mlx5_defs.h
@@ -46,9 +46,6 @@
/* Maximum number of DCS created per port. */
#define MLX5_HWS_CNT_DCS_NUM 4

-/* Alarm timeout. */
-#define MLX5_ALARM_TIMEOUT_US 100000
-
/* Maximum number of extended statistics counters. */
#define MLX5_MAX_XSTATS 64

@@ -170,9 +167,6 @@
/* Size of the hash table for tag table. */
#define MLX5_TAGS_HLIST_ARRAY_SIZE (1 << 15)

-/* Size fo the hash table for SFT table. */
-#define MLX5_FLOW_SFT_HLIST_ARRAY_SIZE 4096
-
/* Hairpin TX/RX queue configuration parameters. */
#define MLX5_HAIRPIN_QUEUE_STRIDE 6
#define MLX5_HAIRPIN_JUMBO_LOG_SIZE (14 + 2)
diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h
index ff61706054..c525516672 100644
--- a/drivers/net/mlx5/mlx5_flow.h
+++ b/drivers/net/mlx5/mlx5_flow.h
@@ -222,9 +222,6 @@ struct mlx5_mirror {
struct mlx5_mirror_clone clone[MLX5_MIRROR_MAX_CLONES_NUM];
};

-/* Default queue number. */
-#define MLX5_RSSQ_DEFAULT_NUM 16
-
#define MLX5_FLOW_LAYER_OUTER_L2 (1u << 0)
#define MLX5_FLOW_LAYER_OUTER_L3_IPV4 (1u << 1)
#define MLX5_FLOW_LAYER_OUTER_L3_IPV6 (1u << 2)
@@ -469,10 +466,6 @@ struct mlx5_mirror {

#define MLX5_FLOW_XCAP_ACTIONS (MLX5_FLOW_ACTION_ENCAP | MLX5_FLOW_ACTION_DECAP)

-#ifndef IPPROTO_MPLS
-#define IPPROTO_MPLS 137
-#endif
-
#define MLX5_IPV6_HDR_ECN_MASK 0x3
#define MLX5_IPV6_HDR_DSCP_SHIFT 2

@@ -519,9 +512,6 @@ struct mlx5_mirror {
RTE_ETH_RSS_NONFRAG_IPV4_TCP | RTE_ETH_RSS_NONFRAG_IPV4_UDP | \
RTE_ETH_RSS_NONFRAG_IPV4_OTHER)

-/* Valid L4 RSS types */
-#define MLX5_L4_RSS_TYPES (RTE_ETH_RSS_L4_SRC_ONLY | RTE_ETH_RSS_L4_DST_ONLY)
-
/* IBV hash source bits for IPV4. */
#define MLX5_IPV4_IBV_RX_HASH (IBV_RX_HASH_SRC_IPV4 | IBV_RX_HASH_DST_IPV4)

@@ -1898,13 +1888,6 @@ flow_hw_get_reg_id_from_ctx(void *dr_ctx, enum rte_flow_item_type type,
(((func) == RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ) || \
((func) == RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ_SORT))

-/* extract next protocol type from Ethernet & VLAN headers */
-#define MLX5_ETHER_TYPE_FROM_HEADER(_s, _m, _itm, _prt) do { \
- (_prt) = ((const struct _s *)(_itm)->mask)->_m; \
- (_prt) &= ((const struct _s *)(_itm)->spec)->_m; \
- (_prt) = rte_be_to_cpu_16((_prt)); \
-} while (0)
-
/* array of valid combinations of RX Hash fields for RSS */
static const uint64_t mlx5_rss_hash_fields[] = {
MLX5_RSS_HASH_IPV4,
diff --git a/drivers/net/mlx5/mlx5_rxtx_vec.h b/drivers/net/mlx5/mlx5_rxtx_vec.h
index 77c3f4efa0..672e301f77 100644
--- a/drivers/net/mlx5/mlx5_rxtx_vec.h
+++ b/drivers/net/mlx5/mlx5_rxtx_vec.h
@@ -13,13 +13,6 @@

#include "mlx5_autoconf.h"

-/* HW checksum offload capabilities of vectorized Tx. */
-#define MLX5_VEC_TX_CKSUM_OFFLOAD_CAP \
- (RTE_ETH_TX_OFFLOAD_IPV4_CKSUM | \
- RTE_ETH_TX_OFFLOAD_UDP_CKSUM | \
- RTE_ETH_TX_OFFLOAD_TCP_CKSUM | \
- RTE_ETH_TX_OFFLOAD_OUTER_IPV4_CKSUM)
-
/*
* Compile time sanity check for vectorized functions.
*/
diff --git a/drivers/net/mlx5/mlx5_utils.h b/drivers/net/mlx5/mlx5_utils.h
index c65839c5d9..95866351c2 100644
--- a/drivers/net/mlx5/mlx5_utils.h
+++ b/drivers/net/mlx5/mlx5_utils.h
@@ -22,9 +22,6 @@

#include "mlx5_defs.h"

-/* Save and restore errno around argument evaluation. */
-#define ERRNO_SAFE(x) ((errno = (int []){ errno, ((x), 0) }[0]))
-
extern int mlx5_logtype;

#define MLX5_NET_LOG_PREFIX "mlx5_net"
diff --git a/drivers/net/mlx5/windows/mlx5_os.h b/drivers/net/mlx5/windows/mlx5_os.h
index fb7198c244..57d147bd8c 100644
--- a/drivers/net/mlx5/windows/mlx5_os.h
+++ b/drivers/net/mlx5/windows/mlx5_os.h
@@ -7,8 +7,6 @@

#include "mlx5_win_ext.h"

-#define PCI_DRV_FLAGS 0
-
#define MLX5_NAMESIZE MLX5_FS_NAME_MAX

enum mlx5_sw_parsing_offloads {
--
2.51.0