[05/25] net/virtio: use new memory locking API

Message ID 5a7a9dec12c87201e47b98917d32cc5e89b0a3b2.1559147228.git.anatoly.burakov@intel.com (mailing list archive)
State Superseded, archived
Headers
Series Make shared memory config non-public |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation fail Compilation issues

Commit Message

Anatoly Burakov May 29, 2019, 4:30 p.m. UTC
  Replace usages of direct access to shared memory config with
calls to the new API.

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

Comments

Tiwei Bie May 30, 2019, 6:39 a.m. UTC | #1
[PATCH 05/25] net/virtio: use new memory locking API

A minor nit: net/virtio -> net/virtio-user

For the rest,
Reviewed-by: Tiwei Bie <tiwei.bie@intel.com>

On Wed, May 29, 2019 at 05:30:51PM +0100, Anatoly Burakov wrote:
> Replace usages of direct access to shared memory config with
> calls to the new API.
> 
> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
> ---
>  drivers/net/virtio/virtio_user/virtio_user_dev.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
[...]
  

Patch

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