summaryrefslogtreecommitdiffstats
path: root/src/vnet/devices/virtio/virtio_pci_modern.c
diff options
context:
space:
mode:
authorMohsin Kazmi <sykazmi@cisco.com>2020-09-29 10:01:25 +0000
committerBeno�t Ganne <bganne@cisco.com>2020-09-29 13:34:13 +0000
commit162a296756f3dbead55079e4670973d859df1ef9 (patch)
treec24b836a83a051d809508697ba8871538a0ea040 /src/vnet/devices/virtio/virtio_pci_modern.c
parentd68faf8559da72aa6ad0526d5a86fb16587b1508 (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/virtio_pci_modern.c')
-rw-r--r--src/vnet/devices/virtio/virtio_pci_modern.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/vnet/devices/virtio/virtio_pci_modern.c b/src/vnet/devices/virtio/virtio_pci_modern.c
index 4eb0ff102ae..1934f98003d 100644
--- a/src/vnet/devices/virtio/virtio_pci_modern.c
+++ b/src/vnet/devices/virtio/virtio_pci_modern.c
@@ -208,7 +208,8 @@ virtio_pci_modern_set_queue_enable (virtio_if_t * vif, u16 queue_id,
}
static u16
-virtio_pci_modern_get_queue_notify_off (virtio_if_t * vif, u16 queue_id)
+virtio_pci_modern_get_queue_notify_off (vlib_main_t * vm, virtio_if_t * vif,
+ u16 queue_id)
{
u16 queue_notify_off = 0;
virtio_pci_modern_set_queue_select (vif, queue_id);
@@ -387,14 +388,11 @@ virtio_pci_modern_get_isr (vlib_main_t * vm, virtio_if_t * vif)
inline void
virtio_pci_modern_notify_queue (vlib_main_t * vm, virtio_if_t * vif,
- u16 queue_id)
+ u16 queue_id, u16 queue_notify_off)
{
- u16 queue_notify_off =
- virtio_pci_modern_get_queue_notify_off (vif, queue_id);
virtio_pci_reg_write_u16 (vif,
VIRTIO_NOTIFICATION_OFFSET (vif) +
- vif->notify_off_multiplier * queue_notify_off,
- queue_id);
+ queue_notify_off, queue_id);
}
static void
@@ -418,6 +416,7 @@ const virtio_pci_func_t virtio_pci_modern_func = {
.set_queue_size = virtio_pci_modern_set_queue_size,
.setup_queue = virtio_pci_modern_setup_queue,
.del_queue = virtio_pci_modern_del_queue,
+ .get_queue_notify_off = virtio_pci_modern_get_queue_notify_off,
.notify_queue = virtio_pci_modern_notify_queue,
.set_config_irq = virtio_pci_modern_set_msix_config,
.set_queue_irq = virtio_pci_modern_set_queue_msix_vector,