diff options
author | Mohsin Kazmi <sykazmi@cisco.com> | 2020-09-29 10:01:25 +0000 |
---|---|---|
committer | Beno�t Ganne <bganne@cisco.com> | 2020-09-29 13:34:13 +0000 |
commit | 162a296756f3dbead55079e4670973d859df1ef9 (patch) | |
tree | c24b836a83a051d809508697ba8871538a0ea040 /src/vnet/devices/virtio/pci.c | |
parent | d68faf8559da72aa6ad0526d5a86fb16587b1508 (diff) |
virtio: fix modern device queue notify
QUEUE_SELECT and QUEUE_NOTIFY_OFF registers are shared between all
workers operating on the same device and operations are not atomic
Type: fix
Change-Id: Ie017b1bfc7e3b6b4e59029f45db78eeffd9f3aeb
Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
Diffstat (limited to 'src/vnet/devices/virtio/pci.c')
-rw-r--r-- | src/vnet/devices/virtio/pci.c | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/src/vnet/devices/virtio/pci.c b/src/vnet/devices/virtio/pci.c index 71d813abfd7..9b68b1cefbe 100644 --- a/src/vnet/devices/virtio/pci.c +++ b/src/vnet/devices/virtio/pci.c @@ -486,7 +486,11 @@ virtio_pci_control_vring_init (vlib_main_t * vm, virtio_if_t * vif, virtio_log_debug (vif, "control-queue: number %u, size %u", queue_num, queue_size); vif->virtio_pci_func->setup_queue (vm, vif, queue_num, ptr); - vring->kick_fd = -1; + vring->queue_notify_offset = + vif->notify_off_multiplier * + vif->virtio_pci_func->get_queue_notify_off (vm, vif, queue_num); + virtio_log_debug (vif, "queue-notify-offset: number %u, offset %u", + queue_num, vring->queue_notify_offset); return error; } @@ -562,7 +566,11 @@ virtio_pci_vring_init (vlib_main_t * vm, virtio_if_t * vif, u16 queue_num) if (vif->virtio_pci_func->setup_queue (vm, vif, queue_num, ptr)) return clib_error_return (0, "error in queue address setup"); - vring->kick_fd = -1; + vring->queue_notify_offset = + vif->notify_off_multiplier * + vif->virtio_pci_func->get_queue_notify_off (vm, vif, queue_num); + virtio_log_debug (vif, "queue-notify-offset: number %u, offset %u", + queue_num, vring->queue_notify_offset); return error; } @@ -775,6 +783,7 @@ virtio_pci_read_caps (vlib_main_t * vm, virtio_if_t * vif, void **bar) if (common_cfg == 0 || notify == 0 || dev_cfg == 0 || isr == 0) { vif->virtio_pci_func = &virtio_pci_legacy_func; + vif->notify_off_multiplier = 0; virtio_log_debug (vif, "legacy virtio pci device found"); return error; } @@ -783,9 +792,14 @@ virtio_pci_read_caps (vlib_main_t * vm, virtio_if_t * vif, void **bar) vif->virtio_pci_func = &virtio_pci_modern_func; if (!pci_cfg) - virtio_log_debug (vif, "modern virtio pci device found"); + { + virtio_log_debug (vif, "modern virtio pci device found"); + } + else + { + virtio_log_debug (vif, "transitional virtio pci device found"); + } - virtio_log_debug (vif, "transitional virtio pci device found"); return error; } @@ -1244,8 +1258,6 @@ virtio_pci_delete_if (vlib_main_t * vm, virtio_if_t * vif) vec_foreach_index (i, vif->rxq_vrings) { virtio_vring_t *vring = vec_elt_at_index (vif->rxq_vrings, i); - if (vring->kick_fd != -1) - close (vring->kick_fd); if (vring->used) { virtio_free_rx_buffers (vm, vring); @@ -1257,8 +1269,6 @@ virtio_pci_delete_if (vlib_main_t * vm, virtio_if_t * vif) vec_foreach_index (i, vif->txq_vrings) { virtio_vring_t *vring = vec_elt_at_index (vif->txq_vrings, i); - if (vring->kick_fd != -1) - close (vring->kick_fd); if (vring->used) { virtio_free_used_desc (vm, vring); |