vdpa/ifc: add interrupt relay for block device
authorAndy Pei <andy.pei@intel.com>
Tue, 24 May 2022 02:48:09 +0000 (10:48 +0800)
committerMaxime Coquelin <maxime.coquelin@redhat.com>
Wed, 1 Jun 2022 09:50:10 +0000 (11:50 +0200)
For the net device type, only interrupt of rxq needed to be relayed.
But for block, since all the queues are used for both read and write
requests. Interrupt of all queues needed to be relayed.

Signed-off-by: Andy Pei <andy.pei@intel.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
drivers/vdpa/ifc/ifcvf_vdpa.c

index 10a4a25..61fb427 100644 (file)
@@ -369,6 +369,7 @@ vdpa_enable_vfio_intr(struct ifcvf_internal *internal, bool m_rx)
        irq_set->index = VFIO_PCI_MSIX_IRQ_INDEX;
        irq_set->start = 0;
        fd_ptr = (int *)&irq_set->data;
+       /* The first interrupt is for the configure space change notification */
        fd_ptr[RTE_INTR_VEC_ZERO_OFFSET] =
                rte_intr_fd_get(internal->pdev->intr_handle);
 
@@ -378,7 +379,13 @@ vdpa_enable_vfio_intr(struct ifcvf_internal *internal, bool m_rx)
        for (i = 0; i < nr_vring; i++) {
                rte_vhost_get_vhost_vring(internal->vid, i, &vring);
                fd_ptr[RTE_INTR_VEC_RXTX_OFFSET + i] = vring.callfd;
-               if ((i & 1) == 0 && m_rx == true) {
+               if (m_rx == true &&
+                       ((i & 1) == 0 || internal->hw.device_type == IFCVF_BLK)) {
+                       /* For the net we only need to relay rx queue,
+                        * which will change the mem of VM.
+                        * For the blk we need to relay all the read cmd
+                        * of each queue
+                        */
                        fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
                        if (fd < 0) {
                                DRV_LOG(ERR, "can't setup eventfd: %s",