[SRP] add SCSI errors to the logs
[mirror/winof/.git] / ulp / srp / kernel / srp_data_path.c
index 9e2d118..7d9bafd 100644 (file)
 // Final address is of the form 0b00ttttttllllllll\r
 #define BUILD_SCSI_ADDRESS(lun) ((uint64_t)lun << 48)\r
 \r
+\r
+static inline\r
+void\r
+__srp_dump_srb_info(srp_send_descriptor_t*             p_send_descriptor)\r
+{\r
+       \r
+       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DATA,\r
+               ("Srb Address              = %p\n",\r
+               p_send_descriptor->p_srb) );\r
+       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DATA,\r
+               ("Srb DataBuffer Address   = %p\n",\r
+               p_send_descriptor->p_srb->DataBuffer) );\r
+       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DATA,\r
+               ("Srb DataTransferLength   = %d\n",\r
+                p_send_descriptor->p_srb->DataTransferLength) );\r
+\r
+       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DATA,\r
+                          ("Returning SrbStatus %s(0x%x) for "\r
+                          "Function = %s(0x%x), Path = 0x%x, Target = 0x%x, "\r
+                          "Lun = 0x%x, tag 0x%I64xn",\r
+                          g_srb_status_name[p_send_descriptor->p_srb->SrbStatus],\r
+                          p_send_descriptor->p_srb->SrbStatus,\r
+                          g_srb_function_name[p_send_descriptor->p_srb->Function],\r
+                          p_send_descriptor->p_srb->Function,\r
+                          p_send_descriptor->p_srb->PathId,\r
+                          p_send_descriptor->p_srb->TargetId,\r
+                          p_send_descriptor->p_srb->Lun,\r
+                          get_srp_command_tag( (srp_cmd_t *)p_send_descriptor->data_segment )) );\r
+}\r
+\r
+\r
 static inline\r
 void\r
 __srp_process_session_send_completions(\r
@@ -68,14 +99,14 @@ __srp_process_session_send_completions(
        ib_wc_t         *p_wc_done_list = NULL;\r
        ib_wc_t         *p_wc;\r
 \r
-       SRP_ENTER( SRP_DBG_DEBUG );\r
+       SRP_ENTER( SRP_DBG_DATA );\r
 \r
        cl_obj_lock( &p_session->obj );\r
 \r
        if ( p_session->connection.state != SRP_CONNECTED )\r
        {\r
                cl_obj_unlock( &p_session->obj );\r
-               SRP_EXIT( SRP_DBG_DEBUG );\r
+               SRP_EXIT( SRP_DBG_DATA );\r
                return;\r
        }\r
 \r
@@ -98,31 +129,52 @@ __srp_process_session_send_completions(
 \r
        while ( (p_wc = p_wc_done_list) != NULL )\r
        {\r
+               srp_send_descriptor_t   *p_send_descriptor;\r
+\r
+               p_send_descriptor = (srp_send_descriptor_t *)((uintn_t)p_wc->wr_id);\r
+\r
                /* Remove head from list */\r
                p_wc_done_list = p_wc->p_next;\r
                p_wc->p_next = NULL;\r
 \r
-               if ( p_wc->status != IB_WCS_SUCCESS )\r
+               switch ( p_wc->status)\r
                {\r
-                       srp_send_descriptor_t   *p_send_descriptor;\r
-\r
-                       p_send_descriptor = (srp_send_descriptor_t *)((uintn_t)p_wc->wr_id);\r
-\r
-                       // TODO: Kill session and inform port driver link down scsiportnotification\r
-                       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_ERROR,\r
-                               ("Send Completion Status %s Vendore Status = 0x%x, \n",\r
-                               p_session->p_hba->ifc.get_wc_status_str( p_wc->status ),\r
-                               (int)p_wc->vendor_specific));\r
+                       case IB_WCS_SUCCESS:\r
+                               break;\r
+                       case IB_WCS_WR_FLUSHED_ERR:\r
+                               // TODO: Kill session and inform port driver link down scsiportnotification\r
+                               SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DATA,\r
+                                       ("Send Completion Status %s Vendore Status = 0x%x, \n",\r
+                                       p_session->p_hba->ifc.get_wc_status_str( p_wc->status ),\r
+                                       (int)p_wc->vendor_specific));\r
+\r
+                               SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DATA,\r
+                                                  ("Send Completion Received for Function = %s(0x%x), "\r
+                                                  "Path = 0x%x, Target = 0x%x, Lun = 0x%x, tag 0x%I64xn",\r
+                                                  g_srb_function_name[p_send_descriptor->p_srb->Function],\r
+                                                  p_send_descriptor->p_srb->Function,\r
+                                                  p_send_descriptor->p_srb->PathId,\r
+                                                  p_send_descriptor->p_srb->TargetId,\r
+                                                  p_send_descriptor->p_srb->Lun,\r
+                                                  get_srp_command_tag( (srp_cmd_t *)p_send_descriptor->data_segment )) );\r
+                               break;\r
+                       default:\r
+                               // TODO: Kill session and inform port driver link down scsiportnotification\r
+                               SRP_PRINT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR,\r
+                                       ("Send Completion Status %s Vendore Status = 0x%x, \n",\r
+                                       p_session->p_hba->ifc.get_wc_status_str( p_wc->status ),\r
+                                       (int)p_wc->vendor_specific));\r
 \r
-                       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_ERROR,\r
-                                          ("Send Completion Received for Function = %s(0x%x), "\r
-                                          "Path = 0x%x, Target = 0x%x, Lun = 0x%x, tag 0x%I64xn",\r
-                                          g_srb_function_name[p_send_descriptor->p_srb->Function],\r
-                                          p_send_descriptor->p_srb->Function,\r
-                                          p_send_descriptor->p_srb->PathId,\r
-                                          p_send_descriptor->p_srb->TargetId,\r
-                                          p_send_descriptor->p_srb->Lun,\r
-                                          get_srp_command_tag( (srp_cmd_t *)p_send_descriptor->data_segment )) );\r
+                               SRP_PRINT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR,\r
+                                                  ("Send Completion Received for Function = %s(0x%x), "\r
+                                                  "Path = 0x%x, Target = 0x%x, Lun = 0x%x, tag 0x%I64xn",\r
+                                                  g_srb_function_name[p_send_descriptor->p_srb->Function],\r
+                                                  p_send_descriptor->p_srb->Function,\r
+                                                  p_send_descriptor->p_srb->PathId,\r
+                                                  p_send_descriptor->p_srb->TargetId,\r
+                                                  p_send_descriptor->p_srb->Lun,\r
+                                                  get_srp_command_tag( (srp_cmd_t *)p_send_descriptor->data_segment )) );\r
+                               break;\r
                }\r
 \r
                /* Put onto head of free list */\r
@@ -148,7 +200,7 @@ __srp_process_session_send_completions(
 \r
        cl_obj_deref( &p_session->obj );\r
 \r
-       SRP_EXIT( SRP_DBG_DEBUG );\r
+       SRP_EXIT( SRP_DBG_DATA );\r
 }\r
 \r
 /* srp_send_completion_cb */\r
@@ -166,13 +218,13 @@ srp_send_completion_cb(
 {\r
        srp_session_t   *p_session = (srp_session_t *)p_context;\r
 \r
-       SRP_ENTER( SRP_DBG_DEBUG );\r
+       SRP_ENTER( SRP_DBG_DATA );\r
 \r
        UNUSED_PARAM( h_cq );\r
 \r
        __srp_process_session_send_completions( p_session );\r
 \r
-       SRP_EXIT( SRP_DBG_DEBUG );\r
+       SRP_EXIT( SRP_DBG_DATA );\r
 }\r
 \r
 static inline\r
@@ -186,7 +238,7 @@ __srp_process_recv_completion(
        uint8_t                 response_status;\r
        srp_send_descriptor_t   *p_send_descriptor;\r
 \r
-       SRP_ENTER( SRP_DBG_DEBUG );\r
+       SRP_ENTER( SRP_DBG_DATA );\r
 \r
        p_srp_rsp = (srp_rsp_t *)p_recv_descriptor->p_data_segment;\r
 \r
@@ -211,13 +263,13 @@ __srp_process_recv_completion(
 \r
                cl_atomic_add( &p_session->connection.request_limit, get_srp_response_request_limit_delta( p_srp_rsp ) );\r
 \r
-               SRP_PRINT( TRACE_LEVEL_WARNING, SRP_DBG_DEBUG,\r
+               SRP_PRINT( TRACE_LEVEL_WARNING, SRP_DBG_DATA,\r
                        ("Matching Send Descriptor Not Found.\n") );\r
 \r
                goto exit;\r
        }\r
 \r
-       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
+       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DATA,\r
                           ("Recv Completion Received for Function = %s(0x%x), "\r
                           "Path = 0x%x, Target = 0x%x, Lun = 0x%x, tag 0x%I64xn",\r
                           g_srb_function_name[p_send_descriptor->p_srb->Function],\r
@@ -235,8 +287,26 @@ __srp_process_recv_completion(
 \r
                        set_srp_tsk_mgmt_from_network_to_host( p_srp_tsk_mgmt );\r
 \r
-                       p_send_descriptor->p_srb->SrbStatus =\r
-                               (response_status == SCSISTAT_GOOD) ? SRB_STATUS_SUCCESS : SRB_STATUS_ABORT_FAILED;\r
+\r
+                       if(response_status == SCSISTAT_GOOD)\r
+                       {\r
+                               p_send_descriptor->p_srb->SrbStatus = SRB_STATUS_SUCCESS;\r
+                       }\r
+                       else\r
+                       {\r
+                               p_send_descriptor->p_srb->SrbStatus = SRB_STATUS_ABORT_FAILED;\r
+                               SRP_PRINT( TRACE_LEVEL_WARNING, SRP_DBG_DATA,\r
+                                          ("Scsi Error  %s (%#x)  Received for Function = %s(0x%x), "\r
+                                          "Path = 0x%x, Target = 0x%x, Lun = 0x%x, tag 0x%I64xn",\r
+                                          g_srb_scsi_status_name[response_status],\r
+                                          response_status,\r
+                                          g_srb_function_name[p_send_descriptor->p_srb->Function],\r
+                                          p_send_descriptor->p_srb->Function,\r
+                                          p_send_descriptor->p_srb->PathId,\r
+                                          p_send_descriptor->p_srb->TargetId,\r
+                                          p_send_descriptor->p_srb->Lun,\r
+                                          get_srp_command_tag( (srp_cmd_t *)p_send_descriptor->data_segment )) );\r
+                       }\r
 \r
                        if ( get_srp_tsk_mgmt_task_management_flags( p_srp_tsk_mgmt ) == TMF_ABORT_TASK )\r
                        {\r
@@ -251,35 +321,7 @@ __srp_process_recv_completion(
                                }\r
 \r
                                cl_atomic_add( &p_session->connection.request_limit, get_srp_response_request_limit_delta( p_srp_rsp ) );\r
-\r
-                               SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
-                                                  ("Srb Status = %s(0x%x)\n",\r
-                                                  g_srb_status_name[p_send_descriptor->p_srb->SrbStatus],\r
-                                                  p_send_descriptor->p_srb->SrbStatus) );\r
-\r
-                               SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG, ("Device Extension Address = %p\n", p_session->p_hba->p_ext) );\r
-                               SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
-                                       ("Srb Address              = %p\n",\r
-                                       p_send_descriptor->p_srb) );\r
-                               SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
-                                       ("Srb DataBuffer Address   = %p\n",\r
-                                       p_send_descriptor->p_srb->DataBuffer) );\r
-                               SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
-                                       ("Srb DataTransferLength   = %d\n",\r
-                                        p_send_descriptor->p_srb->DataTransferLength) );\r
-\r
-                               SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
-                                                  ("Returning SrbStatus %s(0x%x) for "\r
-                                                  "Function = %s(0x%x), Path = 0x%x, Target = 0x%x, "\r
-                                                  "Lun = 0x%x, tag 0x%I64xn",\r
-                                                  g_srb_status_name[p_send_descriptor->p_srb->SrbStatus],\r
-                                                  p_send_descriptor->p_srb->SrbStatus,\r
-                                                  g_srb_function_name[p_send_descriptor->p_srb->Function],\r
-                                                  p_send_descriptor->p_srb->Function,\r
-                                                  p_send_descriptor->p_srb->PathId,\r
-                                                  p_send_descriptor->p_srb->TargetId,\r
-                                                  p_send_descriptor->p_srb->Lun,\r
-                                                  get_srp_command_tag( (srp_cmd_t *)p_send_descriptor->data_segment )) );\r
+                               __srp_dump_srb_info( p_send_descriptor);\r
 \r
                                StorPortNotification( RequestComplete, p_session->p_hba->p_ext, p_send_descriptor->p_srb );\r
                        }\r
