<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.2873" name=GENERATOR></HEAD>
<BODY>
<DIV><FONT face=Arial size=2><SPAN class=412495615-30052006>Hi 
Fab,</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=412495615-30052006></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=412495615-30052006>While doing tests of 
connecting and disconnecting to WSD I have found out that the connection rate is 
low.</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=412495615-30052006>When I say low, I 
mean that some times it took 2 seconds to create a connection. After checking 
for the reason of the problem, I have found out that the main reason is that RNR 
nack signal is sent.</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=412495615-30052006></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=412495615-30052006>It seems that the 
current flow is that one side sends CM_REQ. The received notifies the switch on 
a new accepted socket. After that when the switch calls accept, a CM_REP message 
is sent. No recves are posted, and they will only be posted when the switch 
wants which might be too late. Once the CM_REP was sent, the remote side sends 
RTU and might start to send data.</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=412495615-30052006></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=412495615-30052006>To my understanding, 
the best way to solve this problem is to dely the sending of the CM_REP until 
the first recv is posted. This makes sure that once data arrives, things work 
fine.</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=412495615-30052006></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=412495615-30052006>I have created an 
experimental patch that implements this idea and it seems that things are 
working well with it.</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=412495615-30052006></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=412495615-30052006>What is your 
opinion?</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=412495615-30052006></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=412495615-30052006>Do you want me to 
prepare a "real" patch for this?</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=412495615-30052006></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=412495615-30052006>Thanks</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=412495615-30052006>Tzachi</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=412495615-30052006></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=412495615-30052006>Index: 
ib_cm.c<BR>===================================================================<BR>--- 
ib_cm.c (revision 1372)<BR>+++ ib_cm.c (working copy)<BR>@@ -92,6 
+92,7 @@<BR>   IBSP_TRACE2( 
IBSP_DBG_NEV,<BR>    ("Signaling eventHandle %p at time 
%I64d.\n",<BR>    h_event, cl_get_time_stamp() ) 
);<BR>+  IBSP_ERROR(("Setting the 
event\n"));<BR>   SetEvent( h_event 
);<BR>  }<BR> <BR>@@ -208,6 +209,7 
@@<BR>  ib_api_status_t status;<BR> <BR>  IBSP_ENTER( 
IBSP_DBG_CM );<BR>+ IBSP_ERROR(("cm_rep_callback 
called\n"));<BR> <BR>  memset( &cm_rtu, 0, sizeof(cm_rtu) 
);<BR> <BR>@@ -290,6 +292,8 @@<BR> <BR>  IBSP_ENTER( 
IBSP_DBG_CM );<BR> <BR>+ IBSP_ERROR(("cm_rtu_callback 
called\n"));<BR>+<BR>  cl_spinlock_acquire( &socket_info->mutex 
);<BR> <BR>  if( socket_info->socket_state == 
IBSP_DUPLICATING_REMOTE )<BR>@@ -877,9 +881,11 
@@<BR>  IN    struct 
ibsp_socket_info  *socket_info,<BR>  IN    ib_cm_req_rec_t    *cm_req_received 
)<BR> {<BR>- ib_cm_rep_t cm_rep;<BR>- ib_api_status_t 
status;<BR>+// ib_cm_rep_t cm_rep;<BR>+// ib_api_status_t 
status;<BR> <BR>+ UNREFERENCED_PARAMETER(cm_req_received);<BR>+<BR>  IBSP_ENTER( 
IBSP_DBG_CM );<BR> <BR>  /* Insert into the connection map. 
*/<BR>@@ -888,7 +894,60 @@<BR>   IBSP_EXIT( IBSP_DBG_CM 
);<BR>   return WSAEADDRINUSE;<BR>  }<BR>+#if 
0<BR>+ memset( &cm_rep, 0, sizeof(cm_rep) 
);<BR> <BR>+ cm_rep.qp_type = 
IB_QPT_RELIABLE_CONN;<BR>+ cm_rep.h_qp = 
socket_info->qp;<BR>+ cm_rep.access_ctrl = IB_AC_RDMA_READ | 
IB_AC_RDMA_WRITE | IB_AC_LOCAL_WRITE;<BR>+#if 0<BR>+ // Bug in 
TAVOR<BR>+ cm_rep.sq_depth = QP_ATTRIB_SQ_DEPTH;<BR>+ cm_rep.rq_depth 
= QP_ATTRIB_RQ_DEPTH;<BR>+#endif<BR>+ cm_rep.init_depth = 
QP_ATTRIB_INITIATOR_DEPTH;<BR>+ cm_rep.target_ack_delay = 
10;<BR>+ cm_rep.failover_accepted = 
IB_FAILOVER_ACCEPT_UNSUPPORTED;<BR>+ cm_rep.flow_ctrl = 
cm_req_received->flow_ctrl;<BR>+ cm_rep.rnr_nak_timeout = 
QP_ATTRIB_RNR_NAK_TIMEOUT;<BR>+ cm_rep.rnr_retry_cnt = 
cm_req_received->rnr_retry_cnt;<BR>+ cm_rep.pfn_cm_mra_cb = 
cm_mra_callback;<BR>+ cm_rep.pfn_cm_rej_cb = 
cm_rej_callback;<BR>+ cm_rep.pfn_cm_rtu_cb = 
cm_rtu_callback;<BR>+ cm_rep.pfn_cm_lap_cb = 
cm_lap_callback;<BR>+ cm_rep.pfn_cm_dreq_cb = 
cm_dreq_callback;<BR>+<BR>+ fzprint(("%s():%d:0x%x:0x%x: flow_ctrl=%d 
rnr_retry_cnt=%d\n", __FUNCTION__,<BR>+    __LINE__, 
GetCurrentProcessId(),<BR>+    GetCurrentThreadId(), 
cm_rep.flow_ctrl, cm_rep.rnr_retry_cnt));<BR>+<BR>+ status = ib_cm_rep( 
cm_req_received->h_cm_req, &cm_rep );<BR>+ if( status != IB_SUCCESS 
)<BR>+ {<BR>+  /* Remove from connection map. 
*/<BR>+  ibsp_conn_remove( socket_info 
);<BR>+<BR>+  IBSP_ERROR_EXIT(<BR>+   ("ib_cm_rep 
failed (0x%d) at time %I64d\n",<BR>+   ib_get_err_str( status ), 
cl_get_time_stamp()) );<BR>+  return 
WSAEACCES;<BR>+ }<BR>+#endif<BR>+ IBSP_EXIT( IBSP_DBG_CM 
);<BR>+ return 
0;<BR>+}<BR>+<BR>+<BR>+int<BR>+ib_accept1(<BR>+ IN    struct 
ibsp_socket_info  *socket_info,<BR>+ IN    ib_cm_req_rec_t    *cm_req_received 
)<BR>+{<BR>+ ib_cm_rep_t cm_rep;<BR>+ ib_api_status_t 
status;<BR>+<BR>+ IBSP_ENTER( IBSP_DBG_CM );<BR>+<BR>  memset( 
&cm_rep, 0, sizeof(cm_rep) );<BR> <BR>  cm_rep.qp_type = 
IB_QPT_RELIABLE_CONN;<BR>Index: 
ibspdll.c<BR>===================================================================<BR>--- 
ibspdll.c (revision 1372)<BR>+++ ibspdll.c (working copy)<BR>@@ -325,6 
+325,8 @@<BR>  /* Update the state of the socket context 
*/<BR>  IBSP_CHANGE_SOCKET_STATE( new_socket_info, IBSP_CONNECTED 
);<BR> <BR>+ new_socket_info->cm_req_received = 
p_incoming->cm_req_received;<BR>+<BR>  *lpErrno = ib_accept( 
new_socket_info, &p_incoming->cm_req_received );<BR>  if( 
*lpErrno )<BR>  {<BR>@@ -346,6 +348,8 
@@<BR>   deref_socket_info( new_socket_info 
);<BR>   return 
INVALID_SOCKET;<BR>  }<BR>+ CL_ASSERT(new_socket_info->cm_rep_waiting 
== FALSE);<BR>+ new_socket_info->cm_rep_waiting = 
TRUE;<BR> <BR>  cl_spinlock_acquire( 
&g_ibsp.socket_info_mutex );<BR>  cl_qlist_insert_tail(<BR>@@ 
-369,6 +373,7 @@<BR>  *    of the user supplied callback so 
you can trigger that once your<BR>  *    substituted 
function is triggered).<BR>  */<BR>+<BR> static SOCKET 
WSPAPI<BR> IBSPAccept(<BR>  IN    SOCKET      s,<BR>@@ 
-724,6 +729,8 @@<BR> <BR>  IBSP_ENTER( IBSP_DBG_CONN 
);<BR> <BR>+ IBSP_ERROR(("IBSPConnect 
called\n"));<BR>+<BR>  UNUSED_PARAM( lpCalleeData 
);<BR>  UNUSED_PARAM( lpSQOS );<BR>  UNUSED_PARAM( lpGQOS 
);<BR>@@ -855,6 +862,7 @@<BR> done:<BR>  cl_spinlock_release( 
&socket_info->mutex );<BR>  IBSP_EXIT( IBSP_DBG_CONN 
);<BR>+ IBSP_ERROR(("IBSPConnect returning\n"));<BR>  return 
SOCKET_ERROR;<BR> }<BR> <BR>@@ -1455,6 +1463,12 @@<BR>  
*   handle and then make the receive call. If called with overlap, 
post the operation<BR>  *   to our IOCP or completion 
routine.<BR> */<BR>+<BR>+int<BR>+ib_accept1(<BR>+ IN    struct 
ibsp_socket_info  *socket_info,<BR>+ IN    ib_cm_req_rec_t    *cm_req_received 
);<BR>+<BR> static int 
WSPAPI<BR> IBSPRecv(<BR>      SOCKET      s,<BR>@@ 
-1496,6 +1510,12 
@@<BR>  }<BR> <BR>  cl_spinlock_acquire( 
&socket_info->mutex );<BR>+<BR>+ if (socket_info->cm_rep_waiting 
== TRUE) 
{<BR>+  ib_accept1(socket_info,&socket_info->cm_req_received);<BR>+  socket_info->cm_rep_waiting 
= FALSE;<BR>+ }<BR>+<BR>  switch( socket_info->socket_state 
)<BR>  {<BR>  case IBSP_CONNECTED:<BR>Index: 
ibspstruct.h<BR>===================================================================<BR>--- 
ibspstruct.h (revision 1372)<BR>+++ ibspstruct.h (working copy)<BR>@@ 
-326,6 +326,9 
@@<BR>  long   recv_log_idx;<BR>  long   send_log_idx;<BR> #endif<BR>+<BR>+ boolean_t  cm_rep_waiting;<BR>+ ib_cm_req_rec_t cm_req_received 
;<BR> };<BR> <BR> <BR></SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=412495615-30052006></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=412495615-30052006></SPAN></FONT> </DIV></BODY></HTML>