[Openib-windows] [PATCH] IOU and SRP wpp

Yossi Leybovich sleybo at mellanox.co.il
Thu Sep 7 00:41:07 PDT 2006


Fab
 
attached is patch that fix typo in IOU registry parameters read
and I resend the SRP wpp patch after I merge the latest changes from
OpenIB.
 
10x
Yossi 

Singed-off-by: Yossi Leybovich (sleybo at mellanox.co.il)
 
Index: kernel/iou_driver.c
===================================================================
--- kernel/iou_driver.c (revision 1658)
+++ kernel/iou_driver.c (working copy)
@@ -140,7 +140,7 @@
 
  /* Setup the table entries. */
  table[0].Flags = RTL_QUERY_REGISTRY_DIRECT;
- table[0].Name = L"DebugFlags";
+ table[0].Name = L"DebugLevel";
  table[0].EntryContext = &g_iou_dbg_level;
  table[0].DefaultType = REG_DWORD;
  table[0].DefaultData = &g_iou_dbg_level;

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: srp_wpp.patch
Type: application/octet-stream
Size: 92485 bytes
Desc: srp_wpp.patch
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20060907/23fc57c1/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: iou_wwp2.patch
Type: application/octet-stream
Size: 477 bytes
Desc: iou_wwp2.patch
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20060907/23fc57c1/attachment-0001.obj>


More information about the ofw mailing list