[MLX4] added a possibility to register event handler with MLX4_BUS driver. [MLNX...
authorleonidk <leonidk@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Mon, 21 Jul 2008 10:36:38 +0000 (10:36 +0000)
committerleonidk <leonidk@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Mon, 21 Jul 2008 10:36:38 +0000 (10:36 +0000)
It is an extension of the Ethernet interface of mlx4_bus driver.
The mlx4_eth handler is called on DPC level upon asynchronous events like PORT_UP/PORT_DOWN, passing event data and the callback context parameter, set upon registration.

git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@1423 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

hw/mlx4/kernel/bus/core/cache.c
hw/mlx4/kernel/bus/drv/pdo.c
hw/mlx4/kernel/bus/inc/bus_intf.h
hw/mlx4/kernel/bus/inc/ib_verbs.h

index 11f5e81..a313236 100644 (file)
@@ -382,7 +382,7 @@ static void ib_cache_setup_one(struct ib_device *device)
        }
 
        INIT_IB_EVENT_HANDLER(&device->cache.event_handler,
-                             device, ib_cache_event);
+                             device, ib_cache_event, NULL);
        if (ib_register_event_handler(&device->cache.event_handler))
                goto err_cache;
 
index b8b3b0d..430a695 100644 (file)
@@ -228,7 +228,8 @@ Return Value:
        p_fdo->bus_ib_ifc.mlx4_interface.mlx4_CLOSE_PORT = mlx4_CLOSE_PORT;\r
        p_fdo->bus_ib_ifc.mlx4_interface.mlx4_add_eq = mlx4_add_eq;\r
        p_fdo->bus_ib_ifc.mlx4_interface.mlx4_remove_eq = mlx4_remove_eq;\r
-\r
+       p_fdo->bus_ib_ifc.mlx4_interface.mlx4_register_ev_cb = ib_register_event_handler;\r
+       p_fdo->bus_ib_ifc.mlx4_interface.mlx4_unregister_ev_cb = ib_unregister_event_handler;\r
        \r
        //\r
        // Create a custom interface so that other drivers can\r
index 558fc7d..f507d92 100644 (file)
@@ -2,6 +2,7 @@
 
 #define MLX4_BUS_IB_INTERFACE_VERSION          2
 
+#include <ib_verbs.h>
 //
 // Interface for work with MLX4 IB driver
 //
@@ -109,7 +110,10 @@ typedef int (*MLX4_ADD_EQ) (struct mlx4_dev *dev, int nent,
                          u8 intr, PISR_FUNC func, PVOID func_context ,
                          u8* p_eq_num, struct mlx4_eq ** p_eq);
 
-typedef VOID (*MLX4_REMOVE_EQ) (struct mlx4_dev *dev, u8 eq_num);
+typedef void (*MLX4_REMOVE_EQ) (struct mlx4_dev *dev, u8 eq_num);
+
+typedef int (*MLX4_REGISTER_EVENT_HANDLER) (struct ib_event_handler *event_handler);
+typedef int (*MLX4_UNREGISTER_EVENT_HANDLER)(struct ib_event_handler *event_handler);
 
 
 struct mlx4_interface_ex {
@@ -158,6 +162,9 @@ struct mlx4_interface_ex {
 
        MLX4_ADD_EQ            mlx4_add_eq;
        MLX4_REMOVE_EQ         mlx4_remove_eq;
+
+       MLX4_REGISTER_EVENT_HANDLER mlx4_register_ev_cb;
+       MLX4_UNREGISTER_EVENT_HANDLER mlx4_unregister_ev_cb;
        
 };
 
index a75e582..990740a 100644 (file)
@@ -289,13 +289,15 @@ struct ib_event {
 struct ib_event_handler {
        struct ib_device *device;
        void            (*handler)(struct ib_event_handler *, struct ib_event *);
+       void *            ctx;
        struct list_head  list;
 };
 
-#define INIT_IB_EVENT_HANDLER(_ptr, _device, _handler)         \
+#define INIT_IB_EVENT_HANDLER(_ptr, _device, _handler, _ctx)           \
        {                                                       \
                (_ptr)->device  = _device;                      \
-               (_ptr)->handler = _handler;                     \
+               (_ptr)->handler = _handler;             \
+               (_ptr)->ctx = _ctx;             \
                INIT_LIST_HEAD(&(_ptr)->list);                  \
        }