[Openib-windows] [SRP] SCSI erros patch

Yossi Leybovich sleybo at mellanox.co.il
Fri Nov 17 00:52:44 PST 2006


Hi
 
Can you review this patch .
I encounter SRP target that return CSI errors when WinIB tried to
connect it
I found it hard to debug the problem with the current logs
I added the SCSI errors status to the log and add the SRP_DBG_DATA flag
to control the data path flow
 
Thanks
Yoss
 
Index: kernel/srp_data_path.c
===================================================================
--- kernel/srp_data_path.c (revision 1797)
+++ kernel/srp_data_path.c (working copy)
@@ -59,8 +59,39 @@
 // Final address is of the form 0b00ttttttllllllll
 #define BUILD_SCSI_ADDRESS(lun) ((uint64_t)lun << 48)
 
+
 static inline
 void
+__srp_dump_srb_info(srp_send_descriptor_t*  p_send_descriptor)
+{
+ 
+ SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DATA,
+  ("Srb Address              = %p\n",
+  p_send_descriptor->p_srb) );
+ SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DATA,
+  ("Srb DataBuffer Address   = %p\n",
+  p_send_descriptor->p_srb->DataBuffer) );
+ SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DATA,
+  ("Srb DataTransferLength   = %d\n",
+   p_send_descriptor->p_srb->DataTransferLength) );
+
+ SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DATA,
+      ("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],
+      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
)) );
+}
+
+
+static inline
+void
 __srp_process_session_send_completions(
  IN  srp_session_t   *p_session )
 {
@@ -68,14 +99,14 @@
  ib_wc_t         *p_wc_done_list = NULL;
  ib_wc_t         *p_wc;
 
- SRP_ENTER( SRP_DBG_DEBUG );
+ SRP_ENTER( SRP_DBG_DATA );
 
  cl_obj_lock( &p_session->obj );
 
  if ( p_session->connection.state != SRP_CONNECTED )
  {
   cl_obj_unlock( &p_session->obj );
-  SRP_EXIT( SRP_DBG_DEBUG );
+  SRP_EXIT( SRP_DBG_DATA );
   return;
  }
 
@@ -98,31 +129,52 @@
 
  while ( (p_wc = p_wc_done_list) != NULL )
  {
+  srp_send_descriptor_t   *p_send_descriptor;
+
+  p_send_descriptor = (srp_send_descriptor_t *)((uintn_t)p_wc->wr_id);
+
   /* Remove head from list */
   p_wc_done_list = p_wc->p_next;
   p_wc->p_next = NULL;
 
-  if ( p_wc->status != IB_WCS_SUCCESS )
+  switch ( p_wc->status)
   {
-   srp_send_descriptor_t   *p_send_descriptor;
+   case IB_WCS_SUCCESS:
+    break;
+   case IB_WCS_WR_FLUSHED_ERR:
+    // TODO: Kill session and inform port driver link down
scsiportnotification
+    SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DATA,
+     ("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));
 
-   p_send_descriptor = (srp_send_descriptor_t *)((uintn_t)p_wc->wr_id);
+    SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DATA,
+         ("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 )) );
+    break;
+   default:
+    // TODO: Kill session and inform port driver link down
scsiportnotification
+    SRP_PRINT( TRACE_LEVEL_ERROR, 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));
 
-   // TODO: Kill session and inform port driver link down
scsiportnotification
-   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_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 )) );
+    SRP_PRINT( TRACE_LEVEL_ERROR, 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 )) );
+    break;
   }
 
   /* Put onto head of free list */
@@ -148,7 +200,7 @@
 
  cl_obj_deref( &p_session->obj );
 
- SRP_EXIT( SRP_DBG_DEBUG );
+ SRP_EXIT( SRP_DBG_DATA );
 }
 
 /* srp_send_completion_cb */
@@ -166,13 +218,13 @@
 {
  srp_session_t *p_session = (srp_session_t *)p_context;
 
- SRP_ENTER( SRP_DBG_DEBUG );
+ SRP_ENTER( SRP_DBG_DATA );
 
  UNUSED_PARAM( h_cq );
 
  __srp_process_session_send_completions( p_session );
 
- SRP_EXIT( SRP_DBG_DEBUG );
+ SRP_EXIT( SRP_DBG_DATA );
 }
 
 static inline
