[SRP] fix/improve log issues
authorsleybo <sleybo@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Thu, 14 Dec 2006 12:53:36 +0000 (12:53 +0000)
committersleybo <sleybo@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Thu, 14 Dec 2006 12:53:36 +0000 (12:53 +0000)
git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@561 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

ulp/srp/kernel/srp_data_path.c
ulp/srp/kernel/srp_debug.h
ulp/srp/kernel/srp_driver.c
ulp/srp/kernel/srp_hba.c
ulp/srp/kernel/srp_session.c

index 7d9bafd..44c5901 100644 (file)
@@ -640,16 +640,19 @@ __srp_build_cmd(
 \r
        SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DATA,\r
                ("CDB Length = %d.\n", p_srb->CdbLength) );\r
-#ifdef DBG\r
+#if DBG\r
        {\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
+               if(cmd)\r
+               {       \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
-               cmd[i] = '\0';\r
-               SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DATA, ("CDB = 0x%s\n",cmd) );\r
        }\r
 #endif\r
        \r
index c4ba72c..383d303 100644 (file)
@@ -52,6 +52,7 @@ extern uint32_t               g_srp_dbg_flags;
        WPP_DEFINE_BIT( SRP_DBG_ERROR) \\r
        WPP_DEFINE_BIT( SRP_DBG_PNP) \\r
        WPP_DEFINE_BIT( SRP_DBG_DATA) \\r
+       WPP_DEFINE_BIT( SRP_DBG_SESSION) \\r
        WPP_DEFINE_BIT( SRP_DBG_DEBUG))\r
 \r
 \r
@@ -66,6 +67,7 @@ extern uint32_t               g_srp_dbg_flags;
 // SRP_ENTER(FLAG);\r
 // SRP_EXIT(FLAG);\r
 // USEPREFIX(SRP_PRINT, "%!STDPREFIX! [SRP] :%!FUNC!() :");\r
+// USEPREFIX(SRP_PRINT_EXIT, "%!STDPREFIX! [SRP] :%!FUNC!() :");\r
 // USESUFFIX(SRP_ENTER, " [SRP] :%!FUNC!():[");\r
 // USESUFFIX(SRP_EXIT, " [SRP] :%!FUNC!():]");\r
 // end_wpp\r
@@ -81,10 +83,11 @@ extern uint32_t             g_srp_dbg_flags;
  */\r
 \r
 \r
-#define SRP_DBG_ERR            (1 << 0)\r
-#define SRP_DBG_PNP            (1 << 1)\r
-#define SRP_DBG_DATA   (1 << 2)\r
-#define SRP_DBG_DEBUG  (1 << 3)\r
+#define SRP_DBG_ERR                    (1 << 0)\r
+#define SRP_DBG_PNP                    (1 << 1)\r
+#define SRP_DBG_DATA           (1 << 2)\r
+#define SRP_DBG_SESSION        (1 << 3)\r
+#define SRP_DBG_DEBUG          (1 << 4)\r
 \r
 #define SRP_DBG_ERROR  (CL_DBG_ERROR | SRP_DBG_ERR)\r
 #define SRP_DBG_ALL    CL_DBG_ALL\r
