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>
diff --git a/src/vnet/devices/virtio/virtio_pci_modern.c b/src/vnet/devices/virtio/virtio_pci_modern.c
index 4eb0ff1..1934f98 100644
--- a/src/vnet/devices/virtio/virtio_pci_modern.c
+++ b/src/vnet/devices/virtio/virtio_pci_modern.c
@@ -208,7 +208,8 @@
 }
 
 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 @@
 
 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 @@
   .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,