summaryrefslogtreecommitdiffstats
path: root/vnet/vnet/devices/dpdk/vhost_user.c
diff options
context:
space:
mode:
Diffstat (limited to 'vnet/vnet/devices/dpdk/vhost_user.c')
-rw-r--r--vnet/vnet/devices/dpdk/vhost_user.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/vnet/vnet/devices/dpdk/vhost_user.c b/vnet/vnet/devices/dpdk/vhost_user.c
index 91734e29d1b..0965456e0f9 100644
--- a/vnet/vnet/devices/dpdk/vhost_user.c
+++ b/vnet/vnet/devices/dpdk/vhost_user.c
@@ -241,8 +241,10 @@ dpdk_create_vhost_user_if_internal (u32 * hw_if_index, u32 if_id)
}
// reset lockp
- if (xd->lockp)
- memset ((void *) xd->lockp, 0, CLIB_CACHE_LINE_BYTES);
+ dpdk_device_lock_free(xd);
+
+ if (xd->tx_q_used < tm->n_vlib_mains)
+ dpdk_device_lock_init(xd);
// reset tx vectors
for (j = 0; j < tm->n_vlib_mains; j++)
@@ -299,12 +301,8 @@ dpdk_create_vhost_user_if_internal (u32 * hw_if_index, u32 if_id)
xd->vu_vhost_dev.virtqueue[j]->backend = -1;
}
- xd->lockp = NULL;
- if (xd->tx_q_used < dm->input_cpu_count) {
- xd->lockp = clib_mem_alloc_aligned (CLIB_CACHE_LINE_BYTES,
- CLIB_CACHE_LINE_BYTES);
- memset ((void *) xd->lockp, 0, CLIB_CACHE_LINE_BYTES);
- }
+ if (xd->tx_q_used < dm->input_cpu_count)
+ dpdk_device_lock_init(xd);
DBG_SOCK("tm->n_vlib_mains: %d. TX %d, RX: %d, num_qpairs: %d, Lock: %p",
tm->n_vlib_mains, xd->tx_q_used, xd->rx_q_used, num_qpairs, xd->lockp);
@@ -1795,4 +1793,3 @@ VLIB_CLI_COMMAND (show_vhost_user_command, static) = {
.short_help = "show vhost-user interface",
.function = show_dpdk_vhost_user_command_fn,
};
-