From 280b46b10c98dd9092033899ce63c48abed0e988 Mon Sep 17 00:00:00 2001 From: sleybo Date: Wed, 7 Feb 2007 13:56:47 +0000 Subject: [PATCH] [MTHCA] remove macro HCA_PRINT_EXIT (no implementation in WPP) fix some cosmetics issues in prints git-svn-id: svn://openib.tc.cornell.edu/gen1@590 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86 --- trunk/hw/mthca/kernel/SOURCES | 3 +- trunk/hw/mthca/kernel/hca_debug.h | 32 ++--- trunk/hw/mthca/kernel/hca_direct.c | 63 ++++++--- trunk/hw/mthca/kernel/hca_mcast.c | 35 +++-- trunk/hw/mthca/kernel/hca_memory.c | 56 ++++++-- trunk/hw/mthca/kernel/hca_verbs.c | 203 +++++++++++++++++++++-------- trunk/hw/mthca/kernel/mt_verbs.c | 16 ++- 7 files changed, 279 insertions(+), 129 deletions(-) diff --git a/trunk/hw/mthca/kernel/SOURCES b/trunk/hw/mthca/kernel/SOURCES index f3b1a998..bff6b391 100644 --- a/trunk/hw/mthca/kernel/SOURCES +++ b/trunk/hw/mthca/kernel/SOURCES @@ -77,8 +77,7 @@ TARGETLIBS= \ C_DEFINES = $(C_DEFINES) -DEVENT_TRACING RUN_WPP= $(SOURCES) -km -ext: .c .h .C .H \ -scan:hca_debug.h \ - -func:HCA_PRINT(LEVEL,FLAGS,(MSG,...)) \ - -func:HCA_PRINT_EXIT(LEVEL,FLAGS,(MSG,...)) + -func:HCA_PRINT(LEVEL,FLAGS,(MSG,...)) !ENDIF # -func:HCA_PRINT_EV(LEVEL,FLAGS,(MSG,...)) \ diff --git a/trunk/hw/mthca/kernel/hca_debug.h b/trunk/hw/mthca/kernel/hca_debug.h index 31a48cab..18dba8f0 100644 --- a/trunk/hw/mthca/kernel/hca_debug.h +++ b/trunk/hw/mthca/kernel/hca_debug.h @@ -77,14 +77,17 @@ static void _build_str( const char * format, ... ) WPP_DEFINE_BIT( HCA_DBG_INIT) \ WPP_DEFINE_BIT( HCA_DBG_MAD) \ WPP_DEFINE_BIT( HCA_DBG_PO) \ + WPP_DEFINE_BIT( HCA_DBG_PD)\ WPP_DEFINE_BIT( HCA_DBG_CQ) \ WPP_DEFINE_BIT( HCA_DBG_QP) \ WPP_DEFINE_BIT( HCA_DBG_MEMORY) \ WPP_DEFINE_BIT( HCA_DBG_AV) \ WPP_DEFINE_BIT( HCA_DBG_SRQ) \ + WPP_DEFINE_BIT( HCA_DBG_MCAST) \ WPP_DEFINE_BIT( HCA_DBG_LOW) \ WPP_DEFINE_BIT( HCA_DBG_SHIM)) + #define WPP_GLOBALLOGGER @@ -100,11 +103,10 @@ static void _build_str( const char * format, ... ) // USEPREFIX(HCA_PRINT, "%!STDPREFIX! [MTHCA] :%!FUNC!() :"); // USESUFFIX(HCA_ENTER, " [MTHCA] :%!FUNC!()["); // USESUFFIX(HCA_EXIT, " [MTHCA] :%!FUNC!()]"); -// USEPREFIX(HCA_PRINT_EXIT, "%!STDPREFIX! [MTHCA] :%!FUNC!() :"); -// USESUFFIX(HCA_PRINT_EXIT, "[MTHCA] :%!FUNC!():]"); // end_wpp + #define HCA_PRINT_EV(_level_,_flag_,_msg_) \ { \ HCA_PRINT_EV_MDEV(_level_,_flag_,_msg_) \ @@ -125,14 +127,16 @@ static void _build_str( const char * format, ... ) #define HCA_DBG_PNP (1<<1) #define HCA_DBG_INIT (1 << 2) #define HCA_DBG_MAD (1 << 3) -#define HCA_DBG_PO (1 << 4) -#define HCA_DBG_QP (1 << 5) -#define HCA_DBG_CQ (1 << 6) -#define HCA_DBG_MEMORY (1 << 7) -#define HCA_DBG_AV (1<<8) -#define HCA_DBG_SRQ (1 << 9) -#define HCA_DBG_LOW (1 << 10) -#define HCA_DBG_SHIM (1 << 11) +#define HCA_DBG_PO (1 << 4) +#define HCA_DBG_PD (1<<5) +#define HCA_DBG_QP (1 << 6) +#define HCA_DBG_CQ (1 << 7) +#define HCA_DBG_MEMORY (1 << 8) +#define HCA_DBG_AV (1<<9) +#define HCA_DBG_SRQ (1 << 10) +#define HCA_DBG_MCAST (1<<11) +#define HCA_DBG_LOW (1 << 12) +#define HCA_DBG_SHIM (1 << 13) #if DBG @@ -168,14 +172,6 @@ static void _build_str( const char * format, ... ) HCA_PRINT(TRACE_LEVEL_VERBOSE, flags, ("]\n" )); -#define HCA_PRINT_EXIT(_level_,_flag_,_msg_) \ - {\ - if (status != IB_SUCCESS) {\ - HCA_PRINT(_level_,_flag_,_msg_);\ - }\ - HCA_EXIT(_flag_);\ - } - #endif //EVENT_TRACING diff --git a/trunk/hw/mthca/kernel/hca_direct.c b/trunk/hw/mthca/kernel/hca_direct.c index 1ef67a65..69e91355 100644 --- a/trunk/hw/mthca/kernel/hca_direct.c +++ b/trunk/hw/mthca/kernel/hca_direct.c @@ -81,8 +81,12 @@ mlnx_post_send ( status = IB_SUCCESS; err_post_send: - HCA_PRINT_EXIT(TRACE_LEVEL_ERROR , HCA_DBG_QP, - ("completes with ERROR status %s\n", IB_GET_ERR_STR(status))); + if (status != IB_SUCCESS) + { + HCA_PRINT(TRACE_LEVEL_ERROR , HCA_DBG_QP, + ("completes with ERROR status %s\n", IB_GET_ERR_STR(status))); + } + HCA_EXIT(HCA_DBG_QP); return status; } @@ -115,8 +119,12 @@ mlnx_post_recv ( status = IB_SUCCESS; err_post_recv: - HCA_PRINT_EXIT(TRACE_LEVEL_ERROR , HCA_DBG_QP, - ("completes with ERROR status %s\n", IB_GET_ERR_STR(status))); + if (status != IB_SUCCESS) + { + HCA_PRINT(TRACE_LEVEL_ERROR , HCA_DBG_QP, + ("completes with ERROR status %s\n", IB_GET_ERR_STR(status))); + } + HCA_EXIT(HCA_DBG_QP); return status; } @@ -132,11 +140,11 @@ mlnx_post_srq_recv ( struct ib_srq *ib_srq_p = (struct ib_srq *)h_srq; struct ib_device *ib_dev = ib_srq_p->device; - HCA_ENTER(HCA_DBG_QP); + HCA_ENTER(HCA_DBG_SRQ); err = ib_dev->post_srq_recv(ib_srq_p, p_recv_wr, pp_failed ); if (err) { - HCA_PRINT(TRACE_LEVEL_ERROR ,HCA_DBG_QP, + HCA_PRINT(TRACE_LEVEL_ERROR,HCA_DBG_SRQ, ("post_srq_recv failed (%d)\n", err)); if (err == -ENOMEM) status = IB_INSUFFICIENT_RESOURCES; @@ -148,8 +156,12 @@ mlnx_post_srq_recv ( status = IB_SUCCESS; err_post_recv: - HCA_PRINT_EXIT(TRACE_LEVEL_ERROR , HCA_DBG_QP, - ("completes with ERROR status %s\n", IB_GET_ERR_STR(status))); + if (status != IB_SUCCESS) + { + HCA_PRINT(TRACE_LEVEL_ERROR,HCA_DBG_SRQ, + ("completes with ERROR status %s\n", IB_GET_ERR_STR(status))); + } + HCA_EXIT(HCA_DBG_SRQ); return status; } @@ -198,11 +210,12 @@ mlnx_poll_cq ( status = IB_NOT_FOUND; err_invalid_params: - if (status != IB_NOT_FOUND){ - HCA_PRINT_EXIT(TRACE_LEVEL_ERROR , HCA_DBG_CQ, + if (status != IB_SUCCESS && status != IB_NOT_FOUND) + { + HCA_PRINT(TRACE_LEVEL_ERROR,HCA_DBG_CQ, ("completes with ERROR status %s\n", IB_GET_ERR_STR(status))); - }else - HCA_EXIT(HCA_DBG_CQ); + } + HCA_EXIT(HCA_DBG_CQ); return status; } @@ -217,18 +230,22 @@ mlnx_enable_cq_notify ( struct ib_cq *ib_cq_p = (struct ib_cq *)h_cq; PREP_IBDEV_FOR_PRINT(ib_cq_p->device); - HCA_ENTER(HCA_DBG_SHIM); + HCA_ENTER(HCA_DBG_CQ); // REARM CQ err = ib_req_notify_cq(ib_cq_p, (solicited) ? IB_CQ_SOLICITED : IB_CQ_NEXT_COMP ); if (err) { - HCA_PRINT(TRACE_LEVEL_ERROR ,HCA_DBG_SHIM, + HCA_PRINT(TRACE_LEVEL_ERROR,HCA_DBG_CQ, ("ib_req_notify_cq failed (%d)\n", err)); status = errno_to_iberr(err); } - HCA_PRINT_EXIT(TRACE_LEVEL_ERROR , HCA_DBG_SHIM, - ("completes with ERROR status %s\n", IB_GET_ERR_STR(status))); + if (status != IB_SUCCESS) + { + HCA_PRINT(TRACE_LEVEL_ERROR,HCA_DBG_CQ, + ("completes with ERROR status %s\n", IB_GET_ERR_STR(status))); + } + HCA_EXIT(HCA_DBG_CQ); return status; } @@ -242,17 +259,21 @@ mlnx_enable_ncomp_cq_notify ( struct ib_cq *ib_cq_p = (struct ib_cq *)h_cq; PREP_IBDEV_FOR_PRINT(ib_cq_p->device); - HCA_ENTER(HCA_DBG_SHIM); + HCA_ENTER(HCA_DBG_CQ); err = ib_req_ncomp_notif(ib_cq_p, n_cqes ); if (err) { - HCA_PRINT(TRACE_LEVEL_ERROR ,HCA_DBG_SHIM, + HCA_PRINT(TRACE_LEVEL_ERROR,HCA_DBG_CQ, ("ib_req_ncomp_notif failed (%d)\n", err)); status = errno_to_iberr(err); } - HCA_PRINT_EXIT(TRACE_LEVEL_ERROR , HCA_DBG_SHIM, - ("completes with ERROR status %s\n", IB_GET_ERR_STR(status))); + if (status != IB_SUCCESS) + { + HCA_PRINT(TRACE_LEVEL_ERROR,HCA_DBG_CQ, + ("completes with ERROR status %s\n", IB_GET_ERR_STR(status))); + } + HCA_EXIT(HCA_DBG_CQ); return status; } @@ -267,7 +288,7 @@ mlnx_bind_mw ( UNREFERENCED_PARAMETER(h_qp); UNREFERENCED_PARAMETER(p_mw_bind); UNREFERENCED_PARAMETER(p_rkey); - HCA_PRINT(TRACE_LEVEL_ERROR , HCA_DBG_SHIM ,("mlnx_bind_mw not implemented\n")); + HCA_PRINT(TRACE_LEVEL_ERROR,HCA_DBG_SHIM,("mlnx_bind_mw not implemented\n")); return IB_INVALID_CA_HANDLE; } diff --git a/trunk/hw/mthca/kernel/hca_mcast.c b/trunk/hw/mthca/kernel/hca_mcast.c index 42a17bd3..1df61bfa 100644 --- a/trunk/hw/mthca/kernel/hca_mcast.c +++ b/trunk/hw/mthca/kernel/hca_mcast.c @@ -61,11 +61,11 @@ mlnx_attach_mcast ( PREP_IBDEV_FOR_PRINT(ib_qp_p->device); mlnx_mcast_t *mcast_p; - HCA_ENTER(HCA_DBG_SHIM); + HCA_ENTER(HCA_DBG_MCAST); // sanity checks if( p_umv_buf && p_umv_buf->command ) { - HCA_PRINT(TRACE_LEVEL_ERROR , HCA_DBG_SHIM, + HCA_PRINT(TRACE_LEVEL_ERROR , HCA_DBG_MCAST, ("User mode is not supported yet\n")); status = IB_UNSUPPORTED; goto err_user_unsupported; @@ -95,7 +95,7 @@ mlnx_attach_mcast ( else { err = ibv_attach_mcast(ib_qp_p, (union ib_gid *)p_mcast_gid, (u16)mcast_lid); if (err) { - HCA_PRINT(TRACE_LEVEL_ERROR ,HCA_DBG_SHIM , + HCA_PRINT(TRACE_LEVEL_ERROR,HCA_DBG_MCAST, ("ibv_attach_mcast failed (%d)\n", err)); status = errno_to_iberr(err); goto err_attach; @@ -106,7 +106,8 @@ mlnx_attach_mcast ( mcast_p->ib_qp_p = ib_qp_p; mcast_p->mcast_lid = mcast_lid; RtlCopyMemory(mcast_p->mcast_gid.raw, p_mcast_gid->raw, sizeof *p_mcast_gid); - HCA_PRINT(TRACE_LEVEL_INFORMATION, HCA_DBG_SHIM, ("mcasth %p, qp_p %p, mlid %hx, mgid %I64x`%I64x\n", + HCA_PRINT(TRACE_LEVEL_INFORMATION,HCA_DBG_MCAST, + ("mcasth %p, qp_p %p, mlid %hx, mgid %I64x`%I64x\n", mcast_p, mcast_p->ib_qp_p, mcast_p->mcast_lid, cl_ntoh64(*(uint64_t*)&mcast_p->mcast_gid.raw[0]), cl_ntoh64(*(uint64_t*)&mcast_p->mcast_gid.raw[8] ))); @@ -124,8 +125,12 @@ err_invalid_param: err_unsupported: err_user_unsupported: end: - HCA_PRINT_EXIT(TRACE_LEVEL_ERROR , HCA_DBG_SHIM, - ("completes with ERROR status %s\n", IB_GET_ERR_STR(status))); + if (status != IB_SUCCESS) + { + HCA_PRINT(TRACE_LEVEL_ERROR, HCA_DBG_MCAST, + ("completes with ERROR status %s\n", IB_GET_ERR_STR(status))); + } + HCA_EXIT(HCA_DBG_MCAST); return status; } @@ -138,10 +143,12 @@ mlnx_detach_mcast ( mlnx_mcast_t *mcast_p = (mlnx_mcast_t*)h_mcast; struct ib_device *ib_dev; + + HCA_ENTER(HCA_DBG_MCAST); // sanity check if (!mcast_p || !mcast_p->ib_qp_p) { - HCA_PRINT(TRACE_LEVEL_ERROR , HCA_DBG_SHIM, + HCA_PRINT(TRACE_LEVEL_ERROR , HCA_DBG_MCAST, ("completes with ERROR status IB_INVALID_PARAMETER\n")); status = IB_INVALID_PARAMETER; goto err_invalid_param; @@ -154,7 +161,8 @@ mlnx_detach_mcast ( } - HCA_PRINT(TRACE_LEVEL_INFORMATION, HCA_DBG_SHIM,("mcasth %p, qp_p %p, mlid %hx, mgid %I64x`%I64x\n", + HCA_PRINT(TRACE_LEVEL_INFORMATION,HCA_DBG_MCAST, + ("mcasth %p, qp_p %p, mlid %hx, mgid %I64x`%I64x\n", mcast_p, mcast_p->ib_qp_p, mcast_p->mcast_lid, *(uint64_t*)&mcast_p->mcast_gid.raw[0], *(uint64_t*)&mcast_p->mcast_gid.raw[8] )); @@ -163,7 +171,8 @@ mlnx_detach_mcast ( err = ibv_detach_mcast( mcast_p->ib_qp_p, (union ib_gid *)&mcast_p->mcast_gid, mcast_p->mcast_lid ); if (err) { - HCA_PRINT(TRACE_LEVEL_ERROR ,HCA_DBG_SHIM ,("ibv_detach_mcast failed (%d)\n", err)); + HCA_PRINT(TRACE_LEVEL_ERROR,HCA_DBG_MCAST, + ("ibv_detach_mcast failed (%d)\n", err)); status = errno_to_iberr(err); goto err_detach_mcast; } @@ -173,9 +182,13 @@ mlnx_detach_mcast ( err_detach_mcast: kfree(mcast_p); err_unsupported: - HCA_PRINT(TRACE_LEVEL_ERROR , HCA_DBG_SHIM , - ("completes with ERROR status %s\n", IB_GET_ERR_STR(status))); err_invalid_param: + if (status != IB_SUCCESS) + { + HCA_PRINT(TRACE_LEVEL_ERROR, HCA_DBG_MCAST, + ("completes with ERROR status %d\n", status)); + } + HCA_EXIT(HCA_DBG_MCAST); return status; } diff --git a/trunk/hw/mthca/kernel/hca_memory.c b/trunk/hw/mthca/kernel/hca_memory.c index 90b4e893..e3fdcd6c 100644 --- a/trunk/hw/mthca/kernel/hca_memory.c +++ b/trunk/hw/mthca/kernel/hca_memory.c @@ -107,8 +107,12 @@ err_reg_mr: err_invalid_access: err_invalid_parm: err_unsupported: - HCA_PRINT_EXIT(TRACE_LEVEL_ERROR ,HCA_DBG_MEMORY, - ("completes with ERROR status %s\n", IB_GET_ERR_STR(status))); + if (status != IB_SUCCESS) + { + HCA_PRINT(TRACE_LEVEL_ERROR ,HCA_DBG_MEMORY, + ("completes with ERROR status %s\n", IB_GET_ERR_STR(status))); + } + HCA_EXIT(HCA_DBG_MEMORY); return status; } @@ -189,8 +193,12 @@ err_reg_phys_mr: err_invalid_parm: err_unsupported: err_mem: - HCA_PRINT_EXIT(TRACE_LEVEL_ERROR , HCA_DBG_MEMORY, - ("completes with ERROR status %s\n", IB_GET_ERR_STR(status))); + if (status != IB_SUCCESS) + { + HCA_PRINT(TRACE_LEVEL_ERROR ,HCA_DBG_MEMORY, + ("completes with ERROR status %s\n", IB_GET_ERR_STR(status))); + } + HCA_EXIT(HCA_DBG_MEMORY); return status; } @@ -311,8 +319,12 @@ done: err_dereg_mr: err_unsupported: - HCA_PRINT_EXIT(TRACE_LEVEL_ERROR , HCA_DBG_MEMORY, - ("completes with ERROR status %s\n", IB_GET_ERR_STR(status))); + if (status != IB_SUCCESS) + { + HCA_PRINT(TRACE_LEVEL_ERROR ,HCA_DBG_MEMORY, + ("completes with ERROR status %s\n", IB_GET_ERR_STR(status))); + } + HCA_EXIT(HCA_DBG_MEMORY); return status; } @@ -372,8 +384,12 @@ mlnx_alloc_fmr( err_alloc_fmr: err_invalid_parm: err_unsupported: - HCA_PRINT_EXIT(TRACE_LEVEL_ERROR , HCA_DBG_MEMORY, - ("completes with ERROR status %s\n", IB_GET_ERR_STR(status))); + if (status != IB_SUCCESS) + { + HCA_PRINT(TRACE_LEVEL_ERROR ,HCA_DBG_MEMORY, + ("completes with ERROR status %s\n", IB_GET_ERR_STR(status))); + } + HCA_EXIT(HCA_DBG_MEMORY); return status; } @@ -413,8 +429,12 @@ mlnx_map_phys_fmr ( status = IB_SUCCESS; err_dealloc_fmr: - HCA_PRINT_EXIT(TRACE_LEVEL_ERROR , HCA_DBG_MEMORY, - ("completes with ERROR status %s\n", IB_GET_ERR_STR(status))); + if (status != IB_SUCCESS) + { + HCA_PRINT(TRACE_LEVEL_ERROR ,HCA_DBG_MEMORY, + ("completes with ERROR status %s\n", IB_GET_ERR_STR(status))); + } + HCA_EXIT(HCA_DBG_MEMORY); return status; } @@ -453,8 +473,12 @@ mlnx_unmap_fmr ( err_unmap_fmr: err_unsupported: - HCA_PRINT_EXIT(TRACE_LEVEL_ERROR , HCA_DBG_MEMORY, - ("completes with ERROR status %s\n", IB_GET_ERR_STR(status))); + if (status != IB_SUCCESS) + { + HCA_PRINT(TRACE_LEVEL_ERROR ,HCA_DBG_MEMORY, + ("completes with ERROR status %s\n", IB_GET_ERR_STR(status))); + } + HCA_EXIT(HCA_DBG_MEMORY); return status; @@ -495,8 +519,12 @@ mlnx_dealloc_fmr ( err_dealloc_fmr: err_unsupported: - HCA_PRINT_EXIT(TRACE_LEVEL_ERROR , HCA_DBG_MEMORY, - ("completes with ERROR status %s\n", IB_GET_ERR_STR(status))); + if (status != IB_SUCCESS) + { + HCA_PRINT(TRACE_LEVEL_ERROR ,HCA_DBG_MEMORY, + ("completes with ERROR status %s\n", IB_GET_ERR_STR(status))); + } + HCA_EXIT(HCA_DBG_MEMORY); return status; } diff --git a/trunk/hw/mthca/kernel/hca_verbs.c b/trunk/hw/mthca/kernel/hca_verbs.c index 5cc8a2ac..5d8f74d6 100644 --- a/trunk/hw/mthca/kernel/hca_verbs.c +++ b/trunk/hw/mthca/kernel/hca_verbs.c @@ -74,8 +74,12 @@ mlnx_open_ca ( // find CA object p_hca = mlnx_hca_from_guid( ca_guid ); if( !p_hca ) { - HCA_PRINT_EXIT(TRACE_LEVEL_ERROR , HCA_DBG_SHIM, + if (status != IB_SUCCESS) + { + HCA_PRINT(TRACE_LEVEL_ERROR , HCA_DBG_SHIM, ("completes with ERROR status IB_NOT_FOUND\n")); + } + HCA_EXIT(HCA_DBG_SHIM); return IB_NOT_FOUND; } @@ -104,8 +108,12 @@ done: //err_mad_cache: err_set_cb: - HCA_PRINT_EXIT(TRACE_LEVEL_ERROR , HCA_DBG_SHIM, - ("completes with ERROR status %s\n", IB_GET_ERR_STR(status))); + if (status != IB_SUCCESS) + { + HCA_PRINT(TRACE_LEVEL_ERROR,HCA_DBG_SHIM, + ("completes with ERROR status %s\n", IB_GET_ERR_STR(status))); + } + HCA_EXIT(HCA_DBG_SHIM); return status; } @@ -306,7 +314,8 @@ err_byte_count: err_unsupported: err_user_unsupported: if( status != IB_INSUFFICIENT_MEMORY && status != IB_SUCCESS ) - HCA_PRINT(TRACE_LEVEL_ERROR , HCA_DBG_SHIM ,("completes with ERROR status %s\n", IB_GET_ERR_STR(status))); + HCA_PRINT(TRACE_LEVEL_ERROR, HCA_DBG_SHIM, + ("completes with ERROR status %s\n", IB_GET_ERR_STR(status))); HCA_EXIT(HCA_DBG_SHIM); return status; } @@ -368,7 +377,12 @@ mlnx_modify_ca ( err_modify_port: err_port: err_unsupported: - HCA_PRINT_EXIT(TRACE_LEVEL_ERROR , HCA_DBG_SHIM ,("completes with ERROR status %s\n", IB_GET_ERR_STR(status))); + if (status != IB_SUCCESS) + { + HCA_PRINT(TRACE_LEVEL_ERROR, HCA_DBG_SHIM, + ("completes with ERROR status %s\n", IB_GET_ERR_STR(status))); + } + HCA_EXIT(HCA_DBG_SHIM); return status; } @@ -482,8 +496,12 @@ err_alloc_ucontext: end: if (p_umv_buf && p_umv_buf->command) p_umv_buf->status = status; - HCA_PRINT_EXIT(TRACE_LEVEL_ERROR , HCA_DBG_SHIM, - ("completes with ERROR status %s\n", IB_GET_ERR_STR(status))); + if (status != IB_SUCCESS) + { + HCA_PRINT(TRACE_LEVEL_ERROR,HCA_DBG_SHIM, + ("completes with ERROR status %s\n", IB_GET_ERR_STR(status))); + } + HCA_EXIT(HCA_DBG_SHIM); return status; } @@ -532,7 +550,7 @@ mlnx_allocate_pd ( //TODO: how are we use it ? UNREFERENCED_PARAMETER(type); - HCA_ENTER(HCA_DBG_SHIM); + HCA_ENTER(HCA_DBG_PD); if( p_umv_buf ) { p_context = (struct ib_ucontext *)h_ca; @@ -548,7 +566,7 @@ mlnx_allocate_pd ( ib_pd_p = ibv_alloc_pd(ib_dev, p_context, p_umv_buf); if (IS_ERR(ib_pd_p)) { err = PTR_ERR(ib_pd_p); - HCA_PRINT(TRACE_LEVEL_ERROR , HCA_DBG_SHIM, + HCA_PRINT(TRACE_LEVEL_ERROR,HCA_DBG_PD, ("ibv_alloc_pd failed (%d)\n", err)); status = errno_to_iberr(err); goto err_alloc_pd; @@ -562,8 +580,12 @@ mlnx_allocate_pd ( err_alloc_pd: if (p_umv_buf && p_umv_buf->command) p_umv_buf->status = status; - HCA_PRINT_EXIT(TRACE_LEVEL_ERROR , HCA_DBG_SHIM, - ("completes with ERROR status %s\n", IB_GET_ERR_STR(status))); + if (status != IB_SUCCESS) + { + HCA_PRINT(TRACE_LEVEL_ERROR,HCA_DBG_PD, + ("completes with ERROR status %s\n", IB_GET_ERR_STR(status))); + } + HCA_EXIT(HCA_DBG_PD); return status; } @@ -576,15 +598,15 @@ mlnx_deallocate_pd ( struct ib_pd *ib_pd_p = (struct ib_pd *)h_pd; PREP_IBDEV_FOR_PRINT(ib_pd_p->device); - HCA_ENTER( HCA_DBG_QP); + HCA_ENTER( HCA_DBG_PD); - HCA_PRINT(TRACE_LEVEL_INFORMATION ,HCA_DBG_SHIM , + HCA_PRINT(TRACE_LEVEL_INFORMATION,HCA_DBG_PD, ("pcs %p\n", PsGetCurrentProcess())); // dealloc pd err = ibv_dealloc_pd( ib_pd_p ); if (err) { - HCA_PRINT(TRACE_LEVEL_ERROR ,HCA_DBG_SHIM + HCA_PRINT(TRACE_LEVEL_ERROR,HCA_DBG_PD ,("ibv_dealloc_pd failed (%d)\n", err)); status = errno_to_iberr(err); goto err_dealloc_pd; @@ -592,8 +614,12 @@ mlnx_deallocate_pd ( status = IB_SUCCESS; err_dealloc_pd: - HCA_PRINT_EXIT(TRACE_LEVEL_ERROR , HCA_DBG_SHIM + if (status != IB_SUCCESS) + { + HCA_PRINT(TRACE_LEVEL_ERROR, HCA_DBG_PD ,("completes with ERROR status %s\n", IB_GET_ERR_STR(status))); + } + HCA_EXIT(HCA_DBG_PD); return status; } @@ -652,8 +678,12 @@ err_alloc_av: err_inval_params: if (p_umv_buf && p_umv_buf->command) p_umv_buf->status = status; - HCA_PRINT_EXIT(TRACE_LEVEL_ERROR ,HCA_DBG_AV, - ("completes with ERROR status %s\n", IB_GET_ERR_STR(status))); + if (status != IB_SUCCESS) + { + HCA_PRINT(TRACE_LEVEL_ERROR,HCA_DBG_AV, + ("completes with ERROR status %s\n", IB_GET_ERR_STR(status))); + } + HCA_EXIT(HCA_DBG_AV); return status; } @@ -707,8 +737,12 @@ mlnx_query_av ( err_conv_mthca_av: err_user_unsupported: - HCA_PRINT_EXIT(TRACE_LEVEL_ERROR , HCA_DBG_AV, - ("completes with ERROR status %s\n", IB_GET_ERR_STR(status))); + if (status != IB_SUCCESS) + { + HCA_PRINT(TRACE_LEVEL_ERROR,HCA_DBG_AV, + ("completes with ERROR status %s\n", IB_GET_ERR_STR(status))); + } + HCA_EXIT(HCA_DBG_AV); return status; } @@ -727,7 +761,7 @@ mlnx_modify_av ( // sanity checks if( p_umv_buf && p_umv_buf->command ) { - HCA_PRINT(TRACE_LEVEL_ERROR ,HCA_DBG_AV, + HCA_PRINT(TRACE_LEVEL_ERROR,HCA_DBG_AV, ("User mode is not supported yet\n")); status = IB_UNSUPPORTED; goto err_user_unsupported; @@ -742,7 +776,7 @@ mlnx_modify_av ( //TODO: not implemented in low-level driver err = ibv_modify_ah(ib_ah_p, &ah_attr) if (err) { - HCA_PRINT (TRACE_LEVEL_ERROR, HCA_DBG_AV, + HCA_PRINT (TRACE_LEVEL_ERROR,HCA_DBG_AV, ("ibv_query_ah failed (%d)\n", err)); status = errno_to_iberr(err); goto err_query_ah; @@ -753,8 +787,12 @@ mlnx_modify_av ( #endif err_user_unsupported: - HCA_PRINT_EXIT(TRACE_LEVEL_ERROR , HCA_DBG_AV, - ("completes with ERROR status %s\n", IB_GET_ERR_STR(status))); + if (status != IB_SUCCESS) + { + HCA_PRINT(TRACE_LEVEL_ERROR,HCA_DBG_AV, + ("completes with ERROR status %s\n", IB_GET_ERR_STR(status))); + } + HCA_EXIT(HCA_DBG_AV); return status; } @@ -779,8 +817,12 @@ mlnx_destroy_av ( } err_destroy_ah: - HCA_PRINT_EXIT(TRACE_LEVEL_ERROR , HCA_DBG_AV, - ("completes with ERROR status %s\n", IB_GET_ERR_STR(status))); + if (status != IB_SUCCESS) + { + HCA_PRINT(TRACE_LEVEL_ERROR,HCA_DBG_AV, + ("completes with ERROR status %s\n", IB_GET_ERR_STR(status))); + } + HCA_EXIT(HCA_DBG_AV); return status; } @@ -849,8 +891,12 @@ err_create_srq: err_inval_params: if (p_umv_buf && p_umv_buf->command) p_umv_buf->status = status; - HCA_PRINT_EXIT(TRACE_LEVEL_ERROR ,HCA_DBG_SRQ, - ("completes with ERROR status %s\n", IB_GET_ERR_STR(status))); + if (status != IB_SUCCESS) + { + HCA_PRINT(TRACE_LEVEL_ERROR,HCA_DBG_SRQ, + ("completes with ERROR status %s\n", IB_GET_ERR_STR(status))); + } + HCA_EXIT(HCA_DBG_SRQ); return status; } @@ -878,8 +924,12 @@ mlnx_modify_srq ( status = errno_to_iberr(err); } - HCA_PRINT_EXIT(TRACE_LEVEL_ERROR , HCA_DBG_SRQ, - ("completes with ERROR status %s\n", IB_GET_ERR_STR(status))); + if (status != IB_SUCCESS) + { + HCA_PRINT(TRACE_LEVEL_ERROR,HCA_DBG_SRQ, + ("completes with ERROR status %s\n", IB_GET_ERR_STR(status))); + } + HCA_EXIT(HCA_DBG_SRQ); return status; } @@ -894,7 +944,7 @@ mlnx_query_srq ( struct ib_srq *ib_srq = (struct ib_srq *)h_srq; struct ib_device *ib_dev = ib_srq->device; UNUSED_PARAM(p_umv_buf); - UNUSED_PARAM_WOWPP(ib_dev); + UNUSED_PARAM_WOWPP(ib_dev); HCA_ENTER(HCA_DBG_SRQ); @@ -905,8 +955,12 @@ mlnx_query_srq ( status = errno_to_iberr(err); } - HCA_PRINT_EXIT(TRACE_LEVEL_ERROR , HCA_DBG_SRQ, - ("completes with ERROR status %s\n", IB_GET_ERR_STR(status))); + if (status != IB_SUCCESS) + { + HCA_PRINT(TRACE_LEVEL_ERROR,HCA_DBG_SRQ, + ("completes with ERROR status %s\n", IB_GET_ERR_STR(status))); + } + HCA_EXIT(HCA_DBG_SRQ); return status; } @@ -929,8 +983,12 @@ mlnx_destroy_srq ( status = errno_to_iberr(err); } - HCA_PRINT_EXIT(TRACE_LEVEL_ERROR , HCA_DBG_SRQ, - ("completes with ERROR status %s\n", IB_GET_ERR_STR(status))); + if (status != IB_SUCCESS) + { + HCA_PRINT(TRACE_LEVEL_ERROR,HCA_DBG_SRQ, + ("completes with ERROR status %s\n", IB_GET_ERR_STR(status))); + } + HCA_EXIT(HCA_DBG_SRQ); return status; } @@ -1023,8 +1081,12 @@ err_inval_params: end: if (p_umv_buf && p_umv_buf->command) p_umv_buf->status = status; - HCA_PRINT_EXIT(TRACE_LEVEL_ERROR ,HCA_DBG_QP , - ("completes with ERROR status %s\n", IB_GET_ERR_STR(status))); + if (status != IB_SUCCESS) + { + HCA_PRINT(TRACE_LEVEL_ERROR,HCA_DBG_QP, + ("completes with ERROR status %s\n", IB_GET_ERR_STR(status))); + } + HCA_EXIT(HCA_DBG_QP); return status; } @@ -1045,8 +1107,12 @@ mlnx_create_spl_qp ( status = _create_qp( h_pd, port_num, qp_context, p_create_attr, p_qp_attr, ph_qp, NULL ); - HCA_PRINT_EXIT(TRACE_LEVEL_ERROR , HCA_DBG_SHIM, - ("completes with ERROR status %s\n", IB_GET_ERR_STR(status))); + if (status != IB_SUCCESS) + { + HCA_PRINT(TRACE_LEVEL_ERROR,HCA_DBG_QP, + ("completes with ERROR status %s\n", IB_GET_ERR_STR(status))); + } + HCA_EXIT(HCA_DBG_QP); return status; } @@ -1072,8 +1138,12 @@ mlnx_create_qp ( status = _create_qp( h_pd, port_num, qp_context, p_create_attr, p_qp_attr, ph_qp, p_umv_buf ); - HCA_PRINT_EXIT(TRACE_LEVEL_ERROR ,HCA_DBG_QP, - ("completes with ERROR status %s\n", IB_GET_ERR_STR(status))); + if (status != IB_SUCCESS) + { + HCA_PRINT(TRACE_LEVEL_ERROR,HCA_DBG_QP, + ("completes with ERROR status %s\n", IB_GET_ERR_STR(status))); + } + HCA_EXIT(HCA_DBG_QP); return status; } @@ -1114,7 +1184,8 @@ mlnx_modify_qp ( // modify QP err = ibv_modify_qp(ib_qp_p, &qp_attr, qp_attr_mask); if (err) { - HCA_PRINT(TRACE_LEVEL_ERROR , HCA_DBG_QP ,("ibv_modify_qp failed (%d)\n", err)); + HCA_PRINT(TRACE_LEVEL_ERROR, HCA_DBG_QP, + ("ibv_modify_qp failed (%d)\n", err)); status = errno_to_iberr(err); goto err_modify_qp; } @@ -1149,8 +1220,12 @@ err_mode_unsupported: err_inval_params: if (p_umv_buf && p_umv_buf->command) p_umv_buf->status = status; - HCA_PRINT_EXIT(TRACE_LEVEL_ERROR , HCA_DBG_SHIM, - ("completes with ERROR status %s\n", IB_GET_ERR_STR(status))); + if (status != IB_SUCCESS) + { + HCA_PRINT(TRACE_LEVEL_ERROR,HCA_DBG_QP, + ("completes with ERROR status %s\n", IB_GET_ERR_STR(status))); + } + HCA_EXIT(HCA_DBG_QP); return status; } @@ -1163,7 +1238,6 @@ mlnx_query_qp ( ib_api_status_t status = IB_SUCCESS; struct ib_qp *ib_qp_p = (struct ib_qp *)h_qp; struct mthca_qp *qp_p = (struct mthca_qp *)ib_qp_p; - PREP_IBDEV_FOR_PRINT(ib_qp_p->device); UNREFERENCED_PARAMETER(p_umv_buf); @@ -1207,8 +1281,7 @@ mlnx_query_qp ( status = IB_SUCCESS; - HCA_PRINT_EXIT(TRACE_LEVEL_ERROR , HCA_DBG_QP, - ("completes with ERROR status %s\n", IB_GET_ERR_STR(status))); + HCA_EXIT(HCA_DBG_QP); return status; } @@ -1240,8 +1313,12 @@ mlnx_destroy_qp ( status = IB_SUCCESS; err_destroy_qp: - HCA_PRINT_EXIT(TRACE_LEVEL_ERROR ,HCA_DBG_QP, - ("completes with ERROR status %s\n", IB_GET_ERR_STR(status))); + if (status != IB_SUCCESS) + { + HCA_PRINT(TRACE_LEVEL_ERROR,HCA_DBG_QP, + ("completes with ERROR status %s\n", IB_GET_ERR_STR(status))); + } + HCA_EXIT(HCA_DBG_QP); return status; } @@ -1321,8 +1398,12 @@ err_inval_params: err_cqe: if (p_umv_buf && p_umv_buf->command) p_umv_buf->status = status; - HCA_PRINT_EXIT(TRACE_LEVEL_ERROR ,HCA_DBG_CQ, - ("completes with ERROR status %s\n", IB_GET_ERR_STR(status))); + if (status != IB_SUCCESS) + { + HCA_PRINT(TRACE_LEVEL_ERROR,HCA_DBG_CQ, + ("completes with ERROR status %s\n", IB_GET_ERR_STR(status))); + } + HCA_EXIT(HCA_DBG_CQ); return status; } @@ -1337,7 +1418,7 @@ mlnx_resize_cq ( if (p_umv_buf && p_umv_buf->command) { p_umv_buf->status = IB_UNSUPPORTED; } - HCA_PRINT(TRACE_LEVEL_ERROR , HCA_DBG_SHIM ,("mlnx_resize_cq not implemented\n")); + HCA_PRINT(TRACE_LEVEL_ERROR, HCA_DBG_CQ,("mlnx_resize_cq not implemented\n")); return IB_UNSUPPORTED; } @@ -1352,7 +1433,7 @@ mlnx_query_cq ( if (p_umv_buf && p_umv_buf->command) { p_umv_buf->status = IB_UNSUPPORTED; } - HCA_PRINT(TRACE_LEVEL_ERROR , HCA_DBG_SHIM ,("mlnx_query_cq not implemented\n")); + HCA_PRINT(TRACE_LEVEL_ERROR,HCA_DBG_CQ,("mlnx_query_cq not implemented\n")); return IB_UNSUPPORTED; } @@ -1368,7 +1449,7 @@ mlnx_destroy_cq ( HCA_ENTER( HCA_DBG_QP); - HCA_PRINT(TRACE_LEVEL_INFORMATION ,HCA_DBG_SHIM , + HCA_PRINT(TRACE_LEVEL_INFORMATION,HCA_DBG_CQ, ("cqn %#x, pcs %p\n", ((struct mthca_cq*)ib_cq_p)->cqn, PsGetCurrentProcess()) ); // destroy CQ @@ -1383,8 +1464,12 @@ mlnx_destroy_cq ( status = IB_SUCCESS; err_destroy_cq: - HCA_PRINT_EXIT(TRACE_LEVEL_ERROR , HCA_DBG_SHIM, - ("completes with ERROR status %s\n", IB_GET_ERR_STR(status))); + if (status != IB_SUCCESS) + { + HCA_PRINT(TRACE_LEVEL_ERROR,HCA_DBG_CQ, + ("completes with ERROR status %s\n", IB_GET_ERR_STR(status))); + } + HCA_EXIT(HCA_DBG_CQ); return status; } @@ -1498,8 +1583,12 @@ err_grh_alloc: cl_free(wc_p); err_wc_alloc: err_port_num: - HCA_PRINT_EXIT(TRACE_LEVEL_ERROR , HCA_DBG_MAD, - ("completes with ERROR status %s\n", IB_GET_ERR_STR(status))); + if (status != IB_SUCCESS) + { + HCA_PRINT(TRACE_LEVEL_ERROR,HCA_DBG_MAD, + ("completes with ERROR status %s\n", IB_GET_ERR_STR(status))); + } + HCA_EXIT(HCA_DBG_MAD); return status; } diff --git a/trunk/hw/mthca/kernel/mt_verbs.c b/trunk/hw/mthca/kernel/mt_verbs.c index b6bbcbe0..29955e3c 100644 --- a/trunk/hw/mthca/kernel/mt_verbs.c +++ b/trunk/hw/mthca/kernel/mt_verbs.c @@ -63,7 +63,7 @@ void ibv_um_close( struct ib_ucontext * h_um_ca ) context_p->is_removing = TRUE; if (atomic_read(&context_p->usecnt)) { - HCA_PRINT(TRACE_LEVEL_ERROR ,HCA_DBG_SHIM, + HCA_PRINT(TRACE_LEVEL_ERROR,HCA_DBG_SHIM, ("resources are not released (cnt %d)\n", context_p->usecnt)); status = IB_RESOURCE_BUSY; goto err_usage; @@ -71,20 +71,20 @@ void ibv_um_close( struct ib_ucontext * h_um_ca ) err = ibv_dealloc_pd( context_p->pd ); if (err) { - HCA_PRINT(TRACE_LEVEL_ERROR ,HCA_DBG_SHIM, + HCA_PRINT(TRACE_LEVEL_ERROR,HCA_DBG_SHIM, ("ibv_dealloc_pd failed (%d)\n", err)); status = errno_to_iberr(err); } err = mthca_dealloc_ucontext(context_p); if (err) { - HCA_PRINT(TRACE_LEVEL_ERROR ,HCA_DBG_SHIM, + HCA_PRINT(TRACE_LEVEL_ERROR,HCA_DBG_SHIM, ("mthca_dealloc_ucontext failed (%d)\n", err)); status = errno_to_iberr(err); goto err_dealloc_ucontext; } - HCA_PRINT(TRACE_LEVEL_INFORMATION ,HCA_DBG_SHIM, + HCA_PRINT(TRACE_LEVEL_INFORMATION,HCA_DBG_SHIM, ("pcs %p\n", PsGetCurrentProcess()) ); status = IB_SUCCESS; goto end; @@ -92,8 +92,12 @@ void ibv_um_close( struct ib_ucontext * h_um_ca ) err_dealloc_ucontext: err_usage: end: - HCA_PRINT_EXIT(TRACE_LEVEL_ERROR , HCA_DBG_SHIM, - ("completes with ERROR status %s\n", IB_GET_ERR_STR(status))); + if (status != IB_SUCCESS) + { + HCA_PRINT(TRACE_LEVEL_ERROR,HCA_DBG_SHIM, + ("completes with ERROR status %s\n", IB_GET_ERR_STR(status))); + } + HCA_EXIT(HCA_DBG_SHIM); return; } -- 2.41.0