[v2,04/14] eal: add EAL tailq list lock/unlock API
Checks
Commit Message
Currently, locking/unlocking the TAILQ list requires direct
access to the shared memory config. Add an API to do the same.
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
lib/librte_eal/common/eal_common_mcfg.c | 28 +++++++++++++++++++
.../common/include/rte_eal_memconfig.h | 24 ++++++++++++++++
lib/librte_eal/rte_eal_version.map | 4 +++
3 files changed, 56 insertions(+)
@@ -32,3 +32,31 @@ rte_mcfg_mem_write_unlock(void)
struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
rte_rwlock_write_unlock(&mcfg->memory_hotplug_lock);
}
+
+void
+rte_mcfg_tailq_read_lock(void)
+{
+ struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
+ rte_rwlock_read_lock(&mcfg->qlock);
+}
+
+void
+rte_mcfg_tailq_read_unlock(void)
+{
+ struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
+ rte_rwlock_read_unlock(&mcfg->qlock);
+}
+
+void
+rte_mcfg_tailq_write_lock(void)
+{
+ struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
+ rte_rwlock_write_lock(&mcfg->qlock);
+}
+
+void
+rte_mcfg_tailq_write_unlock(void)
+{
+ struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
+ rte_rwlock_write_unlock(&mcfg->qlock);
+}
@@ -124,6 +124,30 @@ rte_mcfg_mem_write_lock(void);
void
rte_mcfg_mem_write_unlock(void);
+/**
+ * Lock the internal EAL TAILQ list for shared access.
+ */
+void
+rte_mcfg_tailq_read_lock(void);
+
+/**
+ * Unlock the internal EAL TAILQ list for shared access.
+ */
+void
+rte_mcfg_tailq_read_unlock(void);
+
+/**
+ * Lock the internal EAL TAILQ list for exclusive access.
+ */
+void
+rte_mcfg_tailq_write_lock(void);
+
+/**
+ * Unlock the internal EAL TAILQ list for exclusive access.
+ */
+void
+rte_mcfg_tailq_write_unlock(void);
+
#ifdef __cplusplus
}
#endif
@@ -296,6 +296,10 @@ DPDK_19.08 {
rte_mcfg_mem_read_unlock;
rte_mcfg_mem_write_lock;
rte_mcfg_mem_write_unlock;
+ rte_mcfg_tailq_read_lock;
+ rte_mcfg_tailq_read_unlock;
+ rte_mcfg_tailq_write_lock;
+ rte_mcfg_tailq_write_unlock;
} DPDK_19.05;