[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Minios-devel] [UNIKRAFT PATCH v3 5/7] plat/drivers: Configure receive queue interrupt



The patch implements enable and disabling interrupt on the receive
queue.

Signed-off-by: Sharan Santhanam <sharan.santhanam@xxxxxxxxx>
Signed-off-by: Razvan Cojocaru <razvan.cojocaru93@xxxxxxxxx>
Reviewed-by: Simon Kuenzer <simon.kuenzer@xxxxxxxxx>
---
 plat/drivers/virtio/virtio_net.c | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/plat/drivers/virtio/virtio_net.c b/plat/drivers/virtio/virtio_net.c
index 3a749aa..68cada1 100644
--- a/plat/drivers/virtio/virtio_net.c
+++ b/plat/drivers/virtio/virtio_net.c
@@ -642,19 +642,39 @@ err_negotiate_feature:
 }
 
 static int virtio_net_rx_intr_enable(struct uk_netdev *n,
-                                    struct uk_netdev_rx_queue *queue __unused)
+                                    struct uk_netdev_rx_queue *queue)
 {
+       struct virtio_net_device *d __unused;
        int rc = 0;
 
        UK_ASSERT(n);
+       d = to_virtionetdev(n);
+       /* If the interrupt is enabled */
+       if (queue->intr_enabled & VTNET_INTR_EN)
+               return 0;
+
+       /**
+        * Enable the user configuration bit. This would cause the interrupt to
+        * be enabled automatically, if the interrupt could not be enabled now
+        * due to data in the queue.
+        */
+       queue->intr_enabled = VTNET_INTR_USR_EN;
+       rc = virtqueue_intr_enable(queue->vq);
+       if (!rc)
+               queue->intr_enabled |= VTNET_INTR_EN;
 
        return rc;
 }
 
 static int virtio_net_rx_intr_disable(struct uk_netdev *n,
-                                     struct uk_netdev_rx_queue *queue __unused)
+                                     struct uk_netdev_rx_queue *queue)
 {
+       struct virtio_net_device *vndev __unused;
+
        UK_ASSERT(n);
+       vndev = to_virtionetdev(n);
+       virtqueue_intr_disable(queue->vq);
+       queue->intr_enabled &= ~(VTNET_INTR_USR_EN | VTNET_INTR_EN);
        return 0;
 }
 
-- 
2.7.4


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.