virtio_dev_configure() can call virtio_init_device() more than once
with Rx interrupts enabled. Each call enables the eventfds again without
releasing the previous ones. This used to leak the old eventfds, but EAL
now rejects the repeated enable, causing dev_configure() to fail.

Fix this by disabling the eventfds before enabling them again, except
for virtio-user which does not recreate them.

Fixes: e7b9d1d2806c ("net/virtio: fix Rx interrupt setup")
Cc: [email protected]

Signed-off-by: Ciara Loftus <[email protected]>
---
 drivers/net/virtio/virtio_ethdev.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/virtio/virtio_ethdev.c 
b/drivers/net/virtio/virtio_ethdev.c
index f2302089ee..18d258a519 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1455,6 +1455,10 @@ virtio_configure_intr(struct rte_eth_dev *dev)
                return -ENOTSUP;
        }
 
+       /* Release efds from a previous init. VDEV owns its own */
+       if (rte_intr_type_get(dev->intr_handle) != RTE_INTR_HANDLE_VDEV)
+               rte_intr_efd_disable(dev->intr_handle);
+
        ret = rte_intr_efd_enable(dev->intr_handle, dev->data->nb_rx_queues);
        if (ret < 0) {
                PMD_INIT_LOG(ERR, "Fail to create eventfd");
-- 
2.43.0

Reply via email to