From: Dariusz Sosnowski <dsosnowski@nvidia.com>
To: Viacheslav Ovsiienko <viacheslavo@nvidia.com>,
Ori Kam <orika@nvidia.com>, Suanming Mou <suanmingm@nvidia.com>,
Matan Azrad <matan@nvidia.com>
Cc: <dev@dpdk.org>
Subject: [PATCH 8/9] common/mlx5: add debug mode indicator
Date: Wed, 5 Jun 2024 20:34:18 +0200 [thread overview]
Message-ID: <20240605183419.489323-9-dsosnowski@nvidia.com> (raw)
In-Reply-To: <20240605183419.489323-1-dsosnowski@nvidia.com>
Add mlx5_fp_debug_enabled() function which:
- returns true if RTE_LIBRTE_MLX5_DEBUG is defined,
- returns false otherwise.
This allows for conditional execution of code meant to be executed only
when mlx5 debug mode is enabled, without adding conditional compilation
guards inside source code.
When mlx5 debug mode is disabled, any code running if
mlx5_fp_debug_enabled() returns true will be removed by optimizing
compiler due to dead code elimination.
Signed-off-by: Dariusz Sosnowski <dsosnowski@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
---
drivers/common/mlx5/mlx5_common.h | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/drivers/common/mlx5/mlx5_common.h b/drivers/common/mlx5/mlx5_common.h
index 14c70edbef..1abd1e8239 100644
--- a/drivers/common/mlx5/mlx5_common.h
+++ b/drivers/common/mlx5/mlx5_common.h
@@ -109,6 +109,19 @@ pmd_drv_log_basename(const char *s)
#endif /* RTE_LIBRTE_MLX5_DEBUG */
+/**
+ * Returns true if debug mode is enabled for fast path operations.
+ */
+static inline bool
+mlx5_fp_debug_enabled(void)
+{
+#ifdef RTE_LIBRTE_MLX5_DEBUG
+ return true;
+#else
+ return false;
+#endif
+}
+
/* Allocate a buffer on the stack and fill it with a printf format string. */
#define MKSTR(name, ...) \
int mkstr_size_##name = snprintf(NULL, 0, "" __VA_ARGS__); \
--
2.39.2
next prev parent reply other threads:[~2024-06-05 18:36 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-05 18:34 [PATCH 0/9] net/mlx5: flow fast path validation Dariusz Sosnowski
2024-06-05 18:34 ` [PATCH 1/9] ethdev: support duplicating only item mask Dariusz Sosnowski
2024-06-05 18:34 ` [PATCH 2/9] net/mlx5: extract target port validation Dariusz Sosnowski
2024-06-05 18:34 ` [PATCH 3/9] net/mlx5: extract queue index validation Dariusz Sosnowski
2024-06-05 18:34 ` [PATCH 4/9] net/mlx5: store pattern template items Dariusz Sosnowski
2024-06-05 18:34 ` [PATCH 5/9] net/mlx5: store original actions in template Dariusz Sosnowski
2024-06-05 18:34 ` [PATCH 6/9] net/mlx5: store expected type on indirect action Dariusz Sosnowski
2024-06-05 18:34 ` [PATCH 7/9] net/mlx5: store modify field action Dariusz Sosnowski
2024-06-05 18:34 ` Dariusz Sosnowski [this message]
2024-06-05 18:34 ` [PATCH 9/9] net/mlx5: add async flow operation validation Dariusz Sosnowski
2024-06-06 8:50 ` [PATCH 0/9] net/mlx5: flow fast path validation Dariusz Sosnowski
2024-06-12 16:18 ` [PATCH v2] ethdev: support duplicating only item mask Dariusz Sosnowski
2024-06-12 22:28 ` Ferruh Yigit
2024-06-12 16:24 ` [PATCH v2 0/8] net/mlx5: flow fast path validation Dariusz Sosnowski
2024-06-12 16:24 ` [PATCH v2 1/8] net/mlx5: extract target port validation Dariusz Sosnowski
2024-06-12 16:24 ` [PATCH v2 2/8] net/mlx5: extract queue index validation Dariusz Sosnowski
2024-06-12 16:24 ` [PATCH v2 3/8] net/mlx5: store pattern template items Dariusz Sosnowski
2024-06-12 16:24 ` [PATCH v2 4/8] net/mlx5: store original actions in template Dariusz Sosnowski
2024-06-12 16:24 ` [PATCH v2 5/8] net/mlx5: store expected type on indirect action Dariusz Sosnowski
2024-06-12 16:24 ` [PATCH v2 6/8] net/mlx5: store modify field action Dariusz Sosnowski
2024-06-12 16:24 ` [PATCH v2 7/8] common/mlx5: add debug mode indicator Dariusz Sosnowski
2024-06-12 16:24 ` [PATCH v2 8/8] net/mlx5: add async flow operation validation Dariusz Sosnowski
2024-06-26 18:14 ` [PATCH v3 0/8] net/mlx5: flow fast path validation Dariusz Sosnowski
2024-06-26 18:14 ` [PATCH v3 1/8] net/mlx5: extract target port validation Dariusz Sosnowski
2024-06-26 18:14 ` [PATCH v3 2/8] net/mlx5: extract queue index validation Dariusz Sosnowski
2024-06-26 18:14 ` [PATCH v3 3/8] net/mlx5: store pattern template items Dariusz Sosnowski
2024-06-26 18:14 ` [PATCH v3 4/8] net/mlx5: store original actions in template Dariusz Sosnowski
2024-06-26 18:14 ` [PATCH v3 5/8] net/mlx5: store expected type on indirect action Dariusz Sosnowski
2024-06-26 18:14 ` [PATCH v3 6/8] net/mlx5: store modify field action Dariusz Sosnowski
2024-06-26 18:14 ` [PATCH v3 7/8] common/mlx5: add debug mode indicator Dariusz Sosnowski
2024-06-26 18:14 ` [PATCH v3 8/8] net/mlx5: add async flow operation validation Dariusz Sosnowski
2024-06-30 12:39 ` [PATCH v3 0/8] net/mlx5: flow fast path validation Raslan Darawsheh
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=20240605183419.489323-9-dsosnowski@nvidia.com \
--to=dsosnowski@nvidia.com \
--cc=dev@dpdk.org \
--cc=matan@nvidia.com \
--cc=orika@nvidia.com \
--cc=suanmingm@nvidia.com \
--cc=viacheslavo@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;
as well as URLs for NNTP newsgroup(s).