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
committerAndrew Yourtchenko <ayourtch@gmail.com>2020-09-30 11:31:26 +0000
commit8eb1e6d1f092609d30496fae28c0e0d3f73bacbc (patch)
tree82901f2c6656f0a29eca7217457242124c1f4b79 /src/vnet/devices/virtio/virtio_pci_modern.c
parent47e0bd7303b1bcc81c3458ca9e26b43a39fcfe17 (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> (cherry picked from commit 162a296756f3dbead55079e4670973d859df1ef9)
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,