Bottom: 7784f453d39829ad87057d6488280ca48821ba8c
-Top: c4ff9fd67b338806c462b101af47f7cc3c1ab265
+Top: ca319bddfbb13954cab2a3e2352a3275d27cb03d
Author: U-AMR\MSHEFTY <MSHEFTY@mshefty-MOBL2.amr.corp.intel.com>
Date: 2009-12-07 10:36:50 -0800
---
diff --git a/trunk/core/al/kernel/al_cm.c b/trunk/core/al/kernel/al_cm.c
-index 48b0cb5..a3649bc 100644
+index 48b0cb5..955985a 100644
--- a/trunk/core/al/kernel/al_cm.c
+++ b/trunk/core/al/kernel/al_cm.c
-@@ -37,7 +37,8 @@
+@@ -37,7 +37,7 @@
typedef struct _iba_cm_id_priv\r
{\r
iba_cm_id id;\r
- KEVENT destroy_event; \r
+ KEVENT destroy_event;\r
-+int destroyed;\r
\r
} iba_cm_id_priv;\r
\r
-@@ -55,6 +56,7 @@ cm_alloc_id(NTSTATUS (*callback)(iba_cm_id *p_id, iba_cm_event *p_event),
- KeInitializeEvent(&id->destroy_event, NotificationEvent, FALSE);\r
- id->id.callback = callback;\r
- id->id.context = context;\r
-+id->destroyed = 0;\r
- return &id->id;\r
- }\r
- \r
-@@ -68,6 +70,12 @@ static void
- cm_destroy_handler(void *context)\r
- {\r
- iba_cm_id_priv *id = context;\r
-+if (id->destroyed) {\r
-+ DbgPrintEx(DPFLTR_IHVDRIVER_ID, 0, "cm_destroy_handler cid 0x%x already gave up\n",\r
-+ id->id.cid);\r
-+ cm_free_id(&id->id);\r
-+} else\r
-+\r
- KeSetEvent(&id->destroy_event, 0, FALSE);\r
- }\r
- \r
-@@ -137,10 +145,18 @@ static void
- cm_destroy_id(iba_cm_id *p_id)\r
- {\r
- iba_cm_id_priv *id;\r
-+LARGE_INTEGER timeout;\r
-+NTSTATUS status;\r
- \r
- id = CONTAINING_RECORD(p_id, iba_cm_id_priv, id);\r
- kal_cep_destroy(gh_al, p_id->cid, STATUS_SUCCESS);\r
-- KeWaitForSingleObject(&id->destroy_event, Executive, KernelMode, FALSE, NULL);\r
-+timeout.QuadPart = -90 * 1000000 * 10;\r
-+status =\r
-+ KeWaitForSingleObject(&id->destroy_event, Executive, KernelMode, FALSE, &timeout);\r
-+id->destroyed = 1;\r
-+if (status != STATUS_SUCCESS) {\r
-+ DbgPrintEx(DPFLTR_IHVDRIVER_ID, 0, "cm_destroy_id wait error 0x%x cid 0x%x\n", status, p_id->cid);\r
-+} else\r
- cm_free_id(p_id);\r
- }\r
- \r
diff --git a/trunk/core/al/kernel/al_cm_cep.c b/trunk/core/al/kernel/al_cm_cep.c
-index 49fa417..6118420 100644
+index 49fa417..4d0199d 100644
--- a/trunk/core/al/kernel/al_cm_cep.c
+++ b/trunk/core/al/kernel/al_cm_cep.c
@@ -27,7 +27,7 @@
*/\r
\r
\r
-@@ -318,6 +318,7 @@ typedef struct _al_kcep
- \r
- /* Volatile to allow using atomic operations for state checks. */\r
- cep_state_t state;\r
-+cep_state_t old_state[2];\r
- \r
- /*\r
- * Flag that indicates whether a connection took the active role during\r
-@@ -968,6 +969,7 @@ __process_rej(
- ib_put_mad( p_cep->p_mad );\r
- p_cep->p_mad = NULL;\r
- }\r
-+p_cep->old_state[1] = p_cep->state | 0x10000000;\r
- p_cep->state = CEP_STATE_TIMEWAIT;\r
- __insert_timewait( p_cep );\r
- break;\r
-@@ -1728,6 +1730,7 @@ __drep_handler(
- \r
- if( p_cep->state == CEP_STATE_DREQ_SENT )\r
- {\r
-+p_cep->old_state[1] = p_cep->state | 0x20000000;\r
- p_cep->state = CEP_STATE_TIMEWAIT;\r
- \r
- status = __cep_queue_mad( p_cep, p_mad );\r
-@@ -1736,6 +1739,7 @@ __drep_handler(
- {\r
- /* State is DREQ_DESTROY - move to DESTROY to allow cleanup. */\r
- CL_ASSERT( p_cep->state == CEP_STATE_DREQ_DESTROY );\r
-+p_cep->old_state[0] = p_cep->state;\r
- p_cep->state = CEP_STATE_DESTROY;\r
- \r
- ib_put_mad( p_mad );\r
-@@ -2196,6 +2200,9 @@ __cep_mad_send_cb(
- IN void *context,\r
- IN ib_mad_element_t *p_mad )\r
- {\r
-+//ib_wc_status_t mad_status;\r
-+//cep_state_t state;\r
-+//ib_net16_t attr_id;\r
- ib_api_status_t status;\r
- cep_agent_t *p_port_cep;\r
- kcep_t *p_cep;\r
-@@ -2227,37 +2234,50 @@ __cep_mad_send_cb(
+@@ -2227,91 +2227,72 @@ __cep_mad_send_cb(
p_mad->context1 = NULL;\r
\r
KeAcquireInStackQueuedSpinLockAtDpcLevel( &gp_cep_mgr->lock, &hdl );\r
p_cep->p_send_mad = NULL;\r
\r
- switch( p_mad->status )\r
-+//attr_id = p_mad->p_mad_buf->attr_id;\r
-+//mad_status = p_mad->status;\r
-+//state = p_cep->state;\r
-+ //switch( p_mad->status )\r
-+ //{\r
-+ //case IB_WCS_SUCCESS:\r
-+ // KeReleaseInStackQueuedSpinLockFromDpcLevel( &hdl );\r
-+ // ib_put_mad( p_mad );\r
-+ // break;\r
-+\r
-+ //case IB_WCS_CANCELED:\r
-+ //if( p_cep->state != CEP_STATE_REQ_SENT &&\r
-+ // p_cep->state != CEP_STATE_REQ_MRA_RCVD &&\r
-+ // p_cep->state != CEP_STATE_REP_SENT &&\r
-+ // p_cep->state != CEP_STATE_REP_MRA_RCVD &&\r
-+ // p_cep->state != CEP_STATE_LAP_SENT &&\r
-+ // p_cep->state != CEP_STATE_LAP_MRA_RCVD &&\r
-+ // p_cep->state != CEP_STATE_DREQ_SENT &&\r
-+ // p_cep->state != CEP_STATE_SREQ_SENT )\r
-+ //{\r
-+ // KeReleaseInStackQueuedSpinLockFromDpcLevel( &hdl );\r
-+ // ib_put_mad( p_mad );\r
-+ // break;\r
-+ //}\r
++ /* Treat as a timeout so we don't stall the state machine. */\r
+ if( p_mad->status == IB_WCS_CANCELED)\r
++ p_mad->status = IB_WCS_TIMEOUT_RETRY_ERR;\r
++\r
++ switch( p_cep->state )\r
{\r
- case IB_WCS_SUCCESS:\r
- KeReleaseInStackQueuedSpinLockFromDpcLevel( &hdl );\r
- ib_put_mad( p_mad );\r
-- break;\r
--\r
++ case CEP_STATE_REQ_SENT:\r
++ case CEP_STATE_REQ_MRA_RCVD:\r
++ case CEP_STATE_REP_SENT:\r
++ case CEP_STATE_REP_MRA_RCVD:\r
++ /* Send the REJ. */\r
++ __reject_timeout( p_port_cep, p_cep, p_mad );\r
++ __remove_cep( p_cep );\r
++ p_cep->state = CEP_STATE_IDLE;\r
+ break;\r
+ \r
- case IB_WCS_CANCELED:\r
- if( p_cep->state != CEP_STATE_REQ_SENT &&\r
- p_cep->state != CEP_STATE_REQ_MRA_RCVD &&\r
- ib_put_mad( p_mad );\r
- break;\r
- }\r
- /* Treat as a timeout so we don't stall the state machine. */\r
- p_mad->status = IB_WCS_TIMEOUT_RETRY_ERR;\r
-+ }\r
- \r
-- /* Fall through. */\r
+- /* Treat as a timeout so we don't stall the state machine. */\r
+- p_mad->status = IB_WCS_TIMEOUT_RETRY_ERR;\r
+-\r
++ case CEP_STATE_DREQ_DESTROY:\r
++ p_cep->state = CEP_STATE_DESTROY;\r
++ __insert_timewait( p_cep );\r
+ /* Fall through. */\r
- case IB_WCS_TIMEOUT_RETRY_ERR:\r
- default:\r
-+ // /* Fall through. */\r
-+ //case IB_WCS_TIMEOUT_RETRY_ERR:\r
-+ //default:\r
- /* Timeout. Reject the connection. */\r
- switch( p_cep->state )\r
- {\r
-@@ -2272,6 +2292,7 @@ __cep_mad_send_cb(
- break;\r
+- /* Timeout. Reject the connection. */\r
+- switch( p_cep->state )\r
+- {\r
+- case CEP_STATE_REQ_SENT:\r
+- case CEP_STATE_REQ_MRA_RCVD:\r
+- case CEP_STATE_REP_SENT:\r
+- case CEP_STATE_REP_MRA_RCVD:\r
+- /* Send the REJ. */\r
+- __reject_timeout( p_port_cep, p_cep, p_mad );\r
+- __remove_cep( p_cep );\r
+- p_cep->state = CEP_STATE_IDLE;\r
+- break;\r
+-\r
+- case CEP_STATE_DREQ_DESTROY:\r
+- p_cep->state = CEP_STATE_DESTROY;\r
+- __insert_timewait( p_cep );\r
+- /* Fall through. */\r
+-\r
+- case CEP_STATE_DESTROY:\r
+- KeReleaseInStackQueuedSpinLockFromDpcLevel( &hdl );\r
+- ib_put_mad( p_mad );\r
+- goto done;\r
+-\r
+- case CEP_STATE_DREQ_SENT:\r
+- /*\r
+- * Make up a DREP mad so we can respond if we receive\r
+- * a DREQ while in timewait.\r
+- */\r
+- __format_mad_hdr( &p_cep->mads.drep.hdr, p_cep, CM_DREP_ATTR_ID );\r
+- __format_drep( p_cep, NULL, 0, &p_cep->mads.drep );\r
+- p_cep->state = CEP_STATE_TIMEWAIT;\r
+- __insert_timewait( p_cep );\r
+- break;\r
+-\r
+- case CEP_STATE_LAP_SENT:\r
+- /*\r
+- * Before CEP was sent, we have been in CEP_STATE_ESTABLISHED as we\r
+- * failed to send, we return to that state.\r
+- */\r
+- p_cep->state = CEP_STATE_ESTABLISHED;\r
+- break;\r
+- default:\r
+- break;\r
+- }\r
\r
- case CEP_STATE_DREQ_DESTROY:\r
-+//p_cep->old_state[0] = p_cep->state;\r
- p_cep->state = CEP_STATE_DESTROY;\r
- __insert_timewait( p_cep );\r
- /* Fall through. */\r
-@@ -2288,6 +2309,14 @@ __cep_mad_send_cb(
- */\r
- __format_mad_hdr( &p_cep->mads.drep.hdr, p_cep, CM_DREP_ATTR_ID );\r
- __format_drep( p_cep, NULL, 0, &p_cep->mads.drep );\r
-+//DbgPrintEx(DPFLTR_IHVDRIVER_ID, 0, "__cep_mad_send_cb cid 0x%x, attr 0x%x status 0x%x DREQ_SENT->TIMEWAIT\n",\r
-+// p_cep->cid, attr_id, mad_status);\r
-+//p_cep->old_state[1] = p_cep->state | 0x30000000;\r
-+ if( p_cep->p_send_mad )\r
-+ {\r
-+ ib_cancel_mad(h_mad_svc, p_cep->p_send_mad);\r
-+ p_cep->p_send_mad = NULL;\r
-+ }\r
- p_cep->state = CEP_STATE_TIMEWAIT;\r
- __insert_timewait( p_cep );\r
- break;\r
-@@ -2309,15 +2338,21 @@ __cep_mad_send_cb(
+- status = __cep_queue_mad( p_cep, p_mad );\r
+- CL_ASSERT( status != IB_INVALID_STATE );\r
++ case CEP_STATE_DESTROY:\r
+ KeReleaseInStackQueuedSpinLockFromDpcLevel( &hdl );\r
++ ib_put_mad( p_mad );\r
++ goto done;\r
\r
- if( status == IB_SUCCESS )\r
- __process_cep( p_cep );\r
-- break;\r
-- }\r
-+ //break;\r
-+ //}\r
+- if( status == IB_SUCCESS )\r
+- __process_cep( p_cep );\r
++ case CEP_STATE_DREQ_SENT:\r
++ /*\r
++ * Make up a DREP mad so we can respond if we receive\r
++ * a DREQ while in timewait.\r
++ */\r
++ __format_mad_hdr( &p_cep->mads.drep.hdr, p_cep, CM_DREP_ATTR_ID );\r
++ __format_drep( p_cep, NULL, 0, &p_cep->mads.drep );\r
++ p_cep->state = CEP_STATE_TIMEWAIT;\r
++ __insert_timewait( p_cep );\r
++ break;\r
++\r
++ case CEP_STATE_LAP_SENT:\r
++ /*\r
++ * Before CEP was sent, we have been in CEP_STATE_ESTABLISHED as we\r
++ * failed to send, we return to that state.\r
++ */\r
++ p_cep->state = CEP_STATE_ESTABLISHED;\r
++ break;\r
++ default:\r
+ break;\r
+ }\r
\r
++ status = __cep_queue_mad( p_cep, p_mad );\r
++ CL_ASSERT( status != IB_INVALID_STATE );\r
++ KeReleaseInStackQueuedSpinLockFromDpcLevel( &hdl );\r
++\r
++ if( status == IB_SUCCESS )\r
++ __process_cep( p_cep );\r
++\r
done:\r
pfn_destroy_cb = p_cep->pfn_destroy_cb;\r
cep_context = p_cep->context;\r
+@@ -3938,12 +3919,8 @@ __cleanup_cep(
+ CL_ASSERT( KeGetCurrentIrql() == DISPATCH_LEVEL );\r
+ \r
+ /* If we've already come through here, we're done. */\r
+- if( p_cep->state == CEP_STATE_DESTROY ||\r
+- p_cep->state == CEP_STATE_DREQ_DESTROY )\r
+- {\r
+- AL_EXIT( AL_DBG_CM );\r
+- return -1;\r
+- }\r
++ CL_ASSERT( p_cep->state != CEP_STATE_DESTROY &&\r
++ p_cep->state != CEP_STATE_DREQ_DESTROY )\r
\r
- if( !cl_atomic_dec( &p_cep->ref_cnt ) && pfn_destroy_cb )\r
-+//{\r
-+//if (mad_status != IB_WCS_CANCELED)\r
-+// DbgPrintEx(DPFLTR_IHVDRIVER_ID, 0, "__cep_mad_send_cb cid 0x%x, attr 0x%x status 0x%x state 0x%x old states 0x%x 0x%x\n",\r
-+// p_cep->cid, attr_id, mad_status, state, p_cep->old_state[0], p_cep->old_state[1]);\r
-+//\r
- pfn_destroy_cb( cep_context );\r
-+//}\r
- AL_EXIT( AL_DBG_CM );\r
- }\r
- \r
-@@ -3941,6 +3976,7 @@ __cleanup_cep(
- if( p_cep->state == CEP_STATE_DESTROY ||\r
- p_cep->state == CEP_STATE_DREQ_DESTROY )\r
- {\r
-+DbgPrintEx(DPFLTR_IHVDRIVER_ID, 0, "IB CM is D-U-M-B\n");\r
- AL_EXIT( AL_DBG_CM );\r
- return -1;\r
- }\r
-@@ -4041,10 +4077,12 @@ __cleanup_cep(
- AL_PRINT( TRACE_LEVEL_ERROR, AL_DBG_ERROR, ("CEP in state %d.\n", p_cep->state) );\r
- case CEP_STATE_TIMEWAIT:\r
- /* Already in timewait - so all is good. */\r
-+p_cep->old_state[0] = p_cep->state;\r
- p_cep->state = CEP_STATE_DESTROY;\r
- goto out;\r
- }\r
- \r
-+p_cep->old_state[0] = p_cep->state;\r
- p_cep->state = CEP_STATE_DESTROY;\r
- __insert_timewait( p_cep );\r
- \r
-@@ -5282,6 +5320,7 @@ al_cep_rej(
- case CEP_STATE_REP_MRA_SENT:\r
- status = __do_cep_rej(\r
- p_cep, rej_status, p_ari, ari_len, p_pdata, pdata_len );\r
-+p_cep->old_state[1] = p_cep->state | 0x40000000;\r
- p_cep->state = CEP_STATE_TIMEWAIT;\r
- __insert_timewait( p_cep );\r
- break;\r
-@@ -5801,6 +5840,7 @@ al_cep_dreq(
- }\r
- else\r
- {\r
-+p_cep->old_state[1] = p_cep->state | 0x50000000;\r
- p_cep->state = CEP_STATE_TIMEWAIT;\r
- __insert_timewait( p_cep );\r
- }\r
-@@ -5859,11 +5899,14 @@ al_cep_drep(
- break;\r
- \r
- __cep_send_mad( p_port_cep, p_mad );\r
-+p_cep->old_state[1] = p_cep->state | 0x60000000;\r
- p_cep->state = CEP_STATE_TIMEWAIT;\r
- __insert_timewait( p_cep );\r
- break;\r
- \r
- default:\r
-+DbgPrintEx(DPFLTR_IHVDRIVER_ID, 0, "al_cep_drep bad state cid 0x%x state 0x%x\n",\r
-+ p_cep->cid, p_cep->state);\r
- AL_PRINT( TRACE_LEVEL_WARNING, AL_DBG_CM,\r
- ("Invalid state: %d\n", p_cep->state) );\r
- status = IB_INVALID_STATE;
+ /* Cleanup the pending MAD list. */\r
+ while( p_cep->p_mad_head )
+++ /dev/null
-Bottom: c4ff9fd67b338806c462b101af47f7cc3c1ab265
-Top: ca319bddfbb13954cab2a3e2352a3275d27cb03d
-Author: U-AMR\MSHEFTY <MSHEFTY@mshefty-MOBL2.amr.corp.intel.com>
-Date: 2009-12-17 13:08:10 -0800
-
-Refresh of debug
-
----
-
-diff --git a/trunk/core/al/kernel/al_cm.c b/trunk/core/al/kernel/al_cm.c
-index a3649bc..955985a 100644
---- a/trunk/core/al/kernel/al_cm.c
-+++ b/trunk/core/al/kernel/al_cm.c
-@@ -38,7 +38,6 @@ typedef struct _iba_cm_id_priv
- {\r
- iba_cm_id id;\r
- KEVENT destroy_event;\r
--int destroyed;\r
- \r
- } iba_cm_id_priv;\r
- \r
-@@ -56,7 +55,6 @@ cm_alloc_id(NTSTATUS (*callback)(iba_cm_id *p_id, iba_cm_event *p_event),
- KeInitializeEvent(&id->destroy_event, NotificationEvent, FALSE);\r
- id->id.callback = callback;\r
- id->id.context = context;\r
--id->destroyed = 0;\r
- return &id->id;\r
- }\r
- \r
-@@ -70,12 +68,6 @@ static void
- cm_destroy_handler(void *context)\r
- {\r
- iba_cm_id_priv *id = context;\r
--if (id->destroyed) {\r
-- DbgPrintEx(DPFLTR_IHVDRIVER_ID, 0, "cm_destroy_handler cid 0x%x already gave up\n",\r
-- id->id.cid);\r
-- cm_free_id(&id->id);\r
--} else\r
--\r
- KeSetEvent(&id->destroy_event, 0, FALSE);\r
- }\r
- \r
-@@ -145,18 +137,10 @@ static void
- cm_destroy_id(iba_cm_id *p_id)\r
- {\r
- iba_cm_id_priv *id;\r
--LARGE_INTEGER timeout;\r
--NTSTATUS status;\r
- \r
- id = CONTAINING_RECORD(p_id, iba_cm_id_priv, id);\r
- kal_cep_destroy(gh_al, p_id->cid, STATUS_SUCCESS);\r
--timeout.QuadPart = -90 * 1000000 * 10;\r
--status =\r
-- KeWaitForSingleObject(&id->destroy_event, Executive, KernelMode, FALSE, &timeout);\r
--id->destroyed = 1;\r
--if (status != STATUS_SUCCESS) {\r
-- DbgPrintEx(DPFLTR_IHVDRIVER_ID, 0, "cm_destroy_id wait error 0x%x cid 0x%x\n", status, p_id->cid);\r
--} else\r
-+ KeWaitForSingleObject(&id->destroy_event, Executive, KernelMode, FALSE, NULL);\r
- cm_free_id(p_id);\r
- }\r
- \r
-diff --git a/trunk/core/al/kernel/al_cm_cep.c b/trunk/core/al/kernel/al_cm_cep.c
-index 6118420..4d0199d 100644
---- a/trunk/core/al/kernel/al_cm_cep.c
-+++ b/trunk/core/al/kernel/al_cm_cep.c
-@@ -318,7 +318,6 @@ typedef struct _al_kcep
- \r
- /* Volatile to allow using atomic operations for state checks. */\r
- cep_state_t state;\r
--cep_state_t old_state[2];\r
- \r
- /*\r
- * Flag that indicates whether a connection took the active role during\r
-@@ -969,7 +968,6 @@ __process_rej(
- ib_put_mad( p_cep->p_mad );\r
- p_cep->p_mad = NULL;\r
- }\r
--p_cep->old_state[1] = p_cep->state | 0x10000000;\r
- p_cep->state = CEP_STATE_TIMEWAIT;\r
- __insert_timewait( p_cep );\r
- break;\r
-@@ -1730,7 +1728,6 @@ __drep_handler(
- \r
- if( p_cep->state == CEP_STATE_DREQ_SENT )\r
- {\r
--p_cep->old_state[1] = p_cep->state | 0x20000000;\r
- p_cep->state = CEP_STATE_TIMEWAIT;\r
- \r
- status = __cep_queue_mad( p_cep, p_mad );\r
-@@ -1739,7 +1736,6 @@ p_cep->old_state[1] = p_cep->state | 0x20000000;
- {\r
- /* State is DREQ_DESTROY - move to DESTROY to allow cleanup. */\r
- CL_ASSERT( p_cep->state == CEP_STATE_DREQ_DESTROY );\r
--p_cep->old_state[0] = p_cep->state;\r
- p_cep->state = CEP_STATE_DESTROY;\r
- \r
- ib_put_mad( p_mad );\r
-@@ -2200,9 +2196,6 @@ __cep_mad_send_cb(
- IN void *context,\r
- IN ib_mad_element_t *p_mad )\r
- {\r
--//ib_wc_status_t mad_status;\r
--//cep_state_t state;\r
--//ib_net16_t attr_id;\r
- ib_api_status_t status;\r
- cep_agent_t *p_port_cep;\r
- kcep_t *p_cep;\r
-@@ -2245,114 +2238,67 @@ __cep_mad_send_cb(
- if( p_cep->p_send_mad == p_mad )\r
- p_cep->p_send_mad = NULL;\r
- \r
--//attr_id = p_mad->p_mad_buf->attr_id;\r
--//mad_status = p_mad->status;\r
--//state = p_cep->state;\r
-- //switch( p_mad->status )\r
-- //{\r
-- //case IB_WCS_SUCCESS:\r
-- // KeReleaseInStackQueuedSpinLockFromDpcLevel( &hdl );\r
-- // ib_put_mad( p_mad );\r
-- // break;\r
--\r
-- //case IB_WCS_CANCELED:\r
-- //if( p_cep->state != CEP_STATE_REQ_SENT &&\r
-- // p_cep->state != CEP_STATE_REQ_MRA_RCVD &&\r
-- // p_cep->state != CEP_STATE_REP_SENT &&\r
-- // p_cep->state != CEP_STATE_REP_MRA_RCVD &&\r
-- // p_cep->state != CEP_STATE_LAP_SENT &&\r
-- // p_cep->state != CEP_STATE_LAP_MRA_RCVD &&\r
-- // p_cep->state != CEP_STATE_DREQ_SENT &&\r
-- // p_cep->state != CEP_STATE_SREQ_SENT )\r
-- //{\r
-- // KeReleaseInStackQueuedSpinLockFromDpcLevel( &hdl );\r
-- // ib_put_mad( p_mad );\r
-- // break;\r
-- //}\r
-+ /* Treat as a timeout so we don't stall the state machine. */\r
- if( p_mad->status == IB_WCS_CANCELED)\r
-- {\r
-- /* Treat as a timeout so we don't stall the state machine. */\r
- p_mad->status = IB_WCS_TIMEOUT_RETRY_ERR;\r
-- }\r
- \r
-- // /* Fall through. */\r
-- //case IB_WCS_TIMEOUT_RETRY_ERR:\r
-- //default:\r
-- /* Timeout. Reject the connection. */\r
-- switch( p_cep->state )\r
-- {\r
-- case CEP_STATE_REQ_SENT:\r
-- case CEP_STATE_REQ_MRA_RCVD:\r
-- case CEP_STATE_REP_SENT:\r
-- case CEP_STATE_REP_MRA_RCVD:\r
-- /* Send the REJ. */\r
-- __reject_timeout( p_port_cep, p_cep, p_mad );\r
-- __remove_cep( p_cep );\r
-- p_cep->state = CEP_STATE_IDLE;\r
-- break;\r
-+ switch( p_cep->state )\r
-+ {\r
-+ case CEP_STATE_REQ_SENT:\r
-+ case CEP_STATE_REQ_MRA_RCVD:\r
-+ case CEP_STATE_REP_SENT:\r
-+ case CEP_STATE_REP_MRA_RCVD:\r
-+ /* Send the REJ. */\r
-+ __reject_timeout( p_port_cep, p_cep, p_mad );\r
-+ __remove_cep( p_cep );\r
-+ p_cep->state = CEP_STATE_IDLE;\r
-+ break;\r
- \r
-- case CEP_STATE_DREQ_DESTROY:\r
--//p_cep->old_state[0] = p_cep->state;\r
-- p_cep->state = CEP_STATE_DESTROY;\r
-- __insert_timewait( p_cep );\r
-- /* Fall through. */\r
-+ case CEP_STATE_DREQ_DESTROY:\r
-+ p_cep->state = CEP_STATE_DESTROY;\r
-+ __insert_timewait( p_cep );\r
-+ /* Fall through. */\r
- \r
-- case CEP_STATE_DESTROY:\r
-- KeReleaseInStackQueuedSpinLockFromDpcLevel( &hdl );\r
-- ib_put_mad( p_mad );\r
-- goto done;\r
-+ case CEP_STATE_DESTROY:\r
-+ KeReleaseInStackQueuedSpinLockFromDpcLevel( &hdl );\r
-+ ib_put_mad( p_mad );\r
-+ goto done;\r
- \r
-- case CEP_STATE_DREQ_SENT:\r
-- /*\r
-- * Make up a DREP mad so we can respond if we receive\r
-- * a DREQ while in timewait.\r
-- */\r
-- __format_mad_hdr( &p_cep->mads.drep.hdr, p_cep, CM_DREP_ATTR_ID );\r
-- __format_drep( p_cep, NULL, 0, &p_cep->mads.drep );\r
--//DbgPrintEx(DPFLTR_IHVDRIVER_ID, 0, "__cep_mad_send_cb cid 0x%x, attr 0x%x status 0x%x DREQ_SENT->TIMEWAIT\n",\r
--// p_cep->cid, attr_id, mad_status);\r
--//p_cep->old_state[1] = p_cep->state | 0x30000000;\r
-- if( p_cep->p_send_mad )\r
-- {\r
-- ib_cancel_mad(h_mad_svc, p_cep->p_send_mad);\r
-- p_cep->p_send_mad = NULL;\r
-- }\r
-- p_cep->state = CEP_STATE_TIMEWAIT;\r
-- __insert_timewait( p_cep );\r
-- break;\r
-+ case CEP_STATE_DREQ_SENT:\r
-+ /*\r
-+ * Make up a DREP mad so we can respond if we receive\r
-+ * a DREQ while in timewait.\r
-+ */\r
-+ __format_mad_hdr( &p_cep->mads.drep.hdr, p_cep, CM_DREP_ATTR_ID );\r
-+ __format_drep( p_cep, NULL, 0, &p_cep->mads.drep );\r
-+ p_cep->state = CEP_STATE_TIMEWAIT;\r
-+ __insert_timewait( p_cep );\r
-+ break;\r
- \r
-- case CEP_STATE_LAP_SENT:\r
-- /*\r
-- * Before CEP was sent, we have been in CEP_STATE_ESTABLISHED as we\r
-- * failed to send, we return to that state.\r
-- */\r
-- p_cep->state = CEP_STATE_ESTABLISHED;\r
-- break;\r
-- default:\r
-- break;\r
-- }\r
-+ case CEP_STATE_LAP_SENT:\r
-+ /*\r
-+ * Before CEP was sent, we have been in CEP_STATE_ESTABLISHED as we\r
-+ * failed to send, we return to that state.\r
-+ */\r
-+ p_cep->state = CEP_STATE_ESTABLISHED;\r
-+ break;\r
-+ default:\r
-+ break;\r
-+ }\r
- \r
-- status = __cep_queue_mad( p_cep, p_mad );\r
-- CL_ASSERT( status != IB_INVALID_STATE );\r
-- KeReleaseInStackQueuedSpinLockFromDpcLevel( &hdl );\r
-+ status = __cep_queue_mad( p_cep, p_mad );\r
-+ CL_ASSERT( status != IB_INVALID_STATE );\r
-+ KeReleaseInStackQueuedSpinLockFromDpcLevel( &hdl );\r
- \r
-- if( status == IB_SUCCESS )\r
-- __process_cep( p_cep );\r
-- //break;\r
-- //}\r
-+ if( status == IB_SUCCESS )\r
-+ __process_cep( p_cep );\r
- \r
- done:\r
- pfn_destroy_cb = p_cep->pfn_destroy_cb;\r
- cep_context = p_cep->context;\r
- \r
- if( !cl_atomic_dec( &p_cep->ref_cnt ) && pfn_destroy_cb )\r
--//{\r
--//if (mad_status != IB_WCS_CANCELED)\r
--// DbgPrintEx(DPFLTR_IHVDRIVER_ID, 0, "__cep_mad_send_cb cid 0x%x, attr 0x%x status 0x%x state 0x%x old states 0x%x 0x%x\n",\r
--// p_cep->cid, attr_id, mad_status, state, p_cep->old_state[0], p_cep->old_state[1]);\r
--//\r
- pfn_destroy_cb( cep_context );\r
--//}\r
- AL_EXIT( AL_DBG_CM );\r
- }\r
- \r
-@@ -3973,13 +3919,8 @@ __cleanup_cep(
- CL_ASSERT( KeGetCurrentIrql() == DISPATCH_LEVEL );\r
- \r
- /* If we've already come through here, we're done. */\r
-- if( p_cep->state == CEP_STATE_DESTROY ||\r
-- p_cep->state == CEP_STATE_DREQ_DESTROY )\r
-- {\r
--DbgPrintEx(DPFLTR_IHVDRIVER_ID, 0, "IB CM is D-U-M-B\n");\r
-- AL_EXIT( AL_DBG_CM );\r
-- return -1;\r
-- }\r
-+ CL_ASSERT( p_cep->state != CEP_STATE_DESTROY &&\r
-+ p_cep->state != CEP_STATE_DREQ_DESTROY )\r
- \r
- /* Cleanup the pending MAD list. */\r
- while( p_cep->p_mad_head )\r
-@@ -4077,12 +4018,10 @@ DbgPrintEx(DPFLTR_IHVDRIVER_ID, 0, "IB CM is D-U-M-B\n");
- AL_PRINT( TRACE_LEVEL_ERROR, AL_DBG_ERROR, ("CEP in state %d.\n", p_cep->state) );\r
- case CEP_STATE_TIMEWAIT:\r
- /* Already in timewait - so all is good. */\r
--p_cep->old_state[0] = p_cep->state;\r
- p_cep->state = CEP_STATE_DESTROY;\r
- goto out;\r
- }\r
- \r
--p_cep->old_state[0] = p_cep->state;\r
- p_cep->state = CEP_STATE_DESTROY;\r
- __insert_timewait( p_cep );\r
- \r
-@@ -5320,7 +5259,6 @@ al_cep_rej(
- case CEP_STATE_REP_MRA_SENT:\r
- status = __do_cep_rej(\r
- p_cep, rej_status, p_ari, ari_len, p_pdata, pdata_len );\r
--p_cep->old_state[1] = p_cep->state | 0x40000000;\r
- p_cep->state = CEP_STATE_TIMEWAIT;\r
- __insert_timewait( p_cep );\r
- break;\r
-@@ -5840,7 +5778,6 @@ al_cep_dreq(
- }\r
- else\r
- {\r
--p_cep->old_state[1] = p_cep->state | 0x50000000;\r
- p_cep->state = CEP_STATE_TIMEWAIT;\r
- __insert_timewait( p_cep );\r
- }\r
-@@ -5899,14 +5836,11 @@ al_cep_drep(
- break;\r
- \r
- __cep_send_mad( p_port_cep, p_mad );\r
--p_cep->old_state[1] = p_cep->state | 0x60000000;\r
- p_cep->state = CEP_STATE_TIMEWAIT;\r
- __insert_timewait( p_cep );\r
- break;\r
- \r
- default:\r
--DbgPrintEx(DPFLTR_IHVDRIVER_ID, 0, "al_cep_drep bad state cid 0x%x state 0x%x\n",\r
-- p_cep->cid, p_cep->state);\r
- AL_PRINT( TRACE_LEVEL_WARNING, AL_DBG_CM,\r
- ("Invalid state: %d\n", p_cep->state) );\r
- status = IB_INVALID_STATE;