AssertLocked();\r
NTSTATUS rc = STATUS_SUCCESS;\r
\r
+// Check if such code should be here ???? what if we have packets ????\r
+ if (m_PostCreditsWhenCan == true) {\r
+ m_PostCreditsWhenCan = false;\r
+ rc = PostCredits();\r
+ if (!NT_SUCCESS(rc)) {\r
+ SDP_PRINT(SDP_ERR, SDP_BUFFER_POOL, ("PostCredits failed rc = 0x%x\n", rc ));\r
+ goto Cleanup;\r
+ } \r
+ }\r
+\r
+\r
+\r
while ((m_QueuedPackets.Size() > 0) && \r
(m_CurrentlySentBuffers < m_MaxConcurrentSends) &&\r
(m_rRecvBuf > 2)) {\r
ib_send_wr_t send_wr;\r
\r
send_wr.p_next = NULL;\r
- send_wr.wr_id = (uintn_t)pBufferDescriptor;//?????(uint64_t) (uintptr_t) wr;\r
+ send_wr.wr_id = (uintn_t)pBufferDescriptor;\r
send_wr.wr_type = WR_SEND;\r
send_wr.send_opt = IB_SEND_OPT_SIGNALED;//socket_info->send_opt;\r
\r
rc = IB2Status(ib_status);\r
goto Cleanup;\r
}\r
+ //????? Should we clear the post credits here ????????\r
m_CurrentlySentBuffers ++;\r
m_rRecvBuf--;\r
m_pSdpSocket->m_RecvBufferPool.UpdateLocaleAdvertisedBuffers();\r
m_PostCreditsWhenCan = true;\r
goto Cleanup;\r
}\r
+\r
+ if (m_pSdpSocket->GetState() != SS_CONNECTED) {\r
+ SDP_PRINT(SDP_TRACE, SDP_BUFFER_POOL, ("this = 0x%p - Not sending credits,"\r
+ " because state = %s \n",this, SdpSocket::SS2String(m_pSdpSocket->GetState() ))); \r
+ // We will have to send them once we can\r
+ m_PostCreditsWhenCan = true;\r
+ goto Cleanup;\r
+ }\r
\r
// Post the credit\r
if (m_CreditdBufferDescriptor == NULL) {\r
pBufferDescriptor->SetMid(SDP_MID_DISCONNECT);\r
rc = AddBufferToQueuedList(pBufferDescriptor);\r
if (!NT_SUCCESS(rc)) {\r
- SDP_PRINT(SDP_ERR, SDP_BUFFER_POOL, ("SendBuffer failed rc = 0x%x\n", rc ));\r
+ SDP_PRINT(SDP_ERR, SDP_BUFFER_POOL, ("AddBufferToQueuedList failed rc = 0x%x\n", rc ));\r
goto Cleanup;\r
}\r
\r
UserMode,\r
FALSE,\r
NULL\r
- ); \r
+ );\r
pBuffersEvent = NULL;\r
if (( rc == STATUS_ALERTED ) ||( rc == STATUS_USER_APC )) {\r
// BUGBUG: Think what to do here, we should be able to stop the\r
\r
cm_rtu.pfn_cm_apr_cb = cm_apr_callback;\r
cm_rtu.pfn_cm_dreq_cb = cm_dreq_callback;\r
- \r
+\r
ib_status = ib_cm_rtu( m_cm_handle_t, &cm_rtu );\r
if( ib_status != IB_SUCCESS ) {\r
SDP_PRINT(SDP_ERR, SDP_SOCKET, ("ib_cm_rtu failed ib_status = 0x%d\n", ib_status ));\r
\r
// We now start the recieve processing\r
\r
- rc = m_Lock.Lock();\r
+ rc = m_Lock.Lock(); //??????????\r
if (!NT_SUCCESS(rc)) {\r
SDP_PRINT(SDP_ERR, SDP_SOCKET, ("m_Lock.Lock failed rc = 0x%x\n", rc ));\r
goto Cleanup;\r
}\r
\r
// Take the lock and verify the state\r
- rc = m_Lock.Lock();\r
+ rc = m_Lock.Lock(); //???????\r
if (!NT_SUCCESS(rc)) {\r
SDP_PRINT(SDP_ERR, SDP_SOCKET, ("m_Lock.Lock failed rc = 0x%x\n", rc ));\r
goto Cleanup;\r
sdp_msg_hello_ack hello_ack_msg;\r
CreateHelloAckHeader(&hello_ack_msg);\r
\r
+ pNewSocket->m_RecvBufferPool.SetLocaleAdvertisedBuffers(CL_NTOH16(hello_ack_msg.bsdh.recv_bufs));\r
+\r
cm_rep.p_rep_pdata = (uint8_t *) &hello_ack_msg;\r
cm_rep.rep_length = sizeof(hello_ack_msg);\r
\r
goto ErrorLocked;\r
}\r
\r
- rc = pNewSocket->m_Lock.Lock();\r
+ rc = pNewSocket->m_Lock.Lock(); //????????\r
if (!NT_SUCCESS(rc)) {\r
SDP_PRINT(SDP_ERR, SDP_SOCKET, ("pNewSocket.Init() failed rc = 0x%x\n", rc ));\r
goto ErrorLocked;\r
// Sucess - we can now release the lock and update our state\r
pNewSocket->m_state = SS_REP_SENT;\r
\r
- rc = pNewSocket->m_Lock.Unlock(); // Error is ignored, since this is already an error path\r
+ rc = pNewSocket->m_Lock.Unlock(); // ???????? Error is ignored, since this is already an error path\r
if (!NT_SUCCESS(rc)) {\r
SDP_PRINT(SDP_ERR, SDP_SOCKET, ("pNewSocket->m_Lock.Unlock() failed rc = 0x%x\n", rc ));\r
// BUGBUG: who is responsibale for the cleanup ???????\r
\r
\r
// Take the lock and verify the state\r
- rc = m_Lock.Lock();\r
+ rc = m_Lock.Lock(); //?????\r
if (!NT_SUCCESS(rc)) {\r
SDP_PRINT(SDP_ERR, SDP_SOCKET, ("m_Lock.Lock failed rc = 0x%x\n", rc ));\r
goto Cleanup;\r
}\r
\r
// Next step is to move the new socket to the SS_CONNECTED state\r
- rc = pSocket->m_Lock.Lock();\r
+ rc = pSocket->m_Lock.Lock(); //???????\r
if (!NT_SUCCESS(rc)) {\r
SDP_PRINT(SDP_ERR, SDP_SOCKET, ("m_Lock.Lock failed rc = 0x%x\n", rc ));\r
goto ErrorLocked;\r
IN void *cq_context )\r
{\r
SdpSocket *pSocket = (SdpSocket *) cq_context;\r
+ SDP_PRINT(SDP_DEBUG, SDP_SOCKET, ("called this = 0x%x\n", pSocket )); \r
pSocket->m_Lock.SignalCB(SEND_CB_CALLED);\r
}\r
\r
rc = IB2Status(ib_status);\r
goto Cleanup;\r
}\r
-#if 0 \r
+#if DBG\r
/* Query the QP so we can get our QPN. */\r
- status = p_port->p_adapter->p_ifc->query_qp(\r
- p_port->ib_mgr.h_qp, &qp_attr );\r
- if( status != IB_SUCCESS )\r
+ ib_qp_attr_t qp_attr;\r
+ ib_status = ib_query_qp(\r
+ m_qp, &qp_attr );\r
+ if( ib_status != IB_SUCCESS )\r
{\r
- IPOIB_TRACE_EXIT( IPOIB_DBG_ERROR,\r
- ("ib_query_qp returned %s\n", \r
- p_port->p_adapter->p_ifc->get_err_str( status )) );\r
- return status;\r
+ SDP_PRINT(SDP_ERR, SDP_SOCKET, ("ib_query_qp failed ib_status = 0x%d\n", ib_status ));\r
+ // ignore the error, this is only needed for debug\r
}\r
- p_port->ib_mgr.qpn = qp_attr.num;\r
-#endif\r
+ SDP_PRINT(SDP_TRACE, SDP_SOCKET,("QP number is %x\n", CL_NTOH32(qp_attr.num)));\r
+#endif \r
+\r
const net64_t MEM_REG_SIZE = 0xFFFFFFFFFFFFFFFF;\r
/* Register all of physical memory */\r
phys_create.length = MEM_REG_SIZE;\r