From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Dariusz Sosnowski <dsosnowski@nvidia.com>,
xuemingl@nvidia.com, 14pwcse1224@uetpeshawar.edu.pk,
stable@dpdk.org, Stephen Hemminger <stephen@networkplumber.org>,
Viacheslav Ovsiienko <viacheslavo@nvidia.com>,
Bing Zhao <bingz@nvidia.com>, Ori Kam <orika@nvidia.com>,
Suanming Mou <suanmingm@nvidia.com>,
Matan Azrad <matan@nvidia.com>
Subject: [PATCH 02/37] net/mlx5: fix unreachable code warnings
Date: Sun, 29 Nov 2026 16:26:47 -0800 [thread overview]
Message-ID: <20261130002752.2342213-3-stephen@networkplumber.org> (raw)
In-Reply-To: <20261130002752.2342213-1-stephen@networkplumber.org>
From: Dariusz Sosnowski <dsosnowski@nvidia.com>
Building with clang and -Wunreachable-code produces warnings:
- In flow_verbs_discover_priorities()
- With recent rdma-core versions, a condition is skipped
because of goto statement under ifdefs for new version.
- In flow_hw_validate_rule_pattern() and
flow_hw_validate_rule_actions()
- On variable declarations inside switch at the beginning of
switch blocks.
This patch silences these warnings.
First issue is resolved by reorganizing ifdef guards
to remove the need for goto.
Second issue is resolved by moving variable declarations
out of the switch block.
Bugzilla ID: 2140
Fixes: 1d47e9335e2f ("net/mlx5: improve Verbs flow priority discovery")
Fixes: 57c7b94301ee ("net/mlx5: add async flow operation validation")
Fixes: 179e70fd7ad2 ("net/mlx5: fix connection tracking state item validation")
Cc: xuemingl@nvidia.com
Cc: 14pwcse1224@uetpeshawar.edu.pk
Cc: stable@dpdk.org
Reported-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Dariusz Sosnowski <dsosnowski@nvidia.com>
---
drivers/net/mlx5/mlx5_flow_hw.c | 17 ++++++++---------
drivers/net/mlx5/mlx5_flow_verbs.c | 16 +++++++---------
2 files changed, 15 insertions(+), 18 deletions(-)
diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c
index 6e6bf07799..62482c911d 100644
--- a/drivers/net/mlx5/mlx5_flow_hw.c
+++ b/drivers/net/mlx5/mlx5_flow_hw.c
@@ -17351,6 +17351,11 @@ flow_hw_validate_rule_pattern(struct rte_eth_dev *dev,
pt_item++;
for (; pt_item->type != RTE_FLOW_ITEM_TYPE_END; pt_item++, items++) {
+ const struct rte_flow_item_ethdev *ethdev;
+ const struct rte_flow_item_tx_queue *tx_queue;
+ const struct rte_flow_item_conntrack *spec;
+ struct mlx5_txq_ctrl *txq;
+
if (pt_item->type != items->type)
return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM,
items, "Item type does not match the template");
@@ -17375,11 +17380,6 @@ flow_hw_validate_rule_pattern(struct rte_eth_dev *dev,
items, "Item spec is required");
switch (items->type) {
- const struct rte_flow_item_ethdev *ethdev;
- const struct rte_flow_item_tx_queue *tx_queue;
- const struct rte_flow_item_conntrack *spec;
- struct mlx5_txq_ctrl *txq;
-
case RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT:
ethdev = items->spec;
if (flow_hw_validate_target_port_id(dev, ethdev->port_id)) {
@@ -17486,7 +17486,10 @@ flow_hw_validate_rule_actions(struct rte_eth_dev *dev,
* Configuration of masked actions is ignored.
*/
LIST_FOREACH(act_data, &hw_acts->act_list, next) {
+ const struct rte_flow_action_modify_field *mf;
+ const struct rte_flow_action_ethdev *ethdev;
const struct rte_flow_action *user_action;
+ enum rte_flow_action_type expected_type;
user_action = &actions[act_data->action_src];
@@ -17507,10 +17510,6 @@ flow_hw_validate_rule_actions(struct rte_eth_dev *dev,
"Action requires configuration");
switch ((int)user_action->type) {
- enum rte_flow_action_type expected_type;
- const struct rte_flow_action_ethdev *ethdev;
- const struct rte_flow_action_modify_field *mf;
-
case RTE_FLOW_ACTION_TYPE_INDIRECT:
expected_type = act_data->indirect.expected_type;
if (!flow_hw_valid_indirect_action_type(user_action, expected_type))
diff --git a/drivers/net/mlx5/mlx5_flow_verbs.c b/drivers/net/mlx5/mlx5_flow_verbs.c
index eb576f73d4..f404d2c739 100644
--- a/drivers/net/mlx5/mlx5_flow_verbs.c
+++ b/drivers/net/mlx5/mlx5_flow_verbs.c
@@ -50,14 +50,15 @@ struct ibv_spec_header {
*/
static int
flow_verbs_discover_priorities(struct rte_eth_dev *dev,
- const uint16_t *vprio, int vprio_n)
+ const uint16_t *vprio __rte_unused,
+ int vprio_n __rte_unused)
{
struct mlx5_priv *priv = dev->data->dev_private;
struct {
struct ibv_flow_attr attr;
struct ibv_flow_spec_eth eth;
struct ibv_flow_spec_action_drop drop;
- } flow_attr = {
+ } __rte_unused flow_attr = {
.attr = {
.num_of_specs = 2,
.port = (uint8_t)priv->dev_port,
@@ -79,16 +80,15 @@ flow_verbs_discover_priorities(struct rte_eth_dev *dev,
.type = IBV_FLOW_SPEC_ACTION_DROP,
},
};
- struct ibv_flow *flow;
- struct mlx5_hrxq *drop = priv->drop_queue.hrxq;
- int i;
+ struct ibv_flow *flow __rte_unused;
+ struct mlx5_hrxq *drop __rte_unused = priv->drop_queue.hrxq;
+ int i __rte_unused;
int priority = 0;
#if defined(HAVE_MLX5DV_DR_DEVX_PORT) || defined(HAVE_MLX5DV_DR_DEVX_PORT_V35)
/* If DevX supported, driver must support 16 verbs flow priorities. */
priority = 16;
- goto out;
-#endif
+#else
if (!drop->qp) {
rte_errno = ENOTSUP;
return -rte_errno;
@@ -101,8 +101,6 @@ flow_verbs_discover_priorities(struct rte_eth_dev *dev,
claim_zero(mlx5_glue->destroy_flow(flow));
priority = vprio[i];
}
-#if defined(HAVE_MLX5DV_DR_DEVX_PORT) || defined(HAVE_MLX5DV_DR_DEVX_PORT_V35)
-out:
#endif
DRV_LOG(INFO, "port %u supported flow priorities:"
" 0-%d for ingress or egress root table,"
--
2.53.0
next prev parent reply other threads:[~2026-11-30 0:28 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 0:26 [PATCH 00/37] enable unreachable code detection Stephen Hemminger
2026-11-30 0:26 ` [PATCH 01/37] net/mlx4: fix unreachable code warnings Stephen Hemminger
2026-11-30 0:26 ` Stephen Hemminger [this message]
2026-11-30 0:26 ` [PATCH 03/37] eventdev: fix vector adapter instance allocation Stephen Hemminger
2026-11-30 0:26 ` [PATCH 04/37] eal: silence unreachable code in version string Stephen Hemminger
2026-11-30 9:13 ` Bruce Richardson
2026-11-30 0:26 ` [PATCH 05/37] net/dpaa2: remove debug abort in flow destroy Stephen Hemminger
2026-11-30 0:26 ` [PATCH 06/37] app/testpmd: fix unreachable VF traffic error message Stephen Hemminger
2026-11-30 0:26 ` [PATCH 07/37] examples/eventdev_pipeline: remove dead continue Stephen Hemminger
2026-11-30 0:26 ` [PATCH 08/37] examples/ipsec-secgw: remove unreachable config error path Stephen Hemminger
2026-11-30 9:52 ` Radu Nicolau
2026-11-30 0:26 ` [PATCH 09/37] examples/skeleton: handle SIGINT and SIGTERM Stephen Hemminger
2026-11-30 0:26 ` [PATCH 10/37] examples/rxtx_callbacks: " Stephen Hemminger
2026-11-30 0:26 ` [PATCH 11/37] examples/service_cores: " Stephen Hemminger
2026-11-30 0:26 ` [PATCH 12/37] examples/timer: " Stephen Hemminger
2026-11-30 0:26 ` [PATCH 13/37] examples/multi_process: handle SIGINT and SIGTERM in client Stephen Hemminger
2026-11-30 0:26 ` [PATCH 14/37] examples/server_node_efd: handle SIGINT and SIGTERM in node Stephen Hemminger
2026-11-30 0:27 ` [PATCH 15/37] examples/pipeline: handle SIGINT and SIGTERM Stephen Hemminger
2026-11-30 0:27 ` [PATCH 16/37] ethdev: fix unreachable warnings from switch declarations Stephen Hemminger
2026-11-30 0:27 ` [PATCH 17/37] config: add per-directory option for -Wunreachable-code Stephen Hemminger
2026-11-30 0:27 ` [PATCH 18/37] bus/dpaa: exempt this driver from unreachable code detection Stephen Hemminger
2026-11-30 0:27 ` [PATCH 19/37] net/qede: disable unreachable code checks Stephen Hemminger
2026-11-30 0:27 ` [PATCH 20/37] net/txgbe: " Stephen Hemminger
2026-11-30 0:27 ` [PATCH 21/37] net/ixgbe: disable unreachable code check Stephen Hemminger
2026-11-30 9:14 ` Bruce Richardson
2026-11-30 0:27 ` [PATCH 22/37] net/ngbe: " Stephen Hemminger
2026-11-30 0:27 ` [PATCH 23/37] net/octeontx: replace unreachable code Stephen Hemminger
2026-11-30 0:27 ` [PATCH 24/37] common/sfc_efx: disable unreachable code check for base code Stephen Hemminger
2026-11-30 0:27 ` [PATCH 25/37] net/dpaa2: check port state before changing TM hierarchy Stephen Hemminger
2026-11-30 0:27 ` [PATCH 26/37] net/e1000: disable unreachable code check for base code Stephen Hemminger
2026-11-30 9:14 ` Bruce Richardson
2026-11-30 0:27 ` [PATCH 27/37] net/ice: " Stephen Hemminger
2026-11-30 9:16 ` Bruce Richardson
2026-11-30 0:27 ` [PATCH 28/37] raw/ifpga: " Stephen Hemminger
2026-11-30 9:43 ` Bruce Richardson
2026-11-30 0:27 ` [PATCH 29/37] net/bnxt: disable unreachable code check Stephen Hemminger
2026-11-30 0:27 ` [PATCH 30/37] net/ntnic: " Stephen Hemminger
2026-11-30 0:27 ` [PATCH 31/37] lib: mark never returning thread functions Stephen Hemminger
2026-11-30 9:44 ` Bruce Richardson
2026-11-30 0:27 ` [PATCH 32/37] lib: remove unreachable statements Stephen Hemminger
2026-11-30 0:27 ` [PATCH 33/37] app: " Stephen Hemminger
2026-11-30 0:27 ` [PATCH 34/37] examples: " Stephen Hemminger
2026-11-30 9:45 ` Bruce Richardson
2026-11-30 0:27 ` [PATCH 35/37] drivers: " Stephen Hemminger
2026-11-30 10:59 ` Dariusz Sosnowski
2026-11-30 0:27 ` [PATCH 36/37] efd: mark configuration dependent vector selection Stephen Hemminger
2026-11-30 0:27 ` [PATCH 37/37] config: enable unreachable code detection Stephen Hemminger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261130002752.2342213-3-stephen@networkplumber.org \
--to=stephen@networkplumber.org \
--cc=14pwcse1224@uetpeshawar.edu.pk \
--cc=bingz@nvidia.com \
--cc=dev@dpdk.org \
--cc=dsosnowski@nvidia.com \
--cc=matan@nvidia.com \
--cc=orika@nvidia.com \
--cc=stable@dpdk.org \
--cc=suanmingm@nvidia.com \
--cc=viacheslavo@nvidia.com \
--cc=xuemingl@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox