[SRP] Add WPP
authorftillier <ftillier@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Tue, 19 Sep 2006 23:06:28 +0000 (23:06 +0000)
committerftillier <ftillier@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Tue, 19 Sep 2006 23:06:28 +0000 (23:06 +0000)
git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@497 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

ulp/srp/kernel/SOURCES
ulp/srp/kernel/ib_srp.inf
ulp/srp/kernel/srp_connection.c
ulp/srp/kernel/srp_data_path.c
ulp/srp/kernel/srp_debug.h
ulp/srp/kernel/srp_descriptors.c
ulp/srp/kernel/srp_driver.c
ulp/srp/kernel/srp_event.c
ulp/srp/kernel/srp_hba.c
ulp/srp/kernel/srp_hca.c
ulp/srp/kernel/srp_session.c

index 42e7e5f..ebc1f4c 100644 (file)
@@ -2,6 +2,13 @@ TARGETNAME=ibsrp
 TARGETPATH=..\..\..\bin\kernel\obj$(BUILD_ALT_DIR)\r
 TARGETTYPE=MINIPORT\r
 \r
+!if $(FREEBUILD)\r
+ENABLE_EVENT_TRACING=1\r
+!else\r
+#ENABLE_EVENT_TRACING=1\r
+!endif\r
+\r
+\r
 SOURCES= ibsrp.rc                      \\r
                srp_connection.c        \\r
                srp_data_path.c         \\r
@@ -35,4 +42,15 @@ TARGETLIBS= \
 TARGETLIBS= $(TARGETLIBS) $(DDK_LIB_PATH)\storport.lib\r
 #!endif\r
 \r
+!IFDEF ENABLE_EVENT_TRACING\r
+\r
+C_DEFINES = $(C_DEFINES) -DEVENT_TRACING\r
+\r
+RUN_WPP = $(SOURCES) -km -ext: .c .h .C .H \\r
+  -scan:srp_debug.h \\r
+       -func:SRP_PRINT(LEVEL,FLAGS,(MSG,...)) \\r
+       -func:SRP_PRINT_EXIT(LEVEL,FLAGS,(MSG,...)) \r
+\r
+!ENDIF\r
+\r
 MSC_WARNING_LEVEL= /W4\r
index 90de8f3..a1d0132 100644 (file)
@@ -103,6 +103,8 @@ AddReg          = SRP.ParamsReg
 [SRP.ParamsReg]\r
 HKR,"Parameters\PnpInterface",%InternalBus%,%REG_DWORD%,1\r
 HKR,"Parameters\PnpInterface",%PNPBus%,%REG_DWORD%,1\r
+HKR,"Parameters","DebugLevel",%REG_DWORD%,2\r
+HKR,"Parameters","DebugFlags",%REG_DWORD%,0x00ffffff\r
 \r
 ;\r
 ; == The NT EventLog entries are the same for all SCSI miniports. ==\r
index 8f86b36..5c8ea0a 100644 (file)
 \r
 #include "srp_data_path.h"\r
 #include "srp_debug.h"\r
+#if defined(EVENT_TRACING)\r
+#ifdef offsetof\r
+#undef offsetof\r
+#endif\r
+#include "srp_connection.tmh"\r
+#endif\r
 #include "srp_event.h"\r
 #include "srp_hca.h"\r
 #include "srp_session.h"\r
@@ -82,7 +88,7 @@ __srp_create_cqs(
                                                   &p_srp_connection->h_send_cq );\r
        if( status != IB_SUCCESS )\r
        {\r
-               SRP_TRACE( SRP_DBG_ERROR,\r
+               SRP_PRINT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR,\r
                        ("Cannot Create Send Completion Queue. Status = %d\n", status) );\r
                goto exit;\r
        }\r
@@ -99,7 +105,7 @@ __srp_create_cqs(
                                                   &p_srp_connection->h_recv_cq );\r
        if( status != IB_SUCCESS )\r
        {\r
-               SRP_TRACE( SRP_DBG_ERROR,\r
+               SRP_PRINT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR,\r
                        ("Cannot Create Receive Completion Queue. Status = %d\n", status) );\r
        }\r
 \r
@@ -151,7 +157,7 @@ __srp_create_qp(
                                                   &p_srp_connection->h_qp );\r
        if ( status != IB_SUCCESS )\r
        {\r
-               SRP_TRACE( SRP_DBG_ERROR,\r
+               SRP_PRINT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR,\r
                        ("Cannot Create Queue Pair. Status = %d\n", status) );\r
        }\r
 \r
@@ -175,7 +181,7 @@ __srp_create_wc_free_list(
        p_connection->p_wc_array = cl_zalloc( sizeof( ib_wc_t ) * completion_count );\r
        if ( p_connection->p_wc_array == NULL )\r
        {\r
-               SRP_TRACE( SRP_DBG_ERROR,\r
+               SRP_PRINT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR,\r
                        ("Failed to allocate %d work completions.\n",  completion_count) );\r
                status = CL_INSUFFICIENT_MEMORY;\r
                goto exit;\r
@@ -282,7 +288,7 @@ __srp_cm_dreq_cb(
 \r
        SRP_ENTER( SRP_DBG_PNP );\r
 \r
-       SRP_TRACE( SRP_DBG_DEBUG,\r
+       SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
                ("Target has issued a disconnect request.\n") );\r
 \r
        if ( p_hba->adapter_paused == FALSE )\r
@@ -294,7 +300,7 @@ __srp_cm_dreq_cb(
                                                                 SP_UNTAGGED,\r
                                                                 SP_UNTAGGED,\r
                                                                 SRB_STATUS_BUSY );\r
-               SRP_TRACE( SRP_DBG_DEBUG, ("Pausing Adapter for %s.\n", p_hba->ioc_info.profile.id_string) );\r
+               SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG, ("Pausing Adapter for %s.\n", p_hba->ioc_info.profile.id_string) );\r
        }\r
 \r
        cl_obj_lock( &p_srp_session->obj );\r
@@ -307,7 +313,7 @@ __srp_cm_dreq_cb(
        status = p_hba->ifc.cm_drep( p_cm_dreq_rec->h_cm_dreq, &cm_drep );\r
        if ( status != IB_SUCCESS )\r
        {\r
-               SRP_TRACE( SRP_DBG_ERROR,\r
+               SRP_PRINT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR,\r
                        ("Cannot respond to target disconnect request. Status = %d\n", status) );\r
        }\r
 \r
@@ -324,20 +330,22 @@ __srp_cm_dreq_cb(
 \r
        cl_obj_unlock( &p_hba->obj );\r
 \r
-       SRP_TRACE( SRP_DBG_VERBOSE, ("Session Object ref_cnt = %d\n", p_srp_session->obj.ref_cnt) );\r
+       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
+               ("Session Object ref_cnt = %d\n", p_srp_session->obj.ref_cnt) );\r
        cl_obj_destroy( &p_srp_session->obj );\r
 \r
        do\r
        {\r
                retry_count++;\r
 \r
-               SRP_TRACE( SRP_DBG_DEBUG,\r
+               SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
                        ("Attempting to reconnect %s. Connection Attempt Count = %d.\n",\r
                         p_hba->ioc_info.profile.id_string,\r
                         retry_count) );\r
 \r
-               SRP_TRACE( SRP_DBG_VERBOSE,\r
-                       ("Creating New Session For Service Entry Index %d.\n", p_hba->ioc_info.profile.num_svc_entries));\r
+               SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
+                       ("Creating New Session For Service Entry Index %d.\n",\r
+                       p_hba->ioc_info.profile.num_svc_entries));\r
                p_srp_session = srp_new_session( p_hba,\r
                                                                                 p_hba->ioc_info.profile.ioc_guid,\r
                                                                                 &p_hba->p_svc_entries[i],\r
@@ -348,9 +356,10 @@ __srp_cm_dreq_cb(
                        break;\r
                }\r
 \r
-               SRP_TRACE( SRP_DBG_VERBOSE,\r
-                       ("New Session For Service Entry Index %d Created.\n", p_hba->ioc_info.profile.num_svc_entries));\r
-               SRP_TRACE( SRP_DBG_VERBOSE,\r
+               SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
+                       ("New Session For Service Entry Index %d Created.\n",\r
+                       p_hba->ioc_info.profile.num_svc_entries));\r
+               SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
                        ("Logging Into Session.\n"));\r
                status = srp_session_login( p_srp_session );\r
                if ( status == IB_SUCCESS )\r
@@ -372,21 +381,23 @@ __srp_cm_dreq_cb(
                        p_hba->session_list[i] = p_srp_session;\r
                        cl_obj_unlock( &p_hba->obj );\r
 \r
-                       SRP_TRACE( SRP_DBG_VERBOSE,\r
+                       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
                                ("Session Login Issued Successfully.\n"));\r
                }\r
                else\r
                {\r
-                       SRP_TRACE( SRP_DBG_ERROR,\r
+                       SRP_PRINT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR,\r
                                ("Session Login Failure Status = %d.\n", status));\r
-                       SRP_TRACE( SRP_DBG_VERBOSE, ("Session Object ref_cnt = %d\n", p_srp_session->obj.ref_cnt) );\r
+                       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
+                                ("Session Object ref_cnt = %d\n", p_srp_session->obj.ref_cnt) );\r
                        cl_obj_destroy( &p_srp_session->obj );\r
                }\r
        } while ( (status != IB_SUCCESS) && (retry_count < 3) );\r
 \r
        if ( status == IB_SUCCESS )\r
        {\r
-               SRP_TRACE( SRP_DBG_DEBUG, ("Resuming Adapter for %s.\n", p_hba->ioc_info.profile.id_string) );\r
+               SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
+                        ("Resuming Adapter for %s.\n", p_hba->ioc_info.profile.id_string) );\r
                p_hba->adapter_paused = FALSE;\r
                StorPortReady( p_hba->p_ext );\r
 //             StorPortNotification( BusChangeDetected, p_hba->p_ext, 0 );\r
@@ -452,11 +463,13 @@ __srp_cm_reply_cb(
        }\r
        else /* not reported any descriptor format */\r
        {\r
-               SRP_TRACE( SRP_DBG_DEBUG,(" Target does not support valid descriptor formats\n") );\r
+               SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
+                       ("Target does not support valid descriptor formats\n") );\r
                goto rej;\r
        }\r
-       SRP_TRACE( SRP_DBG_DEBUG,\r
-                       ("Request Limit = %d, SendQ Depth = %d, RecvQDepth = %d, ItoT size = %d, TtoI size = %d, Max S/G = %d\n",\r
+       SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
+                       ("Request Limit = %d, SendQ Depth = %d, RecvQDepth = %d, "\r
+                       "ItoT size = %d, TtoI size = %d, Max S/G = %d\n",\r
                        p_connection->request_limit,\r
                        p_connection->send_queue_depth,\r
                        p_connection->recv_queue_depth,\r
@@ -471,7 +484,7 @@ __srp_cm_reply_cb(
        status = p_ifc->cm_mra( p_cm_reply->h_cm_rep, &u.cm_mra );\r
        if ( status != IB_SUCCESS )\r
        {\r
-               SRP_TRACE( SRP_DBG_ERROR,\r
+               SRP_PRINT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR,\r
                        ("Cannot Send MRA. Status = %d\n", status) );\r
                goto rej;\r
        }\r
@@ -479,14 +492,14 @@ __srp_cm_reply_cb(
        status = p_ifc->modify_cq( p_connection->h_send_cq, &p_connection->send_queue_depth );\r
        if ( status != IB_SUCCESS )\r
        {\r
-               SRP_TRACE( SRP_DBG_WARN,\r
+               SRP_PRINT( TRACE_LEVEL_WARNING, SRP_DBG_PNP,\r
                        ("Cannot Modify Send Completion Queue Depth. Status = %d\n", status) );\r
        }\r
 \r
        status = p_ifc->modify_cq( p_connection->h_recv_cq, &p_connection->recv_queue_depth );\r
        if ( status != IB_SUCCESS )\r
        {\r
-               SRP_TRACE( SRP_DBG_WARN,\r
+               SRP_PRINT( TRACE_LEVEL_WARNING, SRP_DBG_PNP,\r
                        ("Cannot Modify Recv Completion Queue Depth. Status = %d\n", status) );\r
        }\r
 \r
@@ -529,7 +542,7 @@ rej:
        status = p_ifc->cm_rtu( p_cm_reply->h_cm_rep, &u.cm_rtu );\r
        if ( status != IB_SUCCESS )\r
        {\r
-               SRP_TRACE( SRP_DBG_ERROR,\r
+               SRP_PRINT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR,\r
                        ("Cannot Send RTU. Status = %d\n", status) );\r
                p_connection->state = SRP_CONNECT_FAILURE;\r
                goto exit;\r
@@ -540,7 +553,7 @@ rej:
        status = p_ifc->rearm_cq( p_connection->h_send_cq, FALSE );\r
        if ( status != IB_SUCCESS)\r
        {\r
-               SRP_TRACE( SRP_DBG_ERROR,\r
+               SRP_PRINT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR,\r
                        ("ib_rearm_cq() for send cq failed!, status 0x%x", status) );\r
 \r
                // TODO: Kill session and inform port driver link down storportnotification\r
@@ -550,7 +563,7 @@ rej:
        status = p_ifc->rearm_cq( p_connection->h_recv_cq, FALSE );\r
        if ( status != IB_SUCCESS)\r
        {\r
-               SRP_TRACE( SRP_DBG_ERROR,\r
+               SRP_PRINT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR,\r
                        ("ib_rearm_cq() for recv failed!, status 0x%x", status) );\r
 \r
                // TODO: Kill session and inform port driver link down storportnotification\r
@@ -593,16 +606,19 @@ __srp_cm_rej_cb(
                set_srp_login_reject_from_network_to_host( p_srp_login_rej ); // <-- Is this coming back NULL?\r
                p_connection->reject_reason = get_srp_login_reject_reason( p_srp_login_rej );\r
 \r
-               SRP_TRACE( SRP_DBG_ERROR,\r
+               SRP_PRINT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR,\r
                        ("Login Rejected. IBT Code = 0x%x, SRP Code = 0x%x\n",\r
                        p_cm_reject->rej_status, p_connection->reject_reason ) );\r
                switch( p_connection->reject_reason )\r
                {\r
                        case LIREJ_INIT_TO_TARG_IU_LENGTH_TOO_LARGE:\r
-                               SRP_TRACE( SRP_DBG_ERROR, ("REQUESTED IU_SIZE %d\n", p_connection->req_max_iu_msg_size ));\r
+                               SRP_PRINT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR,\r
+                                       ("REQUESTED IU_SIZE %d\n",\r
+                                        p_connection->req_max_iu_msg_size ));\r
                                break;\r
                        case LIREJ_UNSUPPORTED_DATA_BUFFER_DESCRIPTOR_FORMAT:\r
-                               SRP_TRACE( SRP_DBG_ERROR, ("REQUESTED DESC FORMAT: %#x, SUPPORTED FORMAT %#x\n",\r
+                               SRP_PRINT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR,\r
+                                       ("REQUESTED DESC FORMAT: %#x, SUPPORTED FORMAT %#x\n",\r
                                        p_connection->descriptor_format, \r
                                        get_srp_login_reject_supported_data_buffer_formats(p_srp_login_rej) ));\r
                                        __srp_issue_session_login( p_connection, (srp_hca_t *)&p_srp_session->hca, p_connection->ioc_max_send_msg_depth );\r
@@ -613,7 +629,7 @@ __srp_cm_rej_cb(
        }\r
        else\r
        {\r
-               SRP_TRACE( SRP_DBG_ERROR,\r
+               SRP_PRINT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR,\r
                        ("Login Rejected. IBT Code = 0x%x\n",\r
                        p_cm_reject->rej_status) );\r
 }\r
@@ -720,7 +736,7 @@ __srp_issue_session_login(
        }\r
        else\r
        {\r
-               SRP_TRACE( SRP_DBG_ERROR,\r
+               SRP_PRINT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR,\r
                        ("Cannot Send Connect Request. Status = %d\n", status) );\r
                p_connection->state = SRP_CONNECT_FAILURE;\r
        }\r
@@ -815,7 +831,7 @@ srp_connect(
        cl_status = cl_event_init( &p_connection->conn_req_event, TRUE );\r
        if ( cl_status != CL_SUCCESS )\r
        {\r
-               SRP_TRACE( SRP_DBG_ERROR,\r
+               SRP_PRINT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR,\r
                        ("Cannot Initialize Connect Request Event. Status = %d\n", cl_status) );\r
                status = cl_status;\r
                goto exit;\r
@@ -831,7 +847,7 @@ srp_connect(
        cl_status = cl_event_wait_on( &p_connection->conn_req_event, EVENT_NO_TIMEOUT, FALSE );\r
        if ( cl_status != CL_SUCCESS )\r
        {\r
-               SRP_TRACE( SRP_DBG_ERROR,\r
+               SRP_PRINT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR,\r
                        ("Wait On Connect Request Event Failed. Status = %d\n", cl_status) );\r
                status = cl_status;\r
                cl_event_destroy( &p_connection->conn_req_event );\r
index aca2b49..c58b01a 100644 (file)
 #include "srp_cmd.h"\r
 #include "srp_data_path.h"\r
 #include "srp_debug.h"\r
+#if defined(EVENT_TRACING)\r
+#ifdef offsetof\r
+#undef offsetof\r
+#endif\r
+#include "srp_data_path.tmh"\r
+#endif\r
 #include "srp_descriptors.h"\r
 #include "srp_rsp.h"\r
 #include "srp_session.h"\r
@@ -62,14 +68,14 @@ __srp_process_session_send_completions(
        ib_wc_t         *p_wc_done_list = NULL;\r
        ib_wc_t         *p_wc;\r
 \r
-       SRP_ENTER( SRP_DBG_FUNC );\r
+       SRP_ENTER( SRP_DBG_DEBUG );\r
 \r
        cl_obj_lock( &p_session->obj );\r
 \r
        if ( p_session->connection.state != SRP_CONNECTED )\r
        {\r
                cl_obj_unlock( &p_session->obj );\r
-               SRP_EXIT( SRP_DBG_FUNC );\r
+               SRP_EXIT( SRP_DBG_DEBUG );\r
                return;\r
        }\r
 \r
@@ -79,7 +85,7 @@ __srp_process_session_send_completions(
                &p_wc_done_list );\r
        if ( status != IB_SUCCESS )\r
        {\r
-               SRP_TRACE_EXIT( SRP_DBG_ERROR,\r
+               SRP_PRINT_EXIT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR,\r
                        ("ib_poll_cq() failed!, status 0x%x\n", status) );\r
 \r
                // TODO: Kill session and inform port driver link down scsiportnotification\r
@@ -103,11 +109,14 @@ __srp_process_session_send_completions(
                        p_send_descriptor = (srp_send_descriptor_t *)((uintn_t)p_wc->wr_id);\r
 \r
                        // TODO: Kill session and inform port driver link down scsiportnotification\r
-                       SRP_TRACE( SRP_DBG_ERROR,\r
-                               ("Send failed!, status 0x%x\n", p_wc->status) );\r
-\r
-                       SRP_TRACE( SRP_DBG_VERBOSE,\r
-                                          ("Send Completion Received for Function = %s(0x%x), Path = 0x%x, Target = 0x%x, Lun = 0x%x, tag 0x%"PRIx64"\n",\r
+                       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_ERROR,\r
+                               ("Send Completion Status %s Vendore Status = 0x%x, \n",\r
+                               p_session->p_hba->ifc.get_wc_status_str( p_wc->status ),\r
+                               (int)p_wc->vendor_specific));\r
+\r
+                       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_ERROR,\r
+                                          ("Send Completion Received for Function = %s(0x%x), "\r
+                                          "Path = 0x%x, Target = 0x%x, Lun = 0x%x, tag 0x%I64xn",\r
                                           g_srb_function_name[p_send_descriptor->p_srb->Function],\r
                                           p_send_descriptor->p_srb->Function,\r
                                           p_send_descriptor->p_srb->PathId,\r
@@ -131,7 +140,7 @@ __srp_process_session_send_completions(
                p_session->connection.h_send_cq, FALSE );\r
        if ( status != IB_SUCCESS)\r
        {\r
-               SRP_TRACE( SRP_DBG_ERROR,\r
+               SRP_PRINT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR,\r
                        ("ib_rearm_cq() failed!, status 0x%x\n", status) );\r
 \r
                // TODO: Kill session and inform port driver link down scsiportnotification\r
@@ -139,7 +148,7 @@ __srp_process_session_send_completions(
 \r
        cl_obj_deref( &p_session->obj );\r
 \r
-       SRP_EXIT( SRP_DBG_FUNC );\r
+       SRP_EXIT( SRP_DBG_DEBUG );\r
 }\r
 \r
 /* srp_send_completion_cb */\r
@@ -157,13 +166,13 @@ srp_send_completion_cb(
 {\r
        srp_session_t   *p_session = (srp_session_t *)p_context;\r
 \r
-       SRP_ENTER( SRP_DBG_FUNC );\r
+       SRP_ENTER( SRP_DBG_DEBUG );\r
 \r
        UNUSED_PARAM( h_cq );\r
 \r
        __srp_process_session_send_completions( p_session );\r
 \r
-       SRP_EXIT( SRP_DBG_FUNC );\r
+       SRP_EXIT( SRP_DBG_DEBUG );\r
 }\r
 \r
 static inline\r
@@ -177,7 +186,7 @@ __srp_process_recv_completion(
        uint8_t                 response_status;\r
        srp_send_descriptor_t   *p_send_descriptor;\r
 \r
-       SRP_ENTER( SRP_DBG_FUNC );\r
+       SRP_ENTER( SRP_DBG_DEBUG );\r
 \r
        p_srp_rsp = (srp_rsp_t *)p_recv_descriptor->p_data_segment;\r
 \r
@@ -195,20 +204,22 @@ __srp_process_recv_completion(
                        p_session->connection.h_qp, &p_recv_descriptor->wr, NULL );\r
                if ( status != IB_SUCCESS )\r
                {\r
-                       SRP_TRACE( SRP_DBG_ERROR,\r
+                       SRP_PRINT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR,\r
                                ("Failed to post send descriptor. Status = %d.\n", status) );\r
                        // TODO: Kill session and inform port driver link down scsiportnotification\r
                }\r
 \r
                cl_atomic_add( &p_session->connection.request_limit, get_srp_response_request_limit_delta( p_srp_rsp ) );\r
 \r
-               SRP_TRACE( SRP_DBG_WARN, ("Matching Send Descriptor Not Found.\n") );\r
+               SRP_PRINT( TRACE_LEVEL_WARNING, SRP_DBG_DEBUG,\r
+                       ("Matching Send Descriptor Not Found.\n") );\r
 \r
                goto exit;\r
        }\r
 \r
-       SRP_TRACE( SRP_DBG_VERBOSE,\r
-                          ("Recv Completion Received for Function = %s(0x%x), Path = 0x%x, Target = 0x%x, Lun = 0x%x, tag 0x%"PRIx64"\n",\r
+       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
+                          ("Recv Completion Received for Function = %s(0x%x), "\r
+                          "Path = 0x%x, Target = 0x%x, Lun = 0x%x, tag 0x%I64xn",\r
                           g_srb_function_name[p_send_descriptor->p_srb->Function],\r
                           p_send_descriptor->p_srb->Function,\r
                           p_send_descriptor->p_srb->PathId,\r
@@ -234,25 +245,33 @@ __srp_process_recv_completion(
                                        p_session->connection.h_qp, &p_recv_descriptor->wr, NULL );\r
                                if ( status != IB_SUCCESS )\r
                                {\r
-                                       SRP_TRACE( SRP_DBG_ERROR,\r
+                                       SRP_PRINT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR,\r
                                                ("Failed to post recv descriptor. Status = %d.\n", status) );\r
                                        // TODO: Kill session and inform port driver link down storportnotification\r
                                }\r
 \r
                                cl_atomic_add( &p_session->connection.request_limit, get_srp_response_request_limit_delta( p_srp_rsp ) );\r
 \r
-                               SRP_TRACE( SRP_DBG_VERBOSE,\r
+                               SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
                                                   ("Srb Status = %s(0x%x)\n",\r
                                                   g_srb_status_name[p_send_descriptor->p_srb->SrbStatus],\r
                                                   p_send_descriptor->p_srb->SrbStatus) );\r
 \r
-                               SRP_TRACE( SRP_DBG_VERBOSE, ("Device Extension Address = %p\n", p_session->p_hba->p_ext) );\r
-                               SRP_TRACE( SRP_DBG_VERBOSE, ("Srb Address              = %p\n", p_send_descriptor->p_srb) );\r
-                               SRP_TRACE( SRP_DBG_VERBOSE, ("Srb DataBuffer Address   = %p\n", p_send_descriptor->p_srb->DataBuffer) );\r
-                               SRP_TRACE( SRP_DBG_VERBOSE, ("Srb DataTransferLength   = %d\n", p_send_descriptor->p_srb->DataTransferLength) );\r
-\r
-                               SRP_TRACE( SRP_DBG_VERBOSE,\r
-                                                  ("Returning SrbStatus %s(0x%x) for Function = %s(0x%x), Path = 0x%x, Target = 0x%x, Lun = 0x%x, tag 0x%"PRIx64"\n",\r
+                               SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG, ("Device Extension Address = %p\n", p_session->p_hba->p_ext) );\r
+                               SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
+                                       ("Srb Address              = %p\n",\r
+                                       p_send_descriptor->p_srb) );\r
+                               SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
+                                       ("Srb DataBuffer Address   = %p\n",\r
+                                       p_send_descriptor->p_srb->DataBuffer) );\r
+                               SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
+                                       ("Srb DataTransferLength   = %d\n",\r
+                                        p_send_descriptor->p_srb->DataTransferLength) );\r
+\r
+                               SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
+                                                  ("Returning SrbStatus %s(0x%x) for "\r
+                                                  "Function = %s(0x%x), Path = 0x%x, Target = 0x%x, "\r
+                                                  "Lun = 0x%x, tag 0x%I64xn",\r
                                                   g_srb_status_name[p_send_descriptor->p_srb->SrbStatus],\r
                                                   p_send_descriptor->p_srb->SrbStatus,\r
                                                   g_srb_function_name[p_send_descriptor->p_srb->Function],\r
@@ -280,7 +299,7 @@ __srp_process_recv_completion(
                                {\r
                                        resid = get_srp_response_data_in_residual_count( p_srp_rsp );\r
 \r
-                                       SRP_TRACE( SRP_DBG_WARN,\r
+                                       SRP_PRINT( TRACE_LEVEL_WARNING, SRP_DBG_DEBUG,\r
                                                ("DI Underflow in response: expected %d got %d.\n",\r
                                                p_send_descriptor->p_srb->DataTransferLength,\r
                                                p_send_descriptor->p_srb->DataTransferLength - resid) );\r
@@ -297,7 +316,7 @@ __srp_process_recv_completion(
                                {\r
                                        resid = get_srp_response_data_out_residual_count( p_srp_rsp );\r
 \r
-                                       SRP_TRACE( SRP_DBG_WARN,\r
+                                       SRP_PRINT( TRACE_LEVEL_WARNING, SRP_DBG_DEBUG,\r
                                                ("DI Underflow in response: expected %d got %d.\n",\r
                                                p_send_descriptor->p_srb->DataTransferLength,\r
                                                p_send_descriptor->p_srb->DataTransferLength - resid) );\r
@@ -327,7 +346,7 @@ __srp_process_recv_completion(
                                        {\r
                                                /* probably a problem with the Vfx FC san like wire pull*/\r
                                                /* initiate session recovery */\r
-                                               SRP_TRACE( SRP_DBG_WARN,\r
+                                               SRP_PRINT( TRACE_LEVEL_WARNING, SRP_DBG_DEBUG,\r
                                                        ("Sense Data indicates FC link connectivity has been lost.\n") );\r
                                                StorPortPauseDevice( p_session->p_hba->p_ext,\r
                                                                                         p_send_descriptor->p_srb->PathId,\r
@@ -339,7 +358,7 @@ __srp_process_recv_completion(
 \r
                                if ( get_srp_response_di_over( p_srp_rsp ) || get_srp_response_do_over( p_srp_rsp ) )\r
                                {\r
-                                       SRP_TRACE( SRP_DBG_WARN,\r
+                                       SRP_PRINT( TRACE_LEVEL_WARNING, SRP_DBG_DEBUG,\r
                                                ("Overflow error in response.\n") );\r
                                        if ( p_send_descriptor->p_srb->SrbStatus == SRB_STATUS_SUCCESS )\r
                                        {\r
@@ -348,33 +367,44 @@ __srp_process_recv_completion(
                                }\r
                        }\r
 \r
-                       SRP_TRACE( SRP_DBG_VERBOSE, ("DataBuffer = 0x%"PRIx64".\n",\r
-                                                                       MmGetPhysicalAddress( p_send_descriptor->p_srb->DataBuffer ).QuadPart) );\r
+                       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
+                               ("DataBuffer = 0x%I64x.\n", MmGetPhysicalAddress(\r
+                               p_send_descriptor->p_srb->DataBuffer ).QuadPart) );\r
 \r
                        /* Repost the recv descriptor */\r
                        status = p_session->p_hba->ifc.post_recv(\r
                                p_session->connection.h_qp, &p_recv_descriptor->wr, NULL );\r
                        if ( status != IB_SUCCESS )\r
                        {\r
-                               SRP_TRACE( SRP_DBG_ERROR,\r
+                               SRP_PRINT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR,\r
                                        ("Failed to post recv descriptor. Status = %d.\n", status) );\r
                                // TODO: Kill session and inform port driver link down storportnotification\r
                        }\r
 \r
                        cl_atomic_add( &p_session->connection.request_limit, get_srp_response_request_limit_delta( p_srp_rsp ) );\r
 \r
-                       SRP_TRACE( SRP_DBG_VERBOSE,\r
+                       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
                                           ("Srb Status = %s(0x%x)\n",\r
                                           g_srb_status_name[p_send_descriptor->p_srb->SrbStatus],\r
                                           p_send_descriptor->p_srb->SrbStatus) );\r
 \r
-                       SRP_TRACE( SRP_DBG_VERBOSE, ("Device Extension Address = %p\n", p_session->p_hba->p_ext) );\r
-                       SRP_TRACE( SRP_DBG_VERBOSE, ("Srb Address              = %p\n", p_send_descriptor->p_srb) );\r
-                       SRP_TRACE( SRP_DBG_VERBOSE, ("Srb DataBuffer Address   = %p\n", p_send_descriptor->p_srb->DataBuffer) );\r
-                       SRP_TRACE( SRP_DBG_VERBOSE, ("Srb DataTransferLength   = %d\n", p_send_descriptor->p_srb->DataTransferLength) );\r
-\r
-                       SRP_TRACE( SRP_DBG_VERBOSE,\r
-                                          ("Returning SrbStatus %s(0x%x) for Function = %s(0x%x), Path = 0x%x, Target = 0x%x, Lun = 0x%x, tag 0x%"PRIx64"\n",\r
+                       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
+                               ("Device Extension Address = %p\n",\r
+                               p_session->p_hba->p_ext) );\r
+                       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
+                               ("Srb Address              = %p\n",\r
+                               p_send_descriptor->p_srb) );\r
+                       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
+                               ("Srb DataBuffer Address   = %p\n",\r
+                               p_send_descriptor->p_srb->DataBuffer) );\r
+                       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
+                               ("Srb DataTransferLength   = %d\n",\r
+                               p_send_descriptor->p_srb->DataTransferLength) );\r
+\r
+                       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
+                                          ("Returning SrbStatus %s(0x%x) for "\r
+                                          "Function = %s(0x%x), Path = 0x%x, "\r
+                                          "Target = 0x%x, Lun = 0x%x, tag 0x%I64xn",\r
                                           g_srb_status_name[p_send_descriptor->p_srb->SrbStatus],\r
                                           p_send_descriptor->p_srb->SrbStatus,\r
                                           g_srb_function_name[p_send_descriptor->p_srb->Function],\r
@@ -397,7 +427,7 @@ __srp_process_recv_completion(
        }\r
 \r
 exit:\r
-       SRP_EXIT( SRP_DBG_FUNC );\r
+       SRP_EXIT( SRP_DBG_DEBUG );\r
 \r
        return ( status );\r
 }\r
@@ -411,14 +441,14 @@ __srp_process_session_recv_completions(
        ib_wc_t         *p_wc_done_list;\r
        ib_wc_t         *p_wc;\r
 \r
-       SRP_ENTER( SRP_DBG_FUNC );\r
+       SRP_ENTER( SRP_DBG_DEBUG );\r
 \r
        cl_obj_lock( &p_session->obj );\r
 \r
        if ( p_session->connection.state != SRP_CONNECTED )\r
        {\r
                cl_obj_unlock( &p_session->obj );\r
-               SRP_EXIT( SRP_DBG_FUNC );\r
+               SRP_EXIT( SRP_DBG_DEBUG );\r
                return;\r
        }\r
 \r
@@ -428,11 +458,11 @@ __srp_process_session_recv_completions(
                &p_wc_done_list );\r
        if ( status != IB_SUCCESS )\r
        {\r
-               SRP_TRACE( SRP_DBG_ERROR,\r
+               SRP_PRINT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR,\r
                        ("ib_poll_cq() failed!, status 0x%x\n", status) );\r
 \r
                // TODO: Kill session and inform port driver link down scsiportnotification\r
-               SRP_EXIT( SRP_DBG_FUNC );\r
+               SRP_EXIT( SRP_DBG_DEBUG );\r
                cl_obj_unlock( &p_session->obj );\r
                return;\r
        }\r
@@ -460,8 +490,10 @@ __srp_process_session_recv_completions(
                }\r
                else\r
                {\r
-                       SRP_TRACE( SRP_DBG_ERROR,\r
-                               ("Recv failed!, status 0x%x\n", p_wc->status) );\r
+                       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_ERROR,\r
+                               ("Recv Completion Status %s Vendore Status = 0x%x, \n",\r
+                               p_session->p_hba->ifc.get_wc_status_str( p_wc->status ),\r
+                               (int)p_wc->vendor_specific) );\r
                }\r
 \r
                /* Put onto head of free list */\r
@@ -479,7 +511,7 @@ __srp_process_session_recv_completions(
                p_session->connection.h_recv_cq, FALSE );\r
        if ( status != IB_SUCCESS)\r
        {\r
-               SRP_TRACE( SRP_DBG_ERROR,\r
+               SRP_PRINT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR,\r
                        ("ib_rearm_cq() failed!, status 0x%x\n", status) );\r
 \r
                // TODO: Kill session and inform port driver link down scsiportnotification\r
@@ -487,7 +519,7 @@ __srp_process_session_recv_completions(
 \r
        cl_obj_deref( &p_session->obj );\r
 \r
-       SRP_EXIT( SRP_DBG_FUNC );\r
+       SRP_EXIT( SRP_DBG_DEBUG );\r
 }\r
 \r
 /* srp_recv_completion_cb */\r
@@ -505,13 +537,13 @@ srp_recv_completion_cb(
 {\r
        srp_session_t   *p_session = (srp_session_t *)p_context;\r
 \r
-       SRP_ENTER( SRP_DBG_FUNC );\r
+       SRP_ENTER( SRP_DBG_DEBUG );\r
 \r
        UNUSED_PARAM( h_cq );\r
 \r
        __srp_process_session_recv_completions( p_session );\r
 \r
-       SRP_EXIT( SRP_DBG_FUNC );\r
+       SRP_EXIT( SRP_DBG_DEBUG );\r
 }\r
 \r
 /* __srp_build_cmd */\r
@@ -541,9 +573,9 @@ __srp_build_cmd(
        ULONG                           scsi_direction = p_srb->SrbFlags & ( SRB_FLAGS_DATA_IN | SRB_FLAGS_DATA_OUT );\r
        DATA_BUFFER_DESCRIPTOR_FORMAT   format = p_srp_conn_info->descriptor_format & DBDF_INDIRECT_DATA_BUFFER_DESCRIPTORS;\r
        ULONG                                                   length;\r
-       SRP_ENTER( SRP_DBG_FUNC );\r
+       SRP_ENTER( SRP_DBG_DEBUG );\r
 \r
-       SRP_TRACE( SRP_DBG_VERBOSE,\r
+       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
                           ("Sending I/O to Path = 0x%x, Target = 0x%x, Lun = 0x%x\n",\r
                           p_srb->PathId,\r
                           p_srb->TargetId,\r
@@ -562,13 +594,15 @@ __srp_build_cmd(
        p_cdb = get_srp_command_cdb( p_srp_cmd );\r
        cl_memcpy( p_cdb, p_srb->Cdb, p_srb->CdbLength );\r
 \r
-       SRP_TRACE( SRP_DBG_VERBOSE, ("CDB Length = %d.\n", p_srb->CdbLength) );\r
-       SRP_TRACE( SRP_DBG_VERBOSE, ("CDB = 0x") );\r
+       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
+               ("CDB Length = %d.\n", p_srb->CdbLength) );\r
+       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG, ("CDB = 0x") );\r
        for ( i = 0; i < p_srb->CdbLength; i++ )\r
        {\r
-               SRP_TRACE( SRP_DBG_VERBOSE, ("%0.2x", p_srb->Cdb[i]) );\r
+               SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
+                       ("%0.2x", p_srb->Cdb[i]) );\r
        }\r
-       SRP_TRACE( SRP_DBG_VERBOSE, ("\n.") );\r
+       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG, ("\n.") );\r
        \r
        if ( !format )\r
        {\r
@@ -648,19 +682,26 @@ __srp_build_cmd(
                                p_memory_descriptor->memory_handle   = p_srp_conn_info->rkey;\r
                                p_memory_descriptor->data_length     = cl_hton32( p_sg_element->Length );\r
 \r
-                               SRP_TRACE( SRP_DBG_VERBOSE, ("virtual_address[%d] = 0x%"PRIx64".\n", i, cl_ntoh64(p_memory_descriptor->virtual_address) ) );\r
-                               SRP_TRACE( SRP_DBG_VERBOSE, ("memory_handle[%d]   = 0x%x.\n", i, cl_ntoh32( p_memory_descriptor->memory_handle) ) );\r
-                               SRP_TRACE( SRP_DBG_VERBOSE, ("data_length[%d]     = %d.\n", i, cl_ntoh32( p_memory_descriptor->data_length) ) );\r
+                               SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
+                                       ("virtual_address[%d] = 0x%I64x.\n",\r
+                                       i, cl_ntoh64(p_memory_descriptor->virtual_address) ) );\r
+                               SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
+                                       ("memory_handle[%d]   = 0x%x.\n",\r
+                                       i, cl_ntoh32( p_memory_descriptor->memory_handle) ) );\r
+                               SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
+                                       ("data_length[%d]     = %d.\n",\r
+                                       i, cl_ntoh32( p_memory_descriptor->data_length) ) );\r
                        }\r
                }\r
-               SRP_TRACE( SRP_DBG_VERBOSE, ("scatter/gather count = %d.\n", scatter_gather_count));\r
+               SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
+                       ("scatter/gather count = %d.\n", scatter_gather_count));\r
        }\r
 \r
        p_srp_cmd->logical_unit_number = cl_hton64( p_srp_cmd->logical_unit_number );\r
 \r
        //set_srp_command_from_host_to_network( p_srp_cmd );\r
 \r
-       SRP_EXIT( SRP_DBG_FUNC );\r
+       SRP_EXIT( SRP_DBG_DEBUG );\r
 }\r
 \r
 /* srp_format_io_request */\r
@@ -681,12 +722,16 @@ srp_format_io_request(
        BOOLEAN         result = TRUE;\r
        srp_session_t   *p_srp_session;\r
 \r
-       SRP_ENTER( SRP_DBG_FUNC );\r
+       SRP_ENTER( SRP_DBG_DEBUG );\r
 \r
-       SRP_TRACE( SRP_DBG_VERBOSE, ("Device Extension Address = %p\n", p_dev_ext) );\r
-       SRP_TRACE( SRP_DBG_VERBOSE, ("Srb Address              = %p\n", p_srb) );\r
-       SRP_TRACE( SRP_DBG_VERBOSE, ("Srb DataBuffer Address   = %p\n", p_srb->DataBuffer) );\r
-       SRP_TRACE( SRP_DBG_VERBOSE, ("Srb DataTransferLength   = %d\n", p_srb->DataTransferLength) );\r
+       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
+               ("Device Extension Address = %p\n", p_dev_ext) );\r
+       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
+               ("Srb Address              = %p\n", p_srb) );\r
+       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
+               ("Srb DataBuffer Address   = %p\n", p_srb->DataBuffer) );\r
+       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
+               ("Srb DataTransferLength   = %d\n", p_srb->DataTransferLength) );\r
 \r
        cl_obj_lock( &p_hba->obj );\r
 \r
@@ -718,14 +763,15 @@ srp_format_io_request(
        else\r
        {\r
                // Handle the error case here\r
-               SRP_TRACE( SRP_DBG_ERROR, ("Cannot Find Session For Target ID = %d\n", p_srb->TargetId) );\r
+               SRP_PRINT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR,\r
+                       ("Cannot Find Session For Target ID = %d\n", p_srb->TargetId) );\r
                cl_obj_unlock( &p_hba->obj );\r
                p_srb->SrbStatus = SRB_STATUS_INVALID_TARGET_ID;\r
                result = FALSE;\r
        }\r
 \r
 \r
-       SRP_EXIT( SRP_DBG_FUNC );\r
+       SRP_EXIT( SRP_DBG_DEBUG );\r
        return ( result );\r
 }\r
 \r
@@ -739,7 +785,7 @@ srp_post_io_request(
        srp_send_descriptor_t   *p_send_descriptor = (srp_send_descriptor_t *)p_srb->SrbExtension;\r
        srp_session_t           *p_srp_session;\r
 \r
-       SRP_ENTER( SRP_DBG_FUNC );\r
+       SRP_ENTER( SRP_DBG_DEBUG );\r
 \r
        cl_obj_lock( &p_hba->obj );\r
 \r
@@ -760,7 +806,8 @@ srp_post_io_request(
 \r
                        if ( p_srp_session->connection.request_limit < 3 )\r
                        {\r
-                               SRP_TRACE( SRP_DBG_WARN, ("Calling StorPortBusy.\n") );\r
+                               SRP_PRINT( TRACE_LEVEL_WARNING, SRP_DBG_DEBUG,\r
+                                       ("Calling StorPortBusy.\n") );\r
                                StorPortBusy( p_dev_ext, 1 );\r
                        }\r
 \r
@@ -776,8 +823,9 @@ srp_post_io_request(
        }\r
 \r
        p_srb->SrbStatus = SRB_STATUS_NO_HBA;\r
-       SRP_TRACE( SRP_DBG_ERROR,\r
-                          ("Returning SrbStatus %s(0x%x) for Function = %s(0x%x), Path = 0x%x, Target = 0x%x, Lun = 0x%x, tag 0x%"PRIx64"\n",\r
+       SRP_PRINT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR,\r
+                          ("Returning SrbStatus %s(0x%x) for Function = %s(0x%x), Path = 0x%x, "\r
+                          "Target = 0x%x, Lun = 0x%x, tag 0x%I64xn",\r
                           g_srb_status_name[p_srb->SrbStatus],\r
                           p_srb->SrbStatus,\r
                           g_srb_function_name[p_srb->Function],\r
@@ -789,7 +837,7 @@ srp_post_io_request(
        StorPortNotification( RequestComplete, p_dev_ext, p_srb );\r
 \r
 exit:\r
-       SRP_EXIT( SRP_DBG_FUNC );\r
+       SRP_EXIT( SRP_DBG_DEBUG );\r
 }\r
 \r
 void\r
@@ -805,7 +853,7 @@ srp_abort_command(
        srp_conn_info_t         srp_conn_info;\r
        srp_tsk_mgmt_t          *p_srp_tsk_mgmt;\r
 \r
-       SRP_ENTER( SRP_DBG_FUNC );\r
+       SRP_ENTER( SRP_DBG_DEBUG );\r
 \r
        cl_obj_lock( &p_hba->obj );\r
 \r
@@ -863,8 +911,9 @@ exit:
        cl_obj_unlock( &p_hba->obj );\r
        if ( p_srb->SrbStatus == SRB_STATUS_ABORT_FAILED )\r
        {\r
-               SRP_TRACE( SRP_DBG_DEBUG,\r
-                                  ("Returning SrbStatus %s(0x%x) for Function = %s(0x%x), Path = 0x%x, Target = 0x%x, Lun = 0x%x\n",\r
+               SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
+                                  ("Returning SrbStatus %s(0x%x) for Function = %s(0x%x), "\r
+                                  "Path = 0x%x, Target = 0x%x, Lun = 0x%x\n",\r
                                   g_srb_status_name[p_srb->SrbStatus],\r
                                   p_srb->SrbStatus,\r
                                   g_srb_function_name[p_srb->Function],\r
@@ -875,7 +924,7 @@ exit:
                StorPortNotification( RequestComplete, p_dev_ext, p_srb );\r
        }\r
 \r
-       SRP_EXIT( SRP_DBG_FUNC );\r
+       SRP_EXIT( SRP_DBG_DEBUG );\r
 }\r
 \r
 void\r
@@ -887,7 +936,7 @@ srp_lun_reset(
        srp_hba_t               *p_hba = ((srp_ext_t *)p_dev_ext)->p_hba;\r
        srp_session_t           *p_srp_session;\r
 \r
-       SRP_ENTER( SRP_DBG_FUNC );\r
+       SRP_ENTER( SRP_DBG_DEBUG );\r
 \r
        cl_obj_lock( &p_hba->obj );\r
 \r
@@ -903,8 +952,9 @@ srp_lun_reset(
 \r
                while ( (p_send_descriptor = srp_remove_lun_head_send_descriptor( &p_srp_session->descriptors, p_srb->Lun )) != NULL )\r
                {\r
-                       SRP_TRACE( SRP_DBG_VERBOSE,\r
-                                          ("Returning SrbStatus %s(0x%x) for Function = %s(0x%x), Path = 0x%x, Target = 0x%x, Lun = 0x%x, tag 0x%"PRIx64"\n",\r
+                       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
+                                          ("Returning SrbStatus %s(0x%x) for Function = %s(0x%x), "\r
+                                          "Path = 0x%x, Target = 0x%x, Lun = 0x%x, tag 0x%I64xn",\r
                                           g_srb_status_name[SRB_STATUS_BUS_RESET],\r
                                           SRB_STATUS_BUS_RESET,\r
                                           g_srb_function_name[p_send_descriptor->p_srb->Function],\r
@@ -917,8 +967,9 @@ srp_lun_reset(
 \r
                p_srb->SrbStatus = SRB_STATUS_SUCCESS;\r
 \r
-               SRP_TRACE( SRP_DBG_DEBUG,\r
-                                  ("Returning SrbStatus %s(0x%x) for Function = %s(0x%x), Path = 0x%x, Target = 0x%x, Lun = 0x%x\n",\r
+               SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
+                                  ("Returning SrbStatus %s(0x%x) for Function = %s(0x%x), "\r
+                                  "Path = 0x%x, Target = 0x%x, Lun = 0x%x\n",\r
                                   g_srb_status_name[p_srb->SrbStatus],\r
                                   p_srb->SrbStatus,\r
                                   g_srb_function_name[p_srb->Function],\r
@@ -937,8 +988,9 @@ srp_lun_reset(
        {\r
                // Handle the error case here\r
                p_srb->SrbStatus = SRB_STATUS_INVALID_TARGET_ID;\r
-               SRP_TRACE( SRP_DBG_DEBUG,\r
-                                  ("Returning SrbStatus %s(0x%x) for Function = %s(0x%x), Path = 0x%x, Target = 0x%x, Lun = 0x%x\n",\r
+               SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
+                                  ("Returning SrbStatus %s(0x%x) for Function = %s(0x%x), "\r
+                                  "Path = 0x%x, Target = 0x%x, Lun = 0x%x\n",\r
                                   g_srb_status_name[p_srb->SrbStatus],\r
                                   p_srb->SrbStatus,\r
                                   g_srb_function_name[p_srb->Function],\r
@@ -952,5 +1004,5 @@ srp_lun_reset(
 \r
        cl_obj_unlock( &p_hba->obj );\r
 \r
-       SRP_EXIT( SRP_DBG_FUNC );\r
+       SRP_EXIT( SRP_DBG_DEBUG );\r
 }\r
index 2ffaf54..5151a90 100644 (file)
 #include <complib/cl_debug.h>\r
 \r
 \r
-extern uint32_t     g_srp_dbg_lvl;\r
-extern char         g_srb_function_name[][32];\r
-extern char         g_srb_status_name[][32];\r
+extern uint32_t                g_srp_dbg_level;\r
+extern uint32_t                g_srp_dbg_flags;\r
+\r
+#if defined(EVENT_TRACING)\r
+//\r
+// Software Tracing Definitions \r
+//\r
+\r
+\r
+#define WPP_CONTROL_GUIDS \\r
+       WPP_DEFINE_CONTROL_GUID(SRPCtlGuid,(5AF07B3C,D119,4233,9C81,C07EF481CBE6),  \\r
+       WPP_DEFINE_BIT( SRP_DBG_ERROR) \\r
+       WPP_DEFINE_BIT( SRP_DBG_PNP) \\r
+       WPP_DEFINE_BIT( SRP_DBG_DEBUG))\r
+\r
+\r
+\r
+#define WPP_LEVEL_FLAGS_ENABLED(lvl, flags) (WPP_LEVEL_ENABLED(flags) && WPP_CONTROL(WPP_BIT_ ## flags).Level  >= lvl)\r
+#define WPP_LEVEL_FLAGS_LOGGER(lvl,flags) WPP_LEVEL_LOGGER(flags)\r
+#define WPP_FLAG_ENABLED(flags)(WPP_LEVEL_ENABLED(flags) && WPP_CONTROL(WPP_BIT_ ## flags).Level  >= TRACE_LEVEL_VERBOSE)\r
+#define WPP_FLAG_LOGGER(flags) WPP_LEVEL_LOGGER(flags)\r
+\r
+\r
+// begin_wpp config\r
+// SRP_ENTER(FLAG);\r
+// SRP_EXIT(FLAG);\r
+// USEPREFIX(SRP_PRINT, "%!STDPREFIX! [SRP] :%!FUNC!() :");\r
+// USESUFFIX(SRP_ENTER, " [SRP] :%!FUNC!():[");\r
+// USESUFFIX(SRP_EXIT, " [SRP] :%!FUNC!():]");\r
+// end_wpp\r
+\r
+\r
+#else\r
+\r
+\r
+#include <evntrace.h>\r
+\r
+/*\r
+ * Debug macros\r
+ */\r
+\r
 \r
-/* Debug message category */\r
-#define SRP_DBG_PNP         (1 << 1)\r
-#define SRP_DBG_DEBUG       (1 << 2)\r
-\r
-/* Debug message types. */\r
-#define SRP_DBG_FUNC        (1 << 28)\r
-#define SRP_DBG_VERBOSE     (1 << 29)\r
-#define SRP_DBG_WARN        (1 << 30)\r
-#define SRP_DBG_ERROR       CL_DBG_ERROR\r
-#define SRP_DBG_ALL         CL_DBG_ALL\r
-\r
-#define SRP_ENTER( lvl )            \\r
-       CL_ENTER( (lvl), g_srp_dbg_lvl )\r
-//     CL_ENTER( (lvl | SRP_DBG_FUNC), g_srp_dbg_lvl )\r
-#define SRP_EXIT( lvl )             \\r
-       CL_EXIT( (lvl), g_srp_dbg_lvl )\r
-//     CL_EXIT( (lvl | SRP_DBG_FUNC), g_srp_dbg_lvl )\r
-#define SRP_TRACE( lvl, msg )       \\r
-       CL_TRACE( (lvl), g_srp_dbg_lvl, msg )\r
-#define SRP_TRACE_EXIT( lvl, msg )  \\r
-       CL_TRACE_EXIT( (lvl), g_srp_dbg_lvl, msg )\r
-#define SRP_PRINT( lvl, msg )       \\r
-       CL_PRINT( (lvl), g_srp_dbg_lvl, msg )\r
+#define SRP_DBG_ERR            (1 << 0)\r
+#define SRP_DBG_PNP            (1 << 1)\r
+#define SRP_DBG_DEBUG  (1 << 3)\r
 \r
+#define SRP_DBG_ERROR  (CL_DBG_ERROR | SRP_DBG_ERR)\r
+#define SRP_DBG_ALL    CL_DBG_ALL\r
+\r
+#if DBG\r
+\r
+// assignment of _level_ is need to to overcome warning C4127\r
+#define SRP_PRINT(_level_,_flag_,_msg_) \\r
+       { \\r
+               if( g_srp_dbg_level >= (_level_) ) \\r
+                       CL_TRACE( _flag_, g_srp_dbg_flags, _msg_ ); \\r
+       }\r
+\r
+#define SRP_PRINT_EXIT(_level_,_flag_,_msg_) \\r
+       { \\r
+               if( g_srp_dbg_level >= (_level_) ) \\r
+                       CL_TRACE( _flag_, g_srp_dbg_flags, _msg_ );\\r
+               SRP_EXIT(_flag_);\\r
+       }\r
+\r
+#define SRP_ENTER(_flag_) \\r
+       { \\r
+               if( g_srp_dbg_level >= TRACE_LEVEL_VERBOSE ) \\r
+                       CL_ENTER( _flag_, g_srp_dbg_flags ); \\r
+       }\r
+\r
+#define SRP_EXIT(_flag_)\\r
+       { \\r
+               if( g_srp_dbg_level >= TRACE_LEVEL_VERBOSE ) \\r
+                       CL_EXIT( _flag_, g_srp_dbg_flags ); \\r
+       }\r
+\r
+\r
+#else\r
+\r
+#define SRP_PRINT(lvl, flags, msg)\r
+\r
+#define SRP_PRINT_EXIT(_level_,_flag_,_msg_)\r
+\r
+#define SRP_ENTER(_flag_)\r
+\r
+#define SRP_EXIT(_flag_)\r
+\r
+\r
+#endif\r
+\r
+\r
+#endif //EVENT_TRACING\r
+\r
+extern char         g_srb_function_name[][32];\r
+extern char         g_srb_status_name[][32];\r
 \r
 #endif  /* _SRP_DEBUG_H_ */\r
index 81cb0e9..6d4432b 100644 (file)
 #include "srp_cmd.h"\r
 #include "srp_data_path.h"\r
 #include "srp_descriptors.h"\r
+#if defined(EVENT_TRACING)\r
+#ifdef offsetof\r
+#undef offsetof\r
+#endif\r
+#include "srp_descriptors.tmh"\r
+#endif\r
 #include "srp_rsp.h"\r
 #include "srp_session.h"\r
 #include "srp_tsk_mgmt.h"\r
@@ -68,7 +74,7 @@ __srp_create_recv_descriptors(
                (srp_recv_descriptor_t *)cl_zalloc( p_descriptors->recv_descriptor_count * sizeof(srp_recv_descriptor_t) );\r
        if ( p_descriptors->p_recv_descriptors_array == NULL )\r
        {\r
-               SRP_TRACE( SRP_DBG_ERROR,\r
+               SRP_PRINT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR,\r
                        ("Failed to allocate %d recv descriptors.\n",  p_descriptors->recv_descriptor_count) );\r
                status = IB_INSUFFICIENT_MEMORY;\r
                goto exit;\r
@@ -79,7 +85,7 @@ __srp_create_recv_descriptors(
                cl_zalloc( p_descriptors->recv_descriptor_count * p_descriptors->recv_data_segment_size );\r
        if ( p_descriptors->p_recv_data_segments_array == NULL )\r
        {\r
-               SRP_TRACE( SRP_DBG_ERROR,\r
+               SRP_PRINT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR,\r
                        ("Failed to allocate %d recv data segments of %d length.\n",\r
                        p_descriptors->recv_descriptor_count,\r
                        p_descriptors->recv_data_segment_size) );\r
@@ -102,7 +108,7 @@ __srp_create_recv_descriptors(
                                                 &p_descriptors->h_recv_mr );\r
        if ( status != IB_SUCCESS )\r
        {\r
-               SRP_TRACE( SRP_DBG_ERROR,\r
+               SRP_PRINT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR,\r
                        ("Failed to register recv data segments. Status = %d.\n", status) );\r
 \r
                cl_free( p_descriptors->p_recv_data_segments_array );\r
@@ -133,8 +139,8 @@ __srp_create_recv_descriptors(
                status = p_ifc->post_recv( h_qp, &p_descriptor->wr, NULL );\r
                if ( status != IB_SUCCESS )\r
                {\r
-                       SRP_TRACE( SRP_DBG_ERROR,\r
-                               ("Failed to post send descriptor. Status = %d.\n", status) );\r
+                       SRP_PRINT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR,\r
+                               ("Failed to post recv descriptor. Status = %d.\n", status) );\r
                        goto exit;\r
                }\r
 \r
@@ -247,7 +253,7 @@ srp_add_send_descriptor(
        IN  srp_descriptors_t       *p_descriptors,\r
        IN  srp_send_descriptor_t   *p_descriptor )\r
 {\r
-       SRP_ENTER( SRP_DBG_FUNC );\r
+       SRP_ENTER( SRP_DBG_DEBUG );\r
 \r
        cl_spinlock_acquire ( &p_descriptors->sent_list_lock );\r
 \r
@@ -256,7 +262,7 @@ srp_add_send_descriptor(
 \r
        cl_spinlock_release ( &p_descriptors->sent_list_lock );\r
 \r
-       SRP_EXIT( SRP_DBG_FUNC );\r
+       SRP_EXIT( SRP_DBG_DEBUG );\r
 }\r
 \r
 /* srp_remove_send_descriptor */\r
@@ -274,7 +280,7 @@ srp_remove_send_descriptor(
        IN  srp_descriptors_t       *p_descriptors,\r
        IN  srp_send_descriptor_t   *p_descriptor )\r
 {\r
-       SRP_ENTER( SRP_DBG_FUNC );\r
+       SRP_ENTER( SRP_DBG_DEBUG );\r
 \r
        cl_spinlock_acquire ( &p_descriptors->sent_list_lock );\r
 \r
@@ -283,7 +289,7 @@ srp_remove_send_descriptor(
 \r
        cl_spinlock_release ( &p_descriptors->sent_list_lock );\r
 \r
-       SRP_EXIT( SRP_DBG_FUNC );\r
+       SRP_EXIT( SRP_DBG_DEBUG );\r
 }\r
 \r
 /* srp_remove_lun_head_send_descriptor */\r
@@ -302,7 +308,7 @@ srp_remove_lun_head_send_descriptor(
 {\r
        srp_send_descriptor_t   *p_descriptor;\r
 \r
-       SRP_ENTER( SRP_DBG_FUNC );\r
+       SRP_ENTER( SRP_DBG_DEBUG );\r
 \r
        cl_spinlock_acquire ( &p_descriptors->sent_list_lock );\r
 \r
@@ -329,7 +335,7 @@ srp_remove_lun_head_send_descriptor(
 \r
        cl_spinlock_release ( &p_descriptors->sent_list_lock );\r
 \r
-       SRP_EXIT( SRP_DBG_FUNC );\r
+       SRP_EXIT( SRP_DBG_DEBUG );\r
 \r
        return ( p_descriptor );\r
 }\r
@@ -355,20 +361,25 @@ srp_post_send_descriptor(
        srp_connection_t        *p_connection;\r
        ib_al_ifc_t                     *p_ifc;\r
 \r
-       SRP_ENTER( SRP_DBG_FUNC );\r
+       SRP_ENTER( SRP_DBG_DEBUG );\r
 \r
        p_connection = &p_session->connection;\r
        p_ifc = &p_session->hca.p_hba->ifc;\r
 \r
        if ( p_connection->state == SRP_CONNECTED )\r
        {\r
-               SRP_TRACE( SRP_DBG_VERBOSE, ("wr_id    = 0x%"PRIx64".\n", p_descriptor->wr.wr_id) );\r
-               SRP_TRACE( SRP_DBG_VERBOSE, ("wr_type  = 0x%x.\n", p_descriptor->wr.wr_type) );\r
-               SRP_TRACE( SRP_DBG_VERBOSE, ("send_opt = 0x%x.\n", p_descriptor->wr.send_opt) );\r
-               SRP_TRACE( SRP_DBG_VERBOSE, ("num_ds   = 0x%x.\n", p_descriptor->wr.num_ds) );\r
-\r
-               SRP_TRACE( SRP_DBG_VERBOSE,\r
-                                  ("Posting  I/O for Function = %s(0x%x), Path = 0x%x, Target = 0x%x, Lun = 0x%x, tag 0x%"PRIx64"\n",\r
+               SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
+                       ("wr_id    = 0x%I64x.\n", p_descriptor->wr.wr_id) );\r
+               SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
+                       ("wr_type  = 0x%x.\n", p_descriptor->wr.wr_type) );\r
+               SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
+                       ("send_opt = 0x%x.\n", p_descriptor->wr.send_opt) );\r
+               SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
+                       ("num_ds   = 0x%x.\n", p_descriptor->wr.num_ds) );\r
+\r
+               SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
+                                  ("Posting  I/O for Function = %s(0x%x), Path = 0x%x, "\r
+                                  "Target = 0x%x, Lun = 0x%x, tag 0x%I64x\n",\r
                                   g_srb_function_name[p_descriptor->p_srb->Function],\r
                                   p_descriptor->p_srb->Function,\r
                                   p_descriptor->p_srb->PathId,\r
@@ -395,19 +406,20 @@ srp_post_send_descriptor(
                {\r
                        /* Remove From Sent List */\r
                        srp_remove_send_descriptor( p_descriptors, p_descriptor );\r
-                       SRP_TRACE( SRP_DBG_ERROR,\r
-                                               ("Failed to post send descriptor. ib_post_send status = 0x%x tag = 0x%"PRIx64"\n",\r
+                       SRP_PRINT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR,\r
+                                               ("Failed to post send descriptor. "\r
+                                               "ib_post_send status = 0x%x tag = 0x%I64x\n",\r
                                                status,\r
                                                get_srp_command_tag( (srp_cmd_t *)p_descriptor->data_segment )) );\r
                }\r
        }\r
        else\r
        {\r
-               SRP_TRACE( SRP_DBG_ERROR,\r
+               SRP_PRINT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR,\r
                        ("Attempting to post to an unconnected session.\n") );\r
        }\r
 \r
-       SRP_EXIT( SRP_DBG_FUNC );\r
+       SRP_EXIT( SRP_DBG_DEBUG );\r
 \r
        return ( status );\r
 }\r
@@ -430,18 +442,19 @@ srp_find_matching_send_descriptor(
 {\r
        srp_send_descriptor_t   *p_send_descriptor;\r
 \r
-       SRP_ENTER( SRP_DBG_FUNC );\r
+       SRP_ENTER( SRP_DBG_DEBUG );\r
 \r
        cl_spinlock_acquire( &p_descriptors->sent_list_lock );\r
 \r
        p_send_descriptor = (srp_send_descriptor_t *)cl_qlist_head( &p_descriptors->sent_descriptors );\r
        CL_ASSERT( &p_descriptors->sent_descriptors == p_send_descriptor->list_item.p_list );\r
 \r
-       SRP_TRACE( SRP_DBG_VERBOSE, ("rsp tag = 0x%"PRIx64".\n", tag) );\r
+       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
+               ("rsp tag = 0x%I64x.\n", tag) );\r
 \r
        while ( p_send_descriptor != (srp_send_descriptor_t *)cl_qlist_end( &p_descriptors->sent_descriptors ) )\r
        {\r
-               SRP_TRACE( SRP_DBG_VERBOSE, ("cmd tag = 0x%"PRIx64".\n",\r
+               SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG, ("cmd tag = 0x%I64x.\n",\r
                        get_srp_command_tag( (srp_cmd_t *)p_send_descriptor->data_segment )) );\r
 \r
                if ( get_srp_command_tag( (srp_cmd_t *)p_send_descriptor->data_segment ) == tag )\r
@@ -460,7 +473,7 @@ srp_find_matching_send_descriptor(
 exit:\r
        cl_spinlock_release( &p_descriptors->sent_list_lock );\r
 \r
-       SRP_EXIT( SRP_DBG_FUNC );\r
+       SRP_EXIT( SRP_DBG_DEBUG );\r
 \r
        return ( p_send_descriptor );\r
 }\r
@@ -485,7 +498,7 @@ srp_build_send_descriptor(
        STOR_PHYSICAL_ADDRESS   physical_address;\r
        ULONG                   length;\r
 \r
-       SRP_ENTER( SRP_DBG_FUNC );\r
+       SRP_ENTER( SRP_DBG_DEBUG );\r
 \r
        cl_memclr( p_send_descriptor, (sizeof ( srp_send_descriptor_t ) - SRP_MAX_IU_SIZE) );\r
 \r
@@ -502,11 +515,16 @@ srp_build_send_descriptor(
        p_send_descriptor->ds[0].length =  p_srp_conn_info->init_to_targ_iu_sz;\r
        p_send_descriptor->ds[0].lkey =   p_srp_conn_info->lkey;\r
 \r
-       SRP_TRACE( SRP_DBG_VERBOSE, ("hca vaddr        = 0x%"PRIx64".\n", p_srp_conn_info->vaddr));\r
-       SRP_TRACE( SRP_DBG_VERBOSE, ("physical_address = 0x%"PRIx64".\n", physical_address.QuadPart));\r
-       SRP_TRACE( SRP_DBG_VERBOSE, ("IU  vaddr        = 0x%"PRIx64".\n", p_send_descriptor->ds[0].vaddr));\r
-       SRP_TRACE( SRP_DBG_VERBOSE, ("length           = %d.\n",          p_send_descriptor->ds[0].length));\r
-       SRP_TRACE( SRP_DBG_VERBOSE, ("lkey             = 0x%x.\n",        p_send_descriptor->ds[0].lkey));\r
-\r
-       SRP_EXIT( SRP_DBG_FUNC );\r
+       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
+               ("hca vaddr        = 0x%I64x.\n", p_srp_conn_info->vaddr));\r
+       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
+               ("physical_address = 0x%I64x.\n", physical_address.QuadPart));\r
+       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
+               ("IU  vaddr        = 0x%I64x.\n", p_send_descriptor->ds[0].vaddr));\r
+       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
+               ("length           = %d.\n",          p_send_descriptor->ds[0].length));\r
+       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
+               ("lkey             = 0x%x.\n",        p_send_descriptor->ds[0].lkey));\r
+\r
+       SRP_EXIT( SRP_DBG_DEBUG );\r
 }\r
index 71b7b4b..8103867 100644 (file)
 #include "srp_data.h"\r
 #include "srp_data_path.h"\r
 #include "srp_debug.h"\r
+#if defined(EVENT_TRACING)\r
+#ifdef offsetof\r
+#undef offsetof\r
+#endif\r
+#include "srp_driver.tmh"\r
+#endif\r
 #include "srp_descriptors.h"\r
 #include "srp_hba.h"\r
 #include "srp_session.h"\r
@@ -46,8 +52,9 @@
 \r
 BOOLEAN             g_srp_system_shutdown = FALSE;\r
 \r
-//uint32_t            g_srp_dbg_lvl = SRP_DBG_PNP | SRP_DBG_ERROR | SRP_DBG_WARN | SRP_DBG_VERBOSE | SRP_DBG_FUNC;\r
-uint32_t            g_srp_dbg_lvl = SRP_DBG_DEBUG | SRP_DBG_ERROR | SRP_DBG_WARN;\r
+\r
+uint32_t                       g_srp_dbg_level = TRACE_LEVEL_ERROR;\r
+uint32_t                       g_srp_dbg_flags = 0x0000ffff;\r
 \r
 char g_srb_function_name[][32] =\r
 {\r
@@ -142,6 +149,11 @@ PDRIVER_DISPATCH    gpfn_pnp;
 PDRIVER_ADD_DEVICE  gpfn_add_device;\r
 PDRIVER_UNLOAD      gpfn_unload;\r
 \r
+\r
+static NTSTATUS\r
+__read_registry(\r
+       IN                              UNICODE_STRING* const           p_Param_Path );\r
+\r
 NTSTATUS\r
 srp_add_device(\r
        IN              DRIVER_OBJECT               *p_drv_obj,\r
@@ -198,6 +210,73 @@ static void
 __srp_free(\r
        IN              cl_obj_t                    *p_obj );\r
 \r
+\r
+\r
+static NTSTATUS\r
+__read_registry(\r
+       IN                              UNICODE_STRING* const           p_registry_path )\r
+{\r
+       NTSTATUS                                        status;\r
+       /* Remember the terminating entry in the table below. */\r
+       RTL_QUERY_REGISTRY_TABLE        table[3];\r
+       UNICODE_STRING                          param_path;\r
+\r
+       SRP_ENTER( SRP_DBG_PNP );\r
+\r
+       RtlInitUnicodeString( &param_path, NULL );\r
+       param_path.MaximumLength = p_registry_path->Length + \r
+               sizeof(L"\\Parameters");\r
+       param_path.Buffer = cl_zalloc( param_path.MaximumLength );\r
+       if( !param_path.Buffer )\r
+       {\r
+               SRP_PRINT_EXIT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR, \r
+                       ("Failed to allocate parameters path buffer.\n") );\r
+               return STATUS_INSUFFICIENT_RESOURCES;\r
+       }\r
+\r
+       RtlAppendUnicodeStringToString( &param_path, p_registry_path );\r
+       RtlAppendUnicodeToString( &param_path, L"\\Parameters" );\r
+\r
+       /*\r
+        * Clear the table.  This clears all the query callback pointers,\r
+        * and sets up the terminating table entry.\r
+        */\r
+       cl_memclr( table, sizeof(table) );\r
+\r
+       /* Setup the table entries. */\r
+       table[0].Flags = RTL_QUERY_REGISTRY_DIRECT;\r
+       table[0].Name = L"DebugLevel";\r
+       table[0].EntryContext = &g_srp_dbg_level;\r
+       table[0].DefaultType = REG_DWORD;\r
+       table[0].DefaultData = &g_srp_dbg_level;\r
+       table[0].DefaultLength = sizeof(ULONG);\r
+\r
+       table[1].Flags = RTL_QUERY_REGISTRY_DIRECT;\r
+       table[1].Name = L"DebugFlags";\r
+       table[1].EntryContext = &g_srp_dbg_flags;\r
+       table[1].DefaultType = REG_DWORD;\r
+       table[1].DefaultData = &g_srp_dbg_flags;\r
+       table[1].DefaultLength = sizeof(ULONG);\r
+       /* Have at it! */\r
+       status = RtlQueryRegistryValues( RTL_REGISTRY_ABSOLUTE, \r
+               param_path.Buffer, table, NULL, NULL );\r
+\r
+#ifndef EVENT_TRACING\r
+       if( g_srp_dbg_flags & SRP_DBG_ERR )\r
+               g_srp_dbg_flags |= CL_DBG_ERROR;\r
+#endif\r
+\r
+       SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_PNP,\r
+               ("debug level %d debug flags 0x%.8x\n",\r
+               g_srp_dbg_level,\r
+               g_srp_dbg_flags) );\r
+\r
+       cl_free( param_path.Buffer );\r
+       SRP_EXIT( SRP_DBG_PNP );\r
+       return status;\r
+}\r
+\r
+\r
 ULONG\r
 DriverEntry(\r
        IN              DRIVER_OBJECT               *p_drv_obj,\r
@@ -209,16 +288,30 @@ DriverEntry(
 \r
        SRP_ENTER( SRP_DBG_PNP );\r
 \r
+#if defined(EVENT_TRACING)\r
+       WPP_INIT_TRACING( p_drv_obj, p_registry_path );\r
+#endif\r
+\r
        status = CL_INIT;\r
        if( !NT_SUCCESS(status) )\r
        {\r
-               SRP_TRACE_EXIT( SRP_DBG_ERROR,\r
+               SRP_PRINT_EXIT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR,\r
                        ("cl_init returned %08X.\n", status) );\r
                return status;\r
        }\r
 \r
        gp_drv_obj = p_drv_obj;\r
 \r
+       /* Get the registry values. */\r
+       status = __read_registry( p_registry_path );\r
+       if( !NT_SUCCESS(status) )\r
+       {\r
+               CL_DEINIT;\r
+               SRP_PRINT_EXIT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR,\r
+                       ("__read_registry returned %08x.\n", status) );\r
+               return status;\r
+       }\r
+\r
        cl_obj_construct( &g_drv_obj, SRP_OBJ_TYPE_DRV );\r
 \r
        KeInitializeMutex( &g_srp_pnp_mutex, 0 );\r
@@ -279,7 +372,7 @@ DriverEntry(
                else\r
                {\r
                        CL_DEINIT;\r
-                       SRP_TRACE( SRP_DBG_ERROR,\r
+                       SRP_PRINT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR,\r
                                ("StorPortInitialize returned 0x%x.\n", status) );\r
                }\r
        }\r
@@ -289,7 +382,8 @@ DriverEntry(
                status = (ULONG)STATUS_INSUFFICIENT_RESOURCES;\r
        }\r
 \r
-       SRP_TRACE_EXIT( SRP_DBG_PNP, ("DriverEntry returning status of 0x%x.\n", status) );\r
+       SRP_PRINT_EXIT( TRACE_LEVEL_INFORMATION, SRP_DBG_PNP,\r
+               ("DriverEntry returning status of 0x%x.\n", status) );\r
        return status;\r
 }\r
 \r
@@ -298,16 +392,22 @@ srp_unload(
        IN              DRIVER_OBJECT               *p_drv_obj )\r
 {\r
        SRP_ENTER( SRP_DBG_PNP );\r
+#if defined(EVENT_TRACING)\r
+       WPP_CLEANUP( p_drv_obj );\r
+#endif\r
 \r
        /* Kill all SRP objects. */\r
-       SRP_TRACE( SRP_DBG_DEBUG, ("Destroying all SRP objects.\n") );\r
-       SRP_TRACE( SRP_DBG_VERBOSE, ("Driver Object ref_cnt = %d\n", g_drv_obj.ref_cnt) );\r
+       SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
+               ("Destroying all SRP objects.\n") );\r
+       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
+               ("Driver Object ref_cnt = %d\n", g_drv_obj.ref_cnt) );\r
        cl_obj_destroy( &g_drv_obj );\r
 \r
        CL_DEINIT;\r
 \r
        /* Invoke the port driver's unload routine. */\r
-       SRP_TRACE( SRP_DBG_DEBUG, ("Invoking the port driver's unload routine.\n") );\r
+       SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
+               ("Invoking the port driver's unload routine.\n") );\r
        gpfn_unload( p_drv_obj );\r
 \r
        SRP_EXIT( SRP_DBG_PNP );\r
@@ -334,7 +434,7 @@ srp_add_device(
        SRP_ENTER( SRP_DBG_PNP );\r
 \r
        status = gpfn_add_device( p_drv_obj, p_pdo );\r
-       SRP_TRACE( SRP_DBG_PNP,\r
+       SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_PNP,\r
                ("srp_add_device status = 0x%x.\n", status) );\r
 \r
        SRP_EXIT( SRP_DBG_PNP );\r
@@ -354,7 +454,7 @@ srp_dispatch_pnp(
 \r
        p_stack = IoGetCurrentIrpStackLocation( p_irp );\r
        minor = p_stack->MinorFunction;\r
-       SRP_TRACE( SRP_DBG_PNP,\r
+       SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_PNP,\r
                ("Minor PNP Function = %d.\n", minor) );\r
 \r
        if( minor == IRP_MN_START_DEVICE )\r
@@ -364,12 +464,12 @@ srp_dispatch_pnp(
                wait_status = KeWaitForMutexObject(\r
                        &g_srp_pnp_mutex, Executive, KernelMode, FALSE, NULL );\r
 \r
-               SRP_TRACE( SRP_DBG_PNP,\r
+               SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_PNP,\r
                        ("KeWaitForMutexObject status = 0x%x.\n", wait_status) );\r
                gp_self_do = p_dev_obj;\r
        }\r
        status = gpfn_pnp( p_dev_obj, p_irp );\r
-       SRP_TRACE( SRP_DBG_PNP,\r
+       SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_PNP,\r
                ("gpfn_pnp status = 0x%x.\n", status) );\r
 \r
        if( minor == IRP_MN_START_DEVICE )\r
@@ -377,7 +477,7 @@ srp_dispatch_pnp(
                LONG    release_status;\r
                gp_self_do = NULL;\r
                release_status = KeReleaseMutex( &g_srp_pnp_mutex, FALSE );\r
-               SRP_TRACE( SRP_DBG_PNP,\r
+               SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_PNP,\r
                        ("KeReleaseMutex status = %d.\n", release_status) );\r
        }\r
 \r
@@ -408,7 +508,7 @@ srp_find_adapter(
 \r
        if( KeGetCurrentIrql() >= DISPATCH_LEVEL )\r
        {\r
-               SRP_TRACE_EXIT( SRP_DBG_ERROR,\r
+               SRP_PRINT_EXIT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR,\r
                        ("Improper IRQL!\n") );\r
                return SP_RETURN_ERROR;\r
        }\r
@@ -418,7 +518,7 @@ srp_find_adapter(
        ib_status = srp_hba_create( &g_drv_obj, p_ext );\r
        if( ib_status != IB_SUCCESS )\r
        {\r
-               SRP_TRACE_EXIT( SRP_DBG_ERROR,\r
+               SRP_PRINT_EXIT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR,\r
                        ("srp_hba_create returned %d\n", ib_status) );\r
                return SP_RETURN_ERROR;\r
        }\r
@@ -443,7 +543,7 @@ srp_find_adapter(
 //     p_config->InitiatorBusId[0]           = 127;\r
 //     p_config->DeviceExtensionSize         = sizeof( srp_ext_t );\r
 \r
-       SRP_TRACE( SRP_DBG_VERBOSE,\r
+       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
                ("NumberOfPhysicalBreaks passed in = %d.\n", p_config->NumberOfPhysicalBreaks) );\r
 \r
        if ( p_config->NumberOfPhysicalBreaks == SP_UNINITIALIZED_VALUE )\r
@@ -455,7 +555,7 @@ srp_find_adapter(
                p_config->NumberOfPhysicalBreaks = MIN( p_ext->p_hba->max_sg - 1, p_config->NumberOfPhysicalBreaks );\r
        }\r
 \r
-       SRP_TRACE( SRP_DBG_VERBOSE,\r
+       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
                ("NumberOfPhysicalBreaks set to = %d.\n", p_config->NumberOfPhysicalBreaks) );\r
 \r
        SRP_EXIT( SRP_DBG_PNP );\r
@@ -470,7 +570,8 @@ srp_init(
 \r
        UNUSED_PARAM( p_dev_ext );\r
 \r
-       SRP_TRACE( SRP_DBG_PNP, ("called at IRQL %d\n", KeGetCurrentIrql()) );\r
+       SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_PNP,\r
+               ("called at IRQL %d\n", KeGetCurrentIrql()) );\r
 \r
        SRP_EXIT( SRP_DBG_PNP );\r
        return TRUE;\r
@@ -481,10 +582,11 @@ srp_start_io(
        IN              PVOID                       p_dev_ext,\r
        IN              PSCSI_REQUEST_BLOCK         p_srb )\r
 {\r
-       SRP_ENTER( SRP_DBG_FUNC );\r
+       SRP_ENTER( SRP_DBG_DEBUG );\r
 \r
-       SRP_TRACE( SRP_DBG_VERBOSE,\r
-                          ("Starting I/O for Function = %s(0x%x), Path = 0x%x, Target = 0x%x, Lun = 0x%x\n",\r
+       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
+                          ("Starting I/O for Function = %s(0x%x), Path = 0x%x, "\r
+                          "Target = 0x%x, Lun = 0x%x\n",\r
                           g_srb_function_name[p_srb->Function],\r
                           p_srb->Function,\r
                           p_srb->PathId,\r
@@ -526,8 +628,10 @@ srp_start_io(
                                p_srp_session->p_shutdown_srb = p_srb;\r
                                cl_obj_destroy( &p_srp_session->obj );\r
 \r
-                               SRP_TRACE( SRP_DBG_DEBUG,\r
-                                                  ("Returning SrbStatus %s(0x%x) for Function = %s(0x%x), Path = 0x%x, Target = 0x%x, Lun = 0x%x\n",\r
+                               SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
+                                                  ("Returning SrbStatus %s(0x%x) for "\r
+                                                  "Function = %s(0x%x), Path = 0x%x, "\r
+                                                  "Target = 0x%x, Lun = 0x%x\n",\r
                                                   g_srb_status_name[p_srb->SrbStatus],\r
                                                   p_srb->SrbStatus,\r
                                                   g_srb_function_name[p_srb->Function],\r
@@ -539,8 +643,10 @@ srp_start_io(
                        else\r
                        {\r
                                p_srb->SrbStatus = SRB_STATUS_SUCCESS;\r
-                               SRP_TRACE( SRP_DBG_DEBUG,\r
-                                                  ("Returning SrbStatus %s(0x%x) for Function = %s(0x%x), Path = 0x%x, Target = 0x%x, Lun = 0x%x\n",\r
+                               SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
+                                                  ("Returning SrbStatus %s(0x%x) for "\r
+                                                  "Function = %s(0x%x), Path = 0x%x, "\r
+                                                  "Target = 0x%x, Lun = 0x%x\n",\r
                                                   g_srb_status_name[p_srb->SrbStatus],\r
                                                   p_srb->SrbStatus,\r
                                                   g_srb_function_name[p_srb->Function],\r
@@ -555,8 +661,10 @@ srp_start_io(
 \r
                case SRB_FUNCTION_FLUSH: /* Only receive this if CachesData is TRUE in PORT_CONFIGURATION_INFORMATION */\r
                        p_srb->SrbStatus = SRB_STATUS_SUCCESS;\r
-                       SRP_TRACE( SRP_DBG_DEBUG,\r
-                                          ("Returning SrbStatus %s(0x%x) for Function = %s(0x%x), Path = 0x%x, Target = 0x%x, Lun = 0x%x\n",\r
+                       SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
+                                          ("Returning SrbStatus %s(0x%x) for "\r
+                                          "Function = %s(0x%x), Path = 0x%x, "\r
+                                          "Target = 0x%x, Lun = 0x%x\n",\r
                                           g_srb_status_name[p_srb->SrbStatus],\r
                                           p_srb->SrbStatus,\r
                                           g_srb_function_name[p_srb->Function],\r
@@ -589,8 +697,10 @@ srp_start_io(
 #endif\r
                default:\r
                        p_srb->SrbStatus = SRB_STATUS_INVALID_REQUEST;\r
-                       SRP_TRACE( SRP_DBG_DEBUG,\r
-                                          ("Returning SrbStatus %s(0x%x) for Function = %s(0x%x), Path = 0x%x, Target = 0x%x, Lun = 0x%x\n",\r
+                       SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
+                                          ("Returning SrbStatus %s(0x%x) for "\r
+                                          "Function = %s(0x%x), Path = 0x%x, "\r
+                                          "Target = 0x%x, Lun = 0x%x\n",\r
                                           g_srb_status_name[p_srb->SrbStatus],\r
                                           p_srb->SrbStatus,\r
                                           g_srb_function_name[p_srb->Function],\r
@@ -602,7 +712,7 @@ srp_start_io(
 \r
        }\r
 \r
-       SRP_EXIT( SRP_DBG_FUNC );\r
+       SRP_EXIT( SRP_DBG_DEBUG );\r
 \r
        return ( TRUE );\r
 }\r
@@ -615,7 +725,8 @@ srp_isr(
 \r
        UNUSED_PARAM( p_dev_ext );\r
 \r
-       SRP_TRACE( SRP_DBG_PNP, ("called at IRQL %d\n", KeGetCurrentIrql()) );\r
+       SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_PNP,\r
+               ("called at IRQL %d\n", KeGetCurrentIrql()) );\r
 \r
        SRP_EXIT( SRP_DBG_PNP );\r
        return TRUE;\r
@@ -646,14 +757,15 @@ srp_adapter_ctrl(
 \r
        SRP_ENTER( SRP_DBG_PNP );\r
 \r
-       SRP_TRACE( SRP_DBG_PNP, ("called at IRQL %d\n", KeGetCurrentIrql()) );\r
+       SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_PNP,\r
+               ("called at IRQL %d\n", KeGetCurrentIrql()) );\r
 \r
        p_ext = (srp_ext_t*)p_dev_ext;\r
 \r
        switch( ctrl_type )\r
        {\r
        case ScsiQuerySupportedControlTypes:\r
-               SRP_TRACE( SRP_DBG_DEBUG | SRP_DBG_VERBOSE,\r
+               SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
                        ("ScsiQuerySupportedControlTypes\n") );\r
                p_ctrl_list = (SCSI_SUPPORTED_CONTROL_TYPE_LIST*)params;\r
                p_ctrl_list->SupportedTypeList[ScsiQuerySupportedControlTypes] = TRUE;\r
@@ -664,28 +776,29 @@ srp_adapter_ctrl(
                break;\r
 \r
        case ScsiStopAdapter:\r
-               SRP_TRACE( SRP_DBG_DEBUG | SRP_DBG_VERBOSE,\r
+               SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
                        ("ScsiStopAdapter\n") );\r
                if( p_ext->p_hba )\r
                {\r
-                       SRP_TRACE( SRP_DBG_VERBOSE, ("HBA Object ref_cnt = %d\n", p_ext->p_hba->obj.ref_cnt) );\r
+                       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
+                               ("HBA Object ref_cnt = %d\n", p_ext->p_hba->obj.ref_cnt) );\r
                        cl_obj_destroy( &p_ext->p_hba->obj );\r
                        p_ext->p_hba = NULL;\r
                }\r
                break;\r
 \r
        case ScsiRestartAdapter:\r
-               SRP_TRACE( SRP_DBG_DEBUG | SRP_DBG_VERBOSE,\r
+               SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
                        ("ScsiRestartAdapter\n") );\r
                break;\r
 \r
        case ScsiSetBootConfig:\r
-               SRP_TRACE( SRP_DBG_DEBUG | SRP_DBG_VERBOSE,\r
+               SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
                        ("ScsiSetBootConfig\n") );\r
                break;\r
 \r
        case ScsiSetRunningConfig:\r
-               SRP_TRACE( SRP_DBG_DEBUG | SRP_DBG_VERBOSE,\r
+               SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
                        ("ScsiSetRunningConfig\n") );\r
                break;\r
        }\r
@@ -699,15 +812,16 @@ srp_build_io(
        IN              PVOID                       p_dev_ext,\r
        IN              PSCSI_REQUEST_BLOCK         p_srb )\r
 {\r
-       SRP_ENTER( SRP_DBG_FUNC );\r
+       SRP_ENTER( SRP_DBG_DEBUG );\r
 \r
        if ( p_srb->Function == SRB_FUNCTION_EXECUTE_SCSI )\r
        {\r
 \r
                CL_ASSERT( p_srb->SrbExtension != NULL );\r
 \r
-               SRP_TRACE( SRP_DBG_VERBOSE,\r
-                                  ("Building I/O for Function = %s(0x%x), Path = 0x%x, Target = 0x%x, Lun = 0x%x\n",\r
+               SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
+                                  ("Building I/O for Function = %s(0x%x), "\r
+                                  "Path = 0x%x, Target = 0x%x, Lun = 0x%x\n",\r
                                   g_srb_function_name[p_srb->Function],\r
                                   p_srb->Function,\r
                                   p_srb->PathId,\r
@@ -716,8 +830,10 @@ srp_build_io(
 \r
                if ( srp_format_io_request( p_dev_ext, p_srb ) == FALSE )\r
                {\r
-                       SRP_TRACE_EXIT( SRP_DBG_ERROR,\r
-                                                       ("Returning SrbStatus %s(0x%x) for Function = %s(0x%x), Path = 0x%x, Target = 0x%x, Lun = 0x%x\n",\r
+                       SRP_PRINT_EXIT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR,\r
+                                                       ("Returning SrbStatus %s(0x%x) for "\r
+                                                       "Function = %s(0x%x), Path = 0x%x, "\r
+                                                       "Target = 0x%x, Lun = 0x%x\n",\r
                                                    g_srb_status_name[p_srb->SrbStatus],\r
                                                        p_srb->SrbStatus,\r
                                                        g_srb_function_name[p_srb->Function],\r
@@ -732,7 +848,7 @@ srp_build_io(
                }\r
        }\r
 \r
-       SRP_EXIT( SRP_DBG_FUNC );\r
+       SRP_EXIT( SRP_DBG_DEBUG );\r
 \r
        return ( TRUE );\r
 }\r
index 9d89f2a..c015c9c 100644 (file)
 \r
 \r
 #include "srp_debug.h"\r
+#if defined(EVENT_TRACING)\r
+#ifdef offsetof\r
+#undef offsetof\r
+#endif\r
+#include "srp_event.tmh"\r
+#endif\r
 #include "srp_event.h"\r
 #include "srp_session.h"\r
 \r
@@ -46,34 +52,28 @@ void
 srp_async_event_handler_cb(\r
        IN  ib_async_event_rec_t    *p_event_rec )\r
 {\r
-#ifdef _DEBUG_\r
        srp_session_t   *p_srp_session = (srp_session_t * __ptr64)p_event_rec->context;\r
-#endif\r
 \r
        SRP_ENTER( SRP_DBG_PNP );\r
 \r
-#ifndef _DEBUG_\r
-       UNUSED_PARAM( p_event_rec );\r
-#endif\r
-\r
        switch ( p_event_rec->code )\r
        {\r
                case IB_AE_PORT_ACTIVE:\r
-                       SRP_TRACE( SRP_DBG_DEBUG,\r
+                       SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
                                ("Async Event IB_AE_PORT_ACTIVE (%d) received for %s.\n",\r
                                 p_event_rec->code,\r
                                 p_srp_session->p_hba->ioc_info.profile.id_string) );\r
                        break;\r
 \r
                case IB_AE_PORT_DOWN:\r
-                       SRP_TRACE( SRP_DBG_DEBUG,\r
+                       SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
                                ("Async Event IB_AE_PORT_DOWN (%d) received for %s.\n",\r
                                 p_event_rec->code,\r
                                 p_srp_session->p_hba->ioc_info.profile.id_string) );\r
                        break;\r
 \r
                default:\r
-                       SRP_TRACE( SRP_DBG_DEBUG,\r
+                       SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
                                ("Async Event %d received.\n", p_event_rec->code) );\r
                        break;\r
        }\r
index ba8949d..dbcad9e 100644 (file)
 #include "srp_data.h"\r
 #include "srp_data_path.h"\r
 #include "srp_debug.h"\r
+#if defined(EVENT_TRACING)\r
+#ifdef offsetof\r
+#undef offsetof\r
+#endif\r
+#include "srp_hba.tmh"\r
+#endif\r
 #include "srp_session.h"\r
 \r
 #include <complib/cl_byteswap.h>\r
@@ -65,36 +71,80 @@ __srp_dump_ioc_info( const ib_ioc_info_t *p_ioc_info )
 {\r
        UNUSED_PARAM( p_ioc_info );\r
 \r
-       SRP_PRINT( SRP_DBG_VERBOSE, ("Dumping IOC Info\n") );\r
-\r
-       SRP_PRINT( SRP_DBG_VERBOSE, ("   chassis_guid    = 0x%"PRIx64"\n", cl_ntoh64( p_ioc_info->chassis_guid )) );\r
-       SRP_PRINT( SRP_DBG_VERBOSE, ("   chassis_slot    = %d\n",          p_ioc_info->chassis_slot) );\r
-       SRP_PRINT( SRP_DBG_VERBOSE, ("   iou_guid        = 0x%"PRIx64"\n", cl_ntoh64( p_ioc_info->iou_guid )) );\r
-       SRP_PRINT( SRP_DBG_VERBOSE, ("   iou_slot        = %d\n",          p_ioc_info->iou_slot) );\r
-       SRP_PRINT( SRP_DBG_VERBOSE, ("\n") );\r
-       SRP_PRINT( SRP_DBG_VERBOSE, ("Dumping IOC Info Profile\n") );\r
-\r
-       SRP_PRINT( SRP_DBG_VERBOSE, ("   ioc_guid        = 0x%"PRIx64"\n", cl_ntoh64( p_ioc_info->profile.ioc_guid )) );\r
-       SRP_PRINT( SRP_DBG_VERBOSE, ("   vend_id         = %d\n",          cl_ntoh32( p_ioc_info->profile.vend_id )) );\r
-       SRP_PRINT( SRP_DBG_VERBOSE, ("   dev_id          = %d\n",          cl_ntoh32( p_ioc_info->profile.dev_id )) );\r
-       SRP_PRINT( SRP_DBG_VERBOSE, ("   dev_ver         = %d\n",          cl_ntoh16( p_ioc_info->profile.dev_ver )) );\r
-\r
-       SRP_PRINT( SRP_DBG_VERBOSE, ("   subsys_vend_id  = %d\n",          cl_ntoh32( p_ioc_info->profile.subsys_vend_id )) );\r
-       SRP_PRINT( SRP_DBG_VERBOSE, ("   subsys_id       = %d\n",          cl_ntoh32( p_ioc_info->profile.subsys_id )) );\r
-\r
-       SRP_PRINT( SRP_DBG_VERBOSE, ("   io_class        = %d\n",          cl_ntoh16( p_ioc_info->profile.io_class )) );\r
-       SRP_PRINT( SRP_DBG_VERBOSE, ("   io_subclass     = %d\n",          cl_ntoh16( p_ioc_info->profile.io_subclass )) );\r
-       SRP_PRINT( SRP_DBG_VERBOSE, ("   protocol        = %d\n",          cl_ntoh16( p_ioc_info->profile.protocol )) );\r
-       SRP_PRINT( SRP_DBG_VERBOSE, ("   protocol_ver    = %d\n",          cl_ntoh16( p_ioc_info->profile.protocol_ver )) );\r
-\r
-       SRP_PRINT( SRP_DBG_VERBOSE, ("   send_msg_depth  = %d\n",          cl_ntoh16( p_ioc_info->profile.send_msg_depth )) );\r
-       SRP_PRINT( SRP_DBG_VERBOSE, ("   rdma_read_depth = %d\n",          p_ioc_info->profile.rdma_read_depth) );\r
-       SRP_PRINT( SRP_DBG_VERBOSE, ("   send_msg_size   = %d\n",          cl_ntoh32( p_ioc_info->profile.send_msg_size )) );\r
-       SRP_PRINT( SRP_DBG_VERBOSE, ("   rdma_size       = %d\n",          cl_ntoh32( p_ioc_info->profile.rdma_size )) );\r
-\r
-       SRP_PRINT( SRP_DBG_VERBOSE, ("   ctrl_ops_cap    = 0x%X\n",        p_ioc_info->profile.ctrl_ops_cap) );\r
-       SRP_PRINT( SRP_DBG_VERBOSE, ("   num_svc_entries = 0x%X\n",        p_ioc_info->profile.num_svc_entries) );\r
-       SRP_PRINT( SRP_DBG_VERBOSE, ("   id_string       = %s\n",          p_ioc_info->profile.id_string) );\r
+       SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
+               ("Dumping IOC Info\n") );\r
+\r
+       SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
+               ("   chassis_guid    = 0x%I64x\n",\r
+               cl_ntoh64( p_ioc_info->chassis_guid )) );\r
+       SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
+               ("   chassis_slot    = %d\n",\r
+               p_ioc_info->chassis_slot) );\r
+       SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
+               ("   iou_guid        = 0x%I64x\n",\r
+               cl_ntoh64( p_ioc_info->iou_guid )) );\r
+       SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
+               ("   iou_slot        = %d\n",\r
+               p_ioc_info->iou_slot) );\r
+       SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG, ("\n") );\r
+       SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
+               ("Dumping IOC Info Profile\n") );\r
+\r
+       SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
+               ("   ioc_guid        = 0x%I64x\n",\r
+               cl_ntoh64( p_ioc_info->profile.ioc_guid )) );\r
+       SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
+               ("   vend_id         = %d\n",\r
+               cl_ntoh32( p_ioc_info->profile.vend_id )) );\r
+       SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
+               ("   dev_id          = %d\n",\r
+               cl_ntoh32( p_ioc_info->profile.dev_id )) );\r
+       SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
+               ("   dev_ver         = %d\n",\r
+               cl_ntoh16( p_ioc_info->profile.dev_ver )) );\r
+\r
+       SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
+               ("   subsys_vend_id  = %d\n",\r
+               cl_ntoh32( p_ioc_info->profile.subsys_vend_id )) );\r
+       SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
+               ("   subsys_id       = %d\n",\r
+               cl_ntoh32( p_ioc_info->profile.subsys_id )) );\r
+\r
+       SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
+               ("   io_class        = %d\n",\r
+               cl_ntoh16( p_ioc_info->profile.io_class )) );\r
+       SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
+               ("   io_subclass     = %d\n",\r
+               cl_ntoh16( p_ioc_info->profile.io_subclass )) );\r
+       SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
+               ("   protocol        = %d\n",\r
+               cl_ntoh16( p_ioc_info->profile.protocol )) );\r
+       SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
+               ("   protocol_ver    = %d\n",\r
+               cl_ntoh16( p_ioc_info->profile.protocol_ver )) );\r
+\r
+       SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
+               ("   send_msg_depth  = %d\n",\r
+               cl_ntoh16( p_ioc_info->profile.send_msg_depth )) );\r
+       SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
+               ("   rdma_read_depth = %d\n",\r
+               p_ioc_info->profile.rdma_read_depth) );\r
+       SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
+               ("   send_msg_size   = %d\n",\r
+               cl_ntoh32( p_ioc_info->profile.send_msg_size )) );\r
+       SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
+               ("   rdma_size       = %d\n",\r
+               cl_ntoh32( p_ioc_info->profile.rdma_size )) );\r
+\r
+       SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
+               ("   ctrl_ops_cap    = 0x%X\n",\r
+               p_ioc_info->profile.ctrl_ops_cap) );\r
+       SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
+               ("   num_svc_entries = 0x%X\n",\r
+               p_ioc_info->profile.num_svc_entries) );\r
+       SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
+               ("   id_string       = %s\n",\r
+               p_ioc_info->profile.id_string) );\r
 }\r
 \r
 \r
@@ -124,7 +174,7 @@ __get_ioc_ifc(
        status = cl_fwd_query_ifc( gp_self_do, &io_stack );\r
        if( !NT_SUCCESS( status ) )\r
        {\r
-               SRP_TRACE_EXIT( SRP_DBG_ERROR,\r
+               SRP_PRINT_EXIT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR,\r
                        ("Query interface for IOU parameters returned %08x.\n", status) );\r
                return FALSE;\r
        }\r
@@ -158,7 +208,7 @@ srp_hba_create(
        p_hba = (srp_hba_t*)cl_zalloc( sizeof(srp_hba_t) );\r
        if( !p_hba )\r
        {\r
-               SRP_TRACE_EXIT( SRP_DBG_ERROR,\r
+               SRP_PRINT_EXIT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR,\r
                        ("Failed to allocate srp_hba_t structure.\n") );\r
                return IB_INSUFFICIENT_MEMORY;\r
        }\r
@@ -173,7 +223,8 @@ srp_hba_create(
 \r
        if( !__get_ioc_ifc( p_hba ) )\r
        {\r
-               SRP_TRACE_EXIT( SRP_DBG_ERROR, ("__get_ioc_ifc failed.\n") );\r
+               SRP_PRINT_EXIT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR,\r
+                       ("__get_ioc_ifc failed.\n") );\r
                return IB_ERROR;\r
        }\r
 \r
@@ -187,7 +238,7 @@ srp_hba_create(
                __srp_destroying_hba, __srp_cleanup_hba, __srp_free_hba );\r
        if( cl_status != CL_SUCCESS )\r
        {\r
-               SRP_TRACE_EXIT( SRP_DBG_ERROR,\r
+               SRP_PRINT_EXIT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR,\r
                        ("cl_obj_init returned %s\n", cl_status_text[cl_status]) );\r
                return IB_ERROR;\r
        }\r
@@ -195,9 +246,10 @@ srp_hba_create(
        ib_status = p_hba->ifc.open_al( &p_hba->h_al );\r
        if( ib_status != IB_SUCCESS )\r
        {\r
-               SRP_TRACE( SRP_DBG_VERBOSE, ("HBA Object ref_cnt = %d\n", p_hba->obj.ref_cnt) );\r
+               SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
+                       ("HBA Object ref_cnt = %d\n", p_hba->obj.ref_cnt) );\r
                cl_obj_destroy( &p_hba->obj );\r
-               SRP_TRACE_EXIT( SRP_DBG_ERROR,\r
+               SRP_PRINT_EXIT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR,\r
                        ("ib_open_al returned %s\n", p_hba->ifc.get_err_str( ib_status )) );\r
                return ib_status;\r
        }\r
@@ -214,9 +266,10 @@ srp_hba_create(
        ib_status = p_hba->ifc.reg_pnp( p_hba->h_al, &pnp_req, &p_hba->h_pnp );\r
        if( ib_status != IB_SUCCESS )\r
        {\r
-               SRP_TRACE( SRP_DBG_VERBOSE, ("HBA Object ref_cnt = %d\n", p_hba->obj.ref_cnt) );\r
+               SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
+                       ("HBA Object ref_cnt = %d\n", p_hba->obj.ref_cnt) );\r
                cl_obj_destroy( &p_hba->obj );\r
-               SRP_TRACE_EXIT( SRP_DBG_ERROR,\r
+               SRP_PRINT_EXIT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR,\r
                        ("ib_reg_pnp returned %s\n", p_hba->ifc.get_err_str( ib_status )) );\r
                return ib_status;\r
        }\r
@@ -230,10 +283,12 @@ srp_hba_create(
        if ( p_hba->session_list[0] == NULL )\r
        {\r
                p_ext->p_hba = NULL;\r
-               SRP_TRACE( SRP_DBG_VERBOSE, ("HBA Object ref_cnt = %d\n", p_hba->obj.ref_cnt) );\r
+               SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
+                       ("HBA Object ref_cnt = %d\n", p_hba->obj.ref_cnt) );\r
                cl_obj_destroy( &p_hba->obj );\r
 \r
-               SRP_TRACE( SRP_DBG_ERROR, ("Session Connection Failure.\n") );\r
+               SRP_PRINT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR,\r
+                       ("Session Connection Failure.\n") );\r
                ib_status = IB_ERROR;\r
        }\r
 \r
@@ -252,14 +307,16 @@ __srp_destroying_hba(
 \r
        p_hba = PARENT_STRUCT( p_obj, srp_hba_t, obj );\r
 \r
-       SRP_TRACE( SRP_DBG_VERBOSE, ("Before dereg pnp HBA Object ref_cnt = %d\n", p_hba->obj.ref_cnt) );\r
+       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
+               ("Before dereg pnp HBA Object ref_cnt = %d\n", p_hba->obj.ref_cnt) );\r
 \r
        if( p_hba->h_pnp )\r
        {\r
                p_hba->ifc.dereg_pnp( p_hba->h_pnp, cl_obj_deref );\r
        }\r
 \r
-       SRP_TRACE( SRP_DBG_VERBOSE, ("After dereg pnp HBA Object ref_cnt = %d\n", p_hba->obj.ref_cnt) );\r
+       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
+               ("After dereg pnp HBA Object ref_cnt = %d\n", p_hba->obj.ref_cnt) );\r
 \r
        SRP_EXIT( SRP_DBG_PNP );\r
 }\r
@@ -275,7 +332,8 @@ __srp_remove_path_records(
        cl_spinlock_acquire( &p_hba->path_record_list_lock );\r
        p_srp_path_record = (srp_path_record_t *)cl_qlist_remove_head( &p_hba->path_record_list );\r
 \r
-       SRP_TRACE( SRP_DBG_DEBUG, ("Removing any remaining path records.\n") );\r
+       SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
+               ("Removing any remaining path records.\n") );\r
 \r
        while ( p_srp_path_record != (srp_path_record_t *)cl_qlist_end( &p_hba->path_record_list ) )\r
        {\r
@@ -339,7 +397,8 @@ __srp_validate_ioc(
                   cl_ntoh16( p_ioc_rec->info.profile.io_class )  != SRP_IO_CLASS_R10 ) ||\r
                 cl_ntoh16( p_ioc_rec->info.profile.io_subclass ) != SRP_IO_SUBCLASS )\r
        {\r
-               SRP_TRACE_EXIT( SRP_DBG_ERROR, ("Not an SRP CLASS(0x%x)/SUBCLASS(0x%x).\n",\r
+               SRP_PRINT_EXIT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR,\r
+                                               ("Not an SRP CLASS(0x%x)/SUBCLASS(0x%x).\n",\r
                                                cl_ntoh16( p_ioc_rec->info.profile.io_class ),\r
                                                cl_ntoh16( p_ioc_rec->info.profile.io_subclass )) );\r
                return FALSE;\r
@@ -353,7 +412,8 @@ __srp_validate_ioc(
                 !(p_ioc_rec->info.profile.ctrl_ops_cap & CTRL_OPS_CAP_RF) ||\r
                 !(p_ioc_rec->info.profile.ctrl_ops_cap & CTRL_OPS_CAP_WF) )\r
        {\r
-               SRP_TRACE_EXIT( SRP_DBG_ERROR, ("Not an SRP PROTOCOL/PROTOCOL_VER.\n") );\r
+               SRP_PRINT_EXIT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR,\r
+                       ("Not an SRP PROTOCOL/PROTOCOL_VER.\n") );\r
                return FALSE;\r
        }\r
 \r
@@ -362,7 +422,8 @@ __srp_validate_ioc(
                 cl_ntoh16( p_ioc_rec->info.profile.send_msg_depth ) == 0 ||\r
                 cl_ntoh32( p_ioc_rec->info.profile.rdma_size )      <  SRP_MIN_TGT_TO_INI_DMA )\r
        {\r
-               SRP_TRACE_EXIT( SRP_DBG_ERROR, ("Device Not Capable.\n") );\r
+               SRP_PRINT_EXIT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR,\r
+                       ("Device Not Capable.\n") );\r
                return FALSE;\r
        }\r
 \r
@@ -400,19 +461,22 @@ __srp_path_rec_equal(
 \r
        if ( p_path_rec_1->hop_flow_raw.val != p_path_rec_2->hop_flow_raw.val )\r
        {\r
-               SRP_TRACE( SRP_DBG_DEBUG, ("hop_flow_raw.val does not match.\n") );\r
+               SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
+                       ("hop_flow_raw.val does not match.\n") );\r
                return ( FALSE );\r
        }\r
 \r
        if ( p_path_rec_1->tclass != p_path_rec_2->tclass )\r
        {\r
-               SRP_TRACE( SRP_DBG_DEBUG, ("tclass does not match.\n") );\r
+               SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
+                       ("tclass does not match.\n") );\r
                return ( FALSE );\r
        }\r
 \r
        if ( p_path_rec_1->num_path != p_path_rec_2->num_path )\r
        {\r
-               SRP_TRACE( SRP_DBG_DEBUG, ("num_path does not match.\n") );\r
+               SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
+                       ("num_path does not match.\n") );\r
                if ( check_num_path == TRUE )\r
                {\r
                        return ( FALSE );\r
@@ -421,37 +485,43 @@ __srp_path_rec_equal(
 \r
        if ( p_path_rec_1->pkey != p_path_rec_2->pkey )\r
        {\r
-               SRP_TRACE( SRP_DBG_DEBUG, ("pkey does not match.\n") );\r
+               SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
+                       ("pkey does not match.\n") );\r
                return ( FALSE );\r
        }\r
 \r
        if ( p_path_rec_1->sl != p_path_rec_2->sl )\r
        {\r
-               SRP_TRACE( SRP_DBG_DEBUG, ("sl does not match.\n") );\r
+               SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
+                       ("sl does not match.\n") );\r
                return ( FALSE );\r
        }\r
 \r
        if ( p_path_rec_1->mtu != p_path_rec_2->mtu )\r
        {\r
-               SRP_TRACE( SRP_DBG_DEBUG, ("mtu does not match.\n") );\r
+               SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
+                       ("mtu does not match.\n") );\r
                return ( FALSE );\r
        }\r
 \r
        if ( p_path_rec_1->rate != p_path_rec_2->rate )\r
        {\r
-               SRP_TRACE( SRP_DBG_DEBUG, ("rate does not match.\n") );\r
+               SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
+                       ("rate does not match.\n") );\r
                return ( FALSE );\r
        }\r
 \r
        if ( p_path_rec_1->pkt_life != p_path_rec_2->pkt_life )\r
        {\r
-               SRP_TRACE( SRP_DBG_DEBUG, ("pkt_life does not match.\n") );\r
+               SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
+                       ("pkt_life does not match.\n") );\r
                return ( FALSE );\r
        }\r
 \r
        if ( p_path_rec_1->preference != p_path_rec_2->preference )\r
        {\r
-               SRP_TRACE( SRP_DBG_DEBUG, ("preference does not match.\n") );\r
+               SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
+                       ("preference does not match.\n") );\r
                if ( check_preference == TRUE )\r
                {\r
                        return ( FALSE );\r
@@ -462,26 +532,31 @@ __srp_path_rec_equal(
 \r
        if ( p_path_rec_1->resv0 != p_path_rec_2->resv0 )\r
        {\r
-               SRP_TRACE( SRP_DBG_DEBUG, ("resv0 does not match.\n") );\r
+               SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
+                       ("resv0 does not match.\n") );\r
        }\r
 \r
        if ( p_path_rec_1->resv1 != p_path_rec_2->resv1 )\r
        {\r
-               SRP_TRACE( SRP_DBG_DEBUG, ("resv1 does not match.\n") );\r
+               SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
+                       ("resv1 does not match.\n") );\r
        }\r
 \r
        if ( p_path_rec_1->resv2 != p_path_rec_2->resv2 )\r
        {\r
-               SRP_TRACE( SRP_DBG_DEBUG, ("resv2 does not match.\n") );\r
+               SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
+                       ("resv2 does not match.\n") );\r
        }\r
 \r
        if ( cl_memcmp( p_path_rec_1, p_path_rec_2, sizeof( ib_path_rec_t ) ) != 0 )\r
        {\r
-               SRP_TRACE( SRP_DBG_DEBUG, ("p_path_rec_1 does not match p_path_rec_2.\n") );\r
+               SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
+                       ("p_path_rec_1 does not match p_path_rec_2.\n") );\r
        }\r
        else\r
        {\r
-               SRP_TRACE( SRP_DBG_DEBUG, ("p_path_rec_1 matches p_path_rec_2.\n") );\r
+               SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
+                       ("p_path_rec_1 matches p_path_rec_2.\n") );\r
        }\r
 \r
 #endif\r
@@ -503,7 +578,7 @@ __srp_find_path(
 \r
        SRP_ENTER( SRP_DBG_PNP );\r
 \r
-       SRP_TRACE( SRP_DBG_VERBOSE,\r
+       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
                ("Finding path record (slid:%d dlid:%d) for %s.\n",\r
                p_path_rec->slid,\r
                p_path_rec->dlid,\r
@@ -520,7 +595,7 @@ __srp_find_path(
                                                                        check_num_path,\r
                                                                        check_preference ) == TRUE )\r
                {\r
-                       SRP_TRACE( SRP_DBG_VERBOSE,\r
+                       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
                                ("Found path record (slid:%d dlid:%d) for %s.\n",\r
                                p_path_rec->slid,\r
                                p_path_rec->dlid,\r
@@ -558,7 +633,7 @@ __srp_remove_path(
        {\r
                cl_spinlock_acquire( &p_hba->path_record_list_lock );\r
 \r
-               SRP_TRACE( SRP_DBG_VERBOSE,\r
+               SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
                        ("Removing path record (slid:%d dlid:%d) for %s.\n",\r
                        p_path_rec->slid,\r
                        p_path_rec->dlid,\r
@@ -569,10 +644,10 @@ __srp_remove_path(
                cl_spinlock_release( &p_hba->path_record_list_lock );\r
        }\r
 \r
-       SRP_TRACE( SRP_DBG_DEBUG,\r
+       SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
                ("Current Path count for %s = %d \n",\r
                 p_hba->ioc_info.profile.id_string,\r
-                cl_qlist_count( &p_hba->path_record_list )) );\r
+                (int)cl_qlist_count( &p_hba->path_record_list )) );\r
 \r
        SRP_EXIT( SRP_DBG_PNP );\r
 \r
@@ -596,7 +671,7 @@ __srp_add_path(
                p_srp_path_record->path_rec = *p_path_rec;\r
                cl_spinlock_release( &p_hba->path_record_list_lock );\r
 \r
-               SRP_TRACE( SRP_DBG_WARN,\r
+               SRP_PRINT( TRACE_LEVEL_WARNING, SRP_DBG_DEBUG,\r
                        ("Discarding/Updating duplicate path record (slid:%d dlid:%d) for %s.\n",\r
                        p_path_rec->slid,\r
                        p_path_rec->dlid,\r
@@ -605,7 +680,7 @@ __srp_add_path(
                goto exit;\r
        }\r
 \r
-       SRP_TRACE( SRP_DBG_VERBOSE,\r
+       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
                ("Adding path record (slid:%d dlid:%d) for %s.\n",\r
                p_path_rec->slid,\r
                p_path_rec->dlid,\r
@@ -615,7 +690,8 @@ __srp_add_path(
        p_srp_path_record = cl_zalloc( sizeof( srp_path_record_t ) );\r
        if ( p_srp_path_record == NULL )\r
        {\r
-               SRP_TRACE( SRP_DBG_ERROR, ("Insufficient Memory.\n") );\r
+               SRP_PRINT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR,\r
+                       ("Insufficient Memory.\n") );\r
        }\r
        else\r
        {\r
@@ -626,10 +702,10 @@ __srp_add_path(
                cl_spinlock_release( &p_hba->path_record_list_lock );\r
        }\r
 \r
-       SRP_TRACE( SRP_DBG_DEBUG,\r
+       SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
                ("Current Path count for %s = %d \n",\r
                 p_hba->ioc_info.profile.id_string,\r
-                cl_qlist_count( &p_hba->path_record_list )) );\r
+                (int)cl_qlist_count( &p_hba->path_record_list )) );\r
 \r
 exit:\r
        SRP_EXIT( SRP_DBG_PNP );\r
@@ -657,13 +733,14 @@ __srp_connect_sessions(
                {\r
                        retry_count++;\r
 \r
-                       SRP_TRACE( SRP_DBG_DEBUG,\r
+                       SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
                                ("Attempting to connect %s. Connection Attempt Count = %d.\n",\r
                                 p_hba->ioc_info.profile.id_string,\r
                                 retry_count) );\r
 \r
-                       SRP_TRACE( SRP_DBG_VERBOSE,\r
-                               ("Creating New Session For Service Entry Index %d.\n", p_hba->ioc_info.profile.num_svc_entries));\r
+                       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
+                               ("Creating New Session For Service Entry Index %d.\n",\r
+                               p_hba->ioc_info.profile.num_svc_entries));\r
                        p_session = srp_new_session( p_hba,\r
                                                                                 p_hba->ioc_info.profile.ioc_guid,\r
                                                                                 &p_hba->p_svc_entries[i],\r
@@ -674,9 +751,10 @@ __srp_connect_sessions(
                                break;\r
                        }\r
 \r
-                       SRP_TRACE( SRP_DBG_VERBOSE,\r
-                               ("New Session For Service Entry Index %d Created.\n", p_hba->ioc_info.profile.num_svc_entries));\r
-                       SRP_TRACE( SRP_DBG_VERBOSE,\r
+                       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
+                               ("New Session For Service Entry Index %d Created.\n",\r
+                               p_hba->ioc_info.profile.num_svc_entries));\r
+                       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
                                ("Logging Into Session.\n"));\r
                        status = srp_session_login( p_session );\r
                        if ( status == IB_SUCCESS )\r
@@ -703,14 +781,15 @@ __srp_connect_sessions(
                                p_hba->session_list[i] = p_session;\r
                                cl_obj_unlock( &p_hba->obj );\r
 \r
-                               SRP_TRACE( SRP_DBG_VERBOSE,\r
+                               SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
                                        ("Session Login Issued Successfully.\n"));\r
                        }\r
                        else\r
                        {\r
-                               SRP_TRACE( SRP_DBG_ERROR,\r
+                               SRP_PRINT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR,\r
                                        ("Session Login Failure Status = %d.\n", status));\r
-                               SRP_TRACE( SRP_DBG_VERBOSE, ("Session Object ref_cnt = %d\n", p_session->obj.ref_cnt) );\r
+                               SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
+                                       ("Session Object ref_cnt = %d\n", p_session->obj.ref_cnt) );\r
                                cl_obj_destroy( &p_session->obj );\r
                        }\r
                } while ( (status != IB_SUCCESS) && (retry_count < 3) );\r
@@ -720,7 +799,9 @@ __srp_connect_sessions(
                        status = IB_SUCCESS;\r
                        if ( p_hba->adapter_paused == TRUE )\r
                        {\r
-                               SRP_TRACE( SRP_DBG_DEBUG, ("Resuming Adapter for %s.\n", p_hba->ioc_info.profile.id_string) );\r
+                               SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
+                                       ("Resuming Adapter for %s.\n",\r
+                                       p_hba->ioc_info.profile.id_string) );\r
                                p_hba->adapter_paused = FALSE;\r
                                StorPortReady( p_hba->p_ext );\r
 //                             StorPortNotification( BusChangeDetected, p_hba->p_ext, 0 );\r
@@ -757,11 +838,15 @@ __srp_disconnect_sessions(
 \r
        if ( i == p_hba->ioc_info.profile.num_svc_entries )\r
        {\r
-               SRP_TRACE( SRP_DBG_DEBUG, ("No current connections to %s.\n", p_hba->ioc_info.profile.id_string) );\r
+               SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
+                       ("No current connections to %s.\n",\r
+                       p_hba->ioc_info.profile.id_string) );\r
                goto exit;\r
        }\r
 \r
-       SRP_TRACE( SRP_DBG_DEBUG, ("Current path to %s has been lost.\n", p_hba->ioc_info.profile.id_string) );\r
+       SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
+               ("Current path to %s has been lost.\n",\r
+               p_hba->ioc_info.profile.id_string) );\r
 \r
        p_hba->p_srp_path_record = NULL;\r
 \r
@@ -776,12 +861,16 @@ __srp_disconnect_sessions(
                                                                         SP_UNTAGGED,\r
                                                                         SP_UNTAGGED,\r
                                                                         SRB_STATUS_BUSY );\r
-                       SRP_TRACE( SRP_DBG_DEBUG, ("Pausing Adapter for %s.\n", p_hba->ioc_info.profile.id_string) );\r
+                       SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
+                               ("Pausing Adapter for %s.\n",\r
+                               p_hba->ioc_info.profile.id_string) );\r
                }\r
        }\r
 \r
        /* Destroy all the connections. */\r
-       SRP_TRACE( SRP_DBG_DEBUG, ("Destroy all connections to %s.\n", p_hba->ioc_info.profile.id_string) );\r
+       SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
+               ("Destroy all connections to %s.\n",\r
+               p_hba->ioc_info.profile.id_string) );\r
 \r
        for ( i = 0; i < p_hba->ioc_info.profile.num_svc_entries; i++ )\r
        {\r
@@ -792,13 +881,14 @@ __srp_disconnect_sessions(
 \r
                if ( p_session != NULL )\r
                {\r
-                       SRP_TRACE( SRP_DBG_VERBOSE, ("Session Object ref_cnt = %d\n", p_session->obj.ref_cnt) );\r
+                       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
+                               ("Session Object ref_cnt = %d\n", p_session->obj.ref_cnt) );\r
                        __srp_cleanup_session ( &p_session->obj );\r
                        cl_obj_destroy( &p_session->obj );\r
                }\r
                else\r
                {\r
-                       SRP_TRACE( SRP_DBG_WARN,\r
+                       SRP_PRINT( TRACE_LEVEL_WARNING, SRP_DBG_DEBUG,\r
                                ("Session for Target ID %d on %s is NULL.\n",\r
                                 i,\r
                                 p_hba->ioc_info.profile.id_string) ); // <-- OK in a shutdown or target disconnect\r
@@ -820,24 +910,32 @@ __srp_connect_path(
 \r
        while ( g_srp_system_shutdown == FALSE )\r
        {\r
-               SRP_TRACE( SRP_DBG_DEBUG, ("Searching for path to %s.\n", p_hba->ioc_info.profile.id_string) );\r
+               SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
+                       ("Searching for path to %s.\n",\r
+                        p_hba->ioc_info.profile.id_string) );\r
 \r
                cl_spinlock_acquire( &p_hba->path_record_list_lock );\r
                p_srp_path_record = (srp_path_record_t *)cl_qlist_head( &p_hba->path_record_list );\r
                cl_spinlock_release( &p_hba->path_record_list_lock );\r
                if ( p_srp_path_record == (srp_path_record_t *)cl_qlist_end( &p_hba->path_record_list ) )\r
                {\r
-                       SRP_TRACE( SRP_DBG_DEBUG, ("No paths to %s found.\n", p_hba->ioc_info.profile.id_string) );\r
+                       SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
+                               ("No paths to %s found.\n",\r
+                               p_hba->ioc_info.profile.id_string) );\r
                        break;\r
                }\r
 \r
-               SRP_TRACE( SRP_DBG_VERBOSE, ("Connecting path to %s.\n", p_hba->ioc_info.profile.id_string) );\r
+               SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
+                       ("Connecting path to %s.\n",\r
+                       p_hba->ioc_info.profile.id_string) );\r
 \r
                p_hba->p_srp_path_record = p_srp_path_record;\r
                status = __srp_connect_sessions( p_hba );\r
                if ( status == IB_SUCCESS )\r
                {\r
-                       SRP_TRACE( SRP_DBG_DEBUG, ("Path to %s has connected.\n", p_hba->ioc_info.profile.id_string) );\r
+                       SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
+                               ("Path to %s has connected.\n",\r
+                               p_hba->ioc_info.profile.id_string) );\r
                        break;\r
                }\r
 \r
@@ -869,10 +967,17 @@ __srp_pnp_cb(
        p_ioc_rec = (ib_pnp_ioc_rec_t*)p_pnp_rec;\r
        p_ioc_path = (ib_pnp_ioc_path_rec_t*)p_pnp_rec;\r
 \r
+       SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_PNP,\r
+               ("p_pnp_rec->pnp_event = 0x%x (%s)\n",\r
+               p_pnp_rec->pnp_event, ib_get_pnp_event_str( p_pnp_rec->pnp_event )) );\r
+\r
+\r
        switch( p_pnp_rec->pnp_event )\r
        {\r
                case IB_PNP_IOC_ADD:\r
-                       SRP_TRACE( SRP_DBG_DEBUG, ("IB_PNP_IOC_ADD for %s.\n", p_ioc_rec->info.profile.id_string) );\r
+                       SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
+                               ("IB_PNP_IOC_ADD for %s.\n",\r
+                               p_ioc_rec->info.profile.id_string) );\r
 \r
                        __srp_dump_ioc_info( &p_ioc_rec->info );\r
 \r
@@ -882,7 +987,8 @@ __srp_pnp_cb(
                         */\r
                        if( p_ioc_rec->ca_guid != p_hba->info.ca_guid )\r
                        {\r
-                               SRP_TRACE_EXIT( SRP_DBG_WARN, ("Ignoring CA GUID.\n") );\r
+                               SRP_PRINT_EXIT( TRACE_LEVEL_WARNING, SRP_DBG_DEBUG,\r
+                                       ("Ignoring CA GUID.\n") );\r
                                status = IB_INVALID_GUID;\r
                                break;\r
                        }\r
@@ -890,7 +996,8 @@ __srp_pnp_cb(
                        /* Trap our IOC GUID so we can get path notification events. */\r
                        if( p_ioc_rec->info.profile.ioc_guid != p_hba->info.guid )\r
                        {\r
-                               SRP_TRACE_EXIT( SRP_DBG_WARN, ("Ignoring GUID.\n") );\r
+                               SRP_PRINT_EXIT( TRACE_LEVEL_WARNING, SRP_DBG_DEBUG,\r
+                                       ("Ignoring GUID.\n") );\r
                                status = IB_INVALID_GUID;\r
                                break;\r
                        }\r
@@ -905,7 +1012,8 @@ __srp_pnp_cb(
                        p_hba->p_svc_entries = cl_zalloc( sizeof(ib_svc_entry_t) * p_hba->ioc_info.profile.num_svc_entries );\r
                        if ( p_hba->p_svc_entries == NULL )\r
                        {\r
-                               SRP_TRACE_EXIT( SRP_DBG_ERROR, ("Insufficient Memory.\n") );\r
+                               SRP_PRINT_EXIT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR,\r
+                                       ("Insufficient Memory.\n") );\r
                                status = IB_INSUFFICIENT_MEMORY;\r
                                break;\r
                        }\r
@@ -914,23 +1022,29 @@ __srp_pnp_cb(
                                                p_ioc_rec->svc_entry_array,\r
                                                sizeof(ib_svc_entry_t) * p_hba->ioc_info.profile.num_svc_entries);\r
 \r
-                       SRP_TRACE( SRP_DBG_VERBOSE, ("Found %d Service Entries.\n", p_hba->ioc_info.profile.num_svc_entries));\r
+                       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
+                               ("Found %d Service Entries.\n",\r
+                               p_hba->ioc_info.profile.num_svc_entries));\r
                        break;\r
 \r
                case IB_PNP_IOC_REMOVE:\r
-                       SRP_TRACE( SRP_DBG_DEBUG, ("IB_PNP_IOC_REMOVE for %s.\n", p_hba->ioc_info.profile.id_string) );\r
+                       SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
+                               ("IB_PNP_IOC_REMOVE for %s.\n",\r
+                               p_hba->ioc_info.profile.id_string) );\r
 \r
                        CL_ASSERT( p_pnp_rec->guid == p_hba->info.guid );\r
 \r
-                       SRP_TRACE( SRP_DBG_DEBUG, ("Hey!!! Our IOC went away.\n") );\r
+                       SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
+                               ("Hey!!! Our IOC went away.\n") );\r
 \r
                        __srp_disconnect_sessions( p_hba, FALSE );\r
                        __srp_remove_path_records( p_hba );\r
-                       SRP_TRACE( SRP_DBG_VERBOSE, ("HBA Object ref_cnt = %d\n", p_hba->obj.ref_cnt) );\r
+                       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
+                               ("HBA Object ref_cnt = %d\n", p_hba->obj.ref_cnt) );\r
                        break;\r
 \r
                case IB_PNP_IOC_PATH_ADD:\r
-                       SRP_TRACE( SRP_DBG_DEBUG,\r
+                       SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
                                ("IB_PNP_IOC_PATH_ADD (slid:%d dlid:%d) for %s.\n",\r
                                p_ioc_path->path.slid,\r
                                p_ioc_path->path.dlid,\r
@@ -945,13 +1059,15 @@ __srp_pnp_cb(
 \r
                        if ( p_hba->p_srp_path_record == NULL )\r
                        {\r
-                               SRP_TRACE( SRP_DBG_VERBOSE, ("Connecting new path to %s.\n", p_hba->ioc_info.profile.id_string) );\r
+                               SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
+                                       ("Connecting new path to %s.\n",\r
+                                       p_hba->ioc_info.profile.id_string) );\r
                                status = __srp_connect_path( p_hba );\r
                        }\r
                        break;\r
 \r
                case IB_PNP_IOC_PATH_REMOVE:\r
-                       SRP_TRACE( SRP_DBG_DEBUG,\r
+                       SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
                                ("IB_PNP_IOC_PATH_REMOVE (slid:%d dlid:%d) for %s.\n",\r
                                p_ioc_path->path.slid,\r
                                p_ioc_path->path.dlid,\r
@@ -962,7 +1078,7 @@ __srp_pnp_cb(
                        {\r
                                if ( p_srp_path_record == p_hba->p_srp_path_record )\r
                                {\r
-                                       SRP_TRACE( SRP_DBG_VERBOSE,\r
+                                       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
                                                ("Current path to %s has been lost.\n",\r
                                                 p_hba->ioc_info.profile.id_string) );\r
 \r
index 34e1940..5f0f2ff 100644 (file)
 \r
 \r
 #include "srp_debug.h"\r
+#if defined(EVENT_TRACING)\r
+#ifdef offsetof\r
+#undef offsetof\r
+#endif\r
+#include "srp_hca.tmh"\r
+#endif\r
 #include "srp_event.h"\r
 #include "srp_hca.h"\r
 #include "srp_session.h"\r
@@ -68,7 +74,7 @@ srp_open_ca_by_port_gid(
                h_al, p_port_gid, &p_hca->ca_guid );\r
        if ( status != IB_SUCCESS )\r
        {\r
-               SRP_TRACE( SRP_DBG_ERROR,\r
+               SRP_PRINT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR,\r
                        ("Failed to locate Channel Adapter. Status = %d\n", status) );\r
                goto exit;\r
        }\r
@@ -77,7 +83,7 @@ srp_open_ca_by_port_gid(
                srp_async_event_handler_cb, p_context, &p_hca->h_ca );\r
        if ( status != IB_SUCCESS )\r
        {\r
-               SRP_TRACE( SRP_DBG_ERROR,\r
+               SRP_PRINT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR,\r
                        ("Failed to open Channel Adapter. Status = %d\n", status) );\r
                goto exit;\r
        }\r
@@ -88,7 +94,7 @@ srp_open_ca_by_port_gid(
                                                  &p_hca->h_pd );\r
        if ( status != IB_SUCCESS )\r
        {\r
-               SRP_TRACE( SRP_DBG_ERROR,\r
+               SRP_PRINT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR,\r
                        ("Failed to create Protection Domain. Status = %d\n", status) );\r
                goto exit;\r
        }\r
@@ -114,7 +120,7 @@ srp_open_ca_by_port_gid(
                                                  &p_hca->h_mr );\r
        if( status != IB_SUCCESS )\r
        {\r
-               SRP_TRACE( SRP_DBG_ERROR,\r
+               SRP_PRINT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR,\r
                        ("Physical Memory Registration Failure. Status = %d\n", status) );\r
 exit:\r
                srp_close_ca( p_hca );\r
@@ -142,10 +148,11 @@ srp_close_ca(
        if( p_hca->h_ca )\r
        {\r
                p_hca->p_hba->ifc.close_ca( p_hca->h_ca, ib_sync_destroy );\r
-               SRP_TRACE( SRP_DBG_DEBUG, ("Closed Channel Adapter.\n") );\r
+               SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
+                       ("Closed Channel Adapter.\n") );\r
        }\r
 \r
-       cl_memclr( p_hca, sizeof( *p_hca ) );\r
+               cl_memclr( p_hca, sizeof( *p_hca ) );\r
 \r
        SRP_EXIT( SRP_DBG_PNP );\r
 }\r
@@ -174,7 +181,7 @@ srp_get_responder_resources(
        status = p_hca->p_hba->ifc.query_ca( p_hca->h_ca, NULL, &ca_attr_size );\r
        if ( status != IB_INSUFFICIENT_MEMORY )\r
        {\r
-               SRP_TRACE( SRP_DBG_ERROR,\r
+               SRP_PRINT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR,\r
                        ("Cannot Query Channel Adapter. Status = %d\n", status) );\r
                goto exit;\r
        }\r
@@ -182,7 +189,7 @@ srp_get_responder_resources(
        p_ca_attr = cl_zalloc( ca_attr_size );\r
        if ( p_ca_attr == NULL )\r
        {\r
-               SRP_TRACE( SRP_DBG_ERROR,\r
+               SRP_PRINT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR,\r
                                   ("Memory Allocation Error: Cannot Create CA Attributes.\n") );\r
                goto exit;\r
        }\r
@@ -190,7 +197,7 @@ srp_get_responder_resources(
        status = p_hca->p_hba->ifc.query_ca( p_hca->h_ca, p_ca_attr, &ca_attr_size );\r
        if ( status != IB_SUCCESS )\r
        {\r
-               SRP_TRACE( SRP_DBG_ERROR,\r
+               SRP_PRINT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR,\r
                        ("Cannot Query Channel Adapter. Status = %d\n", status) );\r
        }\r
        else\r
index 7d064a6..69a3a45 100644 (file)
 \r
 \r
 #include "srp_debug.h"\r
+#if defined(EVENT_TRACING)\r
+#ifdef offsetof\r
+#undef offsetof\r
+#endif\r
+#include "srp_session.tmh"\r
+#endif\r
 #include "srp_session.h"\r
 #include <stdlib.h>\r
 \r
@@ -54,7 +60,8 @@ __srp_destroying_session(
 \r
        p_srp_session->connection.state = SRP_CONNECTION_CLOSING;\r
 \r
-       SRP_TRACE( SRP_DBG_VERBOSE, ("Session Object ref_cnt = %d\n", p_srp_session->obj.ref_cnt) );\r
+       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
+               ("Session Object ref_cnt = %d\n", p_srp_session->obj.ref_cnt) );\r
 \r
        SRP_EXIT( SRP_DBG_PNP );\r
 }\r
@@ -84,12 +91,12 @@ __srp_cleanup_session(
        if ( p_srp_session->p_shutdown_srb != NULL )\r
        {\r
                p_srp_session->p_shutdown_srb->SrbStatus = SRB_STATUS_SUCCESS;\r
-               SRP_TRACE( SRP_DBG_DEBUG,\r
+               SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
                        ("Returning SrbStatus %s(0x%x) for Function = %s(0x%x), "\r
                        "Path = 0x%x, Target = 0x%x, Lun = 0x%x\n",\r
                        g_srb_status_name[p_srp_session->p_shutdown_srb->SrbStatus],\r
                        p_srp_session->p_shutdown_srb->SrbStatus,\r
-                       p_srp_session->p_shutdown_srb[p_srp_session->p_shutdown_srb->Function],\r
+                       g_srb_function_name[p_srp_session->p_shutdown_srb->Function],\r
                        p_srp_session->p_shutdown_srb->Function,\r
                        p_srp_session->p_shutdown_srb->PathId,\r
                        p_srp_session->p_shutdown_srb->TargetId,\r
@@ -101,7 +108,8 @@ __srp_cleanup_session(
        srp_free_connection( &p_srp_session->connection );\r
        srp_destroy_descriptors( &p_srp_session->descriptors );\r
 \r
-       SRP_TRACE( SRP_DBG_VERBOSE, ("Session Object ref_cnt = %d\n", p_srp_session->obj.ref_cnt) );\r
+       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
+               ("Session Object ref_cnt = %d\n", p_srp_session->obj.ref_cnt) );\r
 \r
        SRP_EXIT( SRP_DBG_PNP );\r
 }\r
@@ -125,11 +133,15 @@ __srp_free_session(
 \r
        p_srp_session = PARENT_STRUCT( p_obj, srp_session_t, obj );\r
 \r
-       SRP_TRACE( SRP_DBG_VERBOSE, ("Before DeInit Session Object ref_cnt = %d\n", p_srp_session->obj.ref_cnt) );\r
+       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
+               ("Before DeInit Session Object ref_cnt = %d\n",\r
+               p_srp_session->obj.ref_cnt) );\r
 \r
        cl_obj_deinit( p_obj );\r
 \r
-       SRP_TRACE( SRP_DBG_VERBOSE, ("After DeInit Session Object ref_cnt = %d\n", p_srp_session->obj.ref_cnt) );\r
+       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG, \r
+               ("After DeInit Session Object ref_cnt = %d\n",\r
+               p_srp_session->obj.ref_cnt) );\r
 \r
        cl_free( p_srp_session );\r
 \r
@@ -162,7 +174,7 @@ __srp_validate_service_entry(
 \r
        if ( cl_memcmp( p_svc_entry->name, SRP_SERVICE_NAME_PREFIX, strlen(SRP_SERVICE_NAME_PREFIX)) != 0 )\r
        {\r
-               SRP_TRACE_EXIT( SRP_DBG_ERROR,\r
+               SRP_PRINT_EXIT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR,\r
                        ("Service Name Not Properly Formatted.\n") );\r
                status = IB_INVALID_SERVICE_TYPE;\r
                goto exit;\r
@@ -187,7 +199,7 @@ __srp_validate_service_entry(
                ntstatus = RtlCharToInteger( current_digit, 16, &id_extension );\r
                if ( ntstatus != STATUS_SUCCESS )\r
                {\r
-                       SRP_TRACE_EXIT( SRP_DBG_ERROR,\r
+                       SRP_PRINT_EXIT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR,\r
                                ("Target Id Extension INVALID.\n") );\r
                        status = IB_INVALID_PARAMETER;\r
                        break;\r
@@ -238,7 +250,7 @@ srp_new_session(
        p_srp_session = (srp_session_t*)cl_zalloc( sizeof(srp_session_t) );\r
        if ( p_srp_session == NULL )\r
        {\r
-               SRP_TRACE_EXIT( SRP_DBG_ERROR,\r
+               SRP_PRINT_EXIT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR,\r
                        ("Failed to allocate srp_session_t structure.\n") );\r
                *p_status = IB_INSUFFICIENT_MEMORY;\r
                goto exit;\r
@@ -261,16 +273,20 @@ srp_new_session(
        }\r
 \r
        cl_obj_construct( &p_srp_session->obj, SRP_OBJ_TYPE_SESSION );\r
-       SRP_TRACE( SRP_DBG_VERBOSE, ("After Construct Session Object ref_cnt = %d\n", p_srp_session->obj.ref_cnt) );\r
+       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
+               ("After Construct Session Object ref_cnt = %d\n",\r
+                p_srp_session->obj.ref_cnt) );\r
        cl_status = cl_obj_init( &p_srp_session->obj,\r
                                                         CL_DESTROY_ASYNC,\r
                                                         __srp_destroying_session,\r
                                                         __srp_cleanup_session,\r
                                                         __srp_free_session );\r
-       SRP_TRACE( SRP_DBG_VERBOSE, ("After Init Session Object ref_cnt = %d\n", p_srp_session->obj.ref_cnt) );\r
+       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
+               ("After Init Session Object ref_cnt = %d\n",\r
+               p_srp_session->obj.ref_cnt) );\r
        if( cl_status != CL_SUCCESS )\r
        {\r
-               SRP_TRACE_EXIT( SRP_DBG_ERROR,\r
+               SRP_PRINT_EXIT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR,\r
                        ("cl_obj_init returned %s\n", cl_status_text[cl_status]) );\r
 \r
                cl_free( p_srp_session );\r
@@ -283,7 +299,9 @@ srp_new_session(
                                           &p_srp_session->p_hba->obj,\r
                                           &p_srp_session->obj );\r
 \r
-       SRP_TRACE( SRP_DBG_VERBOSE, ("After Insert Rel Session Object ref_cnt = %d\n", p_srp_session->obj.ref_cnt) );\r
+       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
+               ("After Insert Rel Session Object ref_cnt = %d\n",\r
+               p_srp_session->obj.ref_cnt) );\r
 \r
 exit:\r
        SRP_EXIT( SRP_DBG_PNP );\r