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

[Minios-devel] [UNIKRAFT PATCH 12/15] plat/tap: Start a tap device



The patch implements the function to start the tap device.

Signed-off-by: Sharan Santhanam <sharan.santhanam@xxxxxxxxx>
---
 plat/drivers/tap/tap.c | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/plat/drivers/tap/tap.c b/plat/drivers/tap/tap.c
index fad92ef..ab864a1 100644
--- a/plat/drivers/tap/tap.c
+++ b/plat/drivers/tap/tap.c
@@ -411,10 +411,27 @@ err_exit:
 
 static int tap_netdev_start(struct uk_netdev *n)
 {
-       int rc = -EINVAL;
+       int rc = 0;
+       struct tap_net_dev *tdev = NULL;
+       struct uk_ifreq ifrq = {0};
 
        UK_ASSERT(n);
-       return rc;
+       tdev = to_tapnetdev(n);
+       /* Set the name of the device */
+       snprintf(ifrq.ifr_name, sizeof(ifrq.ifr_name), "%s", tdev->name);
+
+       ifrq.ifr_flags = UK_IFF_UP | UK_IFF_PROMISC;
+
+       /* Set the status of the device */
+       rc = tap_netif_configure(tdev->ctrl_sock, UK_SIOCSIFFLAGS, &ifrq);
+       if (rc < 0) {
+               uk_pr_err(DRIVER_NAME": Failed(%d) to set the flags of if: 
%s\n",
+                         rc, tdev->name);
+               return rc;
+       }
+       tdev->promisc = 1;
+
+       return 0;
 }
 
 static void tap_netdev_info_get(struct uk_netdev *dev __unused,
-- 
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®.