@@ -186,7 +238,7 @@
  uint8_t                 response_status;
  srp_send_descriptor_t   *p_send_descriptor;
 
- SRP_ENTER( SRP_DBG_DEBUG );
+ SRP_ENTER( SRP_DBG_DATA );
 
  p_srp_rsp = (srp_rsp_t *)p_recv_descriptor->p_data_segment;
 
@@ -211,13 +263,13 @@
 
   cl_atomic_add( &p_session->connection.request_limit,
get_srp_response_request_limit_delta( p_srp_rsp ) );
 
-  SRP_PRINT( TRACE_LEVEL_WARNING, SRP_DBG_DEBUG,
+  SRP_PRINT( TRACE_LEVEL_WARNING, SRP_DBG_DATA,
    ("Matching Send Descriptor Not Found.\n") );
 
   goto exit;
  }
 
- SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,
+ SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DATA,
       ("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],
@@ -235,9 +287,27 @@
 
    set_srp_tsk_mgmt_from_network_to_host( p_srp_tsk_mgmt );
 
-   p_send_descriptor->p_srb->SrbStatus =
-    (response_status == SCSISTAT_GOOD) ? SRB_STATUS_SUCCESS :
SRB_STATUS_ABORT_FAILED;
 
+   if(response_status == SCSISTAT_GOOD)
+   {
+    p_send_descriptor->p_srb->SrbStatus = SRB_STATUS_SUCCESS;
+   }
+   else
+   {
+    p_send_descriptor->p_srb->SrbStatus = SRB_STATUS_ABORT_FAILED;
+    SRP_PRINT( TRACE_LEVEL_WARNING, SRP_DBG_DATA,
+        ("Scsi Error  %s (%#x)  Received for Function = %s(0x%x), "
+        "Path = 0x%x, Target = 0x%x, Lun = 0x%x, tag 0x%I64xn",
+        g_srb_scsi_status_name[response_status],
+        response_status,
+        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 )) );
+   }
+
    if ( get_srp_tsk_mgmt_task_management_flags( p_srp_tsk_mgmt ) ==
TMF_ABORT_TASK )
    {
     /* Repost the recv descriptor */
@@ -251,36 +321,8 @@
     }
 
     cl_atomic_add( &p_session->connection.request_limit,
get_srp_response_request_limit_delta( p_srp_rsp ) );
+    __srp_dump_srb_info( p_send_descriptor);
 
-    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_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_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],
-         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 )) );
-
     StorPortNotification( RequestComplete, p_session->p_hba->p_ext,
p_send_descriptor->p_srb );
    }
    break;
@@ -288,8 +330,25 @@
 
   case SRP_CMD:
    p_send_descriptor->p_srb->ScsiStatus = response_status;