@@ -288,8 +330,25 @@ __srp_process_recv_completion(
 \r
                case SRP_CMD:\r
                        p_send_descriptor->p_srb->ScsiStatus = response_status;\r
-                       p_send_descriptor->p_srb->SrbStatus =\r
-                               (response_status == SCSISTAT_GOOD) ? SRB_STATUS_SUCCESS : SRB_STATUS_ERROR;\r
+                       if(response_status == SCSISTAT_GOOD)\r
+                       {\r
+                               p_send_descriptor->p_srb->SrbStatus = SRB_STATUS_SUCCESS;\r
+                       }\r
+                       else\r
+                       {\r
+                               p_send_descriptor->p_srb->SrbStatus = SRB_STATUS_ABORT_FAILED;\r
+                               SRP_PRINT( TRACE_LEVEL_WARNING, SRP_DBG_DATA,\r
+                                          ("Scsi Error  %s (%#x)  Received for Function = %s(0x%x), "\r
+                                          "Path = 0x%x, Target = 0x%x, Lun = 0x%x, tag 0x%I64xn",\r
+                                          g_srb_scsi_status_name[response_status],\r
+                                          response_status,\r
+                                          g_srb_function_name[p_send_descriptor->p_srb->Function],\r
+                                          p_send_descriptor->p_srb->Function,\r
+                                          p_send_descriptor->p_srb->PathId,\r
+                                          p_send_descriptor->p_srb->TargetId,\r
+                                          p_send_descriptor->p_srb->Lun,\r
+                                          get_srp_command_tag( (srp_cmd_t *)p_send_descriptor->data_segment )) );\r
+                       }\r
 \r
                        if ( get_srp_response_flags( p_srp_rsp ) != 0 )\r
                        {\r
@@ -299,7 +358,7 @@ __srp_process_recv_completion(
                                {\r
                                        resid = get_srp_response_data_in_residual_count( p_srp_rsp );\r
 \r
-                                       SRP_PRINT( TRACE_LEVEL_WARNING, SRP_DBG_DEBUG,\r
+                                       SRP_PRINT( TRACE_LEVEL_WARNING, SRP_DBG_DATA,\r
                                                ("DI Underflow in response: expected %d got %d.\n",\r
                                                p_send_descriptor->p_srb->DataTransferLength,\r
                                                p_send_descriptor->p_srb->DataTransferLength - resid) );\r
@@ -316,7 +375,7 @@ __srp_process_recv_completion(
                                {\r
                                        resid = get_srp_response_data_out_residual_count( p_srp_rsp );\r
 \r
-                                       SRP_PRINT( TRACE_LEVEL_WARNING, SRP_DBG_DEBUG,\r
+                                       SRP_PRINT( TRACE_LEVEL_WARNING, SRP_DBG_DATA,\r
                                                ("DI Underflow in response: expected %d got %d.\n",\r
                                                p_send_descriptor->p_srb->DataTransferLength,\r
                                                p_send_descriptor->p_srb->DataTransferLength - resid) );\r
@@ -338,7 +397,11 @@ __srp_process_recv_completion(
                                                           p_sense_data,\r
                                                           MIN( get_srp_response_sense_data_list_length( p_srp_rsp ),\r
                                                                        p_send_descriptor->p_srb->SenseInfoBufferLength ) );\r
-\r
+                                       SRP_PRINT( TRACE_LEVEL_WARNING, SRP_DBG_DATA,\r
+                                                       ("Sense Data  SENSE_KEY 0x%02x ADDITIONAL_SENSE_CODE"\r
+                                                       "0x%02x ADDITIONAL_SENSE_QUILIFIER 0x%02x.\n",\r
+                                                       p_sense_data[2],p_sense_data[12],p_sense_data[13]) );\r
+                                       \r
                                        if ( ((p_sense_data[2]&0xf) == 0x0b /*ABORTED_COMMAND*/) &&\r
                                                (p_sense_data[12] == 0x08) &&\r
                                                (p_sense_data[13] == 0x00) )\r
@@ -346,7 +409,7 @@ __srp_process_recv_completion(
                                        {\r
                                                /* probably a problem with the Vfx FC san like wire pull*/\r
                                                /* initiate session recovery */\r
-                                               SRP_PRINT( TRACE_LEVEL_WARNING, SRP_DBG_DEBUG,\r
+                                               SRP_PRINT( TRACE_LEVEL_WARNING, SRP_DBG_DATA,\r
                                                        ("Sense Data indicates FC link connectivity has been lost.\n") );\r
                                                StorPortPauseDevice( p_session->p_hba->p_ext,\r
                                                                                         p_send_descriptor->p_srb->PathId,\r
@@ -354,11 +417,12 @@ __srp_process_recv_completion(
                                                                                         p_send_descriptor->p_srb->Lun,\r
                                                                                         5 );\r
                                        }\r
+                                       \r
                                }\r
 \r
                                if ( get_srp_response_di_over( p_srp_rsp ) || get_srp_response_do_over( p_srp_rsp ) )\r
                                {\r
-                                       SRP_PRINT( TRACE_LEVEL_WARNING, SRP_DBG_DEBUG,\r
+                                       SRP_PRINT( TRACE_LEVEL_WARNING, SRP_DBG_DATA,\r
                                                ("Overflow error in response.\n") );\r
                                        if ( p_send_descriptor->p_srb->SrbStatus == SRB_STATUS_SUCCESS )\r
                                        {\r
@@ -367,7 +431,7 @@ __srp_process_recv_completion(
                                }\r
                        }\r
 \r
-                       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
+                       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DATA,\r
                                ("DataBuffer = 0x%I64x.\n", MmGetPhysicalAddress(\r
                                p_send_descriptor->p_srb->DataBuffer ).QuadPart) );\r
 \r
@@ -382,37 +446,7 @@ __srp_process_recv_completion(
                        }\r
 \r
                        cl_atomic_add( &p_session->connection.request_limit, get_srp_response_request_limit_delta( p_srp_rsp ) );\r
-\r
-                       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
-                                          ("Srb Status = %s(0x%x)\n",\r
-                                          g_srb_status_name[p_send_descriptor->p_srb->SrbStatus],\r
-                                          p_send_descriptor->p_srb->SrbStatus) );\r
-\r
-                       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
-                               ("Device Extension Address = %p\n",\r
-                               p_session->p_hba->p_ext) );\r
-                       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
-                               ("Srb Address              = %p\n",\r
-                               p_send_descriptor->p_srb) );\r
-                       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
-                               ("Srb DataBuffer Address   = %p\n",\r
-                               p_send_descriptor->p_srb->DataBuffer) );\r
-                       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
-                               ("Srb DataTransferLength   = %d\n",\r
-                               p_send_descriptor->p_srb->DataTransferLength) );\r
-\r
-                       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
-                                          ("Returning SrbStatus %s(0x%x) for "\r
-                                          "Function = %s(0x%x), Path = 0x%x, "\r
-                                          "Target = 0x%x, Lun = 0x%x, tag 0x%I64xn",\r
-                                          g_srb_status_name[p_send_descriptor->p_srb->SrbStatus],\r
-                                          p_send_descriptor->p_srb->SrbStatus,\r
-                                          g_srb_function_name[p_send_descriptor->p_srb->Function],\r
-                                          p_send_descriptor->p_srb->Function,\r
-                                          p_send_descriptor->p_srb->PathId,\r
-                                          p_send_descriptor->p_srb->TargetId,\r
-                                          p_send_descriptor->p_srb->Lun,\r
-                                          get_srp_command_tag( (srp_cmd_t *)p_send_descriptor->data_segment )) );\r
+                       __srp_dump_srb_info( p_send_descriptor);\r
 \r
                        StorPortNotification( RequestComplete, p_session->p_hba->p_ext, p_send_descriptor->p_srb );\r
                        break;\r
@@ -427,7 +461,7 @@ __srp_process_recv_completion(
        }\r
 \r
 exit:\r
-       SRP_EXIT( SRP_DBG_DEBUG );\r
+       SRP_EXIT( SRP_DBG_DATA );\r
 \r
        return ( status );\r
 }\r
@@ -441,14 +475,14 @@ __srp_process_session_recv_completions(
        ib_wc_t         *p_wc_done_list;\r
        ib_wc_t         *p_wc;\r
 \r
-       SRP_ENTER( SRP_DBG_DEBUG );\r
+       SRP_ENTER( SRP_DBG_DATA );\r
 \r
        cl_obj_lock( &p_session->obj );\r
 \r
        if ( p_session->connection.state != SRP_CONNECTED )\r
        {\r
                cl_obj_unlock( &p_session->obj );\r
-               SRP_EXIT( SRP_DBG_DEBUG );\r
+               SRP_EXIT( SRP_DBG_DATA );\r
                return;\r
        }\r
 \r
@@ -462,7 +496,7 @@ __srp_process_session_recv_completions(
                        ("ib_poll_cq() failed!, status 0x%x\n", status) );\r
 \r
                // TODO: Kill session and inform port driver link down scsiportnotification\r
-               SRP_EXIT( SRP_DBG_DEBUG );\r
+               SRP_EXIT( SRP_DBG_DATA );\r
                cl_obj_unlock( &p_session->obj );\r
                return;\r
        }\r
@@ -490,10 +524,20 @@ __srp_process_session_recv_completions(
                }\r
                else\r
                {\r
-                       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_ERROR,\r
-                               ("Recv Completion Status %s Vendore Status = 0x%x, \n",\r
-                               p_session->p_hba->ifc.get_wc_status_str( p_wc->status ),\r
-                               (int)p_wc->vendor_specific) );\r
+                       if( p_wc->status != IB_WCS_WR_FLUSHED_ERR )\r
+                       {\r
+                               SRP_PRINT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR,\r
+                                       ("Recv Completion with Error Status %s (vendore specific %#x)\n",\r
+                                       p_session->p_hba->ifc.get_wc_status_str( p_wc->status ),\r
+                                       (int)p_wc->vendor_specific) );\r
+                       }\r
+                       else\r
+                       {\r
+                               SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DATA,\r
+                                       ("Recv Completion Flushed in Error Status: %s\n",\r
+                                       p_session->p_hba->ifc.get_wc_status_str( p_wc->status )));\r
+\r
+                       }\r
                }\r
 \r
                /* Put onto head of free list */\r
@@ -519,7 +563,7 @@ __srp_process_session_recv_completions(
 \r
        cl_obj_deref( &p_session->obj );\r
 \r
-       SRP_EXIT( SRP_DBG_DEBUG );\r
+       SRP_EXIT( SRP_DBG_DATA );\r
 }\r
 \r
 /* srp_recv_completion_cb */\r
@@ -537,13 +581,13 @@ srp_recv_completion_cb(
 {\r
        srp_session_t   *p_session = (srp_session_t *)p_context;\r
 \r
-       SRP_ENTER( SRP_DBG_DEBUG );\r
+       SRP_ENTER( SRP_DBG_DATA );\r
 \r
        UNUSED_PARAM( h_cq );\r
 \r
        __srp_process_session_recv_completions( p_session );\r
 \r
-       SRP_EXIT( SRP_DBG_DEBUG );\r
+       SRP_EXIT( SRP_DBG_DATA );\r
 }\r
 \r
 /* __srp_build_cmd */\r
@@ -573,9 +617,9 @@ __srp_build_cmd(
        ULONG                           scsi_direction = p_srb->SrbFlags & ( SRB_FLAGS_DATA_IN | SRB_FLAGS_DATA_OUT );\r
        DATA_BUFFER_DESCRIPTOR_FORMAT   format = p_srp_conn_info->descriptor_format & DBDF_INDIRECT_DATA_BUFFER_DESCRIPTORS;\r
        ULONG                                                   length;\r
-       SRP_ENTER( SRP_DBG_DEBUG );\r
+       SRP_ENTER( SRP_DBG_DATA );\r
 \r
-       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
+       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DATA,\r
                           ("Sending I/O to Path = 0x%x, Target = 0x%x, Lun = 0x%x\n",\r
                           p_srb->PathId,\r
                           p_srb->TargetId,\r
@@ -594,15 +638,20 @@ __srp_build_cmd(
        p_cdb = get_srp_command_cdb( p_srp_cmd );\r
        cl_memcpy( p_cdb, p_srb->Cdb, p_srb->CdbLength );\r
 \r
-       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
+       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DATA,\r
                ("CDB Length = %d.\n", p_srb->CdbLength) );\r
-       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG, ("CDB = 0x") );\r
-       for ( i = 0; i < p_srb->CdbLength; i++ )\r
+#ifdef DBG\r
        {\r
-               SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
-                       ("%0.2x", p_srb->Cdb[i]) );\r
+               char*   cmd;\r
+               cmd = cl_zalloc(p_srb->CdbLength +1);\r
+               for ( i = 0; i < p_srb->CdbLength; i++ )\r
+               {\r
+                       cmd[i] = p_srb->Cdb[i];\r
+               }\r
+               cmd[i] = '\0';\r
+               SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DATA, ("CDB = 0x%s\n",cmd) );\r
        }\r
-       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG, ("\n.") );\r
+#endif\r
        \r
        if ( !format )\r
        {\r
@@ -682,18 +731,18 @@ __srp_build_cmd(
                                p_memory_descriptor->memory_handle   = p_srp_conn_info->rkey;\r
                                p_memory_descriptor->data_length     = cl_hton32( p_sg_element->Length );\r
 \r
-                               SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
+                               SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DATA,\r
                                        ("virtual_address[%d] = 0x%I64x.\n",\r
                                        i, cl_ntoh64(p_memory_descriptor->virtual_address) ) );\r
-                               SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
+                               SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DATA,\r
                                        ("memory_handle[%d]   = 0x%x.\n",\r
                                        i, cl_ntoh32( p_memory_descriptor->memory_handle) ) );\r
-                               SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
+                               SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DATA,\r
                                        ("data_length[%d]     = %d.\n",\r
                                        i, cl_ntoh32( p_memory_descriptor->data_length) ) );\r
                        }\r
                }\r
-               SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
+               SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DATA,\r
                        ("scatter/gather count = %d.\n", scatter_gather_count));\r
        }\r
 \r
@@ -701,7 +750,7 @@ __srp_build_cmd(
 \r
        //set_srp_command_from_host_to_network( p_srp_cmd );\r
 \r
-       SRP_EXIT( SRP_DBG_DEBUG );\r
+       SRP_EXIT( SRP_DBG_DATA );\r
 }\r
 \r
 /* srp_format_io_request */\r
@@ -722,15 +771,15 @@ srp_format_io_request(
        BOOLEAN         result = TRUE;\r
        srp_session_t   *p_srp_session;\r
 \r
-       SRP_ENTER( SRP_DBG_DEBUG );\r
+       SRP_ENTER( SRP_DBG_DATA );\r
 \r
-       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
+       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DATA,\r
                ("Device Extension Address = %p\n", p_dev_ext) );\r
-       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
+       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DATA,\r
                ("Srb Address              = %p\n", p_srb) );\r
-       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
+       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DATA,\r
                ("Srb DataBuffer Address   = %p\n", p_srb->DataBuffer) );\r
