Hook in mlx4/ driver to activate kernel bypass logic.

Signed-off-by: Kanoj Sarcar <[email protected]>
---
 kern/drivers/net/Kbuild      |  2 ++
 kern/drivers/net/Kconfig     |  5 +++++
 kern/drivers/net/mlx4/main.c | 23 +++++++++++++++++++++++
 3 files changed, 30 insertions(+)

diff --git a/kern/drivers/net/Kbuild b/kern/drivers/net/Kbuild
index 4901efb..6b57bb7 100644
--- a/kern/drivers/net/Kbuild
+++ b/kern/drivers/net/Kbuild
@@ -2,6 +2,8 @@
 obj-y                                                  += dummy.o
 obj-$(CONFIG_BNX2X)                            += bnx2x/
 obj-$(CONFIG_MLX4_CORE)                                        += mlx4/
+obj-$(CONFIG_MLX4_INFINIBAND)                          += mlx4u/
+obj-$(CONFIG_MLX4_INFINIBAND)                          += udrvr/
 obj-y                                                  += ether8139.o
 obj-y                                                  += ether8169.o
 obj-y                                                  += ether82563.o
diff --git a/kern/drivers/net/Kconfig b/kern/drivers/net/Kconfig
index 1d43190..e0323de 100644
--- a/kern/drivers/net/Kconfig
+++ b/kern/drivers/net/Kconfig
@@ -15,6 +15,7 @@ config BNX2X_SRIOV
 config MLX4_EN
        tristate "Mellanox Technologies 1/10/40Gbit Ethernet support"
        select MLX4_CORE
+       select MLX4_INFINIBAND
        help
                This driver supports Mellanox Technologies ConnectX Ethernet
                devices.
@@ -29,3 +30,7 @@ config MLX4_DEFAULT_MGM_LOG_ENTRY_SIZE
        default 10
        help
                To activate device managed flow steering when available, set to 
-1.
+
+config MLX4_INFINIBAND
+       tristate
+       default n
diff --git a/kern/drivers/net/mlx4/main.c b/kern/drivers/net/mlx4/main.c
index 9b88c0a..a664d68 100644
--- a/kern/drivers/net/mlx4/main.c
+++ b/kern/drivers/net/mlx4/main.c
@@ -3949,6 +3949,29 @@ static int mlx4_pnp(struct ether *edev)
        persist->edev = edev;
        mlx4_en_init();
 
+       /*
+        * In Linux, this is the module initialization vs device probe sequence:
+        * Core init routine mlx4_init() first executes, then EN/IB interface
+        * registration (mlx4_en_init(), mlx4_ib_init() invokes
+        * mlx4_register_interface()). Then, probe flow
+        * mlx4_pnp():mlx4_init_one():__mlx4_init_one():mlx4_load_one() does
+        * mlx4_register_device(). This causes all registered
+        * interface handlers (mlx4_en_add(), mlx4_ib_add()) to be invoked.
+        *
+        * In Akaros, the flow is different. Device probe flow first does
+        * mlx4_register_device(). Then core init mlx4_init() followed by
+        * interface registration. What should really happen is that
+        * mlx4_init(), mlx4_en_init() and mlx4_ib_init() should be invoked
+        * from ethermlx4_link() prior to device probe.
+        */
+#ifdef CONFIG_MLX4_INFINIBAND
+       extern int mlx4_ib_init();
+       extern int ib_uverbs_init();
+
+       ib_uverbs_init();
+       mlx4_ib_init();
+#endif
+
        // edev->ctlr is already initialized to struct mlx4_en_priv.
        pdev = persist->pdev;
        edev->irq = pdev->irqline;

-- 
You received this message because you are subscribed to the Google Groups 
"Akaros" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to