-   p_send_descriptor->p_srb->SrbStatus =
-    (response_status == SCSISTAT_GOOD) ? SRB_STATUS_SUCCESS :
SRB_STATUS_ERROR;
+   if(response_status == SCSISTAT_GOOD)
+   {
+    p_send_descriptor->p_srb->SrbStatus = SRB_STATUS_SUCCESS;
+   }
+   else
+   {
+    p_send_descriptor->p_srb->SrbStatus = SRB_STATUS_ABORT_FAILED;
+    SRP_PRINT( TRACE_LEVEL_WARNING, SRP_DBG_DATA,
+        ("Scsi Error  %s (%#x)  Received for Function = %s(0x%x), "
+        "Path = 0x%x, Target = 0x%x, Lun = 0x%x, tag 0x%I64xn",
+        g_srb_scsi_status_name[response_status],
+        response_status,
+        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 )) );
+   }
 
    if ( get_srp_response_flags( p_srp_rsp ) != 0 )
    {
@@ -299,7 +358,7 @@
     {
      resid = get_srp_response_data_in_residual_count( p_srp_rsp );
 
-     SRP_PRINT( TRACE_LEVEL_WARNING, SRP_DBG_DEBUG,
+     SRP_PRINT( TRACE_LEVEL_WARNING, SRP_DBG_DATA,
       ("DI Underflow in response: expected %d got %d.\n",
       p_send_descriptor->p_srb->DataTransferLength,
       p_send_descriptor->p_srb->DataTransferLength - resid) );
@@ -316,7 +375,7 @@
     {
      resid = get_srp_response_data_out_residual_count( p_srp_rsp );
 
-     SRP_PRINT( TRACE_LEVEL_WARNING, SRP_DBG_DEBUG,
+     SRP_PRINT( TRACE_LEVEL_WARNING, SRP_DBG_DATA,
       ("DI Underflow in response: expected %d got %d.\n",
       p_send_descriptor->p_srb->DataTransferLength,
       p_send_descriptor->p_srb->DataTransferLength - resid) );
@@ -338,7 +397,11 @@
           p_sense_data,
           MIN( get_srp_response_sense_data_list_length( p_srp_rsp ),
          p_send_descriptor->p_srb->SenseInfoBufferLength ) );
-
+     SRP_PRINT( TRACE_LEVEL_WARNING, SRP_DBG_DATA,
+       ("Sense Data  SENSE_KEY 0x%02x ADDITIONAL_SENSE_CODE"
+       "0x%02x ADDITIONAL_SENSE_QUILIFIER 0x%02x.\n",
+       p_sense_data[2],p_sense_data[12],p_sense_data[13]) );
+     
      if ( ((p_sense_data[2]&0xf) == 0x0b /*ABORTED_COMMAND*/) &&
       (p_sense_data[12] == 0x08) &&
       (p_sense_data[13] == 0x00) )
@@ -346,7 +409,7 @@
      {
       /* probably a problem with the Vfx FC san like wire pull*/
       /* initiate session recovery */
-      SRP_PRINT( TRACE_LEVEL_WARNING, SRP_DBG_DEBUG,
+      SRP_PRINT( TRACE_LEVEL_WARNING, SRP_DBG_DATA,
        ("Sense Data indicates FC link connectivity has been lost.\n")
);
       StorPortPauseDevice( p_session->p_hba->p_ext,
             p_send_descriptor->p_srb->PathId,
@@ -354,11 +417,12 @@
             p_send_descriptor->p_srb->Lun,
             5 );
      }
+     
     }
 
     if ( get_srp_response_di_over( p_srp_rsp ) ||
get_srp_response_do_over( p_srp_rsp ) )
     {
-     SRP_PRINT( TRACE_LEVEL_WARNING, SRP_DBG_DEBUG,
+     SRP_PRINT( TRACE_LEVEL_WARNING, SRP_DBG_DATA,
       ("Overflow error in response.\n") );
      if ( p_send_descriptor->p_srb->SrbStatus == SRB_STATUS_SUCCESS )
      {
@@ -367,7 +431,7 @@
     }
    }
 
-   SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,
+   SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DATA,
     ("DataBuffer = 0x%I64x.\n", MmGetPhysicalAddress(
     p_send_descriptor->p_srb->DataBuffer ).QuadPart) );
 
@@ -382,38 +446,8 @@
    }
 
    cl_atomic_add( &p_session->connection.request_limit,
get_srp_response_request_limit_delta( p_srp_rsp ) );
+   __srp_dump_srb_info( p_send_descriptor);
 
-   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_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_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],
-        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 )) );
-
    StorPortNotification( RequestComplete, p_session->p_hba->p_ext,
p_send_descriptor->p_srb );
    break;
 
@@ -427,7 +461,7 @@
  }
 
 exit:
- SRP_EXIT( SRP_DBG_DEBUG );
+ SRP_EXIT( SRP_DBG_DATA );
 
  return ( status );
 }
@@ -441,14 +475,14 @@
  ib_wc_t         *p_wc_done_list;
  ib_wc_t         *p_wc;
 
- SRP_ENTER( SRP_DBG_DEBUG );
+ SRP_ENTER( SRP_DBG_DATA );
 
  cl_obj_lock( &p_session->obj );
 
  if ( p_session->connection.state != SRP_CONNECTED )
  {
   cl_obj_unlock( &p_session->obj );
-  SRP_EXIT( SRP_DBG_DEBUG );
+  SRP_EXIT( SRP_DBG_DATA );
   return;
  }
 
