From: tzachid Date: Mon, 21 Nov 2005 12:18:52 +0000 (+0000) Subject: Credits are being implemented for read. (Rev 211) X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=1c9029a4f14bccefba7331b3f4b9aa9daf4333aa;p=~shefty%2Frdma-win.git Credits are being implemented for read. (Rev 211) git-svn-id: svn://openib.tc.cornell.edu/gen1@170 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86 --- diff --git a/trunk/ulp/sdp/kernel/SdpArp.cpp b/trunk/ulp/sdp/kernel/SdpArp.cpp index 62b985d7..3eb115ab 100644 --- a/trunk/ulp/sdp/kernel/SdpArp.cpp +++ b/trunk/ulp/sdp/kernel/SdpArp.cpp @@ -45,7 +45,7 @@ SdpArp::QueryPathRecord( } if( query_context.status != IB_SUCCESS ) { - SDP_PRINT(SDP_ERR, SDP_ARP, ("ib_query failed ib_status = 0x%d\n", query_context.status )); + SDP_PRINT(SDP_ERR, SDP_ARP, ("query_context.status failed ib_status = 0x%d\n", query_context.status )); rc = IB2Status(query_context.status); goto Cleanup; } diff --git a/trunk/ulp/sdp/kernel/SdpArp.h b/trunk/ulp/sdp/kernel/SdpArp.h index ada64324..5ad62369 100644 --- a/trunk/ulp/sdp/kernel/SdpArp.h +++ b/trunk/ulp/sdp/kernel/SdpArp.h @@ -65,8 +65,11 @@ public: 4 * 256*256 + 8 * 256 + + 120) { - *SrcPortGuid = CL_NTOH64(0x2c90200002002);//????? swlab120 - *SrcCaGuid = CL_NTOH64(0x2c90200002000); +// *SrcPortGuid = CL_NTOH64(0x2c90200002001);//????? swlab120 +// *SrcCaGuid = CL_NTOH64(0x2c90200002000); + + *SrcPortGuid = CL_NTOH64(0x2c9010b7c4362);//????? swlab159 + *SrcCaGuid = CL_NTOH64(0x2c9010b7c4360); return STATUS_SUCCESS; } ASSERT(FALSE); diff --git a/trunk/ulp/sdp/kernel/SdpBufferPool.cpp b/trunk/ulp/sdp/kernel/SdpBufferPool.cpp index 41255872..7761e8b0 100644 --- a/trunk/ulp/sdp/kernel/SdpBufferPool.cpp +++ b/trunk/ulp/sdp/kernel/SdpBufferPool.cpp @@ -78,6 +78,10 @@ BufferPool::BufferPool() m_CurrentlySentBuffers = 0; m_CurrentlyAllocated = 0; m_ClientWaiting = false; + m_PostCreditsWhenCan = false; + m_CreditsCurrentlyPosted = false; + m_CreditdBufferDescriptor = NULL; + } NTSTATUS @@ -188,6 +192,7 @@ BufferPool::AddBufferToQueuedList(BufferDescriptor *pBufferDescriptor) AssertLocked(); NTSTATUS rc = STATUS_SUCCESS; + ASSERT(pBufferDescriptor->GetFlags() == 0); m_QueuedPackets.InsertTailList(&pBufferDescriptor->BuffersList); rc = SendBuffersIfCan(); @@ -218,27 +223,53 @@ BufferPool::AllowOthersToGet() /* called when a send packet has finished. */ -VOID + +NTSTATUS BufferPool::ReturnBuffer(BufferDescriptor *pBufferDescriptor) { SDP_PRINT(SDP_TRACE, SDP_BUFFER_POOL, ("this = 0x%p buffer=0x%p\n",this, pBufferDescriptor)); + AssertLocked(); + bool CreditUpdate = false; + NTSTATUS rc = STATUS_SUCCESS; #if DBG if (m_CurrentlySentBuffers == 1) { SDP_PRINT(SDP_WARN, SDP_PERFORMANCE, ("Currently no packets are bing sent m_ClientWaiting = %s\n", m_ClientWaiting ? "true" : "false")); } -#endif - - AssertLocked(); - m_FreePackets.InsertTailList(&pBufferDescriptor->BuffersList); - // Is there a client waiting ? - if ( m_ClientWaiting) { - KeSetEvent( &m_WaitingClients, IO_NO_INCREMENT, FALSE ); - m_ClientWaiting = false; +#endif + ASSERT( pBufferDescriptor->GetFlags() == CREDIT_UPDATE || + pBufferDescriptor->GetFlags() == 0); + + CreditUpdate = (pBufferDescriptor->GetFlags() == CREDIT_UPDATE); + if (CreditUpdate) { + // This is a credit update packet, need to act accordingly + ASSERT(m_CreditdBufferDescriptor == NULL); + ASSERT(m_CreditsCurrentlyPosted == true); + m_CreditdBufferDescriptor = pBufferDescriptor; + m_CreditsCurrentlyPosted = false; + + if (m_PostCreditsWhenCan == true) { + m_PostCreditsWhenCan = false; + rc = PostCredits(); + if (!NT_SUCCESS(rc)) { + SDP_PRINT(SDP_ERR, SDP_BUFFER_POOL, ("PostCredits failed rc = 0x%x\n", rc )); + goto Cleanup; + } + } + } else { + m_FreePackets.InsertTailList(&pBufferDescriptor->BuffersList); + // Is there a client waiting ? + if ( m_ClientWaiting) { + KeSetEvent( &m_WaitingClients, IO_NO_INCREMENT, FALSE ); + m_ClientWaiting = false; + } } +Cleanup: m_CurrentlySentBuffers--; ASSERT(m_CurrentlySentBuffers >= 0); + + return rc; } /* @@ -298,6 +329,11 @@ BufferPool::ShutDown() BufferDescriptor::DeAllocateBuffer(pBufferDescriptor, SEND_BUFFERS_ALLOCATION_TAG); } + if(m_CreditdBufferDescriptor != NULL) { + BufferDescriptor::DeAllocateBuffer(m_CreditdBufferDescriptor, SEND_BUFFERS_ALLOCATION_TAG); + m_CreditdBufferDescriptor = NULL; + } + } NTSTATUS @@ -309,10 +345,10 @@ BufferPool::SendBuffer(BufferDescriptor *pBufferDescriptor) msg_hdr_bsdh *pHeader = (msg_hdr_bsdh *) pBufferDescriptor->pBuffer; - pHeader->recv_bufs = m_pSdpSocket->m_RecvBufferPool.GetCurrentlyPostedRecievedBuffers(); //?????recv_bufs = conn->l_advt_bf; + pHeader->recv_bufs = m_pSdpSocket->m_RecvBufferPool.GetCurrentlyPostedRecievedBuffers(); pHeader->size = pBufferDescriptor->DataSize + sizeof msg_hdr_bsdh; pHeader->seq_num = GetAndIncreaseSendSeq(); - pHeader->seq_ack = m_pSdpSocket->m_RecvBufferPool.GetRecvSeq();//????conn->advt_seq; + pHeader->seq_ack = m_pSdpSocket->m_RecvBufferPool.GetRecvSeq(); m_AdvtSeq = pHeader->seq_ack;// Currently only for debug pHeader->mid = SDP_MID_DATA; pHeader->flags = SDP_MSG_FLAG_NON_FLAG; @@ -324,7 +360,7 @@ BufferPool::SendBuffer(BufferDescriptor *pBufferDescriptor) ib_send_wr_t send_wr; send_wr.p_next = NULL; - send_wr.wr_id = (uintn_t)pBufferDescriptor;//??? buff->wrid;//?????(uint64_t) (uintptr_t) wr; + send_wr.wr_id = (uintn_t)pBufferDescriptor;//?????(uint64_t) (uintptr_t) wr; send_wr.wr_type = WR_SEND; send_wr.send_opt = IB_SEND_OPT_SIGNALED;//socket_info->send_opt; @@ -343,11 +379,63 @@ BufferPool::SendBuffer(BufferDescriptor *pBufferDescriptor) } m_CurrentlySentBuffers ++; m_rRecvBuf--; + m_pSdpSocket->m_RecvBufferPool.UpdateLocaleAdvertisedBuffers(); Cleanup: return rc; } + +NTSTATUS +BufferPool::PostCredits() +{ + SDP_PRINT(SDP_TRACE, SDP_BUFFER_POOL, ("this = 0x%p \n",this)); + AssertLocked(); + NTSTATUS rc = STATUS_SUCCESS; + + // TODO: If we currently have buffers with data that we should post, and we + // have enough credits then we shouldn't do anything. data will be sent when + // the time comes. + + if (m_CreditsCurrentlyPosted) { + // We will have to send them once we can + m_PostCreditsWhenCan = true; + goto Cleanup; + } + + // Post the credit + if (m_CreditdBufferDescriptor == NULL) { + + rc = BufferDescriptor::AllocateBuffer( + &m_CreditdBufferDescriptor, + sizeof msg_hdr_bsdh, + SEND_BUFFERS_ALLOCATION_TAG + ); + if (!NT_SUCCESS(rc)) { + SDP_PRINT(SDP_ERR, SDP_BUFFER_POOL, ("AllocateBuffer failed rc = 0x%x\n", rc )); + ASSERT(m_CreditdBufferDescriptor == NULL); + goto Cleanup; + } + m_CreditdBufferDescriptor->SetFlags(CREDIT_UPDATE); + } + ASSERT(m_CreditdBufferDescriptor->GetFlags() == CREDIT_UPDATE); + + ASSERT(m_CreditdBufferDescriptor->DataSize == 0); + + rc = SendBuffer(m_CreditdBufferDescriptor); + if (!NT_SUCCESS(rc)) { + SDP_PRINT(SDP_ERR, SDP_BUFFER_POOL, ("AllocateBuffer failed rc = 0x%x\n", rc )); + goto Cleanup; + } + + m_CreditsCurrentlyPosted = true; + m_CreditdBufferDescriptor = NULL; + +Cleanup: + return rc; + +} + VOID BufferPool::AssertLocked() { #if DBG diff --git a/trunk/ulp/sdp/kernel/SdpBufferPool.h b/trunk/ulp/sdp/kernel/SdpBufferPool.h index bf668386..b65bab4f 100644 --- a/trunk/ulp/sdp/kernel/SdpBufferPool.h +++ b/trunk/ulp/sdp/kernel/SdpBufferPool.h @@ -48,6 +48,9 @@ private: // The defenition of the function that we use to report back errors typedef void (* SendErrorCB )(NTSTATUS Error, VOID *Context); +// The flags that are being used to give more information about the BufferDescriptors +const uint8_t CREDIT_UPDATE = 1; + // Each buffer starts with msg_hdr_bsdh and is followed by the actual data class BufferDescriptor { @@ -86,14 +89,19 @@ public: VOID Reset() { DataSize = 0; DataStart = 0; + Flags = 0; } + VOID SetFlags(uint8_t flags) { Flags = flags; } + uint8_t GetFlags() { return Flags; } + // Each buffer starts with bsdh_hdr structure - VOID *pBuffer; // A pointer to the actual place that we put the data - uint32_t BufferSize; // The total size of the buffer (size that we have allocated) - uint32_t DataSize; // The size of the data - uint32_t DataStart; // The place in which the data starts (used for recieve packets) - LIST_ENTRY BuffersList; // The place to hold the list of the buffers + VOID *pBuffer; // A pointer to the actual place that we put the data + uint32_t BufferSize; // The total size of the buffer (size that we have allocated) + uint32_t DataSize; // The size of the data + uint32_t DataStart; // The place in which the data starts (used for recieve packets) + LIST_ENTRY BuffersList; // The place to hold the list of the buffers + uint8_t Flags; // A field that tells if there is anything special in this descriptor ib_local_ds_t ds_array; // Used for sending the buffer @@ -130,7 +138,7 @@ public: VOID AllowOthersToGet(); - VOID ReturnBuffer(BufferDescriptor *pBufferDescriptor); + NTSTATUS ReturnBuffer(BufferDescriptor *pBufferDescriptor); NTSTATUS SendBuffersIfCan(); @@ -144,10 +152,11 @@ public: if (m_rRecvBuf == 2) { SDP_PRINT(SDP_ALL, SDP_BUFFER_POOL,("m_rRecvBuf = %d, it is being set to %d seqnum = %d\n", m_rRecvBuf, rRecvBuf, m_SendSeq)); } + ASSERT(rRecvBuf < 1000); m_rRecvBuf = rRecvBuf; } - + NTSTATUS PostCredits(); private: @@ -185,6 +194,18 @@ private: SdpSocket *m_pSdpSocket; + /* + Following two flags are responsible for sending the credits to the + remote side. + Since we are not allowed to send more than one more credit at a time, + we have to remember if a credit is being sent, and if one is, we have + to delay the send of the next credit to the time that the previous + credit was sent + */ + bool m_PostCreditsWhenCan; + bool m_CreditsCurrentlyPosted; + BufferDescriptor *m_CreditdBufferDescriptor; + VOID AssertLocked(); }; diff --git a/trunk/ulp/sdp/kernel/SdpLock.h b/trunk/ulp/sdp/kernel/SdpLock.h index 56b1625a..b833d4db 100644 --- a/trunk/ulp/sdp/kernel/SdpLock.h +++ b/trunk/ulp/sdp/kernel/SdpLock.h @@ -92,12 +92,16 @@ public: NTSTATUS rc = STATUS_SUCCESS; ASSERT(KeGetCurrentIrql() == PASSIVE_LEVEL); bool Locked = false; + bool WaitedOnLock = false; do { KeAcquireSpinLock(&m_SpinLock, &OldIrql); if (m_InUse) { // We have to release the spinlock and wait on the event - m_NumberOfClientWaiting++; + if (WaitedOnLock == false) { + m_NumberOfClientWaiting++; + WaitedOnLock = true; + } KeReleaseSpinLock(&m_SpinLock, OldIrql); rc = MyKeWaitForSingleObject(&m_Event, UserRequest, UserMode, false, NULL); if (( rc == STATUS_ALERTED ) ||( rc == STATUS_USER_APC )) { @@ -113,7 +117,10 @@ public: KeClearEvent(&m_Event); OldFlags = m_flags; ResetFlags(m_flags); - m_NumberOfClientWaiting--; + if (WaitedOnLock) { + m_NumberOfClientWaiting--; + } + ASSERT(m_NumberOfClientWaiting >= 0); KeReleaseSpinLock(&m_SpinLock, OldIrql); rc = HandleFlags(OldFlags); if (!NT_SUCCESS(rc)) { diff --git a/trunk/ulp/sdp/kernel/SdpRecvPool.cpp b/trunk/ulp/sdp/kernel/SdpRecvPool.cpp index 1781d355..3928c99a 100644 --- a/trunk/ulp/sdp/kernel/SdpRecvPool.cpp +++ b/trunk/ulp/sdp/kernel/SdpRecvPool.cpp @@ -8,7 +8,8 @@ RecvPool::RecvPool() m_ClientBeingServed = false; m_CurrentlyPostedRecievedBuffers = 0; m_CurrentlyAllocated = 0; - m_ClientWaiting = false; + m_ClientWaiting = false; + m_LocaleAdvertisedBuffers = 0; } NTSTATUS @@ -91,6 +92,20 @@ RecvPool::RecievedBuffer(BufferDescriptor *pBufferDescriptor, bool error) } // ???? Handle state changes here ???? + // Check if we have to send more credits to the remote side + ASSERT(m_LocaleAdvertisedBuffers > 0); + m_LocaleAdvertisedBuffers--; + + ASSERT(m_CurrentlyPostedRecievedBuffers >= m_LocaleAdvertisedBuffers); + if (m_CurrentlyPostedRecievedBuffers - m_LocaleAdvertisedBuffers > + SDP_RECV_CREDIT_UPDATE) { + rc = m_pSdpSocket->m_SendBufferPool.PostCredits(); + if (!NT_SUCCESS(rc)) { + SDP_PRINT(SDP_ERR, SDP_BUFFER_POOL, ("m_SendBufferPool.PostCredits failed rc = 0x%x\n", rc )); + goto Cleanup; + } + } + // Wake up the clients of the send (new credits were added) rc = m_pSdpSocket->m_SendBufferPool.SendBuffersIfCan(); if (!NT_SUCCESS(rc)) { @@ -99,6 +114,7 @@ RecvPool::RecievedBuffer(BufferDescriptor *pBufferDescriptor, bool error) } m_CurrentlyPostedRecievedBuffers--; + ASSERT(m_CurrentlyPostedRecievedBuffers >= 0); // We might be able to post a new recieve buffer now ASSERT(m_CurrentlyPostedRecievedBuffers < m_MaxConcurrentRecieves); @@ -106,7 +122,7 @@ RecvPool::RecievedBuffer(BufferDescriptor *pBufferDescriptor, bool error) if (!NT_SUCCESS(rc)) { SDP_PRINT(SDP_ERR, SDP_BUFFER_POOL, ("RecieveIfCan failed rc = 0x%x\n", rc )); goto Cleanup; - } + } Cleanup: return rc; @@ -223,10 +239,12 @@ RecvPool::AllowOthersToGet() NTSTATUS RecvPool::ReceiveIfCan() { - SDP_PRINT(SDP_TRACE, SDP_BUFFER_POOL, ("this = 0x%p \n",this)); + SDP_PRINT(SDP_TRACE, SDP_BUFFER_POOL, ("this = 0x%p m_CurrentlyPostedRecievedBuffers = %d m_LocaleAdvertisedBuffers = %d\n", + this, m_CurrentlyPostedRecievedBuffers, m_LocaleAdvertisedBuffers)); AssertLocked(); BufferDescriptor *pBufferDescriptor = NULL; NTSTATUS rc = STATUS_SUCCESS; + uint16_t StartLocaleAdvertisedBuffers = m_LocaleAdvertisedBuffers; while (m_CurrentlyPostedRecievedBuffers < m_MaxConcurrentRecieves) { // do we have a free packet ? @@ -256,6 +274,15 @@ RecvPool::ReceiveIfCan() goto Cleanup; } } + if (StartLocaleAdvertisedBuffers <= 2) { + // In this case we have (probably) posted some buffers. We have to notify the + // other side that he has more credits + rc = m_pSdpSocket->m_SendBufferPool.PostCredits(); + if (!NT_SUCCESS(rc)) { + SDP_PRINT(SDP_ERR, SDP_BUFFER_POOL, ("m_SendBufferPool.PostCredits failed rc = 0x%x\n", rc )); + goto Cleanup; + } + } Cleanup: return rc; diff --git a/trunk/ulp/sdp/kernel/SdpRecvPool.h b/trunk/ulp/sdp/kernel/SdpRecvPool.h index 4e86b027..b25a8334 100644 --- a/trunk/ulp/sdp/kernel/SdpRecvPool.h +++ b/trunk/ulp/sdp/kernel/SdpRecvPool.h @@ -37,18 +37,29 @@ public: VOID ShutDown(); - uint16_t GetCurrentlyPostedRecievedBuffers(){return m_CurrentlyPostedRecievedBuffers;} - + uint16_t GetCurrentlyPostedRecievedBuffers() { + return m_CurrentlyPostedRecievedBuffers; + } + + void SetLocaleAdvertisedBuffers(uint16_t LocaleAdvertisedBuffers) { + m_LocaleAdvertisedBuffers = LocaleAdvertisedBuffers; + } + + void UpdateLocaleAdvertisedBuffers() { + m_LocaleAdvertisedBuffers = m_CurrentlyPostedRecievedBuffers; + } private: NTSTATUS PostReceiveBuffer(BufferDescriptor *pBufferDescriptor); // Global data about this connection int m_MaxBuffers; // The maximum number of buffers that we allow for this QP (to be allocated) - int m_MaxConcurrentRecieves; // The total numbers of sends that are allowd for the QP + int m_MaxConcurrentRecieves; // The total numbers of recvs that are allowd for the QP int m_MaxMessageSize; // The maximum buffer size that we allow for recieving uint16_t m_CurrentlyPostedRecievedBuffers; // Number of buffers that we have posted for recieve and didn't get an answer yet + uint16_t m_LocaleAdvertisedBuffers; // Number of buffers that we have advertised to the remote side (l_advt_bf in linux) + int m_CurrentlyAllocated; // The number of buffers that we have already allocated bool m_ClientBeingServed; // true if we have already started giving buffers to a client diff --git a/trunk/ulp/sdp/kernel/SdpSocket.cpp b/trunk/ulp/sdp/kernel/SdpSocket.cpp index 6add3c1e..c35c720d 100644 --- a/trunk/ulp/sdp/kernel/SdpSocket.cpp +++ b/trunk/ulp/sdp/kernel/SdpSocket.cpp @@ -26,14 +26,6 @@ cm_rep_callback( pSocket->CmRepCallback(p_cm_rep_rec); } -static void AL_API -cm_req_callback( - IN ib_cm_req_rec_t *p_cm_req_rec ) -{ - SDP_PRINT(SDP_TRACE, SDP_SOCKET, ("cm_req_callback called")); - ASSERT(FALSE); -} - static void AL_API cm_mra_callback( IN ib_cm_mra_rec_t *p_cm_mra_rec ) @@ -107,7 +99,9 @@ NTSTATUS SdpSocket::WSPSend( { SDP_PRINT(SDP_TRACE, SDP_SOCKET, ("this = 0x%p \n",this)); - NTSTATUS rc = STATUS_SUCCESS; + NTSTATUS rc = STATUS_SUCCESS; + NTSTATUS rc1; // used only to check that there are no more errors on the + // return path BufferDescriptor * pBufferDescriptor = NULL; bool First = true; ULONG Coppied = 0; @@ -177,7 +171,8 @@ NTSTATUS SdpSocket::WSPSend( if (!NT_SUCCESS(rc)) { SDP_PRINT(SDP_ERR, SDP_SOCKET, ("pBufferDescriptor->WriteData failed rc = 0x%x\n", rc )); // free the buffer that you have - m_SendBufferPool.ReturnBuffer(pBufferDescriptor); + rc1 = m_SendBufferPool.ReturnBuffer(pBufferDescriptor); + ASSERT(NT_SUCCESS(rc1)); m_Lock.Unlock(); // Error ignored as this is already an error pass goto Cleanup; } @@ -188,7 +183,8 @@ NTSTATUS SdpSocket::WSPSend( if (!NT_SUCCESS(rc)) { SDP_PRINT(SDP_ERR, SDP_SOCKET, ("m_SendBufferPool.AddBufferToQueuedList failed rc = 0x%x\n", rc )); // free the buffer that you have - m_SendBufferPool.ReturnBuffer(pBufferDescriptor); + rc1 = m_SendBufferPool.ReturnBuffer(pBufferDescriptor); + ASSERT(NT_SUCCESS(rc1)); m_Lock.Unlock(); // Error ignored as this is already an error pass goto Cleanup; } @@ -428,6 +424,8 @@ NTSTATUS SdpSocket::WSPConnect( // We need to prepare the hello mesage for the CM sdp_msg_hello hello_msg; CreateHelloHeader(&hello_msg, pWspConnectIn->IP); + // We can now update the number of buffers that we have + m_RecvBufferPool.SetLocaleAdvertisedBuffers(CL_NTOH16(hello_msg.bsdh.recv_bufs)); // Create the CM request ib_cm_req_t cm_req; @@ -440,7 +438,7 @@ NTSTATUS SdpSocket::WSPConnect( ib_status = ib_cm_req( &cm_req ); if( ib_status != IB_SUCCESS ) { - SDP_PRINT(SDP_ERR, SDP_SOCKET, ("ib_open_ca failed ib_status = 0x%d\n", ib_status )); + SDP_PRINT(SDP_ERR, SDP_SOCKET, ("ib_cm_req failed ib_status = 0x%d\n", ib_status )); rc = IB2Status(ib_status); pWspConnectOut->Errno = WSAENETUNREACH; // BUGBUG: verify this error goto Cleanup; @@ -796,7 +794,7 @@ static NTSTATUS __recv_cb2(SdpSocket * pSdpSocket) NTSTATUS SdpSocket::send_cb() { SDP_PRINT(SDP_TRACE, SDP_SOCKET, ("called this =0x%x\n", this)); - NTSTATUS rc = STATUS_SUCCESS; + NTSTATUS rc = STATUS_SUCCESS, rc1 = STATUS_SUCCESS, rc2 = STATUS_SUCCESS; ib_api_status_t ib_status; ib_wc_t *p_wc, *p_free; size_t i; @@ -827,8 +825,8 @@ NTSTATUS SdpSocket::send_cb() { ASSERT( p_wc->wc_type == IB_WC_SEND ); pBufferDescriptor = (BufferDescriptor*)(uintn_t)p_wc->wr_id; - m_SendBufferPool.ReturnBuffer(pBufferDescriptor); - + rc2 = m_SendBufferPool.ReturnBuffer(pBufferDescriptor); + UpdateRc(&rc1, rc2); // We remember the error here and continue to avoid leaks switch( p_wc->status ) { case IB_WCS_SUCCESS: @@ -858,7 +856,13 @@ NTSTATUS SdpSocket::send_cb() } /* If we didn't use up every WC, break out. */ } while( !p_free ); - + if (!NT_SUCCESS(rc1)) { + SDP_PRINT(SDP_ERR, SDP_SOCKET, ("Error was detected on ReturnBuffer rc1 = 0x%x\n", rc1 )); + ASSERT(NT_SUCCESS(rc)); + rc = rc1; + goto Cleanup; + } + /* Rearm the CQ. */ ib_status = ib_rearm_cq(m_scq, FALSE ); @@ -1128,7 +1132,7 @@ VOID SdpSocket::CreateCmRequest( cm_req->rnr_retry_cnt = 6;//????QP_ATTRIB_RNR_RETRY; cm_req->retry_cnt = 6;//????QP_ATTRIB_RETRY_COUNT; - cm_req->pfn_cm_req_cb = cm_req_callback; + cm_req->pfn_cm_req_cb = NULL; cm_req->pfn_cm_mra_cb = cm_mra_callback; cm_req->pfn_cm_rej_cb = cm_rej_callback; cm_req->pfn_cm_rep_cb = cm_rep_callback; diff --git a/trunk/ulp/sdp/kernel/SdpSocket.h b/trunk/ulp/sdp/kernel/SdpSocket.h index 4092a4d2..61c7c24c 100644 --- a/trunk/ulp/sdp/kernel/SdpSocket.h +++ b/trunk/ulp/sdp/kernel/SdpSocket.h @@ -25,6 +25,8 @@ const int MAX_RECV_PACKETS = 200; // This is the maximum number */ #define QP_ATTRIB_RQ_DEPTH 64 #define QP_ATTRIB_RQ_SGE 1 +const int SDP_RECV_CREDIT_UPDATE = 20; // send credit update to the remote + // side. /* Number of entries in a CQ */ #define IB_CQ_SIZE (QP_ATTRIB_SQ_DEPTH + QP_ATTRIB_RQ_DEPTH + 1) diff --git a/trunk/ulp/sdp/todo b/trunk/ulp/sdp/todo index 37a4ff56..25b433c1 100644 --- a/trunk/ulp/sdp/todo +++ b/trunk/ulp/sdp/todo @@ -18,12 +18,15 @@ KERNEL MODE: recv: 1) What to do when I don’t have all the buffer to return? + 2) When posting the credits, consider not sending the credits if there are packets pending and + and we have credits. general: USER MODE: +* check why DHCP doesn't work when the provider is installed. * Check the lifetime of the SdpSocket (when is it deleted and so)??