[DAPL2] incorporate WinOF 1.1 DAPL fixes for rnr handling.
authorstansmith <stansmith@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Tue, 27 May 2008 22:52:49 +0000 (22:52 +0000)
committerstansmith <stansmith@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Tue, 27 May 2008 22:52:49 +0000 (22:52 +0000)
git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@1212 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

ulp/dapl2/dapl/ibal/dapl_ibal_cm.c
ulp/dapl2/dapl/ibal/dapl_ibal_dto.h
ulp/dapl2/dapl/ibal/dapl_ibal_qp.c
ulp/dapl2/dapl/ibal/dapl_ibal_util.h

index 5c75cd5..0998421 100644 (file)
@@ -924,13 +924,13 @@ dapls_ib_connect (
     cm_req.init_depth       = (uint8_t)ep_ptr->param.ep_attr.max_rdma_read_out;\r
 \r
     /* time wait before retrying a pkt after receiving a RNR NAK */\r
-    cm_req.rnr_nak_timeout  = 12; /* 163.84ms */\r
+    cm_req.rnr_nak_timeout  = IB_RNR_NAK_TIMEOUT;\r
     \r
        /* \r
      * number of time local QP should retry after receiving RNR NACK before\r
      * reporting an error\r
      */\r
-    cm_req.rnr_retry_cnt       = 6;    /* 7 is infinite */\r
+    cm_req.rnr_retry_cnt       = IB_RNR_RETRY_CNT;\r
 \r
     cm_req.remote_resp_timeout = 16;   /* 250ms */\r
     cm_req.local_resp_timeout  = 16;   /* 250ms */\r
@@ -1510,8 +1510,8 @@ dapls_ib_accept_connection (
     cm_rep.flags             = 0;\r
     cm_rep.failover_accepted = IB_FAILOVER_ACCEPT_UNSUPPORTED;\r
     cm_rep.target_ack_delay  = 14;\r
-    cm_rep.rnr_nak_timeout   = 12;\r
-    cm_rep.rnr_retry_cnt     = 6;\r
+    cm_rep.rnr_nak_timeout   = IB_RNR_NAK_TIMEOUT;\r
+    cm_rep.rnr_retry_cnt     = IB_RNR_RETRY_CNT;\r
     cm_rep.pp_recv_failure   = NULL;\r
     cm_rep.p_recv_wr         = NULL;\r
      \r
index d7ced9d..aaa5eed 100644 (file)
@@ -80,7 +80,7 @@ static _INLINE_ char * dapls_dto_op_str(int dto);
  */\r
 STATIC _INLINE_ DAT_RETURN \r
 dapls_ib_post_recv (\r
-       IN  DAPL_EP                     *ep_ptr,\r
+       IN  DAPL_EP                             *ep_ptr,\r
        IN  DAPL_COOKIE                 *cookie,\r
        IN  DAT_COUNT                   num_segments,\r
        IN  DAT_LMR_TRIPLET             *local_iov)\r
@@ -128,7 +128,7 @@ dapls_ib_post_recv (
 \r
     if (cookie != NULL)\r
     {\r
-       cookie->val.dto.size            =  total_len;\r
+               cookie->val.dto.size = total_len;\r
 \r
         dapl_dbg_log (DAPL_DBG_TYPE_EP,\r
                       "--> DsPR: EP = %p QP = %p cookie= %p, num_seg= %d\n", \r
@@ -144,21 +144,18 @@ dapls_ib_post_recv (
 \r
     if (IB_SUCCESS == ib_status)\r
     {\r
-       return DAT_SUCCESS;\r
+               return DAT_SUCCESS;\r
     }\r
-    else\r
-    {\r
-        dapl_dbg_log (DAPL_DBG_TYPE_EP, "--> DsPR: post_recv status %s\n", \r
-                      ib_get_err_str(ib_status));\r
 \r
-        /*\r
-         * Moving QP to error state; \r
-         */\r
-        ib_status = dapls_modify_qp_state_to_error ( ep_ptr->qp_handle);\r
-        ep_ptr->qp_state = IB_QPS_ERROR;\r
+    dapl_dbg_log (DAPL_DBG_TYPE_EP, "--> DsPR: post_recv status %s\n", \r
+                      ib_get_err_str(ib_status));\r
+    /*\r
+     * Moving QP to error state; \r
+     */\r
+    (void) dapls_modify_qp_state_to_error ( ep_ptr->qp_handle);\r
+    ep_ptr->qp_state = IB_QPS_ERROR;\r
 \r
        return (dapl_ib_status_convert (ib_status));\r
-    }\r
 }\r
 \r
 \r
@@ -169,8 +166,8 @@ dapls_ib_post_recv (
  */\r
 STATIC _INLINE_ DAT_RETURN \r
 dapls_ib_post_send (\r
-       IN  DAPL_EP                     *ep_ptr,\r
-       IN  ib_send_op_type_t           op_type,\r
+       IN  DAPL_EP                             *ep_ptr,\r
+       IN  ib_send_op_type_t   op_type,\r
        IN  DAPL_COOKIE                 *cookie,\r
        IN  DAT_COUNT                   num_segments,\r
        IN  DAT_LMR_TRIPLET             *local_iov,\r
@@ -178,13 +175,14 @@ dapls_ib_post_send (
        IN  DAT_COMPLETION_FLAGS        completion_flags)\r
 {\r
     ib_api_status_t    ib_status;\r
-    ib_send_wr_t       send_wr, *failed_wr_p;\r
+    ib_send_wr_t               send_wr, *failed_wr_p;\r
     ib_local_ds_t       ds_array[DAPL_DEFAULT_DS_ENTRIES], *ds_array_p;\r
-    DAT_COUNT          i, total_len;\r
+    DAT_COUNT                  i, total_len;\r
 \r
     if (ep_ptr->param.ep_state != DAT_EP_STATE_CONNECTED)\r
     {\r
-       ib_qp_attr_t             qp_attr;\r
+       ib_qp_attr_t    qp_attr;\r
+\r
        ib_query_qp ( ep_ptr->qp_handle, &qp_attr );\r
 \r
        dapl_dbg_log (DAPL_DBG_TYPE_ERR, "--> DsPS: !CONN EP (%p) ep_state=%d "\r
@@ -210,32 +208,32 @@ dapls_ib_post_send (
 \r
     if (NULL == ds_array_p)\r
     {\r
-       return (DAT_INSUFFICIENT_RESOURCES);\r
+               return (DAT_INSUFFICIENT_RESOURCES);\r
     }\r
 \r
-    total_len                   = 0;\r
+    total_len = 0;\r
 \r
     for (i = 0; i < num_segments; i++, ds_array_p++)\r
     {\r
-      ds_array_p->length = (uint32_t)local_iov[i].segment_length;\r
-       ds_array_p->lkey   = htonl(local_iov[i].lmr_context);\r
-       ds_array_p->vaddr  = local_iov[i].virtual_address;\r
-       total_len         += ds_array_p->length;\r
+               ds_array_p->length = (uint32_t)local_iov[i].segment_length;\r
+               ds_array_p->lkey   = htonl(local_iov[i].lmr_context);\r
+               ds_array_p->vaddr  = local_iov[i].virtual_address;\r
+               total_len         += ds_array_p->length;\r
     }\r
 \r
     if (cookie != NULL)\r
     {\r
-       cookie->val.dto.size            =  total_len;\r
+               cookie->val.dto.size = total_len;\r
 \r
        dapl_dbg_log (DAPL_DBG_TYPE_EP,\r
-               "--> DsPS: EVD=%p EP=%p QP=%p type=%d, sg=%d "\r
-               "ln=%d, ck=%p 0x" F64x "\n", \r
-               ep_ptr->param.request_evd_handle, ep_ptr, ep_ptr->qp_handle, \r
-               op_type, num_segments, total_len,\r
-               cookie, cookie->val.dto.cookie.as_64 );\r
+                                       "--> DsPS: EVD=%p EP=%p QP=%p type=%d, sg=%d "\r
+                                       "ln=%d, ck=%p 0x" F64x "\n", \r
+                               ep_ptr->param.request_evd_handle, ep_ptr, ep_ptr->qp_handle,\r
+                               op_type, num_segments, total_len,\r
+                               cookie, cookie->val.dto.cookie.as_64 );\r
     }\r
 \r
-    send_wr.wr_id              = (DAT_UINT64)cookie;\r
+    send_wr.wr_id = (DAT_UINT64)cookie;\r
 \r
     /* RC for now */\r
     if (total_len > 0)\r
@@ -267,14 +265,14 @@ dapls_ib_post_send (
        dapl_os_free( send_wr.ds_array, num_segments * sizeof(ib_local_ds_t) );\r
 \r
     if (IB_SUCCESS == ib_status)\r
-       return DAT_SUCCESS;\r
+               return DAT_SUCCESS;\r
 \r
     dapl_dbg_log (DAPL_DBG_TYPE_EP, "--> DsPS: EP=%p post_send status = %s\n", \r
                   ep_ptr, ib_get_err_str(ib_status));\r
     /*\r
      * Moving QP to error state; \r
      */\r
-    ib_status = dapls_modify_qp_state_to_error ( ep_ptr->qp_handle);\r
+    (void) dapls_modify_qp_state_to_error ( ep_ptr->qp_handle);\r
     ep_ptr->qp_state = IB_QPS_ERROR;\r
 \r
     return (dapl_ib_status_convert (ib_status));\r
index 27d71cf..acb2546 100644 (file)
@@ -556,9 +556,9 @@ dapls_modify_qp_state_to_rtr (
     qp_mod.state.rtr.primary_av.conn.path_mtu = p_port->p_attr->mtu;\r
     qp_mod.state.rtr.primary_av.conn.local_ack_timeout = 7;\r
     qp_mod.state.rtr.primary_av.conn.seq_err_retry_cnt = 7;\r
-    qp_mod.state.rtr.primary_av.conn.rnr_retry_cnt     = 7;\r
+    qp_mod.state.rtr.primary_av.conn.rnr_retry_cnt = IB_RNR_RETRY_CNT;\r
     qp_mod.state.rtr.resp_res               = 4; // in-flight RDMAs\r
-    qp_mod.state.rtr.rnr_nak_timeout        = 7;\r
+    qp_mod.state.rtr.rnr_nak_timeout        = IB_RNR_NAK_TIMEOUT;\r
  \r
     ib_status = ib_modify_qp (qp_handle, &qp_mod);\r
     \r
@@ -579,7 +579,8 @@ dapls_modify_qp_state_to_rts ( ib_qp_handle_t  qp_handle )
     qp_mod.req_state                   = IB_QPS_RTS;\r
     qp_mod.state.rts.sq_psn            = DAPL_IBAL_START_PSN;\r
     qp_mod.state.rts.retry_cnt         = 7;\r
-    qp_mod.state.rts.rnr_retry_cnt     = 6;\r
+    qp_mod.state.rts.rnr_retry_cnt     = IB_RNR_RETRY_CNT;\r
+    qp_mod.state.rtr.rnr_nak_timeout   = IB_RNR_NAK_TIMEOUT;\r
     qp_mod.state.rts.local_ack_timeout = 7;\r
     qp_mod.state.rts.init_depth        = 4; \r
 \r
index 72164c3..e33afeb 100644 (file)
@@ -112,6 +112,34 @@ typedef struct _ib_hca_name
 #define          IB_MAX_DREQ_PDATA_SIZE     220\r
 #define          IB_MAX_DREP_PDATA_SIZE     224\r
 \r
+\r
+/* Resource Not Ready\r
+       1-6 is an actual retry count which is decremented to zero before\r
+        an error condition is set.\r
+    7 is 'magic' in that it implies Infinite retry, just keeps trying.\r
+*/\r
+#define                IB_RNR_RETRY_CNT   7\r
+\r
+/*\r
+IB 1.2 spec, page 331, table 45, RNR NAK timeout encoding (5-bits)\r
\r
+00000=655.36ms(milliseconds)\r
+00001=0.01ms\r
+00010=0.02ms\r
+00011=0.03ms\r
+00100=0.04ms\r
+00101=0.06ms\r
+00110=0.08ms\r
+00111=0.12ms\r
+\r
+11100=163.84ms 28d\r
+11101=245.76ms 29d\r
+11110=327.68ms 30d\r
+11111=491.52ms 31d\r
+*/\r
+#define                IB_RNR_NAK_TIMEOUT   0\r
+\r
+\r
 typedef void\r
 (*dapl_ibal_pfn_destructor_t)(\r
     IN    void*    context );\r