@@ -462,7 +496,7 @@
    ("ib_poll_cq() failed!, status 0x%x\n", status) );
 
   // TODO: Kill session and inform port driver link down
scsiportnotification
-  SRP_EXIT( SRP_DBG_DEBUG );
+  SRP_EXIT( SRP_DBG_DATA );
   cl_obj_unlock( &p_session->obj );
   return;
  }
@@ -490,10 +524,20 @@
   }
   else
   {
-   SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_ERROR,
-    ("Recv 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) );
+   if( p_wc->status != IB_WCS_WR_FLUSHED_ERR )
+   {
+    SRP_PRINT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR,
+     ("Recv Completion with Error Status %s (vendore specific %#x)\n",
+     p_session->p_hba->ifc.get_wc_status_str( p_wc->status ),
+     (int)p_wc->vendor_specific) );
+   }
+   else
+   {
+    SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DATA,
+     ("Recv Completion Flushed in Error Status: %s\n",
+     p_session->p_hba->ifc.get_wc_status_str( p_wc->status )));
+
+   }
   }
 
   /* Put onto head of free list */
@@ -519,7 +563,7 @@
 
  cl_obj_deref( &p_session->obj );
 
- SRP_EXIT( SRP_DBG_DEBUG );
+ SRP_EXIT( SRP_DBG_DATA );
 }
 
 /* srp_recv_completion_cb */
@@ -537,13 +581,13 @@
 {
  srp_session_t *p_session = (srp_session_t *)p_context;
 
- SRP_ENTER( SRP_DBG_DEBUG );
+ SRP_ENTER( SRP_DBG_DATA );
 
  UNUSED_PARAM( h_cq );
 
  __srp_process_session_recv_completions( p_session );
 
- SRP_EXIT( SRP_DBG_DEBUG );
+ SRP_EXIT( SRP_DBG_DATA );
 }
 
 /* __srp_build_cmd */
@@ -573,9 +617,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_DEBUG );
+ SRP_ENTER( SRP_DBG_DATA );
 
- SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,
+ SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DATA,
       ("Sending I/O to Path = 0x%x, Target = 0x%x, Lun = 0x%x\n",
       p_srb->PathId,
       p_srb->TargetId,
@@ -594,15 +638,20 @@
  p_cdb = get_srp_command_cdb( p_srp_cmd );
  cl_memcpy( p_cdb, p_srb->Cdb, p_srb->CdbLength );
 
- SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,
+ SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DATA,
   ("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_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,
-   ("%0.2x", p_srb->Cdb[i]) );
+  char* cmd;
+  cmd = cl_zalloc(p_srb->CdbLength +1);
+  for ( i = 0; i < p_srb->CdbLength; i++ )
+  {
+   cmd[i] = p_srb->Cdb[i];
+  }
+  cmd[i] = '\0';
+  SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DATA, ("CDB = 0x%s\n",cmd) );
  }
- SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG, ("\n.") );
+
  
  if ( !format )
  {
@@ -682,18 +731,18 @@
     p_memory_descriptor->memory_handle   = p_srp_conn_info->rkey;
     p_memory_descriptor->data_length     = cl_hton32(
p_sg_element->Length );
 
-    SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,
+    SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DATA,
      ("virtual_address[%d] = 0x%I64x.\n",
      i, cl_ntoh64(p_memory_descriptor->virtual_address) ) );
-    SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,
+    SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DATA,
      ("memory_handle[%d]   = 0x%x.\n",
      i, cl_ntoh32( p_memory_descriptor->memory_handle) ) );
-    SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,
+    SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DATA,
      ("data_length[%d]     = %d.\n",
      i, cl_ntoh32( p_memory_descriptor->data_length) ) );
    }
   }
-  SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,
+  SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DATA,
    ("scatter/gather count = %d.\n", scatter_gather_count));
  }
 
@@ -701,7 +750,7 @@
 
  //set_srp_command_from_host_to_network( p_srp_cmd );
 
- SRP_EXIT( SRP_DBG_DEBUG );
+ SRP_EXIT( SRP_DBG_DATA );
 }
 
 /* srp_format_io_request */
@@ -722,15 +771,15 @@
  BOOLEAN         result = TRUE;
  srp_session_t   *p_srp_session;
 
