};\r
\r
enum ib_event_type {\r
- IB_EVENT_CQ_ERR = IB_AE_CQ_ERROR,\r
- IB_EVENT_QP_FATAL = IB_AE_QP_FATAL,\r
- IB_EVENT_QP_REQ_ERR = IB_AE_WQ_REQ_ERROR,\r
- IB_EVENT_QP_ACCESS_ERR = IB_AE_WQ_ACCESS_ERROR,\r
- IB_EVENT_COMM_EST = IB_AE_QP_COMM,\r
- IB_EVENT_SQ_DRAINED = IB_AE_SQ_DRAINED,\r
- IB_EVENT_PATH_MIG = IB_AE_QP_APM,\r
- IB_EVENT_PATH_MIG_ERR = IB_AE_QP_APM_ERROR,\r
- IB_EVENT_DEVICE_FATAL = IB_AE_LOCAL_FATAL,\r
- IB_EVENT_PORT_ACTIVE = IB_AE_PORT_ACTIVE,\r
- IB_EVENT_PORT_ERR = IB_AE_PORT_DOWN,\r
- IB_EVENT_SRQ_LIMIT_REACHED = IB_AE_SRQ_LIMIT_REACHED,\r
- IB_EVENT_SRQ_ERR = IB_AE_SRQ_CATAS_ERROR,\r
- IB_EVENT_QP_LAST_WQE_REACHED = IB_AE_SRQ_QP_LAST_WQE_REACHED,\r
- IB_EVENT_LID_CHANGE = IB_AE_UNKNOWN + 1,\r
+ IB_EVENT_CQ_ERR = IB_AE_CQ_ERROR,\r
+ IB_EVENT_QP_FATAL = IB_AE_QP_FATAL,\r
+ IB_EVENT_QP_REQ_ERR = IB_AE_WQ_REQ_ERROR,\r
+ IB_EVENT_QP_ACCESS_ERR = IB_AE_WQ_ACCESS_ERROR,\r
+ IB_EVENT_COMM_EST = IB_AE_QP_COMM,\r
+ IB_EVENT_SQ_DRAINED = IB_AE_SQ_DRAINED,\r
+ IB_EVENT_PATH_MIG = IB_AE_QP_APM,\r
+ IB_EVENT_PATH_MIG_ERR = IB_AE_QP_APM_ERROR,\r
+ IB_EVENT_DEVICE_FATAL = IB_AE_LOCAL_FATAL,\r
+ IB_EVENT_PORT_ACTIVE = IB_AE_PORT_ACTIVE,\r
+ IB_EVENT_PORT_ERR = IB_AE_PORT_DOWN,\r
+ IB_EVENT_SRQ_LIMIT_REACHED = IB_AE_SRQ_LIMIT_REACHED,\r
+ IB_EVENT_SRQ_ERR = IB_AE_SRQ_CATAS_ERROR,\r
+ IB_EVENT_QP_LAST_WQE_REACHED = IB_AE_SRQ_QP_LAST_WQE_REACHED,\r
+ IB_EVENT_RESET_DRIVER = IB_AE_RESET_DRIVER, // device will be reset upon fatal error\r
+ IB_EVENT_RESET_CLIENT = IB_AE_RESET_CLIENT, // device will be reset upon client request\r
+ IB_EVENT_RESET_END = IB_AE_RESET_END, // device has been reset \r
+ IB_EVENT_LID_CHANGE = IB_AE_UNKNOWN + 1,\r
IB_EVENT_PKEY_CHANGE,\r
IB_EVENT_SM_CHANGE,\r
- IB_EVENT_CLIENT_REREGISTER,\r
- IB_EVENT_RESET_DRIVER, // device will be reset upon fatal error\r
- IB_EVENT_RESET_CLIENT, // device will be upon client request\r
- IB_EVENT_RESET_END // device has been reset \r
+ IB_EVENT_CLIENT_REREGISTER\r
};\r
\r
struct ib_event {\r
\r
/////////////////////////////////////////////////////////\r
/////////////////////////////////////////////////////////\r
+\r
+void ca_event_handler(struct ib_event *ev, void *context)\r
+{\r
+ mlnx_hca_t *p_hca = (mlnx_hca_t *)context;\r
+ ib_event_rec_t event_rec;\r
+ LIST_ENTRY *entry;\r
+ ci_event_handler_t *event_handler;\r
+\r
+ // prepare parameters\r
+ event_rec.type = ev->event;\r
+ event_rec.port_number = ev->element.port_num;\r
+ if (event_rec.type > IB_AE_UNKNOWN) {\r
+ // CL_ASSERT(0); // This shouldn't happen\r
+ HCA_PRINT(TRACE_LEVEL_ERROR,HCA_DBG_SHIM,("Unmapped E_EV_CA event of type 0x%x. Replaced by 0x%x (IB_AE_LOCAL_FATAL)\n", \r
+ event_rec.type, IB_AE_LOCAL_FATAL));\r
+ event_rec.type = IB_AE_LOCAL_FATAL;\r
+ }\r
+\r
+ // call the user callback\r
+ KeAcquireSpinLockAtDpcLevel(&p_hca->event_list_lock);\r
+ for (entry = p_hca->event_list.Flink; entry != &p_hca->event_list;\r
+ entry = entry->Flink) {\r
+\r
+ event_handler = CONTAINING_RECORD(entry, ci_event_handler_t, entry);\r
+ event_rec.context = (void *) event_handler;\r
+ event_handler->pfn_async_event_cb(&event_rec);\r
+ }\r
+ KeReleaseSpinLockFromDpcLevel(&p_hca->event_list_lock);\r
+\r
+ if (p_hca && p_hca->async_cb_p) {\r
+ event_rec.context = (void *)p_hca->ca_context;\r
+ (p_hca->async_cb_p)(&event_rec);\r
+ } else {\r
+ HCA_PRINT(TRACE_LEVEL_ERROR ,HCA_DBG_SHIM ,("Incorrect context. Async callback was not invoked\n"));\r
+ }\r
+}\r
+\r
+\r
+void event_handler( struct ib_event_handler *handler, struct ib_event *event )\r
+{\r
+ ca_event_handler( event, handler->ctx );\r
+}\r
+\r
ib_api_status_t\r
mlnx_set_cb(\r
IN mlnx_hca_t * p_hca, \r
IN ci_async_event_cb_t async_cb_p,\r
IN const void* const ib_context)\r
{\r
+ int err;\r
cl_status_t cl_status;\r
+ struct ib_device *ibdev = hca2ibdev(p_hca);\r
\r
// Setup the callbacks\r
if (!p_hca->async_proc_mgr_p)\r
\r
p_hca->async_cb_p = async_cb_p;\r
p_hca->ca_context = ib_context; // This is the context our CB forwards to IBAL\r
+\r
+ // register callback with bus driver\r
+ INIT_IB_EVENT_HANDLER( &p_hca->ib_event_handler, ibdev, \r
+ event_handler, p_hca, NULL, 0 );\r
+ \r
+ err = ibdev->x.register_ev_cb(&p_hca->ib_event_handler);\r
+ if (err) {\r
+ RtlZeroMemory( &p_hca->ib_event_handler, sizeof(p_hca->ib_event_handler) );\r
+ return IB_ERROR;\r
+ }\r
+\r
return IB_SUCCESS;\r
}\r
\r
IN mlnx_hca_t * p_hca)\r
{\r
cl_async_proc_t *p_async_proc;\r
-\r
+ struct ib_device *ibdev = hca2ibdev(p_hca);\r
\r
cl_spinlock_acquire( &hca_lock );\r
\r
+ // unregister callback with bus driver\r
+ if ( p_hca->ib_event_handler.handler )\r
+ ibdev->x.unregister_ev_cb(&p_hca->ib_event_handler);\r
+\r
p_async_proc = p_hca->async_proc_mgr_p;\r
p_hca->async_proc_mgr_p = NULL;\r
\r
}\r
}\r
\r
-void ca_event_handler(struct ib_event *ev, void *context)\r
-{\r
- mlnx_hca_t *p_hca = (mlnx_hca_t *)context;\r
- ib_event_rec_t event_rec;\r
- LIST_ENTRY *entry;\r
- ci_event_handler_t *event_handler;\r
-\r
- // prepare parameters\r
- event_rec.type = ev->event;\r
- event_rec.port_number = ev->element.port_num;\r
- if (event_rec.type > IB_AE_UNKNOWN) {\r
- // CL_ASSERT(0); // This shouldn't happen\r
- HCA_PRINT(TRACE_LEVEL_ERROR,HCA_DBG_SHIM,("Unmapped E_EV_CA event of type 0x%x. Replaced by 0x%x (IB_AE_LOCAL_FATAL)\n", \r
- event_rec.type, IB_AE_LOCAL_FATAL));\r
- event_rec.type = IB_AE_LOCAL_FATAL;\r
- }\r
-\r
- // call the user callback\r
- KeAcquireSpinLockAtDpcLevel(&p_hca->event_list_lock);\r
- for (entry = p_hca->event_list.Flink; entry != &p_hca->event_list;\r
- entry = entry->Flink) {\r
-\r
- event_handler = CONTAINING_RECORD(entry, ci_event_handler_t, entry);\r
- event_rec.context = (void *) event_handler;\r
- event_handler->pfn_async_event_cb(&event_rec);\r
- }\r
- KeReleaseSpinLockFromDpcLevel(&p_hca->event_list_lock);\r
-\r
- if (p_hca && p_hca->async_cb_p) {\r
- event_rec.context = (void *)p_hca->ca_context;\r
- (p_hca->async_cb_p)(&event_rec);\r
- } else {\r
- HCA_PRINT(TRACE_LEVEL_ERROR ,HCA_DBG_SHIM ,("Incorrect context. Async callback was not invoked\n"));\r
- }\r
-}\r
-\r
enum ib_rate to_rate(uint8_t rate)\r
{\r
if (rate == IB_PATH_RECORD_RATE_2_5_GBS) return IB_RATE_2_5_GBPS;\r