[v2,15/20] ethdev: annotate pthread mutex

Message ID 20230224151143.3274897-16-david.marchand@redhat.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series Enable lock annotations on most libraries and drivers |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

David Marchand Feb. 24, 2023, 3:11 p.m. UTC
  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@redhat.com>
---
 lib/ethdev/rte_flow.c | 8 ++++++++
 1 file changed, 8 insertions(+)
  

Patch

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);