- SRP_ENTER( SRP_DBG_DEBUG );
+ SRP_ENTER( SRP_DBG_DATA );
 
- SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,
+ SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DATA,
   ("Device Extension Address = %p\n", p_dev_ext) );
- SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,
+ SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DATA,
   ("Srb Address              = %p\n", p_srb) );
- SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,
+ SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DATA,
   ("Srb DataBuffer Address   = %p\n", p_srb->DataBuffer) );
- SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,
+ SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DATA,
   ("Srb DataTransferLength   = %d\n", p_srb->DataTransferLength) );
 
  cl_obj_lock( &p_hba->obj );
@@ -771,7 +820,7 @@
  }
 
 
- SRP_EXIT( SRP_DBG_DEBUG );
+ SRP_EXIT( SRP_DBG_DATA );
  return ( result );
 }
 
@@ -785,7 +834,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_DEBUG );
+ SRP_ENTER( SRP_DBG_DATA );
 
  cl_obj_lock( &p_hba->obj );
 
@@ -806,7 +855,7 @@
 
    if ( p_srp_session->connection.request_limit < 3 )
    {
-    SRP_PRINT( TRACE_LEVEL_WARNING, SRP_DBG_DEBUG,
+    SRP_PRINT( TRACE_LEVEL_WARNING, SRP_DBG_DATA,
      ("Calling StorPortBusy.\n") );
     StorPortBusy( p_dev_ext, 1 );
    }
@@ -837,7 +886,7 @@
  StorPortNotification( RequestComplete, p_dev_ext, p_srb );
 
 exit:
- SRP_EXIT( SRP_DBG_DEBUG );
+ SRP_EXIT( SRP_DBG_DATA );
 }
 
 void
@@ -853,7 +902,7 @@
  srp_conn_info_t         srp_conn_info;
  srp_tsk_mgmt_t          *p_srp_tsk_mgmt;
 
- SRP_ENTER( SRP_DBG_DEBUG );
+ SRP_ENTER( SRP_DBG_DATA );
 
  cl_obj_lock( &p_hba->obj );
 
@@ -911,7 +960,7 @@
  cl_obj_unlock( &p_hba->obj );
  if ( p_srb->SrbStatus == SRB_STATUS_ABORT_FAILED )
  {
-  SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,
+  SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DATA,
        ("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],
@@ -924,7 +973,7 @@
   StorPortNotification( RequestComplete, p_dev_ext, p_srb );
  }
 
- SRP_EXIT( SRP_DBG_DEBUG );
+ SRP_EXIT( SRP_DBG_DATA );
 }
 
 void
@@ -936,7 +985,7 @@
  srp_hba_t               *p_hba = ((srp_ext_t *)p_dev_ext)->p_hba;
  srp_session_t           *p_srp_session;
 
- SRP_ENTER( SRP_DBG_DEBUG );
+ SRP_ENTER( SRP_DBG_DATA );
 
  cl_obj_lock( &p_hba->obj );
 
