--- /dev/null
+Bottom: 972874b4731983ba35c9ef3f2166d1e603a2ed20
+Top: d239e593429e837db4a6c612700a2b7fbefff96b
+Author: Sean Hefty <sean.hefty@intel.com>
+Date: 2010-06-18 11:04:35 -0700
+
+Refresh of umad-dbg
+
+---
+
+diff --git a/trunk/core/al/al_mad.c b/trunk/core/al/al_mad.c
+index f11ac2b..51310f9 100644
+--- a/trunk/core/al/al_mad.c
++++ b/trunk/core/al/al_mad.c
+@@ -61,6 +61,7 @@
+ \r
+ #define AL_RMPP_WINDOW 16 /* Max size of RMPP window */\r
+ #define AL_REASSEMBLY_TIMEOUT 5000 /* 5 seconds */\r
++#define AL_RMPP_RETRIES 5\r
+ \r
+ static void\r
+ __cleanup_mad_disp(\r
+@@ -1452,6 +1453,12 @@ __init_send_mad(
+ return IB_INVALID_SETTING;\r
+ }\r
+ \r
++ if( !p_mad_element->timeout_ms )\r
++ p_mad_element->timeout_ms = AL_REASSEMBLY_TIMEOUT;\r
++\r
++ if( !h_send->retry_cnt )\r
++ h_send->retry_cnt = AL_RMPP_RETRIES;\r
++\r
+ p_rmpp_hdr->rmpp_version = rmpp_version;\r
+ p_rmpp_hdr->rmpp_type = IB_RMPP_TYPE_DATA;\r
+ ib_rmpp_set_resp_time( p_rmpp_hdr, IB_RMPP_NO_RESP_TIME );\r
+diff --git a/trunk/ulp/libibumad/src/umad.cpp b/trunk/ulp/libibumad/src/umad.cpp
+index f033cbe..99a9187 100644
+--- a/trunk/ulp/libibumad/src/umad.cpp
++++ b/trunk/ulp/libibumad/src/umad.cpp
+@@ -49,7 +49,6 @@ typedef struct um_port
+ IWMProvider *prov;\r
+ NET64 dev_guid;\r
+ OVERLAPPED overlap;\r
+- BOOL pending;\r
+ UINT8 port_num;\r
+ \r
+ } um_port_t;\r
+@@ -590,6 +589,14 @@ int umad_send(int portid, int agentid, void *umad, int length,
+ return 0;\r
+ }\r
+ \r
++static void umad_cancel_recv(um_port_t *port)\r
++{\r
++ DWORD bytes;\r
++\r
++ port->prov->CancelOverlappedRequests();\r
++ port->prov->GetOverlappedResult(&port->overlap, &bytes, TRUE);\r
++}\r
++\r
+ __declspec(dllexport)\r
+ int umad_recv(int portid, void *umad, int *length, int timeout_ms)\r
+ {\r
+@@ -599,18 +606,12 @@ int umad_recv(int portid, void *umad, int *length, int timeout_ms)
+ \r
+ port = &ports[portid];\r
+ hr = port->prov->Receive(mad, sizeof(WM_MAD) + (size_t) *length, &port->overlap);\r
+-\r
+ if (hr == WV_IO_PENDING) {\r
+- if (port->pending && timeout_ms == 0) {\r
+- do {\r
+- hr = WaitForSingleObject(port->overlap.hEvent, 250);\r
+- } while (hr == WAIT_TIMEOUT && port->pending);\r
+- } else {\r
+- hr = WaitForSingleObject(port->overlap.hEvent, (DWORD) timeout_ms);\r
+- if (hr == WAIT_TIMEOUT) {\r
+- _set_errno(EWOULDBLOCK);\r
+- return -EWOULDBLOCK;\r
+- }\r
++ hr = WaitForSingleObject(port->overlap.hEvent, (DWORD) timeout_ms);\r
++ if (hr == WAIT_TIMEOUT) {\r
++ umad_cancel_recv(port);\r
++ _set_errno(EWOULDBLOCK);\r
++ return -EWOULDBLOCK;\r
+ }\r
+ }\r
+ \r
+@@ -620,7 +621,6 @@ int umad_recv(int portid, void *umad, int *length, int timeout_ms)
+ }\r
+ \r
+ if (mad->Length <= (UINT32) *length) {\r
+- port->pending = FALSE;\r
+ hr = (HRESULT) mad->Id;\r
+ umad_convert_av(&mad->Address, &((struct ib_user_mad *) mad)->addr);\r
+ } else {\r
+@@ -641,19 +641,20 @@ int umad_poll(int portid, int timeout_ms)
+ \r
+ port = &ports[portid];\r
+ hr = port->prov->Receive(&mad, sizeof mad, &port->overlap);\r
+-\r
+ if (hr == WV_IO_PENDING) {\r
+ hr = WaitForSingleObject(port->overlap.hEvent, (DWORD) timeout_ms);\r
+ if (hr == WAIT_TIMEOUT) {\r
++ umad_cancel_recv(port);\r
++ _set_errno(ETIMEDOUT);\r
+ return -ETIMEDOUT;\r
+ }\r
+ }\r
+ \r
+ if (FAILED(hr) && hr != ERROR_MORE_DATA) {\r
++ _set_errno(EIO);\r
+ return -EIO;\r
+ }\r
+ \r
+- port->pending = TRUE;\r
+ return 0;\r
+ }\r
+ \r
+@@ -705,7 +706,6 @@ int umad_register(int portid, int mgmt_class, int mgmt_version,
+ __declspec(dllexport)\r
+ int umad_unregister(int portid, int agentid)\r
+ {\r
+- ports[portid].pending = FALSE;\r
+ return ports[portid].prov->Deregister((UINT64) agentid);\r
+ }