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

[UNIKRAFT PATCH v3 02/16] plat/tap: Bus interface for the tap device



The tap driver registers itself with the uk_bus. The uk_bus on
initialization provide the necessary interface to setup the driver.
The probe callback provides necessary interface to setup the tap
device.

Signed-off-by: Sharan Santhanam <sharan.santhanam@xxxxxxxxx>
---
 plat/drivers/tap/tap.c | 33 +++++++++++++++++++++++++++++++++
 plat/linuxu/Config.uk  |  1 +
 2 files changed, 34 insertions(+)

diff --git a/plat/drivers/tap/tap.c b/plat/drivers/tap/tap.c
index 4beb67bd..3435e846 100644
--- a/plat/drivers/tap/tap.c
+++ b/plat/drivers/tap/tap.c
@@ -37,6 +37,17 @@
 #include <uk/netdev_driver.h>
 #include <uk/netbuf.h>
 #include <uk/errptr.h>
+#include <uk/bus.h>
+
+struct tap_net_drv {
+       /* allocator to initialize the driver data structure */
+       struct uk_alloc *a;
+};
+
+/**
+ * Module level variables
+ */
+static struct tap_net_drv tap_drv = {0};
 
 /**
  * Module functions
@@ -214,3 +225,25 @@ static const struct uk_netdev_ops tap_netdev_ops = {
        .txq_info_get = tap_netdev_txq_info_get,
        .rxq_info_get = tap_netdev_rxq_info_get,
 };
+
+/**
+ * Register a tap driver as bus. Currently in Unikraft, the uk_bus interface
+ * provides the necessary to provide callbacks for bring a pseudo device. In 
the
+ * future we might provide interface to support the pseudo device.
+ */
+static int tap_drv_probe(void)
+{
+       return 0;
+}
+
+static int tap_drv_init(struct uk_alloc *_a)
+{
+       tap_drv.a = _a;
+       return 0;
+}
+
+static struct uk_bus tap_bus = {
+       .init = tap_drv_init,
+       .probe = tap_drv_probe,
+};
+UK_BUS_REGISTER(&tap_bus);
diff --git a/plat/linuxu/Config.uk b/plat/linuxu/Config.uk
index 5df48f3f..3900e8bc 100644
--- a/plat/linuxu/Config.uk
+++ b/plat/linuxu/Config.uk
@@ -22,6 +22,7 @@ if (PLAT_LINUXU)
        bool "Tap driver"
        default y if LIBUKNETDEV
        depends on LIBUKNETDEV
+       select LIBUKBUS
        help
                Enable drivers to support tap device on the linuxu platform. The
                driver implements the uknetdev interface and provides an 
interface
-- 
2.20.1




 


Rackspace

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