@@ -952,7 +1001,7 @@
 
   while ( (p_send_descriptor = srp_remove_lun_head_send_descriptor(
&p_srp_session->descriptors, p_srb->Lun )) != NULL )
   {
-   SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,
+   SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DATA,
         ("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],
@@ -967,7 +1016,7 @@
 
   p_srb->SrbStatus = SRB_STATUS_SUCCESS;
 
-  SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,
+  SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DATA,
        ("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],
@@ -988,7 +1037,7 @@
  {
   // Handle the error case here
   p_srb->SrbStatus = SRB_STATUS_INVALID_TARGET_ID;
-  SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,
+  SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DATA,
        ("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],
@@ -1004,5 +1053,5 @@
 
  cl_obj_unlock( &p_hba->obj );
 
- SRP_EXIT( SRP_DBG_DEBUG );
+ SRP_EXIT( SRP_DBG_DATA );
 }
Index: kernel/srp_debug.h
===================================================================
--- kernel/srp_debug.h (revision 1797)
+++ kernel/srp_debug.h (working copy)
@@ -51,6 +51,7 @@
 
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_DATA) \
  WPP_DEFINE_BIT( SRP_DBG_DEBUG))
 
 
@@ -82,6 +83,7 @@
 
 #define SRP_DBG_ERR  (1 << 0)
 #define SRP_DBG_PNP  (1 << 1)
+#define SRP_DBG_DATA (1 << 2)
 #define SRP_DBG_DEBUG (1 << 3)
 
 #define SRP_DBG_ERROR (CL_DBG_ERROR | SRP_DBG_ERR)
@@ -134,5 +136,6 @@
 
 extern char         g_srb_function_name[][32];
 extern char         g_srb_status_name[][32];
+extern char         g_srb_scsi_status_name[][32];
 
 #endif  /* _SRP_DEBUG_H_ */
Index: kernel/srp_descriptors.c
===================================================================
--- kernel/srp_descriptors.c (revision 1797)
+++ kernel/srp_descriptors.c (working copy)
@@ -253,7 +253,7 @@
  IN  srp_descriptors_t       *p_descriptors,
  IN  srp_send_descriptor_t   *p_descriptor )
 {
- SRP_ENTER( SRP_DBG_DEBUG );
+ SRP_ENTER( SRP_DBG_DATA );
 
  cl_spinlock_acquire ( &p_descriptors->sent_list_lock );
 
@@ -262,7 +262,7 @@
 
  cl_spinlock_release ( &p_descriptors->sent_list_lock );
 
- SRP_EXIT( SRP_DBG_DEBUG );
+ SRP_EXIT( SRP_DBG_DATA );
 }
 
 /* srp_remove_send_descriptor */
@@ -280,7 +280,7 @@
  IN  srp_descriptors_t       *p_descriptors,
  IN  srp_send_descriptor_t   *p_descriptor )
 {
- SRP_ENTER( SRP_DBG_DEBUG );
+ SRP_ENTER( SRP_DBG_DATA );
 
  cl_spinlock_acquire ( &p_descriptors->sent_list_lock );
 
@@ -289,7 +289,7 @@
 
  cl_spinlock_release ( &p_descriptors->sent_list_lock );
 
- SRP_EXIT( SRP_DBG_DEBUG );
+ SRP_EXIT( SRP_DBG_DATA );
 }
 
 /* srp_remove_lun_head_send_descriptor */
@@ -308,7 +308,7 @@
 {
  srp_send_descriptor_t   *p_descriptor;
 
- SRP_ENTER( SRP_DBG_DEBUG );
+ SRP_ENTER( SRP_DBG_DATA );
 
  cl_spinlock_acquire ( &p_descriptors->sent_list_lock );
 
@@ -335,7 +335,7 @@
 
  cl_spinlock_release ( &p_descriptors->sent_list_lock );
 
- SRP_EXIT( SRP_DBG_DEBUG );
+ SRP_EXIT( SRP_DBG_DATA );
 
  return ( p_descriptor );
 }
@@ -361,23 +361,23 @@
  srp_connection_t *p_connection;
  ib_al_ifc_t   *p_ifc;
 
- SRP_ENTER( SRP_DBG_DEBUG );
+ SRP_ENTER( SRP_DBG_DATA );
 
  p_connection = &p_session->connection;
  p_ifc = &p_session->hca.p_hba->ifc;
 
  if ( p_connection->state == SRP_CONNECTED )
  {
-  SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,
+  SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DATA,
    ("wr_id    = 0x%I64x.\n", p_descriptor->wr.wr_id) );
-  SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,
+  SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DATA,
    ("wr_type  = 0x%x.\n", p_descriptor->wr.wr_type) );
-  SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,
+  SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DATA,
    ("send_opt = 0x%x.\n", p_descriptor->wr.send_opt) );
-  SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,
+  SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DATA,
    ("num_ds   = 0x%x.\n", p_descriptor->wr.num_ds) );
 
-  SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,
+  SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DATA,
        ("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],
@@ -419,7 +419,7 @@
    ("Attempting to post to an unconnected session.\n") );
  }
 
- SRP_EXIT( SRP_DBG_DEBUG );
+ SRP_EXIT( SRP_DBG_DATA );
 
  return ( status );
 }
