]> xenbits.xensource.com Git - unikraft/unikraft.git/commitdiff
plat/drivers: Starting the virtio device
authorSharan Santhanam <sharan.santhanam@neclab.eu>
Thu, 25 Oct 2018 09:49:51 +0000 (11:49 +0200)
committerSimon Kuenzer <simon.kuenzer@neclab.eu>
Thu, 25 Oct 2018 11:12:23 +0000 (13:12 +0200)
Signed-off-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
Signed-off-by: Razvan Cojocaru <razvan.cojocaru93@gmail.com>
Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
plat/drivers/virtio/virtio_net.c

index 68cada19025638e916ee3a4a352a632a16beb45e..53c0c9369937901015a312cbe3b0c851f4ffcc5f 100644 (file)
@@ -692,7 +692,33 @@ static void virtio_net_info_get(struct uk_netdev *dev,
 
 static int virtio_net_start(struct uk_netdev *n)
 {
+       struct virtio_net_device *d;
+       int i = 0;
+
        UK_ASSERT(n != NULL);
+       d = to_virtionetdev(n);
+
+       /*
+        * By default, interrupts are disabled and it is up to the user or
+        * network stack to manually enable them with a call to
+        * enable_tx|rx_intr()
+        */
+       for (i = 0; i < d->rx_vqueue_cnt; i++) {
+               virtqueue_intr_disable(d->rxqs[i].vq);
+               d->rxqs[i].intr_enabled = 0;
+       }
+
+       for (i = 0; i < d->tx_vqueue_cnt; i++) {
+               virtqueue_intr_disable(d->txqs[i].vq);
+               d->txqs[i].intr_enabled = 0;
+       }
+
+       /*
+        * Set the DRIVER_OK status bit. At this point the device is "live".
+        */
+       virtio_dev_drv_up(d->vdev);
+       uk_pr_info(DRIVER_NAME": %"__PRIu16" started\n", d->uid);
+
        return 0;
 }