[PATCH v2 15/20] ethdev: annotate pthread mutex
David Marchand
david.marchand at redhat.com
Fri Feb 24 16:11:38 CET 2023
fts_enter/exit take mutexes depending on device flags set at
initialisation.
Annotate those helpers and, since clang does not support conditional
locking, waive the lock check on their implementation.
Signed-off-by: David Marchand <david.marchand at redhat.com>
---
lib/ethdev/rte_flow.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/lib/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c
index 69e6e749f7..c66625d1fe 100644
--- a/lib/ethdev/rte_flow.c
+++ b/lib/ethdev/rte_flow.c
@@ -297,6 +297,10 @@ rte_flow_dynf_metadata_register(void)
static inline void
fts_enter(struct rte_eth_dev *dev)
+#ifdef RTE_EXEC_ENV_FREEBSD
+ __rte_exclusive_lock_function(dev->data->flow_ops_mutex)
+ __rte_no_thread_safety_analysis
+#endif
{
if (!(dev->data->dev_flags & RTE_ETH_DEV_FLOW_OPS_THREAD_SAFE))
pthread_mutex_lock(&dev->data->flow_ops_mutex);
@@ -304,6 +308,10 @@ fts_enter(struct rte_eth_dev *dev)
static inline void
fts_exit(struct rte_eth_dev *dev)
+#ifdef RTE_EXEC_ENV_FREEBSD
+ __rte_unlock_function(dev->data->flow_ops_mutex)
+ __rte_no_thread_safety_analysis
+#endif
{
if (!(dev->data->dev_flags & RTE_ETH_DEV_FLOW_OPS_THREAD_SAFE))
pthread_mutex_unlock(&dev->data->flow_ops_mutex);
--
2.39.2
More information about the dev
mailing list