@@ -442,19 +442,19 @@
 {
  srp_send_descriptor_t   *p_send_descriptor;
 
- SRP_ENTER( SRP_DBG_DEBUG );
+ SRP_ENTER( SRP_DBG_DATA );
 
  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_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,
+ SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DATA,
   ("rsp tag = 0x%I64x.\n", tag) );
 
  while ( p_send_descriptor != (srp_send_descriptor_t *)cl_qlist_end(
&p_descriptors->sent_descriptors ) )
  {
-  SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG, ("cmd tag =
0x%I64x.\n",
+  SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DATA, ("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 )
@@ -473,7 +473,7 @@
 exit:
  cl_spinlock_release( &p_descriptors->sent_list_lock );
 
- SRP_EXIT( SRP_DBG_DEBUG );
+ SRP_EXIT( SRP_DBG_DATA );
 
  return ( p_send_descriptor );
 }
@@ -498,7 +498,7 @@
  STOR_PHYSICAL_ADDRESS   physical_address;
  ULONG                   length;
 
- SRP_ENTER( SRP_DBG_DEBUG );
+ SRP_ENTER( SRP_DBG_DATA );
 
  cl_memclr( p_send_descriptor, (sizeof ( srp_send_descriptor_t ) -
SRP_MAX_IU_SIZE) );
 
@@ -515,16 +515,16 @@
  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_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,
+ SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DATA,
   ("hca vaddr        = 0x%I64x.\n", p_srp_conn_info->vaddr));
- SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,
+ SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DATA,
   ("physical_address = 0x%I64x.\n", physical_address.QuadPart));
- SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,
+ SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DATA,
   ("IU  vaddr        = 0x%I64x.\n", p_send_descriptor->ds[0].vaddr));
- SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,
+ SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DATA,
   ("length           = %d.\n",
p_send_descriptor->ds[0].length));
- SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,
+ SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DATA,
   ("lkey             = 0x%x.\n",
p_send_descriptor->ds[0].lkey));
 
- SRP_EXIT( SRP_DBG_DEBUG );
+ SRP_EXIT( SRP_DBG_DATA );
 }
Index: kernel/srp_driver.c
===================================================================
--- kernel/srp_driver.c (revision 1797)
+++ kernel/srp_driver.c (working copy)
@@ -138,6 +138,50 @@
  "LINK_DOWN"               // 0x25
 };
 
+char g_srb_scsi_status_name[][32] =
+{
+ "SCSISTAT_GOOD",    //0x00
+ "",        //0x01
+ " SCSISTAT_CHECK_CONDITION", //0x02
+ "",        //0x03
+ " SCSISTAT_CONDITION_MET",  //0x04
+ "",        //0x05
+ "",        //0x06
+ "",        //0x07
+ " SCSISTAT_BUSY",    //0x08
+ "",        //0x09
+ "",        //0x0A
+ "",        //0x0B
+ "",        //0x0C
+ "",        //0x0D
+ "",        //0x0E
+ "",        //0x0F
+ " SCSISTAT_INTERMEDIATE",  //0x10
+ "",        //0x11
+ "",        //0x12
+ "",        //0x13
+ " SCSISTAT_INTERMEDIATE_COND_MET", //0x14
+ "",        //0x15
+ "",        //0x16
+ "",        //0x17
+ " SCSISTAT_RESERVATION_CONFLICT",  //0x18
+ "",        //0x19
+ "",        // 0x1A
+ "",        // 0x1B
+ "",        // 0x1C
+ "",        // 0x1D
+ "",        // 0x1E
+ "",        // 0x1F
+ "",        //0x20
+ "",        //0x21
+ " SCSISTAT_COMMAND_TERMINATED",    //0x22
+ "",        //0x23
+ "",        //0x24
+ "",        //0x25
+ "",        //0x26
+ "",        //0x27
+ " SCSISTAT_QUEUE_FULL",   //0x28
+};
 
 DRIVER_OBJECT       *gp_drv_obj;
 cl_obj_t            g_drv_obj;
i
-------------- next part --------------
A non-text attachment was scrubbed...
Name: srp_scsi_err.patch
Type: application/octet-stream
Size: 30570 bytes
Desc: srp_scsi_err.patch
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20061117/b2d13ba4/attachment.obj>


More information about the ofw mailing list