index 976ff1d..fe81ad5 100644 (file)
@@ -626,9 +626,9 @@ srp_start_io(
        IN              PVOID                       p_dev_ext,\r
        IN              PSCSI_REQUEST_BLOCK         p_srb )\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
                           ("Starting I/O for Function = %s(0x%x), Path = 0x%x, "\r
                           "Target = 0x%x, Lun = 0x%x\n",\r
                           g_srb_function_name[p_srb->Function],\r
@@ -672,7 +672,7 @@ srp_start_io(
                                p_srp_session->p_shutdown_srb = p_srb;\r
                                cl_obj_destroy( &p_srp_session->obj );\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 "\r
                                                   "Function = %s(0x%x), Path = 0x%x, "\r
                                                   "Target = 0x%x, Lun = 0x%x\n",\r
@@ -687,7 +687,7 @@ srp_start_io(
                        else\r
                        {\r
                                p_srb->SrbStatus = SRB_STATUS_SUCCESS;\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 "\r
                                                   "Function = %s(0x%x), Path = 0x%x, "\r
                                                   "Target = 0x%x, Lun = 0x%x\n",\r
@@ -705,7 +705,7 @@ srp_start_io(
 \r
                case SRB_FUNCTION_FLUSH: /* Only receive this if CachesData is TRUE in PORT_CONFIGURATION_INFORMATION */\r
                        p_srb->SrbStatus = SRB_STATUS_SUCCESS;\r
-                       SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
+                       SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DATA,\r
                                           ("Returning SrbStatus %s(0x%x) for "\r
                                           "Function = %s(0x%x), Path = 0x%x, "\r
                                           "Target = 0x%x, Lun = 0x%x\n",\r
@@ -741,7 +741,7 @@ srp_start_io(
 #endif\r
                default:\r
                        p_srb->SrbStatus = SRB_STATUS_INVALID_REQUEST;\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 "\r
                                           "Function = %s(0x%x), Path = 0x%x, "\r
                                           "Target = 0x%x, Lun = 0x%x\n",\r
@@ -756,7 +756,7 @@ srp_start_io(
 \r
        }\r
 \r
-       SRP_EXIT( SRP_DBG_DEBUG );\r
+       SRP_EXIT( SRP_DBG_DATA );\r
 \r
        return ( TRUE );\r
 }\r
@@ -856,14 +856,14 @@ srp_build_io(
        IN              PVOID                       p_dev_ext,\r
        IN              PSCSI_REQUEST_BLOCK         p_srb )\r
 {\r
-       SRP_ENTER( SRP_DBG_DEBUG );\r
+       SRP_ENTER( SRP_DBG_DATA );\r
 \r
        if ( p_srb->Function == SRB_FUNCTION_EXECUTE_SCSI )\r
        {\r
 \r
                CL_ASSERT( p_srb->SrbExtension != NULL );\r
 \r
-               SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
+               SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DATA,\r
                                   ("Building I/O for Function = %s(0x%x), "\r
                                   "Path = 0x%x, Target = 0x%x, Lun = 0x%x\n",\r
                                   g_srb_function_name[p_srb->Function],\r
@@ -874,7 +874,7 @@ srp_build_io(
 \r
                if ( srp_format_io_request( p_dev_ext, p_srb ) == FALSE )\r
                {\r
-                       SRP_PRINT_EXIT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR,\r
+                       SRP_PRINT_EXIT( TRACE_LEVEL_ERROR, SRP_DBG_DATA,\r
                                                        ("Returning SrbStatus %s(0x%x) for "\r
                                                        "Function = %s(0x%x), Path = 0x%x, "\r
                                                        "Target = 0x%x, Lun = 0x%x\n",\r
@@ -892,7 +892,7 @@ srp_build_io(
                }\r
        }\r
 \r
-       SRP_EXIT( SRP_DBG_DEBUG );\r
+       SRP_EXIT( SRP_DBG_DATA );\r
 \r
        return ( TRUE );\r
 }\r
index affa246..f760ce0 100644 (file)
@@ -597,9 +597,9 @@ __srp_find_path(
                                                                        check_preference ) == TRUE )\r
                {\r
                        SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_PNP,\r
-                               ("Found path record (slid:%d dlid:%d) for %s.\n",\r
-                               p_path_rec->slid,\r
-                               p_path_rec->dlid,\r
+                               ("Found path record (slid:0x%x dlid:0x%x) for %s.\n",\r
+                               cl_ntoh16(p_path_rec->slid),\r
+                               cl_ntoh16(p_path_rec->dlid),\r
                                p_hba->ioc_info.profile.id_string) );\r
                        break;\r
                }\r
@@ -635,9 +635,9 @@ __srp_remove_path(
                cl_spinlock_acquire( &p_hba->path_record_list_lock );\r
 \r
                SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_PNP,\r
-                       ("Removing path record (slid:%d dlid:%d) for %s.\n",\r
-                       p_path_rec->slid,\r
-                       p_path_rec->dlid,\r
+                       ("Removing path record (slid:0x%x dlid:0x%x) for %s.\n",\r
+                       cl_ntoh16(p_path_rec->slid),\r
+                       cl_ntoh16(p_path_rec->dlid),\r
                        p_hba->ioc_info.profile.id_string) );\r
 \r
                cl_qlist_remove_item( &p_hba->path_record_list, &p_srp_path_record->list_item );\r
@@ -682,9 +682,9 @@ __srp_add_path(
        }\r
 \r
        SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_PNP,\r
-               ("Adding path record (slid:%d dlid:%d) for %s.\n",\r
-               p_path_rec->slid,\r
-               p_path_rec->dlid,\r
+               ("Adding path record (slid:0x%x dlid:0x%x) for %s.\n",\r
+               cl_ntoh16(p_path_rec->slid),\r
+               cl_ntoh16(p_path_rec->dlid),\r
                p_hba->ioc_info.profile.id_string) );\r
 \r
 \r
@@ -1072,9 +1072,9 @@ __srp_pnp_cb(
 \r
                case IB_PNP_IOC_PATH_REMOVE:\r
                        SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_PNP,\r
-                               ("IB_PNP_IOC_PATH_REMOVE (slid:%d dlid:%d) for %s.\n",\r
-                               p_ioc_path->path.slid,\r
-                               p_ioc_path->path.dlid,\r
+                               ("IB_PNP_IOC_PATH_REMOVE (slid:%x dlid:%x) for %s.\n",\r
+                               cl_ntoh16(p_ioc_path->path.slid),\r
+                               cl_ntoh16(p_ioc_path->path.dlid),\r
                                p_hba->ioc_info.profile.id_string));\r
 \r
                        p_srp_path_record = __srp_remove_path( p_hba, &p_ioc_path->path );\r
index ffeb7c7..3cef1aa 100644 (file)
@@ -54,7 +54,7 @@ __srp_destroying_session(
 {\r
        srp_session_t   *p_srp_session;\r
 \r
-       SRP_ENTER( SRP_DBG_PNP );\r
+       SRP_ENTER( SRP_DBG_SESSION );\r
 \r
        p_srp_session = PARENT_STRUCT( p_obj, srp_session_t, obj );\r
 \r
@@ -63,7 +63,7 @@ __srp_destroying_session(
        SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
                ("Session Object ref_cnt = %d\n", p_srp_session->obj.ref_cnt) );\r
 \r
-       SRP_EXIT( SRP_DBG_PNP );\r
+       SRP_EXIT( SRP_DBG_SESSION );\r
 }\r
 \r
 \r
@@ -82,7 +82,7 @@ __srp_cleanup_session(
 {\r
        srp_session_t   *p_srp_session;\r
 \r
-       SRP_ENTER( SRP_DBG_PNP );\r
+       SRP_ENTER( SRP_DBG_SESSION );\r
 \r
        p_srp_session = PARENT_STRUCT( p_obj, srp_session_t, obj );\r
 \r
@@ -111,7 +111,7 @@ __srp_cleanup_session(
        SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
                ("Session Object ref_cnt = %d\n", p_srp_session->obj.ref_cnt) );\r
 \r
-       SRP_EXIT( SRP_DBG_PNP );\r
+       SRP_EXIT( SRP_DBG_SESSION );\r
 }\r
 \r
 /* __srp_free_session */\r
@@ -129,7 +129,7 @@ __srp_free_session(
 {\r
        srp_session_t   *p_srp_session;\r
 \r
-       SRP_ENTER( SRP_DBG_PNP );\r
+       SRP_ENTER( SRP_DBG_SESSION );\r
 \r
        p_srp_session = PARENT_STRUCT( p_obj, srp_session_t, obj );\r
 \r
@@ -145,7 +145,7 @@ __srp_free_session(
 \r
        cl_free( p_srp_session );\r
 \r
-       SRP_EXIT( SRP_DBG_PNP );\r
+       SRP_EXIT( SRP_DBG_SESSION );\r
 }\r
 \r
 /* __srp_validate_service_entry */\r
@@ -170,7 +170,7 @@ __srp_validate_service_entry(
        uint64_t        multiplier = 1;\r
        ULONG           id_extension;\r
 \r
-       SRP_ENTER( SRP_DBG_PNP );\r
+       SRP_ENTER( SRP_DBG_SESSION );\r
 \r
        if ( cl_memcmp( p_svc_entry->name, SRP_SERVICE_NAME_PREFIX, strlen(SRP_SERVICE_NAME_PREFIX)) != 0 )\r
        {\r
@@ -214,7 +214,7 @@ __srp_validate_service_entry(
        *p_target_id_extension = cl_hton64( *p_target_id_extension );\r
 \r
 exit:\r
-       SRP_EXIT( SRP_DBG_PNP );\r
+       SRP_EXIT( SRP_DBG_SESSION );\r
 \r
        return ( status );\r
 }\r
@@ -240,7 +240,7 @@ srp_new_session(
        srp_session_t                   *p_srp_session = NULL;\r
        cl_status_t                             cl_status;\r
 \r
-       SRP_ENTER( SRP_DBG_PNP );\r
+       SRP_ENTER( SRP_DBG_SESSION );\r
 \r
        *p_status = __srp_validate_service_entry( p_svc_entry, &target_id_extension );\r
        if ( *p_status != IB_SUCCESS )\r
@@ -304,7 +304,7 @@ srp_new_session(
                p_srp_session->obj.ref_cnt) );\r
 \r
 exit:\r
-       SRP_EXIT( SRP_DBG_PNP );\r
+       SRP_EXIT( SRP_DBG_SESSION );\r
 \r
        return ( p_srp_session );\r
 }\r
@@ -323,7 +323,7 @@ srp_session_login(
 {\r
        ib_api_status_t status;\r
 \r
-       SRP_ENTER( SRP_DBG_PNP );\r
+       SRP_ENTER( SRP_DBG_SESSION );\r
 \r
        status = srp_init_hca( &p_srp_session->hca, p_srp_session->p_hba );\r
        if ( status != IB_SUCCESS )\r
@@ -341,6 +341,6 @@ srp_session_login(
                                                  p_srp_session );\r
 \r
 exit:\r
-       SRP_EXIT( SRP_DBG_PNP );\r
+       SRP_EXIT( SRP_DBG_SESSION );\r
        return ( status );\r
 }\r