[dpdk-dev] [PATCH 05/25] net/virtio: use new memory locking API

Anatoly Burakov anatoly.burakov at intel.com
Wed May 29 18:30:51 CEST 2019


Replace usages of direct access to shared memory config with
calls to the new API.

Signed-off-by: Anatoly Burakov <anatoly.burakov at intel.com>
---
 drivers/net/virtio/virtio_user/virtio_user_dev.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c b/drivers/net/virtio/virtio_user/virtio_user_dev.c
index e743695e4..41ff19267 100644
--- a/drivers/net/virtio/virtio_user/virtio_user_dev.c
+++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c
@@ -125,7 +125,6 @@ is_vhost_user_by_type(const char *path)
 int
 virtio_user_start_device(struct virtio_user_dev *dev)
 {
-	struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
 	uint64_t features;
 	int ret;
 
@@ -142,7 +141,7 @@ virtio_user_start_device(struct virtio_user_dev *dev)
 	 * replaced when we get proper supports from the
 	 * memory subsystem in the future.
 	 */
-	rte_rwlock_read_lock(&mcfg->memory_hotplug_lock);
+	rte_eal_mcfg_mem_read_lock();
 	pthread_mutex_lock(&dev->mutex);
 
 	if (is_vhost_user_by_type(dev->path) && dev->vhostfd < 0)
@@ -180,12 +179,12 @@ virtio_user_start_device(struct virtio_user_dev *dev)
 
 	dev->started = true;
 	pthread_mutex_unlock(&dev->mutex);
-	rte_rwlock_read_unlock(&mcfg->memory_hotplug_lock);
+	rte_eal_mcfg_mem_read_unlock();
 
 	return 0;
 error:
 	pthread_mutex_unlock(&dev->mutex);
-	rte_rwlock_read_unlock(&mcfg->memory_hotplug_lock);
+	rte_eal_mcfg_mem_read_unlock();
 	/* TODO: free resource here or caller to check */
 	return -1;
 }
-- 
2.17.1


More information about the dev mailing list