[WSD] Debug support:
authorftillier <ftillier@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Tue, 3 Oct 2006 00:06:29 +0000 (00:06 +0000)
committerftillier <ftillier@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Tue, 3 Oct 2006 00:06:29 +0000 (00:06 +0000)
- Add environment variables to control CM and QP retries and
adjust packet lifetime.
- Expand error debug output for WC failures to indicate more details.

git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@511 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

ulp/wsd/user/ib_cm.c
ulp/wsd/user/ibsp_iblow.c
ulp/wsd/user/ibsp_ip.c
ulp/wsd/user/ibspdll.c
ulp/wsd/user/ibspdll.h

index d620fa5..3fe4f71 100644 (file)
@@ -265,7 +265,7 @@ cm_rep_callback(
 \r
        default:\r
                /* The socket might be closing */\r
-               IBSP_ERROR( ("socket %x not in connecting state (%s)\n",\r
+               IBSP_ERROR( ("socket %p not in connecting state (%s)\n",\r
                        socket_info, IBSP_SOCKET_STATE_STR( socket_info->socket_state )) );\r
 \r
                ib_reject( p_cm_rep_rec->h_cm_rep, IB_REJ_USER_DEFINED );\r
@@ -788,7 +788,7 @@ ib_connect(
        memset( &cm_req, 0, sizeof(cm_req) );\r
 \r
        cm_req.svc_id = get_service_id_for_port( socket_info->peer_addr.sin_port );\r
-       cm_req.max_cm_retries = CM_RETRIES;\r
+       cm_req.max_cm_retries = g_max_cm_retries;\r
        cm_req.p_primary_path = path_rec;\r
        cm_req.pfn_cm_rep_cb = cm_rep_callback;\r
 \r
@@ -830,7 +830,7 @@ ib_connect(
 \r
        cm_req.rnr_nak_timeout = QP_ATTRIB_RNR_NAK_TIMEOUT;\r
        cm_req.rnr_retry_cnt = QP_ATTRIB_RNR_RETRY;\r
-       cm_req.retry_cnt = QP_ATTRIB_RETRY_COUNT;\r
+       cm_req.retry_cnt = g_qp_retries;\r
        cm_req.p_alt_path = NULL;\r
        cm_req.pfn_cm_mra_cb = cm_mra_callback;\r
        cm_req.pfn_cm_rej_cb = cm_rej_callback;\r
index de059b9..3fa9454 100644 (file)
@@ -200,13 +200,24 @@ complete_wq(
        case IB_WCS_TIMEOUT_RETRY_ERR:\r
        case IB_WCS_REM_INVALID_REQ_ERR:\r
        default:\r
-               IBSP_ERROR( ("%s error: %s\n",\r
-                       ib_get_wc_type_str( wc->wc_type ),\r
-                       ib_get_wc_status_str( wc->status )) );\r
-               lpOverlapped->OffsetHigh = WSAECONNABORTED;\r
-               wr->lpOverlapped->InternalHigh = 0;\r
-               socket_info->qp_error = WSAECONNABORTED;\r
-               break;\r
+               {\r
+                       char    comp_name[MAX_COMPUTERNAME_LENGTH + 1] = {0};\r
+                       DWORD   len = sizeof(comp_name);\r
+                       GetComputerName( comp_name, &len );\r
+                       IBSP_ERROR( ("%s (%s:%d to ",\r
+                               comp_name, inet_ntoa( socket_info->local_addr.sin_addr ),\r
+                               socket_info->local_addr.sin_port) );\r
+                       IBSP_ERROR( ("%s:%d) %s error: %s (vendor specific %i64x)\n",\r
+                               inet_ntoa( socket_info->peer_addr.sin_addr ),\r
+                               socket_info->peer_addr.sin_port,\r
+                               ib_get_wc_type_str( wc->wc_type ),\r
+                               ib_get_wc_status_str( wc->status ),\r
+                               wc->vendor_specific) );\r
+                       lpOverlapped->OffsetHigh = WSAECONNABORTED;\r
+                       wr->lpOverlapped->InternalHigh = 0;\r
+                       socket_info->qp_error = WSAECONNABORTED;\r
+                       break;\r
+               }\r
        }\r
 \r
 #ifdef PERFMON_ENABLED\r
index 30bd29f..8c14db4 100644 (file)
@@ -426,6 +426,7 @@ query_pr(
        ib_query_handle_t query_handle;\r
        ib_query_req_t query_req;\r
        ib_api_status_t status;\r
+       uint8_t pkt_life;\r
 \r
        IBSP_ENTER( IBSP_DBG_HW );\r
 \r
@@ -475,6 +476,13 @@ query_pr(
                path_rec->mtu |= IB_MTU_1024;\r
        }\r
 \r
+       pkt_life = ib_path_rec_pkt_life( path_rec ) + g_pkt_life_modifier;\r
+       if( pkt_life > 0x1F )\r
+               pkt_life = 0x1F;\r
+\r
+       path_rec->pkt_life &= IB_PATH_REC_SELECTOR_MASK;\r
+       path_rec->pkt_life |= pkt_life;\r
+\r
        IBSP_EXIT( IBSP_DBG_HW );\r
        return 0;\r
 \r
index 9e48973..5be27ad 100644 (file)
@@ -55,6 +55,9 @@ uint32_t              g_max_poll = 500;
 uint32_t               g_sa_timeout = 500;\r
 uint32_t               g_sa_retries = 4;\r
 int                            g_connect_err = WSAEADDRNOTAVAIL;\r
+uint8_t                        g_max_cm_retries = CM_RETRIES;\r
+uint8_t                        g_pkt_life_modifier = 0;\r
+uint8_t                        g_qp_retries = QP_ATTRIB_RETRY_COUNT;\r
 \r
 \r
 /*\r
@@ -135,6 +138,32 @@ _DllMain(
                if( i )\r
                        g_connect_err = WSAEHOSTUNREACH;\r
 \r
+               i = GetEnvironmentVariable( "IBWSD_CM_RETRY", env_var, sizeof(env_var) );\r
+               if( i && i <= 16 )\r
+               {\r
+                       g_max_cm_retries = (uint8_t)_tcstoul( env_var, NULL, 0 );\r
+                       if( g_max_cm_retries < 4 )\r
+                               g_max_cm_retries = 4;\r
+                       else if( g_max_cm_retries > 0xF )\r
+                               g_max_cm_retries = 0xFF;\r
+               }\r
+\r
+               i = GetEnvironmentVariable( "IBWSD_PKT_LIFE", env_var, sizeof(env_var) );\r
+               if( i && i <= 16 )\r
+               {\r
+                       g_pkt_life_modifier = (uint8_t)_tcstoul( env_var, NULL, 0 );\r
+                       if( g_pkt_life_modifier > 0x1F )\r
+                               g_pkt_life_modifier = 0x1F;\r
+               }\r
+\r
+               i = GetEnvironmentVariable( "IBWSD_QP_RETRY", env_var, sizeof(env_var) );\r
+               if( i && i <= 16 )\r
+               {\r
+                       g_qp_retries = (uint8_t)_tcstoul( env_var, NULL, 0 );\r
+                       if( g_qp_retries > 7 )\r
+                               g_qp_retries = 7;\r
+               }\r
+\r
                if( init_globals() )\r
                        return FALSE;\r
 \r
@@ -764,7 +793,7 @@ IBSPConnect(
        if( socket_info->local_addr.sin_addr.S_un.S_addr == addr->sin_addr.S_un.S_addr )\r
        {\r
                /* Loopback - let the regular stack take care of that. */\r
-               IBSP_ERROR_EXIT( ("Loopback!\n") );\r
+               IBSP_TRACE_EXIT( IBSP_DBG_CONN | IBSP_DBG_LEVEL1, ("Loopback!\n") );\r
                *lpErrno = WSAEADDRNOTAVAIL;\r
                return SOCKET_ERROR;\r
        }\r
@@ -785,7 +814,7 @@ IBSPConnect(
 \r
        if( dest_port_guid == socket_info->port->guid )\r
        {\r
-               IBSP_ERROR_EXIT( ("Loopback!\n") );\r
+               IBSP_TRACE_EXIT( IBSP_DBG_CONN | IBSP_DBG_LEVEL1, ("Loopback!\n") );\r
                *lpErrno = WSAEADDRNOTAVAIL;\r
                return SOCKET_ERROR;\r
        }\r
index ffb699f..f76cb07 100644 (file)
@@ -63,5 +63,8 @@ extern uint32_t               g_sa_timeout;
 extern uint32_t                g_sa_retries;\r
 /* Allow users to control SA timeouts behavior - fall back on IPoIB or fail. */\r
 extern int                     g_connect_err;\r
+extern uint8_t         g_max_cm_retries;\r
+extern uint8_t         g_pkt_life_modifier;\r
+extern uint8_t         g_qp_retries;\r
 \r
 #endif /* IBSPDLL_H */\r