-       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
+       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DATA,\r
                ("Srb DataTransferLength   = %d\n", p_srb->DataTransferLength) );\r
 \r
        cl_obj_lock( &p_hba->obj );\r
@@ -771,7 +820,7 @@ srp_format_io_request(
        }\r
 \r
 \r
-       SRP_EXIT( SRP_DBG_DEBUG );\r
+       SRP_EXIT( SRP_DBG_DATA );\r
        return ( result );\r
 }\r
 \r
@@ -785,7 +834,7 @@ srp_post_io_request(
        srp_send_descriptor_t   *p_send_descriptor = (srp_send_descriptor_t *)p_srb->SrbExtension;\r
        srp_session_t           *p_srp_session;\r
 \r
-       SRP_ENTER( SRP_DBG_DEBUG );\r
+       SRP_ENTER( SRP_DBG_DATA );\r
 \r
        cl_obj_lock( &p_hba->obj );\r
 \r
@@ -806,7 +855,7 @@ srp_post_io_request(
 \r
                        if ( p_srp_session->connection.request_limit < 3 )\r
                        {\r
-                               SRP_PRINT( TRACE_LEVEL_WARNING, SRP_DBG_DEBUG,\r
+                               SRP_PRINT( TRACE_LEVEL_WARNING, SRP_DBG_DATA,\r
                                        ("Calling StorPortBusy.\n") );\r
                                StorPortBusy( p_dev_ext, 1 );\r
                        }\r
@@ -837,7 +886,7 @@ srp_post_io_request(
        StorPortNotification( RequestComplete, p_dev_ext, p_srb );\r
 \r
 exit:\r
-       SRP_EXIT( SRP_DBG_DEBUG );\r
+       SRP_EXIT( SRP_DBG_DATA );\r
 }\r
 \r
 void\r
@@ -853,7 +902,7 @@ srp_abort_command(
        srp_conn_info_t         srp_conn_info;\r
        srp_tsk_mgmt_t          *p_srp_tsk_mgmt;\r
 \r
-       SRP_ENTER( SRP_DBG_DEBUG );\r
+       SRP_ENTER( SRP_DBG_DATA );\r
 \r
        cl_obj_lock( &p_hba->obj );\r
 \r
@@ -911,7 +960,7 @@ exit:
        cl_obj_unlock( &p_hba->obj );\r
        if ( p_srb->SrbStatus == SRB_STATUS_ABORT_FAILED )\r
        {\r
-               SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
+               SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DATA,\r
                                   ("Returning SrbStatus %s(0x%x) for Function = %s(0x%x), "\r
                                   "Path = 0x%x, Target = 0x%x, Lun = 0x%x\n",\r
                                   g_srb_status_name[p_srb->SrbStatus],\r
@@ -924,7 +973,7 @@ exit:
                StorPortNotification( RequestComplete, p_dev_ext, p_srb );\r
        }\r
 \r
-       SRP_EXIT( SRP_DBG_DEBUG );\r
+       SRP_EXIT( SRP_DBG_DATA );\r
 }\r
 \r
 void\r
@@ -936,7 +985,7 @@ srp_lun_reset(
        srp_hba_t               *p_hba = ((srp_ext_t *)p_dev_ext)->p_hba;\r
        srp_session_t           *p_srp_session;\r
 \r
-       SRP_ENTER( SRP_DBG_DEBUG );\r
+       SRP_ENTER( SRP_DBG_DATA );\r
 \r
        cl_obj_lock( &p_hba->obj );\r
 \r
@@ -952,7 +1001,7 @@ srp_lun_reset(
 \r
                while ( (p_send_descriptor = srp_remove_lun_head_send_descriptor( &p_srp_session->descriptors, p_srb->Lun )) != NULL )\r
                {\r
-                       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
+                       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DATA,\r
                                           ("Returning SrbStatus %s(0x%x) for Function = %s(0x%x), "\r
                                           "Path = 0x%x, Target = 0x%x, Lun = 0x%x, tag 0x%I64xn",\r
                                           g_srb_status_name[SRB_STATUS_BUS_RESET],\r
@@ -967,7 +1016,7 @@ srp_lun_reset(
 \r
                p_srb->SrbStatus = SRB_STATUS_SUCCESS;\r
 \r
-               SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
+               SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DATA,\r
                                   ("Returning SrbStatus %s(0x%x) for Function = %s(0x%x), "\r
                                   "Path = 0x%x, Target = 0x%x, Lun = 0x%x\n",\r
                                   g_srb_status_name[p_srb->SrbStatus],\r
@@ -988,7 +1037,7 @@ srp_lun_reset(
        {\r
                // Handle the error case here\r
                p_srb->SrbStatus = SRB_STATUS_INVALID_TARGET_ID;\r
-               SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
+               SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DATA,\r
                                   ("Returning SrbStatus %s(0x%x) for Function = %s(0x%x), "\r
                                   "Path = 0x%x, Target = 0x%x, Lun = 0x%x\n",\r
                                   g_srb_status_name[p_srb->SrbStatus],\r
@@ -1004,5 +1053,5 @@ srp_lun_reset(
 \r
        cl_obj_unlock( &p_hba->obj );\r
 \r
-       SRP_EXIT( SRP_DBG_DEBUG );\r
+       SRP_EXIT( SRP_DBG_DATA );\r
 }\r