[MTHCA] 1. Applied - with a little improvement - a patch, removing dependency of...
authortzachid <tzachid@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Wed, 29 Mar 2006 17:14:21 +0000 (17:14 +0000)
committertzachid <tzachid@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Wed, 29 Mar 2006 17:14:21 +0000 (17:14 +0000)
2. Applied a patch for support of user-mode calls without a UVP.
3. Applied a patch, eliminating usage of mt_time.h and its abstraction.
4. Cleaning: Removed most of the '#ifdef WIN_TO_BE_CHANGED' stuff.
5. Cleaning: Removed '#if 0'.

git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@259 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

35 files changed:
hw/dirs
hw/mthca/kernel/SOURCES
hw/mthca/kernel/hca_data.c
hw/mthca/kernel/hca_data.h
hw/mthca/kernel/hca_direct.c
hw/mthca/kernel/hca_driver.c
hw/mthca/kernel/hca_driver.h
hw/mthca/kernel/hca_mcast.c
hw/mthca/kernel/hca_memory.c
hw/mthca/kernel/hca_pci.c
hw/mthca/kernel/hca_pnp.c
hw/mthca/kernel/hca_smp.c
hw/mthca/kernel/hca_verbs.c
hw/mthca/kernel/mt_l2w.c
hw/mthca/kernel/mt_l2w.h
hw/mthca/kernel/mt_time.h [deleted file]
hw/mthca/kernel/mt_verbs.c
hw/mthca/kernel/mthca_av.c
hw/mthca/kernel/mthca_cmd.c
hw/mthca/kernel/mthca_cq.c
hw/mthca/kernel/mthca_eq.c
hw/mthca/kernel/mthca_mad.c
hw/mthca/kernel/mthca_mcg.c
hw/mthca/kernel/mthca_memfree.c
hw/mthca/kernel/mthca_mr.c
hw/mthca/kernel/mthca_qp.c
hw/mthca/user/mlnx_ual_av.c
hw/mthca/user/mlnx_ual_mrw.c
hw/mthca/user/mlnx_ual_qp.c
hw/mthca/user/mlnx_uvp.c
hw/mthca/user/mlnx_uvp.h
hw/mthca/user/mlnx_uvp_cq.c
hw/mthca/user/mlnx_uvp_qp.c
hw/mthca/user/mlnx_uvp_verbs.c
hw/mthca/user/mlnx_uvp_verbs.h

diff --git a/hw/dirs b/hw/dirs
index 0cf85a2..f65d556 100644 (file)
--- a/hw/dirs
+++ b/hw/dirs
@@ -1,2 +1,3 @@
 DIRS=\\r
-       mt23108\r
+       mt23108 \\r
+       mthca\r
index 3c9fe3c..66f4f52 100644 (file)
@@ -67,7 +67,6 @@ C_DEFINES=$(C_DEFINES) -DDRIVER -DDEPRECATE_DDK_FUNCTIONS -D__LITTLE_ENDIAN
 \r
 TARGETLIBS= \\r
        $(TARGETPATH)\*\complib.lib     \\r
-       $(TARGETPATH)\*\ibal.lib        \\r
        $(DDK_LIB_PATH)\wdmguid.lib\r
 \r
 \r
index 29d83fb..1fea7e8 100644 (file)
@@ -309,10 +309,8 @@ mlnx_conv_hca_cap(
 \r
                ibal_port_p->subnet_timeout = mthca_port_p->subnet_timeout;\r
                // ibal_port_p->local_ack_timeout = 3; // TBD: currently ~32 usec\r
-#if 0\r
-               HCA_PRINT(TRACE_LEVEL_INFORMATION, HCA_DBG_SHIM ,("Port %d port_guid 0x%I64x\n",\r
+               HCA_PRINT(TRACE_LEVEL_VERBOSE, HCA_DBG_SHIM ,("Port %d port_guid 0x%I64x\n",\r
                        ibal_port_p->port_num, ibal_port_p->port_guid));\r
-#endif\r
        }\r
 }\r
 \r
@@ -649,7 +647,8 @@ mlnx_conv_qp_modify_attr(
                                        qp_attr_p->max_dest_rd_atomic = modify_attr_p->state.rts.resp_res;\r
                                }\r
 \r
-#if 0\r
+#ifdef WIN_TO_BE_REMOVED\r
+               //TODO: do we need that ?\r
                // Linux patch 4793: PKEY_INDEX is not a legal parameter in the RTR->RTS transition.\r
 \r
                                // IB_QP_PKEY_INDEX \r
@@ -700,7 +699,8 @@ mlnx_conv_qp_modify_attr(
                                        qp_attr_p->max_dest_rd_atomic = modify_attr_p->state.rts.resp_res;\r
                                }\r
 \r
-#if 0\r
+#ifdef WIN_TO_BE_REMOVED\r
+               //TODO: do we need that ?\r
                // Linux patch 4793: PKEY_INDEX is not a legal parameter in the RTR->RTS transition.\r
 \r
                                // IB_QP_PKEY_INDEX \r
index 47575b9..ca0ba9e 100644 (file)
@@ -171,7 +171,6 @@ typedef struct _ib_ca {
        uint32_t           index;\r
        cl_async_proc_t     *async_proc_mgr_p;\r
        mlnx_cache_t            *cache; // Cached port attributes.\r
-       const void * __ptr64    p_dev_obj; // store underlying device object\r
 } mlnx_hob_t;\r
 \r
 typedef struct HOBUL_t {\r
@@ -210,7 +209,6 @@ typedef struct _mlnx_hca_t {
        struct mthca_dev *mdev;         // VP Driver device\r
        uint32_t                        hw_ver;                         // HCA HW version\r
        mlnx_hob_t              hob;                                    // HOB - IBAL-related HCA resources\r
-       mlnx_hobul_t    hobul;                                  // HOBUL - - IBAL-related kernel client resources\r
 \r
 #ifdef WIN_TO_BE_REMOVED \r
        // removed as it is found in p_ext->cl_ext.p_pdo\r
index cdece3e..8a68de9 100644 (file)
@@ -61,16 +61,17 @@ mlnx_post_send (
        int err;\r
        ib_api_status_t         status;\r
        struct ib_qp *ib_qp_p = (struct ib_qp *)h_qp;\r
-       struct ib_device *ib_dev_p = ib_qp_p->device;\r
-       \r
+       struct ib_device *ib_dev = ib_qp_p->device;\r
+\r
        HCA_ENTER(HCA_DBG_QP);\r
        \r
        // sanity checks\r
 \r
        // create CQ\r
-       err = ib_dev_p->post_send(ib_qp_p, p_send_wr, pp_failed );\r
+       err = ib_dev->post_send(ib_qp_p, p_send_wr, pp_failed );\r
        if (err) {\r
-               HCA_PRINT(TRACE_LEVEL_ERROR  , HCA_DBG_QP  ,("post_send failed (%d)\n", err));\r
+               HCA_PRINT(TRACE_LEVEL_ERROR  , HCA_DBG_QP,\r
+                       ("post_send failed (%d)\n", err));\r
                if (err == -ENOMEM)\r
                        status = IB_INSUFFICIENT_RESOURCES;\r
                else\r
@@ -81,7 +82,8 @@ mlnx_post_send (
        status = IB_SUCCESS;\r
                \r
 err_post_send: \r
-       HCA_PRINT_EXIT(TRACE_LEVEL_ERROR  , HCA_DBG_QP  ,("completes with ERROR status %s\n", ib_get_err_str(status)));\r
+       HCA_PRINT_EXIT(TRACE_LEVEL_ERROR  , HCA_DBG_QP,\r
+               ("completes with ERROR status %s\n", IB_GET_ERR_STR(status)));\r
        return status;\r
                                                                                                                                                        \r
 }\r
@@ -96,16 +98,17 @@ mlnx_post_recv (
        int err;\r
        ib_api_status_t         status;\r
        struct ib_qp *ib_qp_p = (struct ib_qp *)h_qp;\r
-       struct ib_device *ib_dev_p = ib_qp_p->device;\r
+       struct ib_device *ib_dev = ib_qp_p->device;\r
        \r
        HCA_ENTER(HCA_DBG_QP);\r
 \r
        // sanity checks\r
        \r
        // create CQ\r
-       err = ib_dev_p->post_recv(ib_qp_p, p_recv_wr, pp_failed );\r
+       err = ib_dev->post_recv(ib_qp_p, p_recv_wr, pp_failed );\r
        if (err) {\r
-               HCA_PRINT(TRACE_LEVEL_ERROR  ,HCA_DBG_QP  ,("post_recv failed (%d)\n", err));\r
+               HCA_PRINT(TRACE_LEVEL_ERROR  ,HCA_DBG_QP,\r
+                       ("post_recv failed (%d)\n", err));\r
                if (err == -ENOMEM)\r
                        status = IB_INSUFFICIENT_RESOURCES;\r
                else\r
@@ -116,7 +119,8 @@ mlnx_post_recv (
        status = IB_SUCCESS;\r
                \r
 err_post_recv: \r
-       HCA_PRINT_EXIT(TRACE_LEVEL_ERROR  , HCA_DBG_QP  ,("completes with ERROR status %s\n", ib_get_err_str(status)));\r
+       HCA_PRINT_EXIT(TRACE_LEVEL_ERROR  , HCA_DBG_QP,\r
+               ("completes with ERROR status %s\n", IB_GET_ERR_STR(status)));\r
        return status;\r
                                                                                                                                                        \r
 }\r
@@ -145,7 +149,8 @@ mlnx_poll_cq (
        int err;\r
        ib_api_status_t         status = IB_SUCCESS;\r
        struct ib_cq *ib_cq_p = (struct ib_cq *)h_cq;\r
-       \r
+       PREP_IBDEV_FOR_PRINT(ib_cq_p->device)\r
+\r
        HCA_ENTER(HCA_DBG_CQ);\r
 \r
        // sanity checks\r
@@ -157,14 +162,16 @@ mlnx_poll_cq (
        // poll CQ\r
        err = mthca_poll_cq_list(ib_cq_p, pp_free_wclist, pp_done_wclist );\r
        if (err) {\r
-               HCA_PRINT(TRACE_LEVEL_ERROR ,HCA_DBG_CQ ,("mthca_poll_cq_list failed (%d)\n", err));\r
+               HCA_PRINT(TRACE_LEVEL_ERROR ,HCA_DBG_CQ,\r
+                       ("mthca_poll_cq_list failed (%d)\n", err));\r
                status = errno_to_iberr(err);\r
        }else if (!*pp_done_wclist)\r
                status = IB_NOT_FOUND;\r
                \r
 err_invalid_params:    \r
        if (status != IB_NOT_FOUND){\r
-               HCA_PRINT_EXIT(TRACE_LEVEL_ERROR  , HCA_DBG_CQ  ,("completes with ERROR status %s\n", ib_get_err_str(status)));\r
+               HCA_PRINT_EXIT(TRACE_LEVEL_ERROR  , HCA_DBG_CQ,\r
+                       ("completes with ERROR status %s\n", IB_GET_ERR_STR(status)));\r
        }else\r
                HCA_EXIT(HCA_DBG_CQ);\r
        return status;\r
@@ -179,17 +186,20 @@ mlnx_enable_cq_notify (
        int err;\r
        ib_api_status_t         status = IB_SUCCESS;\r
        struct ib_cq *ib_cq_p = (struct ib_cq *)h_cq;\r
-       \r
+       PREP_IBDEV_FOR_PRINT(ib_cq_p->device)\r
+\r
        HCA_ENTER(HCA_DBG_SHIM);\r
 \r
        // REARM CQ\r
        err = ib_req_notify_cq(ib_cq_p, (solicited) ? IB_CQ_SOLICITED : IB_CQ_NEXT_COMP );\r
        if (err) {\r
-               HCA_PRINT(TRACE_LEVEL_ERROR   ,HCA_DBG_SHIM   ,("ib_req_notify_cq failed (%d)\n", err));\r
+               HCA_PRINT(TRACE_LEVEL_ERROR   ,HCA_DBG_SHIM,\r
+                       ("ib_req_notify_cq failed (%d)\n", err));\r
                status = errno_to_iberr(err);\r
        }\r
                \r
-       HCA_PRINT_EXIT(TRACE_LEVEL_ERROR  , HCA_DBG_SHIM  ,("completes with ERROR status %s\n", ib_get_err_str(status)));\r
+       HCA_PRINT_EXIT(TRACE_LEVEL_ERROR  , HCA_DBG_SHIM,\r
+               ("completes with ERROR status %s\n", IB_GET_ERR_STR(status)));\r
        return status;\r
 }\r
 \r
@@ -201,16 +211,19 @@ mlnx_enable_ncomp_cq_notify (
        int err;\r
        ib_api_status_t         status = IB_SUCCESS;\r
        struct ib_cq *ib_cq_p = (struct ib_cq *)h_cq;\r
+       PREP_IBDEV_FOR_PRINT(ib_cq_p->device)\r
 \r
        HCA_ENTER(HCA_DBG_SHIM);\r
 \r
        err = ib_req_ncomp_notif(ib_cq_p, n_cqes );\r
        if (err) {\r
-               HCA_PRINT(TRACE_LEVEL_ERROR   ,HCA_DBG_SHIM   ,("ib_req_ncomp_notif failed (%d)\n", err));\r
+               HCA_PRINT(TRACE_LEVEL_ERROR   ,HCA_DBG_SHIM,\r
+                       ("ib_req_ncomp_notif failed (%d)\n", err));\r
                status = errno_to_iberr(err);\r
        }\r
                \r
-       HCA_PRINT_EXIT(TRACE_LEVEL_ERROR  , HCA_DBG_SHIM  ,("completes with ERROR status %s\n", ib_get_err_str(status)));\r
+       HCA_PRINT_EXIT(TRACE_LEVEL_ERROR  , HCA_DBG_SHIM,\r
+               ("completes with ERROR status %s\n", IB_GET_ERR_STR(status)));\r
        return status;\r
 }\r
 \r
index 49b88eb..13e6239 100644 (file)
@@ -127,11 +127,6 @@ fw_flash_read_data (
                IN              ULONG                                                   offset,\r
                IN              ULONG POINTER_ALIGNMENT                 length );\r
 \r
-static NTSTATUS\r
-fw_flash_get_ca_guid(\r
-       IN              DEVICE_OBJECT           *p_dev_obj,\r
-       OUT             uint64_t                        *ca_guid );\r
-\r
 static NTSTATUS\r
 fw_flash_read4( \r
        IN                      BUS_INTERFACE_STANDARD  *p_BusInterface,\r
@@ -162,7 +157,6 @@ fw_flash_deinit(
 #pragma alloc_text (INIT, __read_registry)\r
 #pragma alloc_text (PAGE, hca_drv_unload)\r
 #pragma alloc_text (PAGE, hca_sysctl)\r
-#pragma alloc_text (PAGE, fw_flash_get_ca_guid)\r
 #endif\r
 \r
 NTSTATUS\r
@@ -197,9 +191,6 @@ DriverEntry(
 \r
        /*leo:  init function table */\r
        hca_init_vfptr();\r
-\r
-       /*leo: calibrate CPU */\r
-       MT_time_calibrate();\r
        \r
        p_driver_obj->MajorFunction[IRP_MJ_PNP] = cl_pnp;\r
        p_driver_obj->MajorFunction[IRP_MJ_POWER] = cl_power;\r
@@ -445,7 +436,7 @@ End:
 \r
 ib_api_status_t\r
 fw_access_ctrl(\r
-       IN              const   void* __ptr64                           p_context,\r
+       IN              const   ib_ca_handle_t                          h_ca,\r
        IN              const   void* __ptr64* const            handle_array    OPTIONAL,\r
        IN                              uint32_t                                        num_handles,\r
        IN                              ib_ci_op_t* const                       p_ci_op,\r
@@ -466,9 +457,13 @@ fw_access_ctrl(
        UNREFERENCED_PARAMETER(p_umv_buf);\r
 \r
        status =  STATUS_SUCCESS;\r
-       p_hob = (mlnx_hob_t *)(const void *)p_context;\r
 \r
-       p_dev_obj = (DEVICE_OBJECT *)(const void *)p_hob->p_dev_obj;\r
+       if( p_umv_buf )\r
+               p_hob = HOB_FROM_IBDEV( ((struct ib_ucontext*)h_ca)->device );\r
+       else\r
+               p_hob = (mlnx_hob_t *)(const void *)h_ca;\r
+\r
+       p_dev_obj = (DEVICE_OBJECT *)EXT_FROM_HOB(p_hob)->cl_ext.p_self_do;\r
        p_ci =  p_ci_op;\r
 \r
        if ( !p_ci )\r
@@ -482,52 +477,49 @@ fw_access_ctrl(
 \r
        switch ( p_ci->command )\r
        {\r
-               case    FW_READ: // read data from flash\r
-                               if ( if_ready )\r
-                               {\r
-                                       status = fw_flash_read_data(&BusInterface, p_data, offset, length);\r
-                               }\r
-                               break;\r
-               case    FW_WRITE: // write data to flash\r
-                               if ( if_ready )\r
-                               {\r
-\r
-                                       status = fw_flash_write_data(&BusInterface, p_data, offset, length);\r
-                               }\r
-                               break;\r
-               case    FW_READ_CMD:\r
-                               if ( if_ready )\r
-                               {\r
-                                       status = fw_access_pciconf(&BusInterface, 0 , p_data, offset, 4);\r
-                               }\r
-                               break;\r
-               case    FW_WRITE_CMD:\r
-                               if ( if_ready )\r
-                               {\r
-                                       status = fw_access_pciconf(&BusInterface, 1 , p_data, offset, 4);\r
-                               }\r
-                               break;\r
-               case    FW_CLOSE_IF: // close BusInterface\r
-                               if (if_ready )\r
-                               {\r
-                                       if_ready = 0;\r
-                                       BusInterface.InterfaceDereference((PVOID)BusInterface.Context);\r
-                               }\r
-                               return status;\r
-               case    FW_OPEN_IF: // open BusInterface\r
-                               if ( !if_ready )\r
-                               {\r
-                                       status = fw_get_pci_bus_interface(p_dev_obj, &BusInterface);\r
-                               \r
-                                       if ( NT_SUCCESS( status ) )\r
-                                       {\r
-                                               if_ready = 1;\r
-                                               status = STATUS_SUCCESS;\r
-                                       }\r
-                               }\r
-                               return status;\r
-               default:\r
-                               status = STATUS_NOT_SUPPORTED;\r
+       case FW_READ: // read data from flash\r
+               if ( if_ready )\r
+                       status = fw_flash_read_data(&BusInterface, p_data, offset, length);\r
+               break;\r
+\r
+       case FW_WRITE: // write data to flash\r
+               if ( if_ready )\r
+                       status = fw_flash_write_data(&BusInterface, p_data, offset, length);\r
+               break;\r
+\r
+       case FW_READ_CMD:\r
+               if ( if_ready )\r
+                       status = fw_access_pciconf(&BusInterface, 0 , p_data, offset, 4);\r
+               break;\r
+\r
+       case FW_WRITE_CMD:\r
+               if ( if_ready )\r
+                       status = fw_access_pciconf(&BusInterface, 1 , p_data, offset, 4);\r
+               break;\r
+\r
+       case FW_CLOSE_IF: // close BusInterface\r
+               if (if_ready )\r
+               {\r
+                       if_ready = 0;\r
+                       BusInterface.InterfaceDereference((PVOID)BusInterface.Context);\r
+               }\r
+               return status;\r
+\r
+       case FW_OPEN_IF: // open BusInterface\r
+               if ( !if_ready )\r
+               {\r
+                       status = fw_get_pci_bus_interface(p_dev_obj, &BusInterface);\r
+\r
+                       if ( NT_SUCCESS( status ) )\r
+                       {\r
+                               if_ready = 1;\r
+                               status = STATUS_SUCCESS;\r
+                       }\r
+               }\r
+               return status;\r
+\r
+       default:\r
+               status = STATUS_NOT_SUPPORTED;\r
        }\r
 \r
        if ( status != STATUS_SUCCESS )\r
@@ -618,77 +610,6 @@ fw_flash_read_data (
        return status;\r
 }\r
 \r
-static NTSTATUS\r
-fw_flash_get_ca_guid(\r
-               IN              DEVICE_OBJECT           *p_dev_obj,\r
-               OUT             net64_t                 *ca_guid )\r
-{\r
-       NTSTATUS                status = STATUS_SUCCESS;\r
-       BUS_INTERFACE_STANDARD          BusInterface;\r
-\r
-    uint32_t NODE_GUIDH, NODE_GUIDL;\r
-       uint32_t prim_ptr = 0;\r
-    uint32_t signature;\r
-\r
-       primary_sector_t        ps;\r
-       cl_memset( &ps, 0, sizeof(primary_sector_t));\r
-\r
-       status = fw_get_pci_bus_interface(p_dev_obj, &BusInterface);\r
-\r
-       if ( !NT_SUCCESS( status ) )\r
-               return status;\r
-       \r
-       status = fw_flash_init (&BusInterface);\r
-       if (status != STATUS_SUCCESS )\r
-               return status;\r
-    status = fw_flash_read_data(&BusInterface, &signature, 0x24, 4); \r
-       if (status != STATUS_SUCCESS )\r
-               return status;\r
-    //signature = cl_ntoh32(signature);\r
-\r
-    if (signature == FW_SIGNATURE)\r
-    {\r
-       //Fail Safe image\r
-        \r
-        // Assume flash has been verified, and both images have the same guids, therefore,\r
-        // we only need to read the primary image's guids\r
-        status = fw_flash_readbuf(&BusInterface, FW_SECT_SIZE, &ps, sizeof(ps));\r
-               if ( status == STATUS_SUCCESS )\r
-               {\r
-                       status = fw_flash_read_data(&BusInterface, &prim_ptr, ps.fi_addr+0x24, 4);\r
-                       if (status == STATUS_SUCCESS )\r
-                               prim_ptr = prim_ptr + ps.fi_addr;\r
-               }\r
-    }\r
-    else\r
-    {\r
-        // Short image\r
-        prim_ptr = signature;       \r
-    }\r
-\r
-    if ( signature == FW_SIGNATURE || prim_ptr < MAX_FLASH_SIZE )\r
-    {\r
-               /* now we can read ca guid\r
-                * since we read it in host mode fw_flash_read4() \r
-                * swaps it back in BE - how it was stored in FW\r
-                */\r
-        if (( status = fw_flash_read4(&BusInterface, prim_ptr, &NODE_GUIDL)) == STATUS_SUCCESS )\r
-                       if (( status = fw_flash_read4(&BusInterface, prim_ptr+4, &NODE_GUIDH)) == STATUS_SUCCESS )\r
-                       {\r
-                               *ca_guid = NODE_GUIDH;\r
-                               *ca_guid = (*ca_guid << 32) | NODE_GUIDL;\r
-                       }\r
-       }\r
-       else \r
-    {\r
-        //invalid GUID pointer\r
-        return STATUS_NO_SUCH_DEVICE;\r
-    }\r
-       fw_flash_deinit(&BusInterface);\r
-       BusInterface.InterfaceDereference((PVOID)BusInterface.Context);\r
-    return status;\r
-}\r
-\r
 static NTSTATUS\r
 fw_flash_read4( \r
        IN                      BUS_INTERFACE_STANDARD  *p_BusInterface,\r
@@ -701,14 +622,22 @@ fw_flash_read4(
        static uint32_t curr_bank =     0xffffffff;\r
 \r
        if (addr & 0x3)\r
+       {\r
+               HCA_PRINT( TRACE_LEVEL_ERROR, HCA_DBG_INIT,\r
+                       ("Invalid address %08x\n", addr) );\r
                return STATUS_INVALID_PARAMETER;\r
+       }\r
 \r
        bank = addr & BANK_MASK;\r
        if (bank !=  curr_bank)\r
        {\r
                curr_bank = bank;\r
                if ((status = fw_set_bank(p_BusInterface, bank)) != STATUS_SUCCESS )\r
+               {\r
+                       HCA_PRINT( TRACE_LEVEL_ERROR, HCA_DBG_INIT,\r
+                               ("fw_set_bank returned %08x\n", status) );\r
                        return STATUS_INVALID_PARAMETER;\r
+               }\r
        }\r
        status = fw_flash_read_data(p_BusInterface, &lcl_data, addr, 4);\r
        *p_data = cl_ntoh32(lcl_data);\r
@@ -729,11 +658,15 @@ fw_flash_readbuf(
     if (offset & 0x3)\r
     {\r
         //Address should be 4-bytes aligned\r
+               HCA_PRINT( TRACE_LEVEL_ERROR, HCA_DBG_INIT,\r
+                       ("Invalid address %08x\n", offset) );\r
         return STATUS_INVALID_PARAMETER;\r
     }\r
     if (len & 0x3)\r
     {\r
         //Length should be 4-bytes aligned\r
+               HCA_PRINT( TRACE_LEVEL_ERROR, HCA_DBG_INIT,\r
+                       ("Invalid length %d\n", len) );\r
         return STATUS_INVALID_PARAMETER;\r
     }\r
     p_lcl_data = (uint32_t *)p_data;\r
index 3099c4f..50c27f7 100644 (file)
@@ -160,7 +160,12 @@ typedef struct _hca_dev_ext
 #define HOB_FROM_IBDEV(dev_p)          (mlnx_hob_t *)&dev_p->mdev->ext->hca.hob\r
 \r
 \r
-\r
+#define IB_GET_ERR_STR ib_dev->mdev->ext->ci_ifc.get_err_str\r
+#if DBG || defined( EVENT_TRACING )\r
+#define PREP_IBDEV_FOR_PRINT(val)      struct ib_device *ib_dev = val;\r
+#else\r
+#define PREP_IBDEV_FOR_PRINT(val)      struct ib_device *ib_dev = val;\r
+#endif\r
 \r
 /***********************************\r
 Firmware Update definitions\r
index 5813b21..9e90576 100644 (file)
@@ -58,14 +58,15 @@ mlnx_attach_mcast (
        int err;\r
        ib_api_status_t         status;\r
        struct ib_qp *ib_qp_p = (struct ib_qp *)h_qp;\r
+       PREP_IBDEV_FOR_PRINT(ib_qp_p->device)\r
        mlnx_mcast_t *mcast_p;\r
 \r
        HCA_ENTER(HCA_DBG_SHIM);\r
 \r
        // sanity checks\r
        if( p_umv_buf && p_umv_buf->command ) {\r
-               HCA_PRINT(TRACE_LEVEL_ERROR , HCA_DBG_SHIM  ,("User mode is not supported yet\n"));\r
-               HCA_PRINT(TRACE_LEVEL_ERROR, HCA_DBG_SHIM ,("User mode is not supported yet\n"));\r
+               HCA_PRINT(TRACE_LEVEL_ERROR , HCA_DBG_SHIM,\r
+                       ("User mode is not supported yet\n"));\r
                status = IB_UNSUPPORTED;\r
                goto err_user_unsupported;\r
        }\r
@@ -88,7 +89,8 @@ mlnx_attach_mcast (
        else {\r
                err = ibv_attach_mcast(ib_qp_p, (union ib_gid *)p_mcast_gid, (u16)mcast_lid);\r
                if (err) {\r
-                       HCA_PRINT(TRACE_LEVEL_ERROR  ,HCA_DBG_SHIM  ,("ibv_attach_mcast failed (%d)\n", err));\r
+                       HCA_PRINT(TRACE_LEVEL_ERROR  ,HCA_DBG_SHIM  ,\r
+                               ("ibv_attach_mcast failed (%d)\n", err));\r
                        status = errno_to_iberr(err);\r
                        goto err_attach;\r
                }\r
@@ -115,7 +117,8 @@ err_no_mem:
 err_invalid_param:\r
 err_user_unsupported:\r
 end:           \r
-       HCA_PRINT_EXIT(TRACE_LEVEL_ERROR , HCA_DBG_SHIM ,("completes with ERROR status %s\n", ib_get_err_str(status)));\r
+       HCA_PRINT_EXIT(TRACE_LEVEL_ERROR , HCA_DBG_SHIM,\r
+               ("completes with ERROR status %s\n", IB_GET_ERR_STR(status)));\r
        return status;\r
 }\r
 \r
@@ -123,15 +126,21 @@ ib_api_status_t
 mlnx_detach_mcast (\r
        IN              const   ib_mcast_handle_t                       h_mcast)\r
 {\r
-       ib_api_status_t         status;\r
+       ib_api_status_t         status = IB_INVALID_PARAMETER;\r
        int err;\r
        mlnx_mcast_t *mcast_p = (mlnx_mcast_t*)h_mcast;\r
+       struct ib_device *ib_dev;\r
 \r
        // sanity check\r
-       if (!mcast_p || !mcast_p->ib_qp_p) {\r
-               status = IB_INVALID_PARAMETER;\r
-               goto err_invalid_param;\r
+       if (!mcast_p || !mcast_p->ib_qp_p)\r
+       {\r
+               HCA_PRINT_EXIT(TRACE_LEVEL_ERROR , HCA_DBG_SHIM,\r
+                       ("completes with ERROR status IB_INVALID_PARAMETER\n"));\r
+               return IB_INVALID_PARAMETER;\r
        }\r
+\r
+       ib_dev = mcast_p->ib_qp_p->device;\r
+\r
        HCA_PRINT(TRACE_LEVEL_WARNING, HCA_DBG_SHIM,("mcasth %p, qp_p %p, mlid %hx, mgid %I64x`%I64x\n", \r
                mcast_p, mcast_p->ib_qp_p, mcast_p->mcast_lid,\r
                *(uint64_t*)&mcast_p->mcast_gid.raw[0],\r
@@ -155,8 +164,8 @@ mlnx_detach_mcast (
 \r
 err_detach_mcast:\r
        kfree(mcast_p);\r
-err_invalid_param:     \r
-       HCA_PRINT_EXIT(TRACE_LEVEL_ERROR , HCA_DBG_SHIM ,("completes with ERROR status %s\n", ib_get_err_str(status)));\r
+       HCA_PRINT_EXIT(TRACE_LEVEL_ERROR , HCA_DBG_SHIM ,\r
+               ("completes with ERROR status %s\n", IB_GET_ERR_STR(status)));\r
        return status;\r
 }\r
 \r
index 96fbad0..0950f36 100644 (file)
@@ -31,8 +31,8 @@
  */\r
 \r
 \r
-#include "hca_driver.h"\r
 #include "hca_utils.h"\r
+#include "mthca_dev.h"\r
 \r
 #if defined(EVENT_TRACING)\r
 #ifdef offsetof\r
@@ -59,7 +59,8 @@ mlnx_register_mr (
        struct ib_mr *mr_p;\r
        struct mthca_mr *mro_p;\r
        struct ib_pd *ib_pd_p = (struct ib_pd *)h_pd;\r
-       \r
+       PREP_IBDEV_FOR_PRINT(ib_pd_p->device)\r
+\r
        HCA_ENTER(HCA_DBG_MEMORY);\r
 \r
        // sanity checks\r
@@ -68,7 +69,8 @@ mlnx_register_mr (
                goto err_unsupported;\r
        } \r
        if (!p_mr_create || 0 == p_mr_create->length) {\r
-               HCA_PRINT(TRACE_LEVEL_WARNING ,HCA_DBG_MEMORY ,("invalid attributes"));\r
+               HCA_PRINT(TRACE_LEVEL_WARNING ,HCA_DBG_MEMORY,\r
+                       ("invalid attributes"));\r
                status = IB_INVALID_PARAMETER;\r
                goto err_invalid_parm; \r
        }\r
@@ -78,7 +80,8 @@ mlnx_register_mr (
         */\r
        if (p_mr_create->access_ctrl & (IB_AC_RDMA_WRITE | IB_AC_ATOMIC) &&\r
            !(p_mr_create->access_ctrl & IB_AC_LOCAL_WRITE)) {\r
-               HCA_PRINT(TRACE_LEVEL_WARNING ,HCA_DBG_MEMORY ,("invalid access rights"));\r
+               HCA_PRINT(TRACE_LEVEL_WARNING ,HCA_DBG_MEMORY,\r
+                       ("invalid access rights"));\r
                status = IB_INVALID_PERMISSION;\r
                goto err_invalid_access; \r
        }               \r
@@ -93,7 +96,8 @@ mlnx_register_mr (
                        (int)p_mr_create->access_ctrl,\r
                        &iobuf );\r
                if (err) {\r
-                       HCA_PRINT(TRACE_LEVEL_ERROR ,HCA_DBG_MEMORY ,("iobuf_register failed(%d)",err));\r
+                       HCA_PRINT(TRACE_LEVEL_ERROR ,HCA_DBG_MEMORY,\r
+                               ("iobuf_register failed(%d)",err));\r
                        status = errno_to_iberr(err);\r
                        goto err_lock;\r
                }\r
@@ -142,7 +146,8 @@ err_lock:
 err_invalid_access:    \r
 err_invalid_parm:\r
 err_unsupported:\r
-       HCA_PRINT_EXIT(TRACE_LEVEL_ERROR ,HCA_DBG_MEMORY ,("completes with ERROR status %s\n", ib_get_err_str(status)));\r
+       HCA_PRINT_EXIT(TRACE_LEVEL_ERROR ,HCA_DBG_MEMORY,\r
+               ("completes with ERROR status %s\n", IB_GET_ERR_STR(status)));\r
        return status;\r
 }\r
 \r
@@ -161,7 +166,8 @@ mlnx_register_pmr (
        struct ib_mr *mr_p;\r
        struct ib_phys_buf *buffer_list;\r
        struct ib_pd *ib_pd_p = (struct ib_pd *)h_pd;\r
-       \r
+       PREP_IBDEV_FOR_PRINT(ib_pd_p->device)\r
+\r
        UNUSED_PARAM( um_call );\r
 \r
        HCA_ENTER(HCA_DBG_SHIM);\r
@@ -183,8 +189,11 @@ mlnx_register_pmr (
        //NB: p_pmr_create->hca_page_size is not used, i.e. supposed it is always the same\r
        \r
        // register pmr \r
-       if (p_pmr_create->length == (uint64_t)-1LL) \r
-               mr_p = ibv_get_dma_mr(ib_pd_p,  map_qp_ibal_acl(p_pmr_create->access_ctrl) );\r
+       if (p_pmr_create->length == (uint64_t)-1LL)\r
+       {\r
+               mr_p = ibv_get_dma_mr( ib_pd_p,\r
+                       map_qp_ibal_acl(p_pmr_create->access_ctrl) );\r
+       }\r
        else\r
                mr_p = ibv_reg_phys_mr(ib_pd_p, buffer_list, p_pmr_create->num_ranges, \r
                        map_qp_ibal_acl(p_pmr_create->access_ctrl), p_vaddr );\r
@@ -206,7 +215,8 @@ mlnx_register_pmr (
 err_reg_phys_mr:\r
 err_invalid_parm:\r
 err_unsupported:\r
-       HCA_PRINT_EXIT(TRACE_LEVEL_ERROR  , HCA_DBG_MEMORY  ,("completes with ERROR status %s\n", ib_get_err_str(status)));\r
+       HCA_PRINT_EXIT(TRACE_LEVEL_ERROR  , HCA_DBG_MEMORY,\r
+               ("completes with ERROR status %s\n", IB_GET_ERR_STR(status)));\r
        return status;\r
        \r
 }\r
@@ -297,6 +307,7 @@ mlnx_deregister_mr (
 {\r
        ib_api_status_t         status;\r
        int err;\r
+       PREP_IBDEV_FOR_PRINT(((struct ib_mr *)h_mr)->device)\r
 \r
        HCA_ENTER(HCA_DBG_SHIM);\r
 \r
@@ -328,7 +339,8 @@ mlnx_deregister_mr (
        \r
 err_dereg_mr:\r
 err_unsupported:\r
-       HCA_PRINT_EXIT(TRACE_LEVEL_ERROR  , HCA_DBG_MEMORY  ,("completes with ERROR status %s\n", ib_get_err_str(status)));\r
+       HCA_PRINT_EXIT(TRACE_LEVEL_ERROR  , HCA_DBG_MEMORY,\r
+               ("completes with ERROR status %s\n", IB_GET_ERR_STR(status)));\r
        return status;\r
                \r
 }\r
index 40342e4..171549d 100644 (file)
@@ -9,9 +9,6 @@
 #include <complib/cl_thread.h>\r
 #include <initguid.h>\r
 #include <wdmguid.h>\r
-#ifdef WIN_TO_BE_CHANGED\r
-#include <iba/hca_br_ifc.h>\r
-#endif\r
 \r
 #define HCA_RESET_HCR_OFFSET                           0x000F0010\r
 #define HCA_RESET_TOKEN                                                CL_HTON32(0x00000001)\r
@@ -404,7 +401,7 @@ hca_reset( DEVICE_OBJECT* const             pDevObj, int is_tavor )
        }\r
 \r
        if (is_tavor) {\r
-#if 0          \r
+#ifdef WIN_TO_BE_REMOVED\r
                /* Get the HCA Bridge's bus interface. */\r
                status = __get_bus_ifc( pDevObj, &GUID_HCA_BRIDGE_INTERFACE, &brBusIfc );\r
                if( !NT_SUCCESS( status ) )\r
@@ -686,7 +683,7 @@ hca_tune_pci(
                \r
                /* Update Max_Read_Request_Size. */\r
                HCA_PRINT( TRACE_LEVEL_WARNING ,HCA_DBG_PNP,\r
-                       ("Updating max recv byte count of PCI-X capability.\n"));\r
+                       ("Updating max recv byte count of PCI-Express capability.\n"));\r
                pPciExpCap->DevControl = (pPciExpCap->DevControl & ~PCI_EXP_DEVCTL_READRQ) | (5 << 12);\r
                len = hcaBusIfc.SetBusData( hcaBusIfc.Context, PCI_WHICHSPACE_CONFIG,\r
                        &pPciExpCap->DevControl,\r
index 216add0..24c2e73 100644 (file)
@@ -766,7 +766,7 @@ hca_start(
        {\r
                //TODO: no cleanup on error\r
                HCA_PRINT( TRACE_LEVEL_ERROR, HCA_DBG_PNP, \r
-                       ("mthca_start returned %08X\n", status));\r
+                       ("mthca_init_one returned %08X\n", status));\r
                return status;\r
        }\r
 \r
@@ -923,8 +923,6 @@ hca_query_bus_relations(
        IN                                      IRP* const                              p_irp, \r
                OUT                             cl_irp_action_t* const  p_action )\r
 {\r
-#ifndef WIN_TO_BE_CHANGED\r
-\r
        NTSTATUS                        status;\r
        DEVICE_RELATIONS        *p_rel;\r
        hca_dev_ext_t   *p_ext;\r
@@ -966,32 +964,6 @@ hca_query_bus_relations(
        *p_action = IrpPassDown;\r
        HCA_EXIT( HCA_DBG_PNP );\r
        return STATUS_SUCCESS;\r
-\r
-#else\r
-       return cl_irp_skip( p_dev_obj, p_irp, p_action );\r
-       //NTSTATUS      status;\r
-       //hca_dev_ext_t *p_ext;\r
-\r
-       //HCA_ENTER( HCA_DBG_PNP );\r
-\r
-       //p_ext = p_dev_obj->DeviceExtension;\r
-\r
-       //if( p_ext->state == HCA_REGISTERED )\r
-       //{\r
-       //      status = p_ext->ci_ifc.get_relations( p_ext->hca.guid, p_irp );\r
-       //      if( !NT_SUCCESS( status ) )\r
-       //      {\r
-       //              *p_action = IrpComplete;\r
-       //              HCA_PRINT( TRACE_LEVEL_ERROR,\r
-       //                      "AL get_relations returned %08x.\n", status);\r
-       //              return status;\r
-       //      }\r
-       //}\r
-\r
-       //*p_action = IrpPassDown;\r
-       //HCA_EXIT( HCA_DBG_PNP );\r
-       //return STATUS_SUCCESS;\r
-#endif \r
 }\r
 \r
 \r
index 84159d5..adb9d7e 100644 (file)
@@ -523,14 +523,12 @@ mlnx_local_mad (
        IN              const   ib_ca_handle_t                          h_ca,\r
        IN              const   uint8_t                                         port_num,\r
        IN              const   ib_mad_t                                        *p_mad_in,\r
-               OUT                     ib_mad_t                                        *p_mad_out )\r
+       OUT             ib_mad_t                                        *p_mad_out )\r
 {\r
-#ifndef WIN_TO_BE_CHANGED\r
-\r
        int err;\r
        ib_api_status_t         status = IB_SUCCESS;\r
        mlnx_hob_t                      *hob_p = (mlnx_hob_t *)h_ca;\r
-       struct ib_device *ib_dev_p = IBDEV_FROM_HOB( hob_p );\r
+       struct ib_device *ib_dev = IBDEV_FROM_HOB( hob_p );\r
        //TODO: do we need use flags (IB_MAD_IGNORE_MKEY, IB_MAD_IGNORE_BKEY) ?\r
        int mad_flags = 0;  \r
        struct _ib_wc *wc_p;\r
@@ -545,19 +543,7 @@ mlnx_local_mad (
                goto err_port_num;\r
        }\r
 \r
-#ifdef WIN_TO_BE_REMOVED\r
-       //TODO: seems like non need in that\r
-       //TODO: don't know: wr_id, pkey_index !!!\r
-       if (p_mad_in->mgmt_class == IB_MCLASS_SUBN_DIR) {\r
-               ib_smp_t *smp = (ib_smp_t *)p_mad_in;\r
-               u64 wr_id = 0;\r
-               u16 pkey_index = 0;\r
-               build_smp_wc(wr_id, cl_ntoh16(smp->dr_slid), pkey_index, port_num,  &wc);\r
-               wc_p = &wc;\r
-       }\r
-#else\r
        wc_p = NULL;\r
-#endif\r
        \r
        // debug print\r
        {\r
@@ -573,7 +559,7 @@ mlnx_local_mad (
        // process mad\r
        if( !mlnx_cachable_mad( h_ca, port_num, p_mad_in, p_mad_out ) )\r
        {\r
-               err = mthca_process_mad(ib_dev_p, mad_flags, (uint8_t)port_num, \r
+               err = mthca_process_mad(ib_dev, mad_flags, (uint8_t)port_num, \r
                        wc_p, grh_p, (struct ib_mad*)p_mad_in, (struct ib_mad*)p_mad_out);\r
                if (!err) {\r
                        HCA_PRINT( TRACE_LEVEL_ERROR, HCA_DBG_MAD, \r
@@ -591,67 +577,8 @@ mlnx_local_mad (
 \r
 err_process_mad:\r
 err_port_num:  \r
-       HCA_PRINT_EXIT(TRACE_LEVEL_ERROR  , HCA_DBG_MAD  ,("completes with ERROR status %s\n", ib_get_err_str(status)));\r
-       return status;\r
-       \r
-#else\r
-       ib_api_status_t         status;\r
-\r
-       mlnx_hob_t                      *hob_p = (mlnx_hob_t *)h_ca;\r
-       uint32_t                        hca_idx;\r
-       mlnx_hobul_t            *hobul_p;\r
-       HH_hca_dev_t            *hca_ul_info;\r
-\r
-       HCA_ENTER(HCA_DBG_MAD);\r
-\r
-       if (port_num > 2) {\r
-               status = IB_INVALID_PARAMETER;\r
-               goto cleanup;\r
-       }\r
-\r
-       if (!hob_p || E_MARK_CA != hob_p->mark) {\r
-               status = IB_INVALID_CA_HANDLE;\r
-               goto cleanup;\r
-       }\r
-\r
-       hca_idx = hob_p->index;\r
-       hobul_p = mlnx_hobul_array[hca_idx];\r
-       if (NULL == hobul_p) {\r
-               status = IB_INVALID_CA_HANDLE;\r
-               goto cleanup;\r
-       }\r
-\r
-       hca_ul_info = (HH_hca_dev_t *)hobul_p->hh_hndl;\r
-       if (NULL == hca_ul_info) {\r
-               status = IB_INVALID_CA_HANDLE;\r
-               goto cleanup;\r
-       }\r
-\r
-       if( !mlnx_cachable_mad( h_ca, port_num, p_mad_in, p_mad_out ) )\r
-       {\r
-               if( HH_OK != THH_hob_process_local_mad( hobul_p->hh_hndl, port_num,\r
-                       0x0, 0, (void *)p_mad_in, p_mad_out ) )\r
-               {\r
-                       HCA_PRINT( TRACE_LEVEL_ERROR, HCA_DBG_MAD, \r
-                               ("MAD failed:\n\tClass 0x%x\n\tMethod 0x%x\n\tAttr 0x%x",\r
-                               p_mad_in->mgmt_class, p_mad_in->method, p_mad_in->attr_id ));\r
-                       status = IB_ERROR;\r
-                       goto cleanup;\r
-               }\r
-\r
-               mlnx_update_cache( h_ca, port_num, p_mad_out );\r
-       }\r
-\r
-       /* Modify direction for Direct MAD */\r
-       if ( p_mad_in->mgmt_class == IB_MCLASS_SUBN_DIR )\r
-               p_mad_out->status |= IB_SMP_DIRECTION;\r
-\r
-       HCA_EXIT(HCA_DBG_MAD);\r
-       return IB_SUCCESS;\r
-\r
-cleanup:\r
-       HCA_PRINT(TRACE_LEVEL_ERROR  ,HCA_DBG_MAD  ,("status %d\n", status)));\r
-       HCA_EXIT(HCA_DBG_MAD);\r
+       HCA_PRINT_EXIT(TRACE_LEVEL_ERROR  , HCA_DBG_MAD,\r
+               ("completes with ERROR status %s\n", IB_GET_ERR_STR(status)));\r
        return status;\r
-#endif \r
 }\r
+       \r
index 0a6100a..ed458f8 100644 (file)
@@ -67,23 +67,27 @@ mlnx_open_ca (
        IN              const   void*const                                      ca_context,\r
                OUT                     ib_ca_handle_t                          *ph_ca)\r
 {\r
-#ifndef WIN_TO_BE_CHANGED\r
-\r
        mlnx_hca_t                              *p_hca;\r
-       ib_api_status_t status;\r
+       ib_api_status_t status = IB_NOT_FOUND;\r
        mlnx_cache_t    *p_cache;\r
+       struct ib_device *ib_dev;\r
 \r
        HCA_ENTER(HCA_DBG_SHIM);\r
-       HCA_PRINT(TRACE_LEVEL_INFORMATION  ,HCA_DBG_SHIM  ,("context 0x%p\n", ca_context));\r
+       HCA_PRINT(TRACE_LEVEL_INFORMATION  ,HCA_DBG_SHIM,\r
+               ("context 0x%p\n", ca_context));\r
 \r
        // find CA object\r
        p_hca = mlnx_hca_from_guid( ca_guid );\r
        if( !p_hca ) {\r
-               status = IB_NOT_FOUND;\r
-               goto err_hca_from_guid;\r
+               HCA_PRINT_EXIT(TRACE_LEVEL_ERROR  , HCA_DBG_SHIM,\r
+                       ("completes with ERROR status IB_NOT_FOUND\n"));\r
+               return IB_NOT_FOUND;\r
        }\r
 \r
-       HCA_PRINT(TRACE_LEVEL_INFORMATION  ,HCA_DBG_SHIM  ,("context 0x%p\n", ca_context));\r
+       ib_dev = &p_hca->mdev->ib_dev;\r
+\r
+       HCA_PRINT(TRACE_LEVEL_INFORMATION  ,HCA_DBG_SHIM,\r
+               ("context 0x%p\n", ca_context));\r
        status = mlnx_hobs_set_cb(&p_hca->hob,\r
                pfn_completion_cb,\r
                pfn_async_event_cb,\r
@@ -109,107 +113,9 @@ mlnx_open_ca (
 \r
 err_mad_cache:\r
 err_set_cb:\r
-err_hca_from_guid:     \r
-       HCA_PRINT_EXIT(TRACE_LEVEL_ERROR  , HCA_DBG_SHIM  ,("completes with ERROR status %s\n", ib_get_err_str(status)));\r
-       return status;\r
-\r
-#else\r
-       mlnx_hca_t                              *p_hca;\r
-       HH_hca_dev_t *                  hca_ul_info;\r
-       void *                                  hca_ul_resources_p = NULL; // (THH_hca_ul_resources_t *)\r
-       ib_api_status_t                 status;\r
-       mlnx_hob_t                              *new_ca = NULL;\r
-       MOSAL_protection_ctx_t  prot_ctx;\r
-\r
-       HCA_ENTER( HCA_DBG_SHIM);\r
-       HCA_PRINT(TRACE_LEVEL_INFORMATION, HCA_DBG_SHIM,"context 0x%p\n", ca_context)\r
-\r
-       // find CA object\r
-       p_hca = mlnx_hca_from_guid( ca_guid );\r
-       if( !p_hca ) {\r
-               HCA_EXIT( TRACE_LEVEL_VERBOSE );\r
-               return IB_NOT_FOUND;\r
-       }\r
-\r
-       hca_ul_info = p_hca->hh_hndl;\r
-\r
-       {\r
-               // We are opening the HCA in kernel mode.\r
-               // if a HOBKL exists for this device (i.e. it is open) - return E_BUSY\r
-               if (IB_SUCCESS == mlnx_hobs_lookup(p_hca->hh_hndl, &new_ca)) {\r
-                       if (ph_ca) *ph_ca = (ib_ca_handle_t)new_ca;\r
-                       HCA_EXIT( HCA_DBG_SHIM);\r
-                       return IB_RESOURCE_BUSY;\r
-               }\r
-\r
-               // Create a mapping from hca index to hh_hndl\r
-               status = mlnx_hobs_insert(p_hca, &new_ca);\r
-               if (IB_SUCCESS != status) {\r
-                       HCA_EXIT( HCA_DBG_SHIM);\r
-                       return status;\r
-               }\r
-\r
-               /* save copy of HCA device object */\r
-               new_ca->p_dev_obj = p_hca->p_dev_obj;\r
-\r
-               // Initialize the device driver\r
-               if (HH_OK != THH_hob_open_hca(p_hca->hh_hndl, NULL, NULL)) {\r
-                       status = IB_ERROR;\r
-                       goto cleanup;\r
-               }\r
-               \r
-               HCA_PRINT(TRACE_LEVEL_INFORMATION, HCA_DBG_SHIM,"context 0x%p\n", ca_context)\r
-               status = mlnx_hobs_set_cb(new_ca,\r
-                       pfn_completion_cb,\r
-                       pfn_async_event_cb,\r
-                       ca_context);\r
-               if (IB_SUCCESS != status) {\r
-                       goto cleanup;\r
-               }\r
-\r
-               HCA_PRINT(TRACE_LEVEL_INFORMATION, HCA_DBG_SHIM ,("ul_resource sizes: hca %d pd %d\n",\r
-                       hca_ul_info->hca_ul_resources_sz,\r
-                       hca_ul_info->pd_ul_resources_sz));\r
-\r
-               hca_ul_resources_p = cl_zalloc( hca_ul_info->hca_ul_resources_sz);\r
-\r
-               /* get the kernel protection context */ \r
-               prot_ctx = MOSAL_get_kernel_prot_ctx();\r
-       }\r
-\r
-       if (!hca_ul_resources_p) {\r
-               status = IB_INSUFFICIENT_MEMORY;\r
-               goto cleanup;\r
-       }\r
-\r
-       if (HH_OK != THH_hob_alloc_ul_res(p_hca->hh_hndl, prot_ctx, hca_ul_resources_p)) {\r
-               status = IB_ERROR;\r
-               goto cleanup;\r
-       }\r
-\r
-       // TBD: !!! in user mode (kernel hobul_idx != hob_idx)\r
-       status = mlnx_hobul_new(new_ca, p_hca->hh_hndl, hca_ul_resources_p);\r
-       if (IB_SUCCESS != status) {\r
-               goto cleanup;\r
-       }\r
-\r
-       // Return the HOBUL index\r
-       if (ph_ca) *ph_ca = new_ca;\r
-\r
-       HCA_EXIT( HCA_DBG_SHIM);\r
-       return IB_SUCCESS;\r
-\r
-cleanup:\r
-       if (hca_ul_resources_p)\r
-               cl_free( hca_ul_resources_p);\r
-       THH_hob_close_hca(p_hca->hh_hndl);\r
-       mlnx_hobs_remove(new_ca);\r
-\r
-       // For user mode call - return status to user mode\r
-       HCA_PRINT(TRACE_LEVEL_ERROR  ,HCA_DBG_SHIM  ,("status %d \n", status)));\r
-       HCA_EXIT( HCA_DBG_SHIM);\r
+       HCA_PRINT_EXIT(TRACE_LEVEL_ERROR  , HCA_DBG_SHIM,\r
+               ("completes with ERROR status %s\n", IB_GET_ERR_STR(status)));\r
        return status;\r
-#endif \r
 }\r
 \r
 ib_api_status_t\r
@@ -219,8 +125,6 @@ mlnx_query_ca (
        IN      OUT                     uint32_t                                        *p_byte_count,\r
        IN      OUT                     ci_umv_buf_t                            *p_umv_buf )\r
 {\r
-#ifndef WIN_TO_BE_CHANGED\r
-\r
        ib_api_status_t         status;\r
        uint32_t                        size, required_size;\r
        uint8_t                 port_num, num_ports;\r
@@ -354,21 +258,18 @@ mlnx_query_ca (
                        }\r
                }\r
 \r
-#if 0\r
-               HCA_PRINT(TRACE_LEVEL_INFORMATION, HCA_DBG_SHIM,"port %d gid0:", port_num)\r
+               HCA_PRINT(TRACE_LEVEL_VERBOSE, HCA_DBG_SHIM,("port %d gid0:", port_num));\r
                for (i = 0; i < 16; i++)\r
-                       HCA_PRINT(TRACE_LEVEL_INFORMATION, HCA_DBG_SHIM," 0x%x", p_ca_attr->p_port_attr[port_num].p_gid_table[0].raw[i])\r
-               HCA_PRINT(TRACE_LEVEL_INFORMATION, HCA_DBG_SHIM,"\n")\r
-#endif\r
+                       HCA_PRINT(TRACE_LEVEL_VERBOSE, HCA_DBG_SHIM,\r
+                               (" 0x%x", p_ca_attr->p_port_attr[port_num].p_gid_table[0].raw[i]));\r
+               HCA_PRINT(TRACE_LEVEL_VERBOSE, HCA_DBG_SHIM,("\n"));\r
        }\r
 \r
        // set result size\r
        p_ca_attr->size = required_size;\r
        CL_ASSERT( required_size == (((uintn_t)last_p) - ((uintn_t)p_ca_attr)) );\r
-#if 0\r
-               HCA_PRINT(TRACE_LEVEL_INFORMATION, HCA_DBG_SHIM ,HCA_DBG_SHIM ,("Space required %d used %d\n",\r
-                       required_size, ((uintn_t)last_p) - ((uintn_t)p_ca_attr))));\r
-#endif\r
+       HCA_PRINT(TRACE_LEVEL_VERBOSE, HCA_DBG_SHIM , ("Space required %d used %d\n",\r
+               required_size, (int)((uintn_t)last_p - (uintn_t)p_ca_attr) ));\r
        \r
        // !!! GID/PKEY tables must be queried before this call !!!\r
        mlnx_conv_hca_cap(ib_dev, &props, hca_ports, p_ca_attr);\r
@@ -385,169 +286,9 @@ err_query_device:
 err_byte_count:        \r
 err_user_unsupported:\r
        if( status != IB_INSUFFICIENT_MEMORY && status != IB_SUCCESS )\r
-               HCA_PRINT(TRACE_LEVEL_ERROR     , HCA_DBG_SHIM  ,("completes with ERROR status %s\n", ib_get_err_str(status)));\r
+               HCA_PRINT(TRACE_LEVEL_ERROR     , HCA_DBG_SHIM  ,("completes with ERROR status %s\n", IB_GET_ERR_STR(status)));\r
        HCA_EXIT(HCA_DBG_SHIM);\r
        return status;\r
-\r
-\r
-\r
-#else\r
-       ib_api_status_t         status;\r
-\r
-       mlnx_hob_t                      *hob_p = (mlnx_hob_t *)h_ca;\r
-       HH_hca_hndl_t           hh_hndl = NULL;\r
-       HH_hca_dev_t            *hca_ul_info;\r
-       VAPI_hca_cap_t          hca_cap;\r
-       VAPI_hca_port_t         *hca_ports = NULL;\r
-       uint32_t                        size, required_size;\r
-       uint8_t                 port_num, num_ports;\r
-       uint32_t                        num_gids, num_pkeys;\r
-       uint32_t                        num_page_sizes = 1; // TBD: what is actually supported\r
-       uint8_t                         *last_p;\r
-       void                            *hca_ul_resources_p = NULL;\r
-       uint32_t                        priv_op;\r
-\r
-       HCA_ENTER( HCA_DBG_SHIM);\r
-\r
-       if (NULL == p_byte_count) {\r
-               status = IB_INVALID_PARAMETER;\r
-               goto cleanup;\r
-       }\r
-\r
-       mlnx_hobs_get_handle(hob_p, &hh_hndl);\r
-       if (NULL == hh_hndl) {\r
-               HCA_PRINT(TRACE_LEVEL_INFORMATION  , HCA_DBG_SHIM  ,("returning E_NODEV dev\n")));\r
-               status = IB_INVALID_CA_HANDLE;\r
-               goto cleanup;\r
-       }\r
-\r
-       hca_ul_info = (HH_hca_dev_t *)hh_hndl;\r
-\r
-       if (HH_OK != THH_hob_query(hh_hndl, &hca_cap)) {\r
-               status = IB_ERROR;\r
-               goto cleanup;\r
-       }\r
-\r
-       num_ports = hca_cap.phys_port_num;   /* Number of physical ports of the HCA */             \r
-\r
-       if (NULL == (hca_ports = cl_zalloc( num_ports * sizeof(VAPI_hca_port_t)))) {\r
-               HCA_PRINT (TRACE_LEVEL_ERROR, HCA_DBG_SHIM,\r
-                       ("Failed to cl_zalloc ports array\n"));\r
-               status = IB_INSUFFICIENT_MEMORY;\r
-               goto cleanup;\r
-       }\r
-\r
-       // Loop on ports and get their properties\r
-       num_gids = 0;\r
-       num_pkeys = 0;\r
-       required_size = PTR_ALIGN(sizeof(ib_ca_attr_t)) +\r
-               PTR_ALIGN(sizeof(uint32_t) * num_page_sizes) +\r
-               PTR_ALIGN(sizeof(ib_port_attr_t) * num_ports);\r
-       for (port_num = 0; port_num < num_ports; port_num++) {\r
-               if (HH_OK != THH_hob_query_port_prop(hh_hndl, port_num+1, &hca_ports[port_num])) {\r
-                       status = IB_ERROR;\r
-                       goto cleanup;\r
-               }\r
-\r
-               num_gids  = hca_ports[port_num].gid_tbl_len;\r
-               size = PTR_ALIGN(sizeof(ib_gid_t)  * num_gids);\r
-               required_size += size;\r
-\r
-               num_pkeys = hca_ports[port_num].pkey_tbl_len;\r
-               size = PTR_ALIGN(sizeof(uint16_t) * num_pkeys);\r
-               required_size += size;\r
-       }\r
-\r
-       if (NULL == p_ca_attr || *p_byte_count < required_size) {\r
-               *p_byte_count = required_size;\r
-               status = IB_INSUFFICIENT_MEMORY;\r
-               if ( p_ca_attr != NULL) {\r
-                       HCA_PRINT (TRACE_LEVEL_ERROR, HCA_DBG_SHIM,\r
-                               ("Failed *p_byte_count < required_size\n"));\r
-               }\r
-               goto cleanup;\r
-       }\r
-\r
-       // Space is sufficient - setup table pointers\r
-       last_p = (uint8_t*)p_ca_attr;\r
-       last_p += PTR_ALIGN(sizeof(*p_ca_attr));\r
-\r
-       p_ca_attr->p_page_size = (uint32_t*)last_p;\r
-       last_p += PTR_ALIGN(num_page_sizes * sizeof(uint32_t));\r
-\r
-       p_ca_attr->p_port_attr = (ib_port_attr_t *)last_p;\r
-       last_p += PTR_ALIGN(num_ports * sizeof(ib_port_attr_t));\r
-\r
-       for (port_num = 0; port_num < num_ports; port_num++) {\r
-               p_ca_attr->p_port_attr[port_num].p_gid_table = (ib_gid_t *)last_p;\r
-               size = PTR_ALIGN(sizeof(ib_gid_t) * hca_ports[port_num].gid_tbl_len);\r
-               last_p += size;\r
-\r
-               p_ca_attr->p_port_attr[port_num].p_pkey_table = (uint16_t *)last_p;\r
-               size = PTR_ALIGN(sizeof(uint16_t) * hca_ports[port_num].pkey_tbl_len);\r
-               last_p += size;\r
-       }\r
-\r
-       // Separate the loops to ensure that table pointers are always setup\r
-       for (port_num = 0; port_num < num_ports; port_num++) {\r
-               status = mlnx_get_hca_pkey_tbl(hh_hndl, port_num+1,\r
-                       hca_ports[port_num].pkey_tbl_len,\r
-                       p_ca_attr->p_port_attr[port_num].p_pkey_table);\r
-               if (IB_SUCCESS != status) {\r
-                       HCA_PRINT (TRACE_LEVEL_ERROR, HCA_DBG_SHIM,\r
-                               ("Failed to mlnx_get_hca_pkey_tbl for port_num:%d\n",port_num));\r
-                       goto cleanup;\r
-               }\r
-\r
-               status = mlnx_get_hca_gid_tbl(hh_hndl, port_num+1,\r
-                       hca_ports[port_num].gid_tbl_len,\r
-                       &p_ca_attr->p_port_attr[port_num].p_gid_table[0].raw);\r
-               if (IB_SUCCESS != status) {\r
-                       HCA_PRINT (TRACE_LEVEL_ERROR, HCA_DBG_SHIM,\r
-                               ("Failed to mlnx_get_hca_gid_tbl for port_num:%d\n",port_num));\r
-                       goto cleanup;\r
-               }\r
-\r
-#if 0\r
-               {\r
-                       int i;\r
-\r
-                       HCA_PRINT(TRACE_LEVEL_INFORMATION, HCA_DBG_SHIM,("port %d gid0:", port_num));\r
-                       for (i = 0; i < 16; i++)\r
-                               HCA_PRINT(TRACE_LEVEL_INFORMATION, HCA_DBG_SHIM,(" 0x%x", p_ca_attr->p_port_attr[port_num].p_gid_table[0].raw[i]));\r
-                       HCA_PRINT(TRACE_LEVEL_INFORMATION, HCA_DBG_SHIM,("\n"));\r
-               }\r
-#endif\r
-       }\r
-\r
-       // Convert query result into IBAL structure (no cl_memset())\r
-       p_ca_attr->size = required_size;\r
-\r
-       // !!! GID/PKEY tables must be queried before this call !!!\r
-       mlnx_conv_vapi_hca_cap(hca_ul_info, &hca_cap, hca_ports, p_ca_attr);\r
-\r
-       // verify: required space == used space\r
-       CL_ASSERT( required_size == (((uintn_t)last_p) - ((uintn_t)p_ca_attr)) );\r
-\r
-#if 0\r
-       HCA_PRINT(TRACE_LEVEL_INFORMATION, HCA_DBG_SHIM ,HCA_DBG_SHIM ,("Space required %d used %d\n",\r
-               required_size,\r
-               ((uintn_t)last_p) - ((uintn_t)p_ca_attr))));\r
-#endif\r
-\r
-       if (hca_ul_resources_p) cl_free (hca_ul_resources_p);\r
-       if (hca_ports) cl_free( hca_ports );\r
-       HCA_EXIT( HCA_DBG_SHIM);\r
-       return IB_SUCCESS;\r
-\r
-cleanup:\r
-       if (hca_ul_resources_p) cl_free (hca_ul_resources_p);\r
-       if (hca_ports) cl_free( hca_ports);\r
-       if( p_ca_attr != NULL || status != IB_INSUFFICIENT_MEMORY )\r
-               HCA_PRINT(TRACE_LEVEL_ERROR  ,HCA_DBG_SHIM  ,("status %d\n", status)));\r
-       HCA_EXIT( HCA_DBG_SHIM);\r
-       return status;\r
-#endif \r
 }\r
 \r
 ib_api_status_t\r
@@ -557,8 +298,6 @@ mlnx_modify_ca (
        IN              const   ib_ca_mod_t                                     modca_cmd,\r
        IN              const   ib_port_attr_mod_t                      *p_port_attr)\r
 {\r
-#ifndef WIN_TO_BE_CHANGED\r
-\r
 #define SET_CAP_MOD(al_mask, al_fld, ib)               \\r
                if (modca_cmd & al_mask) {      \\r
                        if (p_port_attr->cap.##al_fld)          \\r
@@ -596,72 +335,14 @@ mlnx_modify_ca (
        status =        IB_SUCCESS;\r
 \r
 err_modify_port:\r
-       HCA_PRINT_EXIT(TRACE_LEVEL_ERROR  , HCA_DBG_SHIM  ,("completes with ERROR status %s\n", ib_get_err_str(status)));\r
-       return status;\r
-\r
-#else\r
-       ib_api_status_t                 status;\r
-\r
-       mlnx_hob_t                              *hob_p = (mlnx_hob_t *)h_ca;\r
-       HH_hca_hndl_t                   hh_hndl = NULL;\r
-\r
-       VAPI_hca_attr_t                 hca_attr;\r
-       VAPI_hca_attr_mask_t    hca_attr_mask = 0;\r
-\r
-       HCA_ENTER( HCA_DBG_SHIM);\r
-\r
-       mlnx_hobs_get_handle(hob_p, &hh_hndl);\r
-       if (NULL == hh_hndl) {\r
-               status = IB_INVALID_CA_HANDLE;\r
-               goto cleanup;\r
-       }\r
-\r
-       cl_memclr(&hca_attr, sizeof(hca_attr));\r
-       if (modca_cmd & IB_CA_MOD_IS_SM) {\r
-               hca_attr_mask |= HCA_ATTR_IS_SM;\r
-               hca_attr.is_sm = (MT_bool)p_port_attr->cap.sm;\r
-       }\r
-       if (modca_cmd & IB_CA_MOD_IS_SNMP_SUPPORTED) {\r
-               hca_attr_mask |= HCA_ATTR_IS_SNMP_TUN_SUP;\r
-               hca_attr.is_snmp_tun_sup = (MT_bool)p_port_attr->cap.snmp;\r
-       }\r
-       if (modca_cmd & IB_CA_MOD_IS_DEV_MGMT_SUPPORTED) {\r
-               hca_attr_mask |= HCA_ATTR_IS_DEV_MGT_SUP;\r
-               hca_attr.is_dev_mgt_sup = (MT_bool)p_port_attr->cap.dev_mgmt;\r
-       }\r
-       if (modca_cmd & IB_CA_MOD_IS_VEND_SUPPORTED) {\r
-               hca_attr_mask |= HCA_ATTR_IS_VENDOR_CLS_SUP;\r
-               hca_attr.is_vendor_cls_sup = (MT_bool)p_port_attr->cap.vend;\r
-       }\r
-       if (modca_cmd & IB_CA_MOD_QKEY_CTR) {\r
-               if (p_port_attr->qkey_ctr == 0)\r
-                       hca_attr.reset_qkey_counter = TRUE;\r
-       }\r
-\r
-       if (0 != hca_attr_mask) {\r
-               if (HH_OK != THH_hob_modify( hh_hndl, port_num, &hca_attr, &hca_attr_mask))\r
-               {\r
-                       status = IB_ERROR;\r
-                       goto cleanup;\r
-               }\r
-       }\r
-\r
-       HCA_EXIT( HCA_DBG_SHIM);\r
-       return IB_SUCCESS;\r
-\r
-cleanup:\r
-       HCA_PRINT(TRACE_LEVEL_ERROR  ,HCA_DBG_SHIM  ,("status %d\n",status)));\r
-       HCA_EXIT( HCA_DBG_SHIM);\r
+       HCA_PRINT_EXIT(TRACE_LEVEL_ERROR  , HCA_DBG_SHIM  ,("completes with ERROR status %s\n", IB_GET_ERR_STR(status)));\r
        return status;\r
-#endif \r
 }\r
 \r
 ib_api_status_t\r
 mlnx_close_ca (\r
        IN                              ib_ca_handle_t                          h_ca)\r
 {\r
-#ifndef WIN_TO_BE_CHANGED\r
-\r
        HCA_ENTER(HCA_DBG_SHIM);\r
 \r
        // release HOB resources\r
@@ -672,54 +353,6 @@ mlnx_close_ca (
        HCA_EXIT(HCA_DBG_SHIM);\r
        \r
        return IB_SUCCESS;\r
-\r
-#else\r
-       ib_api_status_t status;\r
-\r
-       HH_hca_hndl_t   hh_hndl = NULL;\r
-       mlnx_hob_t              *hob_p   = (mlnx_hob_t *)h_ca;\r
-       HH_hca_dev_t    *hca_ul_info;\r
-       void                    *hca_ul_resources_p = NULL;\r
-       mlnx_hobul_t    *hobul_p;\r
-\r
-       HCA_ENTER( HCA_DBG_SHIM);\r
-\r
-       hobul_p = mlnx_hobul_array[hob_p->index];\r
-       if( !hobul_p ) {\r
-               status = IB_INVALID_CA_HANDLE;\r
-               goto cleanup;\r
-       }\r
-\r
-       if( hobul_p->count ) {\r
-               status = IB_RESOURCE_BUSY;\r
-               goto cleanup;\r
-       }\r
-\r
-       mlnx_hobs_get_handle(hob_p, &hh_hndl);\r
-       if (NULL == hh_hndl) {\r
-               status = IB_INVALID_CA_HANDLE;\r
-               goto cleanup;\r
-       }\r
-\r
-       hca_ul_info = (HH_hca_dev_t *)hh_hndl;\r
-       mlnx_hobul_get(hob_p, &hca_ul_resources_p);\r
-\r
-       if (hca_ul_resources_p) {\r
-               THH_hob_free_ul_res(hh_hndl, hca_ul_resources_p);\r
-               cl_free( hca_ul_resources_p);\r
-       }\r
-       mlnx_hobul_delete(hob_p);\r
-       THH_hob_close_hca(hh_hndl);\r
-       mlnx_hobs_remove(hob_p);\r
-\r
-       HCA_EXIT( HCA_DBG_SHIM);\r
-       return IB_SUCCESS;\r
-\r
-cleanup:\r
-       HCA_PRINT(TRACE_LEVEL_ERROR  ,HCA_DBG_SHIM  ,("status %d\n",status)));\r
-       HCA_EXIT( HCA_DBG_SHIM);\r
-       return status;\r
-#endif\r
 }\r
 \r
 \r
@@ -729,8 +362,6 @@ mlnx_um_open(
        IN      OUT                     ci_umv_buf_t* const                     p_umv_buf,\r
                OUT                     ib_ca_handle_t* const           ph_um_ca )\r
 {\r
-#ifndef WIN_TO_BE_CHANGED\r
-\r
        int err;\r
        ib_api_status_t         status;\r
        mlnx_hob_t                      *hob_p = (mlnx_hob_t *)h_ca;\r
@@ -744,17 +375,27 @@ mlnx_um_open(
        HCA_ENTER(HCA_DBG_SHIM);\r
 \r
        // sanity check\r
-       if( !p_umv_buf || !p_umv_buf->command || !p_umv_buf->p_inout_buf ||\r
-               (p_umv_buf->output_size < sizeof *uresp_p) ) {\r
-               status = IB_INVALID_PARAMETER;\r
-               goto mlnx_um_open_err;\r
+       ASSERT( p_umv_buf );\r
+       if( !p_umv_buf->command )\r
+       {\r
+               context_p = cl_zalloc( sizeof(struct ib_ucontext) );\r
+               if( !context_p )\r
+               {\r
+                       status = IB_INSUFFICIENT_MEMORY;\r
+                       goto err_alloc_ucontext;\r
+               }\r
+               /* Copy the dev info. */\r
+               context_p->device = ib_dev;\r
+               p_umv_buf->output_size = 0;\r
+               goto done;\r
        }\r
 \r
        // create user context in kernel\r
        context_p = mthca_alloc_ucontext(ib_dev, p_umv_buf);\r
        if (IS_ERR(context_p)) {\r
                err = PTR_ERR(context_p);\r
-               HCA_PRINT(TRACE_LEVEL_ERROR  ,HCA_DBG_SHIM  ,("mthca_alloc_ucontext failed (%d)\n", err));\r
+               HCA_PRINT(TRACE_LEVEL_ERROR  ,HCA_DBG_SHIM,\r
+                       ("mthca_alloc_ucontext failed (%d)\n", err));\r
                status = errno_to_iberr(err);\r
                goto err_alloc_ucontext;\r
        }\r
@@ -767,7 +408,8 @@ mlnx_um_open(
        context_p->pd = ibv_alloc_pd(ib_dev, context_p, &umv_buf);\r
        if (IS_ERR(context_p->pd)) {\r
                err = PTR_ERR(context_p->pd);\r
-               HCA_PRINT(TRACE_LEVEL_ERROR  , HCA_DBG_SHIM  ,("ibv_alloc_pd failed (%d)\n", err));\r
+               HCA_PRINT(TRACE_LEVEL_ERROR  , HCA_DBG_SHIM,\r
+                       ("ibv_alloc_pd failed (%d)\n", err));\r
                status = errno_to_iberr(err);\r
                goto err_alloc_pd;\r
        }\r
@@ -779,7 +421,8 @@ mlnx_um_open(
        uresp_p->pdn = resp.pdn;\r
        uresp_p->vend_id = (uint32_t)ext_p->hcaConfig.VendorID;\r
        uresp_p->dev_id = (uint16_t)ext_p->hcaConfig.DeviceID;\r
-       \r
+\r
+done:\r
        // return the result\r
        if (ph_um_ca) *ph_um_ca = (ib_ca_handle_t)context_p;\r
 \r
@@ -789,118 +432,12 @@ mlnx_um_open(
 err_alloc_pd:\r
        mthca_dealloc_ucontext(context_p);\r
 err_alloc_ucontext: \r
-mlnx_um_open_err:      \r
 end:\r
        if (p_umv_buf && p_umv_buf->command) \r
                p_umv_buf->status = status;\r
-       HCA_PRINT_EXIT(TRACE_LEVEL_ERROR  , HCA_DBG_SHIM  ,("completes with ERROR status %s\n", ib_get_err_str(status)));\r
+       HCA_PRINT_EXIT(TRACE_LEVEL_ERROR  , HCA_DBG_SHIM,\r
+               ("completes with ERROR status %s\n", IB_GET_ERR_STR(status)));\r
        return status;\r
-       \r
-#else\r
-       ib_api_status_t         status;\r
-\r
-       mlnx_hob_t                              *hob_p = (mlnx_hob_t *)h_ca;\r
-       HH_hca_hndl_t                   hh_hndl = NULL;\r
-       HH_hca_dev_t                    *hca_ul_info;\r
-       mlnx_um_ca_t                    *p_um_ca;\r
-       MOSAL_protection_ctx_t  prot_ctx;\r
-\r
-       HCA_ENTER( TRACE_LEVEL_VERBOSE );\r
-\r
-       mlnx_hobs_get_handle( hob_p, &hh_hndl );\r
-       if( !hh_hndl )\r
-       {\r
-               HCA_PRINT(TRACE_LEVEL_INFORMATION  ,HCA_DBG_SHIM  ,("returning E_NODEV dev\n"));\r
-               status = IB_INVALID_CA_HANDLE;\r
-               goto mlnx_um_open_err1;\r
-       }\r
-\r
-       hca_ul_info = (HH_hca_dev_t *)hh_hndl;\r
-\r
-       if( !p_umv_buf->command )\r
-       {\r
-               p_umv_buf->status = IB_SUCCESS;\r
-               goto mlnx_um_open_err1;\r
-       }\r
-\r
-       /*\r
-        * Prepare the buffer with the size including hca_ul_resources_sz\r
-        * NO ALIGNMENT for this size \r
-        */\r
-       if( !p_umv_buf->p_inout_buf ||\r
-               p_umv_buf->output_size < sizeof(void*) )\r
-       {\r
-               p_umv_buf->status = IB_INVALID_PARAMETER;\r
-               goto mlnx_um_open_err1;\r
-       }\r
-\r
-       HCA_PRINT( TRACE_LEVEL_VERBOSE  ,HCA_DBG_SHIM  ,("priv_op = %d\n", p_umv_buf->command ));\r
-\r
-       /* Yes, UVP request for hca_ul_info. */\r
-       p_um_ca = (mlnx_um_ca_t*)cl_zalloc(\r
-               sizeof(mlnx_um_ca_t) + hca_ul_info->hca_ul_resources_sz - 1 );\r
-       if( !p_um_ca )\r
-       {\r
-               p_umv_buf->status = IB_INSUFFICIENT_MEMORY;\r
-               goto mlnx_um_open_err1;\r
-       }\r
-\r
-       p_um_ca->p_mdl = IoAllocateMdl( &p_um_ca->dev_info,\r
-               (ULONG)(sizeof(HH_hca_dev_t) + hca_ul_info->hca_ul_resources_sz),\r
-               FALSE, TRUE, NULL );\r
-       if( !p_um_ca->p_mdl )\r
-       {\r
-               p_umv_buf->status = IB_ERROR;\r
-               goto mlnx_um_open_err2;\r
-       }\r
-       /* Build the page list... */\r
-       MmBuildMdlForNonPagedPool( p_um_ca->p_mdl );\r
-\r
-       /* Map the memory into the calling process's address space. */\r
-       __try\r
-       {\r
-               p_um_ca->p_mapped_addr =\r
-                       MmMapLockedPagesSpecifyCache( p_um_ca->p_mdl,\r
-                       UserMode, MmCached, NULL, FALSE, NormalPagePriority );\r
-       }\r
-       __except(EXCEPTION_EXECUTE_HANDLER)\r
-       {\r
-               p_umv_buf->status = IB_ERROR;\r
-               goto mlnx_um_open_err3;\r
-       }\r
-\r
-       /* Register with THH (attach to the HCA). */\r
-       prot_ctx = MOSAL_get_current_prot_ctx();\r
-       if( THH_hob_alloc_ul_res(hh_hndl, prot_ctx, p_um_ca->ul_hca_res) != HH_OK )\r
-       {\r
-               HCA_PRINT( TRACE_LEVEL_ERROR  ,HCA_DBG_SHIM  ,("Failed to get ul_res\n"));\r
-               p_umv_buf->status = IB_ERROR;\r
-       }\r
-\r
-       if( p_umv_buf->status == IB_SUCCESS )\r
-       {\r
-               /* Copy the dev info. */\r
-               p_um_ca->dev_info = *hca_ul_info;\r
-               *ph_um_ca = (ib_ca_handle_t)p_um_ca;\r
-               (*(void** __ptr64)p_umv_buf->p_inout_buf) = p_um_ca->p_mapped_addr;\r
-               p_umv_buf->status = IB_SUCCESS;\r
-       }\r
-       else\r
-       {\r
-               MmUnmapLockedPages( p_um_ca->p_mapped_addr, p_um_ca->p_mdl );\r
-mlnx_um_open_err3:\r
-               IoFreeMdl( p_um_ca->p_mdl );\r
-mlnx_um_open_err2:\r
-               cl_free( p_um_ca );\r
-mlnx_um_open_err1:\r
-               *ph_um_ca = NULL;\r
-       }\r
-\r
-       //*ph_um_ca = NULL;\r
-       p_umv_buf->output_size = sizeof(void*);\r
-       HCA_EXIT( TRACE_LEVEL_VERBOSE );\r
-       return p_umv_buf->status;\r
-#endif \r
 }\r
 \r
 static void\r
@@ -908,35 +445,13 @@ mlnx_um_close(
        IN                              ib_ca_handle_t                          h_ca,\r
        IN                              ib_ca_handle_t                          h_um_ca )\r
 {\r
-#ifndef WIN_TO_BE_CHANGED\r
-\r
        UNREFERENCED_PARAMETER(h_ca);\r
-       ibv_um_close((struct ib_ucontext *)h_um_ca);\r
-       return;\r
-       \r
-#else\r
-       mlnx_hob_t                      *hob_p = (mlnx_hob_t *)h_ca;\r
-       HH_hca_hndl_t           hh_hndl = NULL;\r
-       mlnx_um_ca_t            *p_um_ca = (mlnx_um_ca_t*)h_um_ca;\r
-\r
-       HCA_ENTER( TRACE_LEVEL_VERBOSE );\r
-\r
-       mlnx_hobs_get_handle( hob_p, &hh_hndl );\r
-       if( !hh_hndl )\r
-               goto mlnx_um_close_cleanup;\r
-\r
-       if( !p_um_ca )\r
-               return;\r
-\r
-       THH_hob_free_ul_res( hh_hndl, p_um_ca->ul_hca_res );\r
-\r
-mlnx_um_close_cleanup:\r
-       MmUnmapLockedPages( p_um_ca->p_mapped_addr, p_um_ca->p_mdl );\r
-       IoFreeMdl( p_um_ca->p_mdl );\r
-       cl_free( p_um_ca );\r
 \r
-       HCA_EXIT( TRACE_LEVEL_VERBOSE );\r
-#endif \r
+       if( !((struct ib_ucontext*)h_um_ca)->pd )\r
+               cl_free( h_um_ca );\r
+       else\r
+               ibv_um_close((struct ib_ucontext *)h_um_ca);\r
+       return;\r
 }\r
 \r
 \r
@@ -951,8 +466,6 @@ mlnx_allocate_pd (
                OUT                     ib_pd_handle_t                          *ph_pd,\r
        IN      OUT                     ci_umv_buf_t                            *p_umv_buf )\r
 {\r
-#ifndef WIN_TO_BE_CHANGED\r
-\r
        ib_api_status_t         status;\r
        struct ib_device *ib_dev;\r
        struct ib_ucontext *context_p;\r
@@ -964,7 +477,7 @@ mlnx_allocate_pd (
        \r
        HCA_ENTER(HCA_DBG_SHIM);\r
 \r
-       if( p_umv_buf && p_umv_buf->command ) {\r
+       if( p_umv_buf ) {\r
                context_p = (struct ib_ucontext *)h_ca;\r
                ib_dev = context_p->device;\r
        }\r
@@ -978,7 +491,8 @@ mlnx_allocate_pd (
        ib_pd_p = ibv_alloc_pd(ib_dev, context_p, p_umv_buf);\r
        if (IS_ERR(ib_pd_p)) {\r
                err = PTR_ERR(ib_pd_p);\r
-               HCA_PRINT(TRACE_LEVEL_ERROR  , HCA_DBG_SHIM  ,("ibv_alloc_pd failed (%d)\n", err));\r
+               HCA_PRINT(TRACE_LEVEL_ERROR  , HCA_DBG_SHIM,\r
+                       ("ibv_alloc_pd failed (%d)\n", err));\r
                status = errno_to_iberr(err);\r
                goto err_alloc_pd;\r
        }\r
@@ -991,159 +505,19 @@ mlnx_allocate_pd (
 err_alloc_pd:  \r
        if (p_umv_buf && p_umv_buf->command) \r
                p_umv_buf->status = status;\r
-       HCA_PRINT_EXIT(TRACE_LEVEL_ERROR  , HCA_DBG_SHIM  ,("completes with ERROR status %s\n", ib_get_err_str(status)));\r
+       HCA_PRINT_EXIT(TRACE_LEVEL_ERROR  , HCA_DBG_SHIM,\r
+               ("completes with ERROR status %s\n", IB_GET_ERR_STR(status)));\r
        return status;\r
-       \r
-#else\r
-       mlnx_hob_t                              *hob_p = (mlnx_hob_t *)h_ca;\r
-       mlnx_hobul_t                    *hobul_p;\r
-       HH_hca_dev_t                    *hca_ul_info;\r
-       HHUL_pd_hndl_t                  hhul_pd_hndl = 0;\r
-       void                                    *pd_ul_resources_p = NULL;\r
-       uint32_t                                pd_idx;\r
-       ib_api_status_t                 status;\r
-       MOSAL_protection_ctx_t  prot_ctx;\r
-\r
-       HCA_ENTER( HCA_DBG_SHIM);\r
-\r
-       hobul_p = mlnx_hobs_get_hobul(hob_p);\r
-       if (NULL == hobul_p) {\r
-               status = IB_INVALID_CA_HANDLE;\r
-               goto cleanup;\r
-       }\r
-\r
-       hca_ul_info = (HH_hca_dev_t *)hobul_p->hh_hndl;\r
-       if (NULL == hca_ul_info) {\r
-               status = IB_INVALID_CA_HANDLE;\r
-               goto cleanup;\r
-       }\r
-\r
-       if( p_umv_buf && p_umv_buf->command )\r
-       {\r
-               // For user mode calls - obtain and verify the vendor information\r
-               if ((p_umv_buf->input_size - sizeof (uint32_t))  != \r
-                       hca_ul_info->pd_ul_resources_sz ||\r
-                       NULL == p_umv_buf->p_inout_buf) {\r
-                               status = IB_INVALID_PARAMETER;\r
-                               goto cleanup;\r
-                       }\r
-                       pd_ul_resources_p = (void *)p_umv_buf->p_inout_buf;\r
-\r
-                       /* get the current protection context */ \r
-                       prot_ctx = MOSAL_get_current_prot_ctx();\r
-       }\r
-       else\r
-       {\r
-               // for kernel mode calls - allocate app resources. Use prep->call->done sequence\r
-               pd_ul_resources_p = cl_zalloc( hca_ul_info->pd_ul_resources_sz);\r
-               if (NULL == pd_ul_resources_p) {\r
-                       status = IB_INSUFFICIENT_MEMORY;\r
-                       goto cleanup;\r
-               }\r
-\r
-               switch( type )\r
-               {\r
-               case IB_PDT_SQP:\r
-                       if (HH_OK != THHUL_pdm_alloc_pd_avs_prep(hobul_p->hhul_hndl,\r
-                               g_sqp_max_avs, PD_FOR_SQP, &hhul_pd_hndl, pd_ul_resources_p))\r
-                       {\r
-                               status = IB_ERROR;\r
-                               goto cleanup;\r
-                       }\r
-                       break;\r
-\r
-               case IB_PDT_UD:\r
-                       if (HH_OK != THHUL_pdm_alloc_pd_avs_prep(hobul_p->hhul_hndl,\r
-                               g_sqp_max_avs, PD_NO_FLAGS, &hhul_pd_hndl, pd_ul_resources_p))\r
-                       {\r
-                               status = IB_ERROR;\r
-                               goto cleanup;\r
-                       }\r
-                       break;\r
-\r
-               default:\r
-                       if (HH_OK != THHUL_pdm_alloc_pd_prep(hobul_p->hhul_hndl, &hhul_pd_hndl, pd_ul_resources_p)) {\r
-                               status = IB_ERROR;\r
-                               goto cleanup;\r
-                       }\r
-               }\r
-               /* get the current protection context */ \r
-               prot_ctx = MOSAL_get_kernel_prot_ctx();\r
-       }\r
-\r
-       // Allocate the PD (cmdif)\r
-       if (HH_OK != THH_hob_alloc_pd(hobul_p->hh_hndl, prot_ctx, pd_ul_resources_p, &pd_idx)) {\r
-               status = IB_INSUFFICIENT_RESOURCES;\r
-               goto cleanup_pd;\r
-       }\r
-\r
-       if( !(p_umv_buf && p_umv_buf->command) )\r
-       {\r
-               // Manage user level resources\r
-               if (HH_OK != THHUL_pdm_alloc_pd_done(hobul_p->hhul_hndl, hhul_pd_hndl, pd_idx, pd_ul_resources_p)) {\r
-                       THH_hob_free_pd(hobul_p->hh_hndl, pd_idx);\r
-                       status = IB_ERROR;\r
-                       goto cleanup_pd;\r
-               }\r
-       }\r
-\r
-       VALIDATE_INDEX(pd_idx, hobul_p->max_pd, IB_ERROR, cleanup_pd);\r
-\r
-       // Save data refs for future use\r
-       cl_mutex_acquire(&hobul_p->pd_info_tbl[pd_idx].mutex);\r
-       hobul_p->pd_info_tbl[pd_idx].pd_num = pd_idx;\r
-       hobul_p->pd_info_tbl[pd_idx].hca_idx = hob_p->index;\r
-       hobul_p->pd_info_tbl[pd_idx].hhul_pd_hndl = hhul_pd_hndl;\r
-       hobul_p->pd_info_tbl[pd_idx].pd_ul_resources_p = pd_ul_resources_p;\r
-       hobul_p->pd_info_tbl[pd_idx].count = 0;\r
-       hobul_p->pd_info_tbl[pd_idx].kernel_mode = !(p_umv_buf && p_umv_buf->command);\r
-       hobul_p->pd_info_tbl[pd_idx].mark = E_MARK_PD;\r
-       cl_mutex_release(&hobul_p->pd_info_tbl[pd_idx].mutex);\r
-\r
-       cl_atomic_inc( &hobul_p->count );\r
-\r
-       if (ph_pd) *ph_pd = (ib_pd_handle_t)PD_HNDL_FROM_PD(pd_idx);\r
-       HCA_PRINT(TRACE_LEVEL_INFORMATION  , HCA_DBG_SHIM  ,("hca_idx 0x%x pd_idx 0x%x returned 0x%p\n", hob_p->index, pd_idx, *ph_pd));\r
-\r
-       if( p_umv_buf && p_umv_buf->command )\r
-       {\r
-               p_umv_buf->output_size = p_umv_buf->input_size;\r
-               /* \r
-               * Copy the pd_idx back to user\r
-               */\r
-               cl_memcpy (((uint8_t* __ptr64)p_umv_buf->p_inout_buf + hca_ul_info->pd_ul_resources_sz),\r
-                       &pd_idx, sizeof (pd_idx));\r
-               p_umv_buf->status = IB_SUCCESS;\r
-       }\r
-       HCA_EXIT( HCA_DBG_SHIM);\r
-       return IB_SUCCESS;\r
-\r
-cleanup_pd:\r
-       THHUL_pdm_free_pd_prep(hobul_p->hhul_hndl, hhul_pd_hndl, FALSE);\r
-       THHUL_pdm_free_pd_done(hobul_p->hhul_hndl, hhul_pd_hndl);\r
-\r
-cleanup:\r
-       if( !(p_umv_buf && p_umv_buf->command) && pd_ul_resources_p )\r
-               cl_free( pd_ul_resources_p);\r
-       if( p_umv_buf && p_umv_buf->command )\r
-       {\r
-               p_umv_buf->status = status;\r
-       }\r
-       HCA_PRINT(TRACE_LEVEL_ERROR  ,HCA_DBG_SHIM   ,("status %d \n", status));\r
-       HCA_EXIT( HCA_DBG_SHIM);\r
-       return status;\r
-#endif \r
-}\r
+}\r
 \r
 ib_api_status_t\r
 mlnx_deallocate_pd (\r
        IN                              ib_pd_handle_t                          h_pd)\r
 {\r
-#ifndef WIN_TO_BE_CHANGED\r
-\r
        ib_api_status_t         status;\r
        int err;\r
        struct ib_pd *ib_pd_p = (struct ib_pd *)h_pd;\r
+       PREP_IBDEV_FOR_PRINT(ib_pd_p->device)\r
 \r
        HCA_ENTER( HCA_DBG_QP);\r
 \r
@@ -1153,95 +527,17 @@ mlnx_deallocate_pd (
        // dealloc pd\r
        err = ibv_dealloc_pd( ib_pd_p );\r
        if (err) {\r
-               HCA_PRINT(TRACE_LEVEL_ERROR  ,HCA_DBG_SHIM  ,("ibv_dealloc_pd failed (%d)\n", err));\r
+               HCA_PRINT(TRACE_LEVEL_ERROR  ,HCA_DBG_SHIM\r
+                       ,("ibv_dealloc_pd failed (%d)\n", err));\r
                status = errno_to_iberr(err);\r
                goto err_dealloc_pd;\r
        }\r
        status = IB_SUCCESS;\r
 \r
 err_dealloc_pd:\r
-       HCA_PRINT_EXIT(TRACE_LEVEL_ERROR  , HCA_DBG_SHIM  ,("completes with ERROR status %s\n", ib_get_err_str(status)));\r
-       return status;\r
-\r
-#else\r
-       uint32_t                        hca_idx = PD_HCA_FROM_HNDL(h_pd);\r
-       uint32_t                        pd_idx  = PD_NUM_FROM_HNDL(h_pd);\r
-       mlnx_hobul_t            *hobul_p;\r
-       HHUL_pd_hndl_t          hhul_pd_hndl;\r
-       ib_api_status_t         status;\r
-\r
-       HCA_ENTER( HCA_DBG_SHIM);\r
-\r
-       VALIDATE_INDEX(hca_idx, MLNX_MAX_HCA, IB_INVALID_CA_HANDLE, cleanup);\r
-       hobul_p = mlnx_hobul_array[hca_idx];\r
-       if (NULL == hobul_p) {\r
-               status =  IB_INVALID_PD_HANDLE;\r
-               goto cleanup;\r
-       }\r
-       VALIDATE_INDEX(pd_idx, hobul_p->max_pd, IB_INVALID_PD_HANDLE, cleanup);\r
-       if (E_MARK_PD != hobul_p->pd_info_tbl[pd_idx].mark) {\r
-               status =  IB_INVALID_PD_HANDLE;\r
-               goto cleanup;\r
-       }\r
-\r
-       cl_mutex_acquire(&hobul_p->pd_info_tbl[pd_idx].mutex);\r
-\r
-       HCA_PRINT(TRACE_LEVEL_INFORMATION, HCA_DBG_SHIM,("pd %d count %d k_mod %d\n", pd_idx, \r
-               hobul_p->pd_info_tbl[pd_idx].count, hobul_p->pd_info_tbl[pd_idx].kernel_mode));\r
-\r
-       if (0 != hobul_p->pd_info_tbl[pd_idx].count) {\r
-               HCA_PRINT(TRACE_LEVEL_INFORMATION, HCA_DBG_SHIM,("pd %d count %d\n", \r
-                       pd_idx, hobul_p->pd_info_tbl[pd_idx].count));\r
-               status = IB_RESOURCE_BUSY;\r
-               goto cleanup_locked;\r
-       }\r
-\r
-       hhul_pd_hndl = hobul_p->pd_info_tbl[pd_idx].hhul_pd_hndl;\r
-\r
-       // PREP:\r
-       if (hobul_p->pd_info_tbl[pd_idx].kernel_mode) {\r
-               if (HH_OK != THHUL_pdm_free_pd_prep(hobul_p->hhul_hndl, hhul_pd_hndl, FALSE)) {\r
-                       status = IB_ERROR;\r
-                       goto cleanup_locked;\r
-               }\r
-       }\r
-\r
-       HCA_PRINT(TRACE_LEVEL_INFORMATION, HCA_DBG_SHIM ,("pd %d before free_pd hh_hndl %p\n", \r
-               pd_idx, hobul_p->hh_hndl);\r
-\r
-       if (HH_OK != THH_hob_free_pd(hobul_p->hh_hndl, pd_idx)) {\r
-               status = IB_ERROR;\r
-               goto cleanup_locked;\r
-       }\r
-\r
-       HCA_PRINT(TRACE_LEVEL_INFORMATION, HCA_DBG_SHIM,"pd %d after free_pd\n", pd_idx)\r
-\r
-       if (hobul_p->pd_info_tbl[pd_idx].kernel_mode) {\r
-               if (HH_OK != THHUL_pdm_free_pd_done(hobul_p->hhul_hndl, hhul_pd_hndl)) {\r
-                       status = IB_ERROR;\r
-                       goto cleanup_locked;\r
-               }\r
-               if (hobul_p->pd_info_tbl[pd_idx].pd_ul_resources_p)\r
-                       cl_free( hobul_p->pd_info_tbl[pd_idx].pd_ul_resources_p);\r
-       }\r
-\r
-       hobul_p->pd_info_tbl[pd_idx].mark = E_MARK_INVALID;\r
-       hobul_p->pd_info_tbl[pd_idx].pd_ul_resources_p = NULL;\r
-\r
-       cl_mutex_release(&hobul_p->pd_info_tbl[pd_idx].mutex);\r
-\r
-       cl_atomic_dec( &hobul_p->count );\r
-       HCA_EXIT( HCA_DBG_SHIM);\r
-       return IB_SUCCESS;\r
-\r
-cleanup_locked:\r
-       cl_mutex_release(&hobul_p->pd_info_tbl[pd_idx].mutex);\r
-\r
-cleanup:\r
-       HCA_PRINT(TRACE_LEVEL_ERROR  ,HCA_DBG_SHIM  ,("status %d\n", status));\r
-       HCA_EXIT( HCA_DBG_SHIM);\r
+       HCA_PRINT_EXIT(TRACE_LEVEL_ERROR  , HCA_DBG_SHIM\r
+               ,("completes with ERROR status %s\n", IB_GET_ERR_STR(status)));\r
        return status;\r
-#endif \r
 }\r
 \r
 /* \r
@@ -1254,12 +550,10 @@ mlnx_create_av (
                OUT                     ib_av_handle_t                          *ph_av,\r
        IN      OUT                     ci_umv_buf_t                            *p_umv_buf )\r
 {\r
-#ifndef WIN_TO_BE_CHANGED\r
-\r
        int err = 0;\r
        ib_api_status_t         status = IB_SUCCESS;\r
        struct ib_pd *ib_pd_p = (struct ib_pd *)h_pd;\r
-       struct ib_device *ib_dev_p = ib_pd_p->device;\r
+       struct ib_device *ib_dev = ib_pd_p->device;\r
        struct ib_ah *ib_av_p;\r
        struct ib_ah_attr ah_attr;\r
        struct ib_ucontext *context_p = NULL;\r
@@ -1281,12 +575,13 @@ mlnx_create_av (
 \r
        // fill parameters \r
        RtlZeroMemory(&ah_attr, sizeof(ah_attr));\r
-       mlnx_conv_ibal_av( ib_dev_p, p_addr_vector,  &ah_attr );\r
+       mlnx_conv_ibal_av( ib_dev, p_addr_vector,  &ah_attr );\r
 \r
        ib_av_p = ibv_create_ah(ib_pd_p, &ah_attr, context_p, p_umv_buf);\r
        if (IS_ERR(ib_pd_p)) {\r
                err = PTR_ERR(ib_pd_p);\r
-               HCA_PRINT(TRACE_LEVEL_ERROR   ,HCA_DBG_QP  ,("ibv_alloc_pd failed (%d)\n", err));\r
+               HCA_PRINT(TRACE_LEVEL_ERROR   ,HCA_DBG_QP,\r
+                       ("ibv_alloc_pd failed (%d)\n", err));\r
                status = errno_to_iberr(err);\r
                goto err_alloc_av;\r
        }\r
@@ -1305,81 +600,9 @@ mlnx_create_av (
        \r
 err_alloc_av:  \r
 err_inval_params:\r
-       HCA_PRINT_EXIT(TRACE_LEVEL_ERROR ,HCA_DBG_QP ,("completes with ERROR status %s\n", ib_get_err_str(status)));\r
-       return status;\r
-       \r
-#else\r
-       uint32_t                        hca_idx = PD_HCA_FROM_HNDL(h_pd);\r
-       uint32_t                        pd_idx  = PD_NUM_FROM_HNDL(h_pd);\r
-       HHUL_ud_av_hndl_t       av_h;\r
-       mlnx_hobul_t            *hobul_p;\r
-       mlnx_avo_t                      *avo_p = NULL;\r
-       HHUL_pd_hndl_t          hhul_pd_hndl;\r
-       ib_api_status_t         status;\r
-\r
-       VAPI_ud_av_t            av;\r
-\r
-       HCA_ENTER( HCA_DBG_SHIM);\r
-\r
-       VALIDATE_INDEX(hca_idx, MLNX_MAX_HCA, IB_INVALID_CA_HANDLE, cleanup);\r
-       hobul_p = mlnx_hobul_array[hca_idx];\r
-       if (NULL == hobul_p) {\r
-               status =  IB_INVALID_PD_HANDLE;\r
-               goto cleanup;\r
-       }\r
-       VALIDATE_INDEX(pd_idx, hobul_p->max_pd, IB_INVALID_PD_HANDLE, cleanup);\r
-       if (E_MARK_PD != hobul_p->pd_info_tbl[pd_idx].mark) {\r
-               status =  IB_INVALID_PD_HANDLE;\r
-               goto cleanup;\r
-       }\r
-       hhul_pd_hndl = hobul_p->pd_info_tbl[pd_idx].hhul_pd_hndl;\r
-\r
-       if (NULL == (avo_p = cl_zalloc( sizeof(mlnx_avo_t)))) {\r
-               status = IB_INSUFFICIENT_MEMORY;\r
-               goto cleanup;\r
-       }\r
-\r
-       cl_memclr(&av, sizeof(av));\r
-       mlnx_conv_ibal_av(hobul_p->hh_hndl, p_addr_vector, &av);\r
-       // This creates a non priviledged ud_av.\r
-       // To create a privilged ud_av call THH_hob_create_ud_av()\r
-       if (HH_OK != THHUL_pdm_create_ud_av(hobul_p->hhul_hndl, hhul_pd_hndl, &av, &av_h)) {\r
-               status = IB_INSUFFICIENT_RESOURCES;\r
-               goto cleanup;\r
-       }\r
-\r
-       // update PD object count\r
-       cl_atomic_inc(&hobul_p->pd_info_tbl[pd_idx].count);\r
-       HCA_PRINT(TRACE_LEVEL_INFORMATION, HCA_DBG_SHIM,"pd %d count %d\n", pd_idx, hobul_p->pd_info_tbl[pd_idx].count)\r
-\r
-\r
-       avo_p->mark    = E_MARK_AV;\r
-       avo_p->hca_idx = hca_idx;\r
-       avo_p->pd_idx  = pd_idx;\r
-       avo_p->h_av    = av_h;\r
-\r
-       if (ph_av) *ph_av = (ib_av_handle_t)avo_p;\r
-\r
-       if( p_umv_buf && p_umv_buf->command )\r
-       {\r
-               p_umv_buf->status = IB_SUCCESS;\r
-       }\r
-       status = IB_SUCCESS;\r
-       goto end;\r
-\r
-cleanup:\r
-       if (avo_p) {\r
-               avo_p->mark = E_MARK_INVALID;\r
-               cl_free( avo_p);\r
-       }\r
-       if( p_umv_buf && p_umv_buf->command )\r
-       {\r
-               p_umv_buf->status = status;\r
-       }\r
-end:\r
-       HCA_PRINT_EXIT(TRACE_LEVEL_ERROR  ,HCA_DBG_SHIM  ,("status %d \n", status));\r
+       HCA_PRINT_EXIT(TRACE_LEVEL_ERROR ,HCA_DBG_QP,\r
+               ("completes with ERROR status %s\n", IB_GET_ERR_STR(status)));\r
        return status;\r
-#endif \r
 }\r
 \r
 ib_api_status_t\r
@@ -1389,27 +612,28 @@ mlnx_query_av (
                OUT                     ib_pd_handle_t                          *ph_pd,\r
        IN      OUT                     ci_umv_buf_t                            *p_umv_buf )\r
 {\r
-#ifndef WIN_TO_BE_CHANGED\r
-                                                                                                                                                               \r
        int err;\r
        ib_api_status_t         status = IB_SUCCESS;\r
        struct ib_ah *ib_ah_p = (struct ib_ah *)h_av;\r
+       PREP_IBDEV_FOR_PRINT(ib_ah_p->device)\r
 \r
        HCA_ENTER(HCA_DBG_SHIM);\r
 \r
        // sanity checks\r
        if( p_umv_buf && p_umv_buf->command ) {\r
-                       HCA_PRINT (TRACE_LEVEL_ERROR, HCA_DBG_SHIM,("User mode is not supported yet\n"));\r
+                       HCA_PRINT (TRACE_LEVEL_ERROR, HCA_DBG_SHIM,\r
+                               ("User mode is not supported yet\n"));\r
                        status = IB_UNSUPPORTED;\r
                        goto err_user_unsupported;\r
        }\r
 \r
        // query AV\r
-#if 0\r
+#ifdef WIN_TO_BE_CHANGED\r
        //TODO: not implemented in low-level driver\r
        err = ibv_query_ah(ib_ah_p, &ah_attr)\r
        if (err) {\r
-               HCA_PRINT(TRACE_LEVEL_ERROR, HCA_DBG_SHIM, ("ibv_query_ah failed (%d)\n", err));\r
+               HCA_PRINT(TRACE_LEVEL_ERROR, HCA_DBG_SHIM,\r
+                       ("ibv_query_ah failed (%d)\n", err));\r
                status = errno_to_iberr(err);\r
                goto err_query_ah;\r
        }\r
@@ -1419,7 +643,8 @@ mlnx_query_av (
 \r
        err = mlnx_conv_mthca_av( ib_ah_p, p_addr_vector );\r
        if (err) {\r
-               HCA_PRINT (TRACE_LEVEL_ERROR, HCA_DBG_SHIM,("mlnx_conv_mthca_av failed (%d)\n", err));\r
+               HCA_PRINT (TRACE_LEVEL_ERROR, HCA_DBG_SHIM,\r
+                       ("mlnx_conv_mthca_av failed (%d)\n", err));\r
                status = errno_to_iberr(err);\r
                goto err_conv_mthca_av;\r
        }\r
@@ -1430,61 +655,9 @@ mlnx_query_av (
        \r
 err_conv_mthca_av:\r
 err_user_unsupported:\r
-       HCA_PRINT_EXIT(TRACE_LEVEL_ERROR  , HCA_DBG_SHIM  ,("completes with ERROR status %s\n", ib_get_err_str(status)));\r
-       return status;\r
-\r
-#else\r
-       mlnx_avo_t                      *avo_p = (mlnx_avo_t *)h_av;\r
-       mlnx_hobul_t            *hobul_p;\r
-       ib_api_status_t         status;\r
-\r
-       VAPI_ud_av_t            av;\r
-\r
-       HCA_ENTER( HCA_DBG_SHIM);\r
-       if (!avo_p || avo_p->mark != E_MARK_AV) {\r
-               status = IB_INVALID_AV_HANDLE;\r
-               goto cleanup;\r
-       }\r
-\r
-       VALIDATE_INDEX(avo_p->hca_idx, MLNX_MAX_HCA, IB_INVALID_CA_HANDLE, cleanup);\r
-       hobul_p = mlnx_hobul_array[avo_p->hca_idx];\r
-       if (NULL == hobul_p) {\r
-               status =  IB_INVALID_AV_HANDLE;\r
-               goto cleanup;\r
-       }\r
-       VALIDATE_INDEX(avo_p->pd_idx, hobul_p->max_pd, IB_INVALID_PD_HANDLE, cleanup);\r
-       if (E_MARK_PD != hobul_p->pd_info_tbl[avo_p->pd_idx].mark) {\r
-               status =  IB_INVALID_PD_HANDLE;\r
-               goto cleanup;\r
-       }\r
-\r
-       if (p_addr_vector) {\r
-               if (HH_OK != THHUL_pdm_query_ud_av(hobul_p->hhul_hndl, avo_p->h_av, &av)) {\r
-                       status = IB_ERROR;\r
-                       goto cleanup;\r
-               }\r
-               mlnx_conv_vapi_av(hobul_p->hh_hndl, &av, p_addr_vector);\r
-       }\r
-\r
-       if (ph_pd) *ph_pd = (ib_pd_handle_t)PD_HNDL_FROM_PD(avo_p->pd_idx);\r
-\r
-       if( p_umv_buf && p_umv_buf->command )\r
-       {\r
-               p_umv_buf->output_size = 0;\r
-               p_umv_buf->status = IB_SUCCESS;\r
-       }\r
-       HCA_EXIT( HCA_DBG_SHIM);\r
-       return IB_SUCCESS;\r
-\r
-cleanup:\r
-       if( p_umv_buf && p_umv_buf->command )\r
-       {\r
-               p_umv_buf->status = status;\r
-       }\r
-       HCA_PRINT(TRACE_LEVEL_ERROR  ,HCA_DBG_SHIM  ,("status %d \n", status));\r
-       HCA_EXIT( HCA_DBG_SHIM);\r
+       HCA_PRINT_EXIT(TRACE_LEVEL_ERROR  , HCA_DBG_SHIM,\r
+               ("completes with ERROR status %s\n", IB_GET_ERR_STR(status)));\r
        return status;\r
-#endif \r
 }\r
 \r
 ib_api_status_t\r
@@ -1493,31 +666,31 @@ mlnx_modify_av (
        IN              const   ib_av_attr_t                            *p_addr_vector,\r
        IN      OUT                     ci_umv_buf_t                            *p_umv_buf )\r
 {\r
-#ifndef WIN_TO_BE_CHANGED\r
-\r
        struct ib_ah_attr ah_attr;\r
        ib_api_status_t         status = IB_SUCCESS;\r
        struct ib_ah *ib_ah_p = (struct ib_ah *)h_av;\r
-       struct ib_device *ib_dev_p = ib_ah_p->pd->device;\r
+       struct ib_device *ib_dev = ib_ah_p->pd->device;\r
 \r
        HCA_ENTER(HCA_DBG_SHIM);\r
 \r
        // sanity checks\r
        if( p_umv_buf && p_umv_buf->command ) {\r
-                       HCA_PRINT(TRACE_LEVEL_ERROR   ,HCA_DBG_SHIM  ,("User mode is not supported yet\n"));\r
+                       HCA_PRINT(TRACE_LEVEL_ERROR   ,HCA_DBG_SHIM,\r
+                               ("User mode is not supported yet\n"));\r
                        status = IB_UNSUPPORTED;\r
                        goto err_user_unsupported;\r
        }\r
 \r
        // fill parameters \r
-       mlnx_conv_ibal_av( ib_dev_p, p_addr_vector,  &ah_attr );\r
+       mlnx_conv_ibal_av( ib_dev, p_addr_vector,  &ah_attr );\r
 \r
        // modify AH\r
-#if 0\r
+#ifdef WIN_TO_BE_CHANGED\r
        //TODO: not implemented in low-level driver\r
        err = ibv_modify_ah(ib_ah_p, &ah_attr)\r
        if (err) {\r
-               HCA_PRINT (TRACE_LEVEL_ERROR, HCA_DBG_SHIM,("ibv_query_ah failed (%d)\n", err));\r
+               HCA_PRINT (TRACE_LEVEL_ERROR, HCA_DBG_SHIM,\r
+                       ("ibv_query_ah failed (%d)\n", err));\r
                status = errno_to_iberr(err);\r
                goto err_query_ah;\r
        }\r
@@ -1527,127 +700,35 @@ mlnx_modify_av (
 #endif\r
 \r
 err_user_unsupported:\r
-       HCA_PRINT_EXIT(TRACE_LEVEL_ERROR  , HCA_DBG_SHIM  ,("completes with ERROR status %s\n", ib_get_err_str(status)));\r
-       return status;\r
-\r
-#else\r
-       mlnx_avo_t                      *avo_p = (mlnx_avo_t *)h_av;\r
-       mlnx_hobul_t            *hobul_p;\r
-       ib_api_status_t         status;\r
-\r
-       VAPI_ud_av_t            av;\r
-\r
-       HCA_ENTER( HCA_DBG_SHIM);\r
-       if (!avo_p || avo_p->mark != E_MARK_AV) {\r
-               status = IB_INVALID_AV_HANDLE;\r
-               goto cleanup;\r
-       }\r
-\r
-       VALIDATE_INDEX(avo_p->hca_idx, MLNX_MAX_HCA, IB_INVALID_CA_HANDLE, cleanup);\r
-       hobul_p = mlnx_hobul_array[avo_p->hca_idx];\r
-       if (NULL == hobul_p) {\r
-               status =  IB_INVALID_AV_HANDLE;\r
-               goto cleanup;\r
-       }\r
-\r
-       cl_memclr(&av, sizeof(av));\r
-       mlnx_conv_ibal_av(hobul_p->hh_hndl, p_addr_vector, &av);\r
-       if (HH_OK != THHUL_pdm_modify_ud_av(hobul_p->hhul_hndl, avo_p->h_av, &av)) {\r
-               status = IB_ERROR;\r
-               goto cleanup;\r
-       }\r
-\r
-       if( p_umv_buf && p_umv_buf->command )\r
-       {\r
-               p_umv_buf->output_size = 0;\r
-               p_umv_buf->status = IB_SUCCESS;\r
-       }\r
-       HCA_EXIT( HCA_DBG_SHIM);\r
-       return IB_SUCCESS;\r
-\r
-cleanup:\r
-       if( p_umv_buf && p_umv_buf->command )\r
-       {\r
-               p_umv_buf->status = status;\r
-       }\r
-       HCA_PRINT(TRACE_LEVEL_ERROR  ,HCA_DBG_SHIM  ,("status %d\n",status));\r
-       HCA_EXIT( HCA_DBG_SHIM);\r
+       HCA_PRINT_EXIT(TRACE_LEVEL_ERROR  , HCA_DBG_SHIM,\r
+               ("completes with ERROR status %s\n", IB_GET_ERR_STR(status)));\r
        return status;\r
-#endif \r
 }\r
 \r
 ib_api_status_t\r
 mlnx_destroy_av (\r
        IN              const   ib_av_handle_t                          h_av)\r
 {\r
-#ifndef WIN_TO_BE_CHANGED\r
-                                                                                                                                                               \r
        int err;\r
        ib_api_status_t         status = IB_SUCCESS;\r
        struct ib_ah *ib_ah_p = (struct ib_ah *)h_av;\r
+       PREP_IBDEV_FOR_PRINT(ib_ah_p->device)\r
 \r
        HCA_ENTER(HCA_DBG_SHIM);\r
 \r
        // destroy AV\r
        err = ibv_destroy_ah( ib_ah_p );\r
        if (err) {\r
-               HCA_PRINT (TRACE_LEVEL_ERROR ,HCA_DBG_SHIM,("ibv_destroy_ah failed (%d)\n", err));\r
+               HCA_PRINT (TRACE_LEVEL_ERROR ,HCA_DBG_SHIM,\r
+                       ("ibv_destroy_ah failed (%d)\n", err));\r
                status = errno_to_iberr(err);\r
                goto err_destroy_ah;\r
        }\r
 \r
 err_destroy_ah:\r
-       HCA_PRINT_EXIT(TRACE_LEVEL_ERROR  , HCA_DBG_SHIM  ,("completes with ERROR status %s\n", ib_get_err_str(status)));\r
-       return status;\r
-\r
-#else\r
-       mlnx_avo_t                      *avo_p = (mlnx_avo_t *)h_av;\r
-       mlnx_hobul_t            *hobul_p;\r
-       ib_api_status_t         status;\r
-\r
-       HCA_ENTER( HCA_DBG_SHIM);\r
-       if (!avo_p || avo_p->mark != E_MARK_AV) {\r
-               status = IB_INVALID_AV_HANDLE;\r
-               goto cleanup;\r
-       }\r
-\r
-       VALIDATE_INDEX(avo_p->hca_idx, MLNX_MAX_HCA, IB_INVALID_CA_HANDLE, cleanup);\r
-       hobul_p = mlnx_hobul_array[avo_p->hca_idx];\r
-       if (NULL == hobul_p) {\r
-               status =  IB_INVALID_AV_HANDLE;\r
-               goto cleanup;\r
-       }\r
-       VALIDATE_INDEX(avo_p->pd_idx, hobul_p->max_pd, IB_INVALID_PD_HANDLE, cleanup);\r
-       if (E_MARK_PD != hobul_p->pd_info_tbl[avo_p->pd_idx].mark) {\r
-               status =  IB_INVALID_PD_HANDLE;\r
-               goto cleanup;\r
-       }\r
-\r
-       // This destroy's a non priviledged ud_av.\r
-       // To destroy a privilged ud_av call THH_hob_destroy_ud_av()\r
-       if (HH_OK != THHUL_pdm_destroy_ud_av(hobul_p->hhul_hndl, avo_p->h_av)) {\r
-               status = IB_ERROR;\r
-               goto cleanup;\r
-       }\r
-\r
-       // update PD object count\r
-       cl_atomic_dec(&hobul_p->pd_info_tbl[avo_p->pd_idx].count);\r
-       HCA_PRINT(TRACE_LEVEL_INFORMATION, HCA_DBG_SHIM,("pd %d count %d\n", avo_p->pd_idx, hobul_p->pd_info_tbl[avo_p->pd_idx].count));\r
-\r
-       avo_p->mark = E_MARK_INVALID;\r
-       cl_free( avo_p);\r
-       HCA_EXIT( HCA_DBG_SHIM);\r
-       return IB_SUCCESS;\r
-\r
-cleanup:\r
-       if (avo_p) {\r
-               avo_p->mark = E_MARK_INVALID;\r
-               cl_free( avo_p);\r
-       }\r
-       HCA_PRINT(TRACE_LEVEL_ERROR  ,HCA_DBG_SHIM  ,("status %d\n", status));\r
-       HCA_EXIT( HCA_DBG_SHIM);\r
+       HCA_PRINT_EXIT(TRACE_LEVEL_ERROR  , HCA_DBG_SHIM,\r
+               ("completes with ERROR status %s\n", IB_GET_ERR_STR(status)));\r
        return status;\r
-#endif \r
 }\r
 \r
 /*\r
@@ -1710,7 +791,8 @@ _create_qp (
                ib_qp_p = ibv_create_qp( ib_pd_p, &qp_init_attr, context_p, p_umv_buf );\r
                if (IS_ERR(ib_qp_p)) {\r
                        err = PTR_ERR(ib_qp_p);\r
-                       HCA_PRINT(TRACE_LEVEL_ERROR  , HCA_DBG_QP  ,("ibv_create_qp failed (%d)\n", err));\r
+                       HCA_PRINT(TRACE_LEVEL_ERROR  , HCA_DBG_QP,\r
+                               ("ibv_create_qp failed (%d)\n", err));\r
                        status = errno_to_iberr(err);\r
                        goto err_create_qp;\r
                }\r
@@ -1740,7 +822,8 @@ _create_qp (
        end:\r
                if (p_umv_buf && p_umv_buf->command) \r
                        p_umv_buf->status = status;\r
-               HCA_PRINT_EXIT(TRACE_LEVEL_ERROR ,HCA_DBG_QP ,("completes with ERROR status %s\n", ib_get_err_str(status)));\r
+               HCA_PRINT_EXIT(TRACE_LEVEL_ERROR ,HCA_DBG_QP ,\r
+                       ("completes with ERROR status %s\n", IB_GET_ERR_STR(status)));\r
                return status;\r
 }\r
 \r
@@ -1753,247 +836,17 @@ mlnx_create_spl_qp (
                OUT                     ib_qp_attr_t                            *p_qp_attr,\r
                OUT                     ib_qp_handle_t                          *ph_qp )\r
 {\r
-#ifndef WIN_TO_BE_CHANGED\r
-\r
        ib_api_status_t         status;\r
+       PREP_IBDEV_FOR_PRINT(((struct ib_pd*)h_pd)->device)\r
 \r
        HCA_ENTER(HCA_DBG_SHIM);\r
 \r
        status =        _create_qp( h_pd, port_num,\r
                qp_context, p_create_attr, p_qp_attr, ph_qp, NULL );\r
                \r
-       HCA_PRINT_EXIT(TRACE_LEVEL_ERROR  , HCA_DBG_SHIM  ,("completes with ERROR status %s\n", ib_get_err_str(status)));\r
-       return status;\r
-                                                                                                                                               \r
-#else\r
-       ib_api_status_t                 status;\r
-       ib_qp_handle_t                  h_qp;\r
-       ci_umv_buf_t                    *p_umv_buf = NULL;\r
-\r
-       uint32_t                                hca_idx = PD_HCA_FROM_HNDL(h_pd);\r
-       uint32_t                                pd_idx  = PD_NUM_FROM_HNDL(h_pd);\r
-       uint32_t                                qp_num;\r
-       uint32_t                                qp_idx;\r
-       uint32_t                                send_cq_num;\r
-       uint32_t                                send_cq_idx;\r
-       uint32_t                                recv_cq_num;\r
-       uint32_t                                recv_cq_idx;\r
-       mlnx_hobul_t                    *hobul_p;\r
-       HH_hca_dev_t                    *hca_ul_info;\r
-       HH_qp_init_attr_t               hh_qp_init_attr;\r
-       HHUL_qp_init_attr_t             ul_qp_init_attr;\r
-       HHUL_qp_hndl_t                  hhul_qp_hndl = NULL;\r
-       VAPI_special_qp_t               vapi_qp_type;\r
-       VAPI_qp_cap_t                   hh_qp_cap;\r
-       void                                    *qp_ul_resources_p = NULL;\r
-       VAPI_sg_lst_entry_t             *send_sge_p = NULL;\r
-       VAPI_sg_lst_entry_t             *recv_sge_p = NULL;\r
-       uint32_t                                num_sge;\r
-\r
-       HCA_ENTER( HCA_DBG_SHIM);\r
-\r
-       VALIDATE_INDEX(hca_idx, MLNX_MAX_HCA, IB_INVALID_CA_HANDLE, cleanup);\r
-       hobul_p = mlnx_hobul_array[hca_idx];\r
-       if (NULL == hobul_p) {\r
-               status = IB_INVALID_PD_HANDLE;\r
-               goto cleanup;\r
-       }\r
-       VALIDATE_INDEX(pd_idx, hobul_p->max_pd, IB_INVALID_PD_HANDLE, cleanup);\r
-       if (E_MARK_PD != hobul_p->pd_info_tbl[pd_idx].mark) {\r
-               status =  IB_INVALID_PD_HANDLE;\r
-               goto cleanup;\r
-       }\r
-\r
-       hca_ul_info = (HH_hca_dev_t *)hobul_p->hh_hndl;\r
-       if (NULL == hca_ul_info) {\r
-               status =  IB_INVALID_PD_HANDLE;\r
-               goto cleanup;\r
-       }\r
-\r
-       // The create attributes must be provided\r
-       if (!p_create_attr) {\r
-               status =  IB_INVALID_PARAMETER;\r
-               goto cleanup;\r
-       }\r
-\r
-       // convert input parameters\r
-       cl_memclr(&ul_qp_init_attr, sizeof(ul_qp_init_attr));\r
-       mlnx_conv_qp_create_attr(p_create_attr, &ul_qp_init_attr, &vapi_qp_type);\r
-       send_cq_num = CQ_NUM_FROM_HNDL(p_create_attr->h_sq_cq);\r
-       recv_cq_num = CQ_NUM_FROM_HNDL(p_create_attr->h_rq_cq);\r
-       send_cq_idx = send_cq_num & hobul_p->cq_idx_mask;\r
-       recv_cq_idx = recv_cq_num & hobul_p->cq_idx_mask;\r
-       VALIDATE_INDEX(send_cq_idx, hobul_p->max_cq, IB_INVALID_CQ_HANDLE, cleanup);\r
-       if ( E_MARK_CQ != hobul_p->cq_info_tbl[send_cq_idx].mark) {\r
-               status =  IB_INVALID_CQ_HANDLE;\r
-               goto cleanup;\r
-       }\r
-       VALIDATE_INDEX(recv_cq_idx, hobul_p->max_cq, IB_INVALID_CQ_HANDLE, cleanup);\r
-       if ( E_MARK_CQ != hobul_p->cq_info_tbl[recv_cq_idx].mark) {\r
-               status =  IB_INVALID_CQ_HANDLE;\r
-               goto cleanup;\r
-       }\r
-\r
-       ul_qp_init_attr.pd    = hobul_p->pd_info_tbl[pd_idx].hhul_pd_hndl;\r
-       ul_qp_init_attr.sq_cq = hobul_p->cq_info_tbl[send_cq_idx].hhul_cq_hndl;\r
-       ul_qp_init_attr.rq_cq = hobul_p->cq_info_tbl[recv_cq_idx].hhul_cq_hndl;\r
-\r
-       if( p_umv_buf && p_umv_buf->command )\r
-       {\r
-               // For user mode calls - obtain and verify the vendor information\r
-               if (p_umv_buf->input_size != hca_ul_info->qp_ul_resources_sz ||\r
-                       NULL == p_umv_buf->p_inout_buf) {\r
-                               status = IB_INVALID_PARAMETER;\r
-                               goto cleanup;\r
-                       }\r
-                       qp_ul_resources_p = (void *)p_umv_buf->p_inout_buf;\r
-\r
-       } else {\r
-               // For kernel mode calls - allocate app resources. Use prep->call->done sequence\r
-               qp_ul_resources_p = cl_zalloc( hca_ul_info->qp_ul_resources_sz);\r
-               if (!qp_ul_resources_p) {\r
-                       status = IB_INSUFFICIENT_MEMORY;\r
-                       goto cleanup;\r
-               }\r
-\r
-               if (HH_OK != THHUL_qpm_special_qp_prep(hobul_p->hhul_hndl,\r
-                       vapi_qp_type,\r
-                       port_num, \r
-                       &ul_qp_init_attr,\r
-                       &hhul_qp_hndl,\r
-                       &hh_qp_cap,\r
-                       qp_ul_resources_p)) {\r
-                               status = IB_ERROR;\r
-                               goto cleanup;\r
-                       }\r
-                       // TBD: if not same report error to IBAL\r
-                       ul_qp_init_attr.qp_cap = hh_qp_cap;  // struct assign\r
-       }\r
-\r
-       // Convert HHUL to HH structure (for HH create_qp)\r
-       hh_qp_init_attr.pd = pd_idx;\r
-       hh_qp_init_attr.rdd = 0; // TBD: RDD\r
-       if( ul_qp_init_attr.srq != HHUL_INVAL_SRQ_HNDL )\r
-       {\r
-               // TBD: HH handle from HHUL handle.\r
-               CL_ASSERT( ul_qp_init_attr.srq == HHUL_INVAL_SRQ_HNDL );\r
-       }\r
-       else\r
-       {\r
-               hh_qp_init_attr.srq = HH_INVAL_SRQ_HNDL;\r
-       }\r
-       hh_qp_init_attr.sq_cq = send_cq_num;\r
-       hh_qp_init_attr.rq_cq = recv_cq_num;\r
-       hh_qp_init_attr.sq_sig_type = ul_qp_init_attr.sq_sig_type;\r
-       hh_qp_init_attr.rq_sig_type = ul_qp_init_attr.rq_sig_type;\r
-       hh_qp_init_attr.ts_type = VAPI_TS_UD;\r
-       hh_qp_init_attr.qp_cap  = ul_qp_init_attr.qp_cap; // struct assign\r
-\r
-       // Allocate the QP (cmdif)\r
-       if (HH_OK != THH_hob_get_special_qp( hobul_p->hh_hndl,\r
-               vapi_qp_type,\r
-               port_num,\r
-               &hh_qp_init_attr,\r
-               qp_ul_resources_p,\r
-               &qp_num))\r
-       {\r
-               status = IB_ERROR;\r
-               goto cleanup_qp;\r
-       }\r
-\r
-       if( !(p_umv_buf && p_umv_buf->command) )\r
-       {\r
-               // Manage user level resources\r
-               if (HH_OK != THHUL_qpm_create_qp_done(hobul_p->hhul_hndl, hhul_qp_hndl, qp_num, qp_ul_resources_p)) {\r
-                       THH_hob_destroy_qp(hobul_p->hh_hndl, qp_num);\r
-                       status = IB_ERROR;\r
-                       goto cleanup_qp;\r
-               }\r
-\r
-               // Create SQ and RQ iov\r
-               num_sge = ul_qp_init_attr.qp_cap.max_sg_size_sq;\r
-               send_sge_p = cl_zalloc( num_sge * sizeof(VAPI_sg_lst_entry_t));\r
-               if (!send_sge_p) {\r
-                       status = IB_INSUFFICIENT_MEMORY;\r
-                       goto cleanup_qp;\r
-               }\r
-\r
-               num_sge = ul_qp_init_attr.qp_cap.max_sg_size_rq;\r
-               recv_sge_p = cl_zalloc( num_sge * sizeof(VAPI_sg_lst_entry_t));\r
-               if (!recv_sge_p) {\r
-                       status = IB_INSUFFICIENT_MEMORY;\r
-                       goto cleanup_qp;\r
-               }\r
-       }\r
-\r
-       // Save data refs for future use\r
-       qp_idx = qp_num & hobul_p->qp_idx_mask;\r
-       VALIDATE_INDEX(qp_idx, hobul_p->max_qp, IB_ERROR, cleanup_qp);\r
-\r
-       h_qp = (ib_qp_handle_t)QP_HNDL_FROM_QP(qp_idx);\r
-       cl_mutex_acquire(&h_qp->mutex);\r
-       h_qp->pd_num                    = pd_idx;\r
-       h_qp->hhul_qp_hndl              = hhul_qp_hndl;\r
-       h_qp->qp_type                   = p_create_attr->qp_type;\r
-       h_qp->sq_signaled               = p_create_attr->sq_signaled;\r
-       h_qp->qp_context                = qp_context;\r
-       h_qp->qp_ul_resources_p = qp_ul_resources_p;\r
-       h_qp->sq_size                   = ul_qp_init_attr.qp_cap.max_sg_size_sq;\r
-       h_qp->rq_size                   = ul_qp_init_attr.qp_cap.max_sg_size_rq;\r
-       h_qp->send_sge_p                = send_sge_p;\r
-       h_qp->recv_sge_p                = recv_sge_p;\r
-       h_qp->qp_num                    = qp_num;\r
-       h_qp->h_sq_cq                   = &hobul_p->cq_info_tbl[send_cq_idx];\r
-       h_qp->h_rq_cq                   = &hobul_p->cq_info_tbl[recv_cq_idx];\r
-       h_qp->kernel_mode               = !(p_umv_buf && p_umv_buf->command);\r
-       h_qp->mark                              = E_MARK_QP;\r
-       HCA_PRINT(TRACE_LEVEL_INFORMATION, HCA_DBG_SHIM,("qp num 0x%x idx 0x%x cq_s 0x%x cq_r 0x%x\n",\r
-               qp_num, qp_idx, send_cq_idx, recv_cq_idx));\r
-       cl_mutex_release(&h_qp->mutex);\r
-\r
-       /* Mark the CQ's associated with this special QP as being high priority. */\r
-       cl_atomic_inc( &h_qp->h_sq_cq->spl_qp_cnt );\r
-       KeSetImportanceDpc( &h_qp->h_sq_cq->dpc, HighImportance );\r
-       cl_atomic_inc( &h_qp->h_rq_cq->spl_qp_cnt );\r
-       KeSetImportanceDpc( &h_qp->h_rq_cq->dpc, HighImportance );\r
-\r
-       // Update PD object count\r
-       cl_atomic_inc(&hobul_p->pd_info_tbl[pd_idx].count);\r
-       HCA_PRINT(TRACE_LEVEL_INFORMATION  , HCA_DBG_SHIM  ,("pd %d count %d\n", pd_idx, hobul_p->pd_info_tbl[pd_idx].count));\r
-\r
-       // Query QP to obtain requested attributes\r
-       if (p_qp_attr) {\r
-               if (IB_SUCCESS != (status = mlnx_query_qp (h_qp, p_qp_attr, p_umv_buf))) {\r
-                       goto cleanup;\r
-               }\r
-       }\r
-\r
-       if (ph_qp) *ph_qp = h_qp;\r
-       if( p_umv_buf && p_umv_buf->command )\r
-       {\r
-               p_umv_buf->output_size = p_umv_buf->input_size;\r
-               p_umv_buf->status = IB_SUCCESS;\r
-       }\r
-       HCA_EXIT( HCA_DBG_SHIM);\r
-       return IB_SUCCESS;\r
-\r
-cleanup_qp:\r
-       if (send_sge_p) cl_free( send_sge_p);\r
-       if (recv_sge_p) cl_free( recv_sge_p);\r
-       if( !(p_umv_buf && p_umv_buf->command) )\r
-               THHUL_qpm_destroy_qp_done(hobul_p->hhul_hndl, hhul_qp_hndl);\r
-\r
-cleanup:\r
-       if( !(p_umv_buf && p_umv_buf->command) && qp_ul_resources_p )\r
-               cl_free( qp_ul_resources_p);\r
-       if( p_umv_buf && p_umv_buf->command )\r
-       {\r
-               p_umv_buf->status = status;\r
-       }\r
-       HCA_PRINT(TRACE_LEVEL_ERROR  ,HCA_DBG_SHIM  ,("stauts %d\n", status));\r
-       HCA_EXIT( HCA_DBG_SHIM);\r
+       HCA_PRINT_EXIT(TRACE_LEVEL_ERROR  , HCA_DBG_SHIM,\r
+               ("completes with ERROR status %s\n", IB_GET_ERR_STR(status)));\r
        return status;\r
-#endif \r
 }\r
 \r
 ib_api_status_t\r
@@ -2005,9 +858,9 @@ mlnx_create_qp (
                OUT                     ib_qp_handle_t                          *ph_qp,\r
        IN      OUT                     ci_umv_buf_t                            *p_umv_buf )\r
 {\r
-#ifndef WIN_TO_BE_CHANGED\r
-\r
        ib_api_status_t         status;\r
+       PREP_IBDEV_FOR_PRINT(((struct ib_pd*)h_pd)->device)\r
+\r
        //NB: algorithm of mthca_alloc_sqp() requires port_num\r
        // PRM states, that special pares are created in couples, so\r
        // looks like we can put here port_num = 1 always\r
@@ -2018,244 +871,24 @@ mlnx_create_qp (
        status = _create_qp( h_pd, port_num,\r
                qp_context, p_create_attr, p_qp_attr, ph_qp, p_umv_buf );\r
                \r
-       HCA_PRINT_EXIT(TRACE_LEVEL_ERROR ,HCA_DBG_QP ,("completes with ERROR status %s\n", ib_get_err_str(status)));\r
+       HCA_PRINT_EXIT(TRACE_LEVEL_ERROR ,HCA_DBG_QP,\r
+               ("completes with ERROR status %s\n", IB_GET_ERR_STR(status)));\r
        return status;\r
-                                                                                                                                               \r
-#else\r
-       ib_api_status_t                 status;\r
-       ib_qp_handle_t                  h_qp;\r
-\r
-       uint32_t                                hca_idx = PD_HCA_FROM_HNDL(h_pd);\r
-       uint32_t                                pd_idx  = PD_NUM_FROM_HNDL(h_pd);\r
-       uint32_t                                qp_num;\r
-       uint32_t                                qp_idx;\r
-       uint32_t                                send_cq_num;\r
-       uint32_t                                send_cq_idx;\r
-       uint32_t                                recv_cq_num;\r
-       uint32_t                                recv_cq_idx;\r
-       mlnx_hobul_t                    *hobul_p;\r
-       HH_hca_dev_t                    *hca_ul_info;\r
-       HH_qp_init_attr_t               hh_qp_init_attr;\r
-       HHUL_qp_init_attr_t             ul_qp_init_attr;\r
-       HHUL_qp_hndl_t                  hhul_qp_hndl = NULL;\r
-       VAPI_qp_cap_t                   hh_qp_cap;\r
-       void                                    *qp_ul_resources_p = NULL;\r
-       VAPI_sg_lst_entry_t             *send_sge_p = NULL;\r
-       VAPI_sg_lst_entry_t             *recv_sge_p = NULL;\r
-       uint32_t                                num_sge;\r
+}\r
 \r
-       HCA_ENTER( HCA_DBG_QP);\r
-\r
-       VALIDATE_INDEX(hca_idx, MLNX_MAX_HCA, IB_INVALID_CA_HANDLE, cleanup);\r
-       hobul_p = mlnx_hobul_array[hca_idx];\r
-       if (NULL == hobul_p) {\r
-               status = IB_INVALID_PD_HANDLE;\r
-               goto cleanup;\r
-       }\r
-       VALIDATE_INDEX(pd_idx, hobul_p->max_pd, IB_INVALID_PD_HANDLE, cleanup);\r
-       if (E_MARK_PD != hobul_p->pd_info_tbl[pd_idx].mark) {\r
-               status =  IB_INVALID_PD_HANDLE;\r
-               goto cleanup;\r
-       }\r
-\r
-       hca_ul_info = (HH_hca_dev_t *)hobul_p->hh_hndl;\r
-       if (NULL == hca_ul_info) {\r
-               status =  IB_INVALID_PD_HANDLE;\r
-               goto cleanup;\r
-       }\r
-\r
-       // The create attributes must be provided\r
-       if (!p_create_attr) {\r
-               status =  IB_INVALID_PARAMETER;\r
-               goto cleanup;\r
-       }\r
-\r
-       // convert input parameters\r
-       cl_memclr(&ul_qp_init_attr, sizeof(ul_qp_init_attr));\r
-       mlnx_conv_qp_create_attr(p_create_attr, &ul_qp_init_attr, NULL);\r
-       send_cq_num = CQ_NUM_FROM_HNDL(p_create_attr->h_sq_cq);\r
-       recv_cq_num = CQ_NUM_FROM_HNDL(p_create_attr->h_rq_cq);\r
-       send_cq_idx = send_cq_num & hobul_p->cq_idx_mask;\r
-       recv_cq_idx = recv_cq_num & hobul_p->cq_idx_mask;\r
-       VALIDATE_INDEX(send_cq_idx, hobul_p->max_cq, IB_INVALID_CQ_HANDLE, cleanup);\r
-       if ( E_MARK_CQ != hobul_p->cq_info_tbl[send_cq_idx].mark) {\r
-               status =  IB_INVALID_CQ_HANDLE;\r
-               goto cleanup;\r
-       }\r
-       VALIDATE_INDEX(recv_cq_idx, hobul_p->max_cq, IB_INVALID_CQ_HANDLE, cleanup);\r
-       if ( E_MARK_CQ != hobul_p->cq_info_tbl[recv_cq_idx].mark) {\r
-               status =  IB_INVALID_CQ_HANDLE;\r
-               goto cleanup;\r
-       }\r
-\r
-       ul_qp_init_attr.pd    = hobul_p->pd_info_tbl[pd_idx].hhul_pd_hndl;\r
-       ul_qp_init_attr.sq_cq = hobul_p->cq_info_tbl[send_cq_idx].hhul_cq_hndl;\r
-       ul_qp_init_attr.rq_cq = hobul_p->cq_info_tbl[recv_cq_idx].hhul_cq_hndl;\r
-\r
-       if( p_umv_buf && p_umv_buf->command )\r
-       {\r
-               // For user mode calls - obtain and verify the vendor information\r
-               if ((p_umv_buf->input_size - sizeof (uint32_t)) != \r
-                       hca_ul_info->qp_ul_resources_sz ||\r
-                       NULL == p_umv_buf->p_inout_buf) {\r
-                               status = IB_INVALID_PARAMETER;\r
-                               goto cleanup;\r
-                       }\r
-                       qp_ul_resources_p = (void *)p_umv_buf->p_inout_buf;\r
-\r
-       } else {\r
-               // for kernel mode calls - allocate app resources. Use prep->call->done sequence\r
-               qp_ul_resources_p = cl_zalloc( hca_ul_info->qp_ul_resources_sz);\r
-               if (!qp_ul_resources_p) {\r
-                       status = IB_INSUFFICIENT_MEMORY;\r
-                       goto cleanup;\r
-               }\r
-\r
-               if (HH_OK != THHUL_qpm_create_qp_prep(hobul_p->hhul_hndl, &ul_qp_init_attr, &hhul_qp_hndl, &hh_qp_cap, qp_ul_resources_p)) {\r
-                       status = IB_ERROR;\r
-                       goto cleanup;\r
-               }\r
-               // TBD: if not same report error to IBAL\r
-               ul_qp_init_attr.qp_cap = hh_qp_cap;  // struct assign\r
-       }\r
-\r
-       // Convert HHUL to HH structure (for HH create_qp)\r
-       hh_qp_init_attr.pd = pd_idx;\r
-       hh_qp_init_attr.rdd = 0; // TBD: RDD\r
-       if( ul_qp_init_attr.srq != HHUL_INVAL_SRQ_HNDL )\r
-       {\r
-               // TBD: HH handle from HHUL handle.\r
-               CL_ASSERT( ul_qp_init_attr.srq == HHUL_INVAL_SRQ_HNDL );\r
-       }\r
-       else\r
-       {\r
-               hh_qp_init_attr.srq = HH_INVAL_SRQ_HNDL;\r
-       }\r
-       hh_qp_init_attr.sq_cq = send_cq_num;\r
-       hh_qp_init_attr.rq_cq = recv_cq_num;\r
-       hh_qp_init_attr.sq_sig_type = ul_qp_init_attr.sq_sig_type;\r
-       hh_qp_init_attr.rq_sig_type = ul_qp_init_attr.rq_sig_type;\r
-       hh_qp_init_attr.ts_type = ul_qp_init_attr.ts_type;\r
-       hh_qp_init_attr.qp_cap  = ul_qp_init_attr.qp_cap; // struct assign\r
-\r
-       // Allocate the QP (cmdif)\r
-       if (HH_OK != THH_hob_create_qp(hobul_p->hh_hndl, &hh_qp_init_attr, qp_ul_resources_p, &qp_num)) {\r
-               status = IB_INSUFFICIENT_RESOURCES;\r
-               goto cleanup_qp;\r
-       }\r
-\r
-       if( !(p_umv_buf && p_umv_buf->command) )\r
-       {\r
-               // Manage user level resources\r
-               if (HH_OK != THHUL_qpm_create_qp_done(hobul_p->hhul_hndl, hhul_qp_hndl, qp_num, qp_ul_resources_p)) {\r
-                       THH_hob_destroy_qp(hobul_p->hh_hndl, qp_num);\r
-                       status = IB_ERROR;\r
-                       goto cleanup_qp;\r
-               }\r
-\r
-               // Create SQ and RQ iov\r
-               num_sge = ul_qp_init_attr.qp_cap.max_sg_size_sq;\r
-               send_sge_p = cl_zalloc( num_sge * sizeof(VAPI_sg_lst_entry_t));\r
-               if (!send_sge_p) {\r
-                       status = IB_INSUFFICIENT_MEMORY;\r
-                       goto cleanup_qp;\r
-               }\r
-\r
-               num_sge = ul_qp_init_attr.qp_cap.max_sg_size_rq;\r
-               recv_sge_p = cl_zalloc( num_sge * sizeof(VAPI_sg_lst_entry_t));\r
-               if (!recv_sge_p) {\r
-                       status = IB_INSUFFICIENT_MEMORY;\r
-                       goto cleanup_qp;\r
-               }\r
-       }\r
-\r
-       // Save data refs for future use\r
-       qp_idx = qp_num & hobul_p->qp_idx_mask;\r
-       VALIDATE_INDEX(qp_idx, hobul_p->max_qp, IB_ERROR, cleanup_qp);\r
-       HCA_PRINT(TRACE_LEVEL_INFORMATION, HCA_DBG_QP,("hobul_p 0x%p mask 0x%x qp_idx 0x%x qp_num 0x%x\n",\r
-               hobul_p, hobul_p->qp_idx_mask, qp_idx, qp_num));\r
-\r
-       h_qp = (ib_qp_handle_t)QP_HNDL_FROM_QP(qp_idx);\r
-       cl_mutex_acquire(&h_qp->mutex);\r
-       h_qp->pd_num                    = pd_idx;\r
-       h_qp->hhul_qp_hndl              = hhul_qp_hndl;\r
-       h_qp->qp_type                   = p_create_attr->qp_type;\r
-       h_qp->sq_signaled               = p_create_attr->sq_signaled;\r
-       h_qp->qp_context                = qp_context;\r
-       h_qp->qp_ul_resources_p = qp_ul_resources_p;\r
-       h_qp->sq_size                   = ul_qp_init_attr.qp_cap.max_sg_size_sq;\r
-       h_qp->rq_size                   = ul_qp_init_attr.qp_cap.max_sg_size_rq;\r
-       h_qp->send_sge_p                = send_sge_p;\r
-       h_qp->recv_sge_p                = recv_sge_p;\r
-       h_qp->qp_num                    = qp_num;\r
-       h_qp->h_sq_cq                   = &hobul_p->cq_info_tbl[send_cq_idx];\r
-       h_qp->h_rq_cq                   = &hobul_p->cq_info_tbl[recv_cq_idx];\r
-       h_qp->kernel_mode               = !(p_umv_buf && p_umv_buf->command);\r
-       h_qp->mark                              = E_MARK_QP;\r
-       HCA_PRINT(TRACE_LEVEL_INFORMATION, HCA_DBG_QP,("qp num 0x%x idx 0x%x cq_s 0x%x cq_r 0x%x\n",\r
-               qp_num, qp_idx, send_cq_idx, recv_cq_idx));\r
-       cl_mutex_release(&h_qp->mutex);\r
-       // Update PD object count\r
-       cl_atomic_inc(&hobul_p->pd_info_tbl[pd_idx].count);\r
-       HCA_PRINT(TRACE_LEVEL_INFORMATION, HCA_DBG_QP,("pd %d count %d\n", pd_idx, hobul_p->pd_info_tbl[pd_idx].count));\r
-\r
-       // Query QP to obtain requested attributes\r
-       if (p_qp_attr) {\r
-               if (IB_SUCCESS != (status = mlnx_query_qp (h_qp, p_qp_attr, p_umv_buf)))\r
-               {\r
-                       if( !(p_umv_buf && p_umv_buf->command) )\r
-                               goto cleanup_qp;\r
-                       else\r
-                               goto cleanup;\r
-               }\r
-       }\r
-\r
-       if (ph_qp) *ph_qp = h_qp;\r
-       if( p_umv_buf && p_umv_buf->command )\r
-       {\r
-               p_umv_buf->output_size = p_umv_buf->input_size;\r
-               p_umv_buf->status = IB_SUCCESS;\r
-               /* \r
-               * Copy the qp_idx back to user\r
-               */\r
-               cl_memcpy (((uint8_t* __ptr64)p_umv_buf->p_inout_buf + hca_ul_info->qp_ul_resources_sz),\r
-                       &qp_num, sizeof (qp_num));\r
-       }\r
-       HCA_EXIT( HCA_DBG_QP);\r
-       return IB_SUCCESS;\r
-\r
-cleanup_qp:\r
-       if (send_sge_p) cl_free( send_sge_p);\r
-       if (recv_sge_p) cl_free( recv_sge_p);\r
-       if( !(p_umv_buf && p_umv_buf->command) )\r
-               THHUL_qpm_destroy_qp_done(hobul_p->hhul_hndl, hhul_qp_hndl);\r
-\r
-cleanup:\r
-       if( !(p_umv_buf && p_umv_buf->command) && qp_ul_resources_p)\r
-               cl_free( qp_ul_resources_p);\r
-       if( p_umv_buf && p_umv_buf->command )\r
-       {\r
-               p_umv_buf->status = status;\r
-       }\r
-       HCA_PRINT_EXIT(TRACE_LEVEL_ERROR ,HCA_DBG_QP ,("status %d\n", status));\r
-       return status;\r
-#endif \r
-}\r
-\r
-ib_api_status_t\r
-mlnx_modify_qp (\r
-       IN              const   ib_qp_handle_t                          h_qp,\r
-       IN              const   ib_qp_mod_t                                     *p_modify_attr,\r
-               OUT                     ib_qp_attr_t                            *p_qp_attr OPTIONAL,\r
-       IN      OUT                     ci_umv_buf_t                            *p_umv_buf OPTIONAL )\r
-{\r
-#ifndef WIN_TO_BE_CHANGED\r
-\r
-       ib_api_status_t         status;\r
-       int err;\r
-       struct ib_qp_attr qp_attr;\r
-       int qp_attr_mask;\r
-       struct ib_qp *ib_qp_p = (struct ib_qp *)h_qp;\r
+ib_api_status_t\r
+mlnx_modify_qp (\r
+       IN              const   ib_qp_handle_t                          h_qp,\r
+       IN              const   ib_qp_mod_t                                     *p_modify_attr,\r
+               OUT                     ib_qp_attr_t                            *p_qp_attr OPTIONAL,\r
+       IN      OUT                     ci_umv_buf_t                            *p_umv_buf OPTIONAL )\r
+{\r
+       ib_api_status_t         status;\r
+       int err;\r
+       struct ib_qp_attr qp_attr;\r
+       int qp_attr_mask;\r
+       struct ib_qp *ib_qp_p = (struct ib_qp *)h_qp;\r
+       PREP_IBDEV_FOR_PRINT(ib_qp_p->device)\r
 \r
        HCA_ENTER(HCA_DBG_QP);\r
 \r
@@ -2315,115 +948,9 @@ err_mode_unsupported:
 err_inval_params:\r
        if (p_umv_buf && p_umv_buf->command) \r
                p_umv_buf->status = status;\r
-       HCA_PRINT_EXIT(TRACE_LEVEL_ERROR  , HCA_DBG_SHIM  ,("completes with ERROR status %s\n", ib_get_err_str(status)));\r
+       HCA_PRINT_EXIT(TRACE_LEVEL_ERROR  , HCA_DBG_SHIM,\r
+               ("completes with ERROR status %s\n", IB_GET_ERR_STR(status)));\r
        return status;\r
-\r
-#else\r
-       ib_api_status_t         status;\r
-\r
-       uint32_t                        hca_idx = QP_HCA_FROM_HNDL(h_qp);\r
-       uint32_t                        qp_num  = QP_NUM_FROM_HNDL(h_qp);\r
-       uint32_t                        qp_idx  = 0;\r
-       mlnx_hobul_t            *hobul_p;\r
-       HHUL_qp_hndl_t          hhul_qp_hndl;\r
-       VAPI_qp_attr_mask_t     hh_qp_attr_mask;\r
-       VAPI_qp_attr_t          hh_qp_attr;\r
-       VAPI_qp_state_t         hh_qp_state;\r
-\r
-       HCA_ENTER( HCA_DBG_QP);\r
-\r
-       VALIDATE_INDEX(hca_idx, MLNX_MAX_HCA, IB_INVALID_CA_HANDLE, cleanup);\r
-       hobul_p = mlnx_hobul_array[hca_idx];\r
-       if (NULL == hobul_p) {\r
-               status = IB_INVALID_QP_HANDLE;\r
-               goto cleanup;\r
-       }\r
-\r
-       qp_idx = qp_num & hobul_p->qp_idx_mask;\r
-       VALIDATE_INDEX(qp_idx, hobul_p->max_qp, IB_INVALID_QP_HANDLE, cleanup);\r
-       if ( E_MARK_QP != hobul_p->qp_info_tbl[qp_idx].mark) {\r
-               status =  IB_INVALID_QP_HANDLE;\r
-               goto cleanup;\r
-       }\r
-\r
-       HCA_PRINT(TRACE_LEVEL_INFORMATION, HCA_DBG_QP, \r
-               ("Before acquire mutex to modify qp_idx 0x%x\n",\r
-               qp_idx));\r
-\r
-       cl_mutex_acquire(&hobul_p->qp_info_tbl[qp_idx].mutex);\r
-\r
-       hhul_qp_hndl = hobul_p->qp_info_tbl[qp_idx].hhul_qp_hndl;\r
-\r
-       // Obtain curernt state of QP\r
-       if (HH_OK != THH_hob_query_qp(hobul_p->hh_hndl, hobul_p->qp_info_tbl[qp_idx].qp_num, &hh_qp_attr))\r
-       {\r
-               status = IB_ERROR;\r
-               goto cleanup_locked;\r
-       }\r
-       hh_qp_state = hh_qp_attr.qp_state; // The current (pre-modify) state\r
-\r
-       // Convert the input parameters. Use query result as default (no cl_memset())\r
-       // cl_memclr(&hh_qp_attr, sizeof(hh_qp_attr));\r
-       status = mlnx_conv_qp_modify_attr(hobul_p->hh_hndl,\r
-               hobul_p->qp_info_tbl[qp_idx].qp_type,\r
-               p_modify_attr, &hh_qp_attr, &hh_qp_attr_mask);\r
-       if( status != IB_SUCCESS )\r
-               goto cleanup_locked;\r
-\r
-       if (HH_OK != THH_hob_modify_qp(hobul_p->hh_hndl,\r
-               hobul_p->qp_info_tbl[qp_idx].qp_num,\r
-               hh_qp_state, &hh_qp_attr, &hh_qp_attr_mask))\r
-       {\r
-               status = IB_ERROR;\r
-               goto cleanup_locked;\r
-       }\r
-\r
-       HCA_PRINT(TRACE_LEVEL_INFORMATION, HCA_DBG_QP, \r
-               ("After hob_modify_qp qp_idx 0x%x k_mod %d\n", \r
-               qp_idx, hobul_p->qp_info_tbl[qp_idx].kernel_mode));\r
-\r
-       // Notify HHUL of the new (post-modify) state. This is done for both k-mode calls only\r
-       if (hobul_p->qp_info_tbl[qp_idx].kernel_mode) {\r
-               if (HH_OK != THHUL_qpm_modify_qp_done(hobul_p->hhul_hndl, hhul_qp_hndl, hh_qp_attr.qp_state))\r
-               {\r
-                       status = IB_ERROR;\r
-                       goto cleanup_locked;\r
-               } \r
-       } \r
-       cl_mutex_release(&hobul_p->qp_info_tbl[qp_idx].mutex);\r
-\r
-       if ((p_qp_attr) && !(p_umv_buf && p_umv_buf->command)) {\r
-               if (IB_SUCCESS != (status = mlnx_query_qp (h_qp, p_qp_attr, p_umv_buf))) {\r
-                       goto cleanup;\r
-               }\r
-       }\r
-\r
-       if ( p_umv_buf && p_umv_buf->command && (! hobul_p->qp_info_tbl[qp_idx].kernel_mode)) {\r
-               HCA_PRINT(TRACE_LEVEL_INFORMATION, HCA_DBG_QP, \r
-                       ("mod_qp qp_idx %d umv_buf %p inout_buf %p\n", \r
-                       qp_idx, p_umv_buf, p_umv_buf->p_inout_buf));\r
-               if (p_umv_buf->p_inout_buf) {\r
-                       p_umv_buf->output_size = sizeof (VAPI_qp_state_t);\r
-                       cl_memcpy (p_umv_buf->p_inout_buf, &(hh_qp_attr.qp_state), \r
-                               (size_t)p_umv_buf->output_size);\r
-                       p_umv_buf->status = IB_SUCCESS;\r
-               }\r
-       }\r
-       HCA_EXIT( HCA_DBG_QP);\r
-       return IB_SUCCESS;\r
-\r
-\r
-cleanup_locked:\r
-       cl_mutex_release(&hobul_p->qp_info_tbl[qp_idx].mutex);\r
-\r
-cleanup:\r
-       if( p_umv_buf && p_umv_buf->command )\r
-       {\r
-               p_umv_buf->status = status;\r
-       }\r
-       HCA_PRINT_EXIT(TRACE_LEVEL_ERROR  ,HCA_DBG_QP  ,("status %d\n", status));\r
-       return status;\r
-#endif \r
 }\r
 \r
 ib_api_status_t\r
@@ -2432,11 +959,10 @@ mlnx_query_qp (
                OUT                     ib_qp_attr_t                            *p_qp_attr,\r
        IN      OUT                     ci_umv_buf_t                            *p_umv_buf )\r
 {\r
-#ifndef WIN_TO_BE_CHANGED\r
-\r
        ib_api_status_t         status = IB_SUCCESS;\r
        struct ib_qp *ib_qp_p = (struct ib_qp *)h_qp;\r
        struct mthca_qp *qp_p = (struct mthca_qp *)ib_qp_p;\r
+       PREP_IBDEV_FOR_PRINT(ib_qp_p->device)\r
 \r
        UNREFERENCED_PARAMETER(p_umv_buf);\r
        \r
@@ -2462,8 +988,8 @@ mlnx_query_qp (
        p_qp_attr->state                                                = mlnx_qps_to_ibal( qp_p->state );\r
        p_qp_attr->num                                          = cl_hton32(qp_p->ibqp.qp_num);\r
 \r
-#if 0          \r
-//TODO: don't know how to fill the following fileds    without support of query_qp in MTHCA    \r
+#ifdef WIN_TO_BE_CHANGED\r
+//TODO: don't know how to fill the following fields    without support of query_qp in MTHCA    \r
        p_qp_attr->access_ctrl                  = qp_p->\r
        p_qp_attr->pkey_index                   = qp_p->\r
        p_qp_attr->dest_num                             = qp_p-\r
@@ -2480,72 +1006,9 @@ mlnx_query_qp (
 \r
        status = IB_SUCCESS;\r
 \r
-       HCA_PRINT_EXIT(TRACE_LEVEL_ERROR , HCA_DBG_QP ,("completes with ERROR status %s\n", ib_get_err_str(status)));\r
-       return status;\r
-\r
-\r
-#else\r
-       ib_api_status_t         status;\r
-\r
-       uint32_t                        hca_idx = QP_HCA_FROM_HNDL(h_qp);\r
-       uint32_t                        qp_num  = QP_NUM_FROM_HNDL(h_qp);\r
-       uint32_t                        qp_idx  = 0;\r
-       mlnx_hobul_t            *hobul_p;\r
-       VAPI_qp_attr_t          hh_qp_attr;\r
-\r
-       HCA_ENTER( HCA_DBG_QP);\r
-\r
-       VALIDATE_INDEX(hca_idx, MLNX_MAX_HCA, IB_INVALID_CA_HANDLE, cleanup);\r
-       hobul_p = mlnx_hobul_array[hca_idx];\r
-       if (NULL == hobul_p) {\r
-               status = IB_INVALID_QP_HANDLE;\r
-               goto cleanup;\r
-       }\r
-\r
-       qp_idx = qp_num & hobul_p->qp_idx_mask;\r
-       VALIDATE_INDEX(qp_idx, hobul_p->max_qp, IB_INVALID_QP_HANDLE, cleanup);\r
-       if ( E_MARK_QP != hobul_p->qp_info_tbl[qp_idx].mark) {\r
-               status =  IB_INVALID_QP_HANDLE;\r
-               goto cleanup;\r
-       }\r
-\r
-       cl_mutex_acquire(&h_qp->mutex);\r
-\r
-       if (HH_OK != THH_hob_query_qp(hobul_p->hh_hndl, h_qp->qp_num, &hh_qp_attr)) {\r
-               status = IB_ERROR;\r
-               goto cleanup_locked;\r
-       }\r
-\r
-       // Convert query result into IBAL structure (no cl_memset())\r
-       mlnx_conv_vapi_qp_attr(hobul_p->hh_hndl, &hh_qp_attr, p_qp_attr);\r
-       p_qp_attr->qp_type = h_qp->qp_type;\r
-       p_qp_attr->h_pd    = (ib_pd_handle_t)PD_HNDL_FROM_PD(h_qp->pd_num);\r
-       p_qp_attr->h_sq_cq = h_qp->h_sq_cq;\r
-       p_qp_attr->h_rq_cq = h_qp->h_rq_cq;\r
-       p_qp_attr->sq_signaled = h_qp->sq_signaled;\r
-\r
-       cl_mutex_release(&h_qp->mutex);\r
-\r
-       if( p_umv_buf && p_umv_buf->command )\r
-       {\r
-               p_umv_buf->output_size = 0;\r
-               p_umv_buf->status = IB_SUCCESS;\r
-       }\r
-       HCA_EXIT( HCA_DBG_QP);\r
-       return IB_SUCCESS;\r
-\r
-cleanup_locked:\r
-       cl_mutex_release(&hobul_p->qp_info_tbl[qp_idx].mutex);\r
-cleanup:\r
-       if( p_umv_buf && p_umv_buf->command )\r
-       {\r
-               p_umv_buf->output_size = 0;\r
-               p_umv_buf->status = status;\r
-       }\r
-       \r
-       HCA_PRINT_EXIT(TRACE_LEVEL_ERROR  ,HCA_DBG_QP  ,("status %d\n", status));\r
+       HCA_PRINT_EXIT(TRACE_LEVEL_ERROR , HCA_DBG_QP,\r
+               ("completes with ERROR status %s\n", IB_GET_ERR_STR(status)));\r
        return status;\r
-#endif \r
 }\r
 \r
 ib_api_status_t\r
@@ -2553,12 +1016,11 @@ mlnx_destroy_qp (
        IN              const   ib_qp_handle_t                          h_qp,\r
        IN              const   uint64_t                                        timewait )\r
 {\r
-#ifndef WIN_TO_BE_CHANGED\r
-\r
        ib_api_status_t         status;\r
        int err;\r
        struct ib_qp *ib_qp_p = (struct ib_qp *)h_qp;\r
-               \r
+       PREP_IBDEV_FOR_PRINT(ib_qp_p->device)\r
+\r
        UNUSED_PARAM( timewait );\r
 \r
        HCA_ENTER( HCA_DBG_QP);\r
@@ -2568,7 +1030,8 @@ mlnx_destroy_qp (
 \r
        err = ibv_destroy_qp( ib_qp_p );\r
        if (err) {\r
-               HCA_PRINT(TRACE_LEVEL_ERROR ,HCA_DBG_QP ,("ibv_destroy_qp failed (%d)\n", err));\r
+               HCA_PRINT(TRACE_LEVEL_ERROR ,HCA_DBG_QP,\r
+                       ("ibv_destroy_qp failed (%d)\n", err));\r
                status = errno_to_iberr(err);\r
                goto err_destroy_qp;\r
        }\r
@@ -2576,113 +1039,9 @@ mlnx_destroy_qp (
        status = IB_SUCCESS;\r
 \r
 err_destroy_qp:\r
-       HCA_PRINT_EXIT(TRACE_LEVEL_ERROR ,HCA_DBG_QP ,("completes with ERROR status %s\n", ib_get_err_str(status)));\r
-       return status;\r
-\r
-#else\r
-\r
-       ib_api_status_t         status;\r
-\r
-       uint32_t                        hca_idx = QP_HCA_FROM_HNDL(h_qp);\r
-       uint32_t                        qp_num  = QP_NUM_FROM_HNDL(h_qp);\r
-       uint32_t                        pd_idx  = 0;\r
-       uint32_t                        qp_idx  = 0;\r
-       mlnx_hobul_t            *hobul_p;\r
-       HHUL_qp_hndl_t          hhul_qp_hndl;\r
-\r
-       UNUSED_PARAM( timewait );\r
-\r
-       HCA_ENTER( HCA_DBG_QP);\r
-       HCA_PRINT(TRACE_LEVEL_INFORMATION, HCA_DBG_QP,("hca %d qp 0x%x\n", hca_idx, qp_num));\r
-\r
-       VALIDATE_INDEX(hca_idx, MLNX_MAX_HCA, IB_INVALID_CA_HANDLE, cleanup);\r
-       hobul_p = mlnx_hobul_array[hca_idx];\r
-       if (NULL == hobul_p) {\r
-               status = IB_INVALID_QP_HANDLE;\r
-               goto cleanup;\r
-       }\r
-\r
-       qp_idx = qp_num & hobul_p->qp_idx_mask;\r
-       HCA_PRINT(TRACE_LEVEL_INFORMATION, HCA_DBG_QP ,("hobul_p 0x%p mask 0x%x qp_idx 0x%x mark %d\n",\r
-               hobul_p, hobul_p->qp_idx_mask, qp_idx, hobul_p->qp_info_tbl[qp_idx].mark));\r
-\r
-       VALIDATE_INDEX(qp_idx, hobul_p->max_qp, IB_INVALID_QP_HANDLE, cleanup);\r
-       if ( E_MARK_QP != hobul_p->qp_info_tbl[qp_idx].mark) {\r
-               if (E_MARK_INVALID == hobul_p->qp_info_tbl[qp_idx].mark) {\r
-                       HCA_PRINT(TRACE_LEVEL_ERROR,HCA_DBG_SHIM,\r
-                               ("completes with ERROR status %s\n", ib_get_err_str(IB_INVALID_QP_HANDLE)));\r
-                       return IB_SUCCESS; // Already freed\r
-               }\r
-               status = IB_INVALID_QP_HANDLE;\r
-               goto cleanup;\r
-       }\r
-\r
-       cl_mutex_acquire(&hobul_p->qp_info_tbl[qp_idx].mutex);\r
-\r
-       hhul_qp_hndl = hobul_p->qp_info_tbl[qp_idx].hhul_qp_hndl;\r
-       pd_idx       = hobul_p->qp_info_tbl[qp_idx].pd_num;\r
-       VALIDATE_INDEX(pd_idx, hobul_p->max_pd, IB_ERROR, cleanup_locked);\r
-\r
-       if (E_MARK_PD != hobul_p->pd_info_tbl[pd_idx].mark) {\r
-               HCA_PRINT(TRACE_LEVEL_INFORMATION, HCA_DBG_QP,("file %s line %d\n", __FILE__, __LINE__));\r
-               HCA_PRINT(TRACE_LEVEL_INFORMATION, HCA_DBG_QP,("pd_idx 0x%x mark %d\n", pd_idx, hobul_p->pd_info_tbl[pd_idx].mark));\r
-               status =  IB_INVALID_PD_HANDLE;\r
-               goto cleanup_locked;\r
-       }\r
-\r
-       HCA_PRINT(TRACE_LEVEL_INFORMATION, HCA_DBG_QP, \r
-               ("Before THH_destroy qp_idx 0x%x k_mod %d pd_idx 0x%x\n",\r
-               qp_idx, hobul_p->qp_info_tbl[qp_idx].kernel_mode, pd_idx));\r
-\r
-       // PREP: no PREP required for destroy_qp\r
-       if (HH_OK != THH_hob_destroy_qp(hobul_p->hh_hndl, qp_num)) {\r
-               status = IB_ERROR;\r
-               goto cleanup_locked;\r
-       }\r
-\r
-       HCA_PRINT(TRACE_LEVEL_INFORMATION, HCA_DBG_QP, \r
-               ("After THH_destroy qp_idx 0x%x k_mod %d pd_idx 0x%x\n",\r
-               qp_idx, hobul_p->qp_info_tbl[qp_idx].kernel_mode, pd_idx));\r
-\r
-       if (hobul_p->qp_info_tbl[qp_idx].kernel_mode) {\r
-               if (HH_OK != THHUL_qpm_destroy_qp_done(hobul_p->hhul_hndl, hhul_qp_hndl)) {\r
-                       status = IB_ERROR;\r
-                       goto cleanup_locked;\r
-               }\r
-               if (hobul_p->qp_info_tbl[qp_idx].qp_ul_resources_p)\r
-                       cl_free( hobul_p->qp_info_tbl[qp_idx].qp_ul_resources_p);\r
-               if (hobul_p->qp_info_tbl[qp_idx].send_sge_p)\r
-                       cl_free( hobul_p->qp_info_tbl[qp_idx].send_sge_p);\r
-               if (hobul_p->qp_info_tbl[qp_idx].recv_sge_p)\r
-                       cl_free( hobul_p->qp_info_tbl[qp_idx].recv_sge_p);\r
-       }\r
-\r
-       if( h_qp->qp_type == IB_QPT_QP0 || h_qp->qp_type == IB_QPT_QP1 )\r
-       {\r
-               if( !cl_atomic_dec( &h_qp->h_sq_cq->spl_qp_cnt ) )\r
-                       KeSetImportanceDpc( &h_qp->h_sq_cq->dpc, MediumImportance );\r
-               if( !cl_atomic_dec( &h_qp->h_rq_cq->spl_qp_cnt ) )\r
-                       KeSetImportanceDpc( &h_qp->h_rq_cq->dpc, MediumImportance );\r
-       }\r
-\r
-       hobul_p->qp_info_tbl[qp_idx].mark = E_MARK_INVALID;\r
-       hobul_p->qp_info_tbl[qp_idx].qp_ul_resources_p = NULL;\r
-       cl_mutex_release(&hobul_p->qp_info_tbl[qp_idx].mutex);\r
-\r
-       // Update PD object count\r
-       cl_atomic_dec(&hobul_p->pd_info_tbl[pd_idx].count);\r
-       HCA_PRINT(TRACE_LEVEL_INFORMATION, HCA_DBG_QP,("pd %d count %d\n", pd_idx, hobul_p->pd_info_tbl[pd_idx].count));\r
-\r
-       HCA_EXIT( HCA_DBG_QP);\r
-       return IB_SUCCESS;\r
-\r
-cleanup_locked:\r
-       cl_mutex_release(&hobul_p->qp_info_tbl[qp_idx].mutex);\r
-cleanup:\r
-       HCA_PRINT(TRACE_LEVEL_ERROR  ,HCA_DBG_QP  ,("status %d\n",status));\r
-       HCA_EXIT( HCA_DBG_SHIM);\r
+       HCA_PRINT_EXIT(TRACE_LEVEL_ERROR ,HCA_DBG_QP,\r
+               ("completes with ERROR status %s\n", IB_GET_ERR_STR(status)));\r
        return status;\r
-#endif \r
 }\r
 \r
 /*\r
@@ -2697,8 +1056,6 @@ mlnx_create_cq (
                OUT                     ib_cq_handle_t                          *ph_cq,\r
        IN      OUT                     ci_umv_buf_t                            *p_umv_buf )\r
 {\r
-#ifndef WIN_TO_BE_CHANGED\r
-\r
        int err;\r
        ib_api_status_t         status;\r
        struct ib_cq *ib_cq_p;\r
@@ -2709,7 +1066,11 @@ mlnx_create_cq (
        \r
        HCA_ENTER(HCA_DBG_CQ);\r
 \r
-       if( p_umv_buf && p_umv_buf->command ) {\r
+       if( p_umv_buf ) {\r
+\r
+               context_p = (struct ib_ucontext *)h_ca;\r
+               hob_p = HOB_FROM_IBDEV(context_p->device);\r
+               ib_dev = context_p->device;\r
 \r
                // sanity checks \r
                if (p_umv_buf->input_size < sizeof(struct ibv_create_cq) ||\r
@@ -2718,10 +1079,6 @@ mlnx_create_cq (
                        status = IB_INVALID_PARAMETER;\r
                        goto err_inval_params;\r
                }\r
-\r
-               context_p = (struct ib_ucontext *)h_ca;\r
-               hob_p = HOB_FROM_IBDEV(context_p->device);\r
-               ib_dev = context_p->device;\r
        }\r
        else {\r
                hob_p = (mlnx_hob_t *)h_ca;\r
@@ -2756,135 +1113,9 @@ err_create_cq:
 err_inval_params:\r
        if (p_umv_buf && p_umv_buf->command) \r
                p_umv_buf->status = status;\r
-       HCA_PRINT_EXIT(TRACE_LEVEL_ERROR ,HCA_DBG_CQ ,("completes with ERROR status %s\n", ib_get_err_str(status)));\r
+       HCA_PRINT_EXIT(TRACE_LEVEL_ERROR ,HCA_DBG_CQ,\r
+               ("completes with ERROR status %s\n", IB_GET_ERR_STR(status)));\r
        return status;\r
-                                                                                                                                               \r
-#else\r
-       ib_api_status_t                 status;\r
-\r
-       mlnx_hob_t                              *hob_p = (mlnx_hob_t *)h_ca;\r
-       uint32_t                                cq_idx;\r
-       uint32_t                                cq_num;\r
-       uint32_t                                cq_size = 0;\r
-       mlnx_hobul_t                    *hobul_p;\r
-       HH_hca_dev_t                    *hca_ul_info;\r
-       HHUL_cq_hndl_t                  hhul_cq_hndl = NULL;\r
-       void                                    *cq_ul_resources_p = NULL;\r
-       MOSAL_protection_ctx_t  prot_ctx;\r
-\r
-       HCA_ENTER( HCA_DBG_CQ);\r
-\r
-       hobul_p = mlnx_hobs_get_hobul(hob_p);\r
-       if (NULL == hobul_p) {\r
-               status = IB_INVALID_CA_HANDLE;\r
-               goto cleanup;\r
-       }\r
-\r
-       hca_ul_info = (HH_hca_dev_t *)hobul_p->hh_hndl;\r
-       if (NULL == hca_ul_info) {\r
-               status =  IB_INVALID_PD_HANDLE;\r
-               goto cleanup;\r
-       }\r
-\r
-       // The size must be provided\r
-       if (!p_size) {\r
-               status =  IB_INVALID_PARAMETER;\r
-               goto cleanup;\r
-       }\r
-       // TBD: verify that the number requested does not exceed to maximum allowed\r
-\r
-       if( p_umv_buf && p_umv_buf->command )\r
-       {\r
-               // For user mode calls - obtain and verify the vendor information\r
-               if ((p_umv_buf->input_size - sizeof (uint32_t))  != \r
-                       hca_ul_info->cq_ul_resources_sz ||\r
-                       NULL == p_umv_buf->p_inout_buf) {\r
-                               status = IB_INVALID_PARAMETER;\r
-                               goto cleanup;\r
-                       }\r
-                       cq_ul_resources_p = (void *)p_umv_buf->p_inout_buf;\r
-\r
-                       /* get the current protection context */ \r
-                       prot_ctx = MOSAL_get_current_prot_ctx();\r
-       } else {\r
-               // for kernel mode calls - allocate app resources. Use prep->call->done sequence\r
-               cq_ul_resources_p = cl_zalloc( hca_ul_info->cq_ul_resources_sz);\r
-               if (!cq_ul_resources_p) {\r
-                       status = IB_INSUFFICIENT_MEMORY;\r
-                       goto cleanup;\r
-               }\r
-               if (HH_OK != THHUL_cqm_create_cq_prep(hobul_p->hhul_hndl, *p_size, &hhul_cq_hndl, &cq_size, cq_ul_resources_p)) {\r
-                       status = IB_ERROR;\r
-                       goto cleanup;\r
-               }\r
-               /* get the current protection context */ \r
-               prot_ctx = MOSAL_get_kernel_prot_ctx();\r
-       }\r
-\r
-       // Allocate the CQ (cmdif)\r
-       if (HH_OK != THH_hob_create_cq(hobul_p->hh_hndl, prot_ctx, cq_ul_resources_p, &cq_num)) {\r
-               status = IB_INSUFFICIENT_RESOURCES;\r
-               goto cleanup_cq;\r
-       }\r
-\r
-       if( !(p_umv_buf && p_umv_buf->command) )\r
-       {\r
-               // Manage user level resources\r
-               if (HH_OK != THHUL_cqm_create_cq_done(hobul_p->hhul_hndl, hhul_cq_hndl, cq_num, cq_ul_resources_p)) {\r
-                       THH_hob_destroy_cq(hobul_p->hh_hndl, cq_num);\r
-                       status = IB_ERROR;\r
-                       goto cleanup_cq;\r
-               }\r
-       }\r
-\r
-       // Save data refs for future use\r
-       cq_idx = cq_num & hobul_p->cq_idx_mask;\r
-       VALIDATE_INDEX(cq_idx, hobul_p->max_cq, IB_ERROR, cleanup_cq);\r
-       cl_mutex_acquire(&hobul_p->cq_info_tbl[cq_idx].mutex);\r
-       hobul_p->cq_info_tbl[cq_idx].hca_idx = hob_p->index;\r
-       hobul_p->cq_info_tbl[cq_idx].cq_num = cq_num;\r
-//     hobul_p->cq_info_tbl[cq_idx].pd_num = pd_idx;\r
-       hobul_p->cq_info_tbl[cq_idx].hhul_cq_hndl = hhul_cq_hndl;\r
-       hobul_p->cq_info_tbl[cq_idx].cq_context = cq_context;\r
-       hobul_p->cq_info_tbl[cq_idx].cq_ul_resources_p = cq_ul_resources_p;\r
-       hobul_p->cq_info_tbl[cq_idx].kernel_mode = !(p_umv_buf && p_umv_buf->command);\r
-       hobul_p->cq_info_tbl[cq_idx].mark = E_MARK_CQ;\r
-       cl_mutex_release(&hobul_p->cq_info_tbl[cq_idx].mutex);\r
-\r
-       // Update CA object count\r
-       cl_atomic_inc(&hobul_p->count);\r
-       HCA_PRINT(TRACE_LEVEL_INFORMATION, HCA_DBG_CQ,("HCA %d count %d\n", h_ca->index, hobul_p->count));\r
-\r
-       *p_size = cq_size;\r
-       if (ph_cq) *ph_cq = (ib_cq_handle_t)CQ_HNDL_FROM_CQ(cq_idx);\r
-\r
-       if( p_umv_buf && p_umv_buf->command )\r
-       {\r
-               p_umv_buf->output_size = p_umv_buf->input_size;\r
-               p_umv_buf->status = IB_SUCCESS;\r
-               /* \r
-               * Copy the cq_idx back to user\r
-               */\r
-               cl_memcpy (((uint8_t* __ptr64)p_umv_buf->p_inout_buf + hca_ul_info->cq_ul_resources_sz),\r
-                       &cq_num, sizeof (cq_num));\r
-       }\r
-       HCA_EXIT( HCA_DBG_SHIM);\r
-       return IB_SUCCESS;\r
-\r
-cleanup_cq:\r
-       THHUL_cqm_destroy_cq_done(hobul_p->hhul_hndl, hhul_cq_hndl);\r
-\r
-cleanup:\r
-       if( !(p_umv_buf && p_umv_buf->command) && cq_ul_resources_p )\r
-               cl_free( cq_ul_resources_p);\r
-       if( p_umv_buf && p_umv_buf->command )\r
-       {\r
-               p_umv_buf->status = status;\r
-       }\r
-\r
-       HCA_PRINT_EXIT(TRACE_LEVEL_ERROR  ,HCA_DBG_CQ  ,("status %d\n",status));\r
-       return status;\r
-#endif \r
 }\r
 \r
 ib_api_status_t\r
@@ -2893,7 +1124,6 @@ mlnx_resize_cq (
        IN      OUT                     uint32_t                                        *p_size,\r
        IN      OUT                     ci_umv_buf_t                            *p_umv_buf )\r
 {\r
-#ifndef WIN_TO_BE_CHANGED\r
        UNREFERENCED_PARAMETER(h_cq);\r
        UNREFERENCED_PARAMETER(p_size);\r
        if (p_umv_buf && p_umv_buf->command) {\r
@@ -2901,101 +1131,6 @@ mlnx_resize_cq (
        }\r
        HCA_PRINT(TRACE_LEVEL_ERROR  , HCA_DBG_SHIM  ,("mlnx_resize_cq not implemented\n"));\r
        return IB_UNSUPPORTED;\r
-#else\r
-       ib_api_status_t         status;\r
-\r
-       uint32_t                        hca_idx = CQ_HCA_FROM_HNDL(h_cq);\r
-       uint32_t                        cq_num  = CQ_NUM_FROM_HNDL(h_cq);\r
-       uint32_t                        cq_idx;\r
-       mlnx_hobul_t            *hobul_p;\r
-\r
-       HHUL_cq_hndl_t          hhul_cq_hndl;\r
-       void                            *cq_ul_resources_p = NULL;\r
-\r
-       HCA_ENTER( HCA_DBG_SHIM);\r
-\r
-       if (!p_size) {\r
-               status = IB_INVALID_PARAMETER;\r
-               goto cleanup;\r
-       }\r
-       VALIDATE_INDEX(hca_idx,   MLNX_MAX_HCA, IB_INVALID_CQ_HANDLE, cleanup);\r
-       hobul_p = mlnx_hobul_array[hca_idx];\r
-       if (NULL == hobul_p) {\r
-               status = IB_INVALID_CQ_HANDLE;\r
-               goto cleanup;\r
-       }\r
-\r
-       cq_idx = cq_num & hobul_p->cq_idx_mask;\r
-       VALIDATE_INDEX(cq_idx, hobul_p->max_cq, IB_INVALID_CQ_HANDLE, cleanup);\r
-       if ( E_MARK_CQ != hobul_p->cq_info_tbl[cq_idx].mark) {\r
-               status =  IB_INVALID_CQ_HANDLE;\r
-               goto cleanup;\r
-       }\r
-\r
-       cl_mutex_acquire(&hobul_p->cq_info_tbl[cq_idx].mutex);\r
-\r
-       hhul_cq_hndl = hobul_p->cq_info_tbl[cq_idx].hhul_cq_hndl;\r
-\r
-       if( p_umv_buf && p_umv_buf->command )\r
-       {\r
-               // For user mode calls - obtain and verify the vendor information\r
-               if( p_umv_buf->input_size != hobul_p->cq_ul_resources_sz ||\r
-                       NULL == p_umv_buf->p_inout_buf )\r
-               {\r
-                       status = IB_INVALID_PARAMETER;\r
-                       goto cleanup_locked;\r
-               }\r
-               cq_ul_resources_p = (void *)p_umv_buf->p_inout_buf;\r
-\r
-       } else {\r
-               // for kernel mode calls - obtain the saved app resources. Use prep->call->done sequence\r
-               cq_ul_resources_p = hobul_p->cq_info_tbl[cq_idx].cq_ul_resources_p;\r
-\r
-               if (HH_OK != THHUL_cqm_resize_cq_prep(\r
-                       hobul_p->hhul_hndl, hhul_cq_hndl,\r
-                       *p_size, p_size, cq_ul_resources_p))\r
-               {\r
-                       status = IB_ERROR;\r
-                       goto cleanup_locked;\r
-               }\r
-       }\r
-\r
-       if (HH_OK != THH_hob_resize_cq(hobul_p->hh_hndl, cq_num, cq_ul_resources_p)) {\r
-               status = IB_ERROR;\r
-               goto cleanup_locked;\r
-       }\r
-\r
-       // DONE: when called on behalf of kernel module\r
-       if (hobul_p->cq_info_tbl[cq_idx].kernel_mode) {\r
-               if (HH_OK != THHUL_cqm_resize_cq_done( hobul_p->hhul_hndl, hhul_cq_hndl, cq_ul_resources_p))\r
-               {\r
-                       status = IB_ERROR;\r
-                       goto cleanup_locked;\r
-               }\r
-       }\r
-\r
-       cl_mutex_release(&hobul_p->cq_info_tbl[cq_idx].mutex);\r
-\r
-       if( p_umv_buf && p_umv_buf->command )\r
-       {\r
-               p_umv_buf->output_size = p_umv_buf->input_size;\r
-               p_umv_buf->status = IB_SUCCESS;\r
-       }\r
-       HCA_EXIT( HCA_DBG_SHIM);\r
-       return IB_SUCCESS;\r
-\r
-cleanup_locked:\r
-       cl_mutex_release(&hobul_p->cq_info_tbl[cq_idx].mutex);\r
-\r
-cleanup:\r
-       if( p_umv_buf && p_umv_buf->command )\r
-       {\r
-               p_umv_buf->status = status;\r
-       }\r
-       HCA_PRINT(TRACE_LEVEL_ERROR  ,HCA_DBG_SHIM ,("status %d\n", status));\r
-       HCA_EXIT( HCA_DBG_SHIM);\r
-       return status;\r
-#endif \r
 }\r
 \r
 ib_api_status_t\r
@@ -3004,7 +1139,6 @@ mlnx_query_cq (
                OUT                     uint32_t                                        *p_size,\r
        IN      OUT                     ci_umv_buf_t                            *p_umv_buf )\r
 {\r
-#ifndef WIN_TO_BE_CHANGED\r
        UNREFERENCED_PARAMETER(h_cq);\r
        UNREFERENCED_PARAMETER(p_size);\r
        if (p_umv_buf && p_umv_buf->command) {\r
@@ -3012,77 +1146,17 @@ mlnx_query_cq (
        }\r
        HCA_PRINT(TRACE_LEVEL_ERROR  , HCA_DBG_SHIM  ,("mlnx_query_cq not implemented\n"));\r
        return IB_UNSUPPORTED;\r
-#else\r
-       ib_api_status_t         status;\r
-\r
-       uint32_t                        hca_idx = CQ_HCA_FROM_HNDL(h_cq);\r
-       uint32_t                        cq_num  = CQ_NUM_FROM_HNDL(h_cq);\r
-       uint32_t                        cq_idx;\r
-       mlnx_hobul_t            *hobul_p;\r
-       HHUL_cq_hndl_t          hhul_cq_hndl;\r
-\r
-       HCA_ENTER( HCA_DBG_SHIM);\r
-\r
-       if (!p_size) {\r
-               status = IB_INVALID_PARAMETER;\r
-               goto cleanup;\r
-       }\r
-       VALIDATE_INDEX(hca_idx,   MLNX_MAX_HCA, IB_INVALID_CQ_HANDLE, cleanup);\r
-       hobul_p = mlnx_hobul_array[hca_idx];\r
-       if (NULL == hobul_p) {\r
-               status = IB_INVALID_CQ_HANDLE;\r
-               goto cleanup;\r
-       }\r
-\r
-       cq_idx = cq_num & hobul_p->cq_idx_mask;\r
-       VALIDATE_INDEX(cq_idx, hobul_p->max_cq, IB_INVALID_CQ_HANDLE, cleanup);\r
-       if ( E_MARK_CQ != hobul_p->cq_info_tbl[cq_idx].mark) {\r
-               status =  IB_INVALID_CQ_HANDLE;\r
-               goto cleanup;\r
-       }\r
-\r
-       cl_mutex_acquire(&hobul_p->cq_info_tbl[cq_idx].mutex);\r
-\r
-       hhul_cq_hndl = hobul_p->cq_info_tbl[cq_idx].hhul_cq_hndl;\r
-\r
-       if (HH_OK != THH_hob_query_cq(hobul_p->hh_hndl, cq_num, p_size)) {\r
-               status = IB_ERROR;\r
-               goto cleanup_locked;\r
-       }\r
-\r
-       cl_mutex_release(&hobul_p->cq_info_tbl[cq_idx].mutex);\r
-\r
-       if( p_umv_buf && p_umv_buf->command )\r
-       {\r
-               p_umv_buf->output_size = 0;\r
-               p_umv_buf->status = IB_SUCCESS;\r
-       }\r
-       HCA_EXIT( HCA_DBG_SHIM);\r
-       return IB_SUCCESS;\r
-\r
-cleanup_locked:\r
-       cl_mutex_release(&hobul_p->cq_info_tbl[cq_idx].mutex);\r
-\r
-cleanup:\r
-       if( p_umv_buf && p_umv_buf->command )\r
-       {\r
-               p_umv_buf->status = status;\r
-       }\r
-       HCA_PRINT(TRACE_LEVEL_ERROR  ,HCA_DBG_SHIM  ,("status %d\n", status));\r
-       HCA_EXIT( HCA_DBG_SHIM);\r
-       return status;\r
-#endif \r
 }\r
 \r
 ib_api_status_t\r
 mlnx_destroy_cq (\r
        IN              const   ib_cq_handle_t                          h_cq)\r
 {\r
-#ifndef WIN_TO_BE_CHANGED\r
                                                                                                                                                                \r
        ib_api_status_t         status;\r
        int err;\r
        struct ib_cq *ib_cq_p = (struct ib_cq *)h_cq;\r
+       PREP_IBDEV_FOR_PRINT(ib_cq_p->device)\r
 \r
        HCA_ENTER( HCA_DBG_QP);\r
 \r
@@ -3092,7 +1166,8 @@ mlnx_destroy_cq (
        // destroy CQ\r
        err = ibv_destroy_cq( ib_cq_p );\r
        if (err) {\r
-               HCA_PRINT (TRACE_LEVEL_ERROR ,HCA_DBG_SHIM,("ibv_destroy_cq failed (%d)\n", err));\r
+               HCA_PRINT (TRACE_LEVEL_ERROR ,HCA_DBG_SHIM,\r
+                       ("ibv_destroy_cq failed (%d)\n", err));\r
                status = errno_to_iberr(err);\r
                goto err_destroy_cq;\r
        }\r
@@ -3100,80 +1175,9 @@ mlnx_destroy_cq (
        status = IB_SUCCESS;\r
 \r
 err_destroy_cq:\r
-       HCA_PRINT_EXIT(TRACE_LEVEL_ERROR  , HCA_DBG_SHIM  ,("completes with ERROR status %s\n", ib_get_err_str(status)));\r
-       return status;\r
-\r
-#else\r
-       ib_api_status_t status;\r
-\r
-       uint32_t        hca_idx = CQ_HCA_FROM_HNDL(h_cq);\r
-       uint32_t        cq_num  = CQ_NUM_FROM_HNDL(h_cq);\r
-       uint32_t                cq_idx;\r
-//     uint32_t        pd_idx = 0;\r
-       mlnx_hobul_t     *hobul_p;\r
-       HHUL_cq_hndl_t   hhul_cq_hndl;\r
-\r
-       HCA_ENTER( HCA_DBG_SHIM);\r
-\r
-       VALIDATE_INDEX(hca_idx,   MLNX_MAX_HCA, IB_INVALID_CQ_HANDLE, cleanup);\r
-       hobul_p = mlnx_hobul_array[hca_idx];\r
-       if (NULL == hobul_p) {\r
-               status = IB_INVALID_CQ_HANDLE;\r
-               goto cleanup;\r
-       }\r
-\r
-       cq_idx = cq_num & hobul_p->cq_idx_mask;\r
-       VALIDATE_INDEX(cq_idx, hobul_p->max_cq, IB_INVALID_CQ_HANDLE, cleanup);\r
-       if ( E_MARK_CQ != hobul_p->cq_info_tbl[cq_idx].mark) {\r
-               status =  IB_INVALID_CQ_HANDLE;\r
-               goto cleanup;\r
-       }\r
-\r
-       cl_mutex_acquire(&hobul_p->cq_info_tbl[cq_idx].mutex);\r
-\r
-       hhul_cq_hndl = hobul_p->cq_info_tbl[cq_idx].hhul_cq_hndl;\r
-//     pd_idx       = hobul_p->cq_info_tbl[cq_idx].pd_num;\r
-//     VALIDATE_INDEX(pd_idx, hobul_p->max_pd, IB_ERROR, cleanup);\r
-//     if (E_MARK_PD != hobul_p->pd_info_tbl[pd_idx].mark) {\r
-//             status =  IB_INVALID_PD_HANDLE;\r
-//             goto cleanup_locked;\r
-//     }\r
-\r
-       // PREP: no PREP required for destroy_cq\r
-       if (HH_OK != THH_hob_destroy_cq(hobul_p->hh_hndl, cq_num)) {\r
-               status = IB_ERROR;\r
-               goto cleanup_locked;\r
-       }\r
-\r
-       if (hobul_p->cq_info_tbl[cq_idx].kernel_mode) {\r
-               if (HH_OK != THHUL_cqm_destroy_cq_done(hobul_p->hhul_hndl, hhul_cq_hndl)) {\r
-                       status = IB_ERROR;\r
-                       goto cleanup_locked;\r
-               }\r
-               if (hobul_p->cq_info_tbl[cq_idx].cq_ul_resources_p)\r
-                       cl_free( hobul_p->cq_info_tbl[cq_idx].cq_ul_resources_p);\r
-       }\r
-\r
-       hobul_p->cq_info_tbl[cq_idx].mark = E_MARK_INVALID;\r
-       hobul_p->cq_info_tbl[cq_idx].cq_ul_resources_p = NULL;\r
-       cl_mutex_release(&hobul_p->cq_info_tbl[cq_idx].mutex);\r
-\r
-       // Update CA object count\r
-       cl_atomic_dec(&hobul_p->count);\r
-       HCA_PRINT(TRACE_LEVEL_INFORMATION  , HCA_DBG_SHIM  ,("CA %d count %d\n", hca_idx, hobul_p->count));\r
-\r
-\r
-       HCA_EXIT( HCA_DBG_SHIM);\r
-       return IB_SUCCESS;\r
-\r
-cleanup_locked:\r
-       cl_mutex_release(&hobul_p->cq_info_tbl[cq_idx].mutex);\r
-\r
-cleanup:\r
-       HCA_PRINT(TRACE_LEVEL_ERROR  ,HCA_DBG_SHIM  ,("status %d\n", status));\r
-       HCA_EXIT( HCA_DBG_SHIM);\r
+       HCA_PRINT_EXIT(TRACE_LEVEL_ERROR  , HCA_DBG_SHIM,\r
+               ("completes with ERROR status %s\n", IB_GET_ERR_STR(status)));\r
        return status;\r
-#endif \r
 }\r
 \r
 \r
index bfd32b1..e1d9929 100644 (file)
@@ -1,33 +1,5 @@
 #include <mt_l2w.h>
 
-u64 mt_ticks_per_sec;
-
-void MT_time_calibrate()
-{
-#if defined(_WIN64) && (defined(IA64) || defined(_IA64_))
-       /* Itanium */
-       mt_ticks_per_sec = 10000000;    
-       
-#elif defined(_WIN64) && (defined(AMD64) || defined(_AMD64_))
-       /* x64 */
-       
-       LARGE_INTEGER a;
-       KeQueryPerformanceCounter( &a );
-       mt_ticks_per_sec = a.QuadPart;
-       
-#elif defined(_WIN32) && (defined(i386) || defined(_x86_))
-       /* x86 */
-       
-       LARGE_INTEGER a;
-       KeQueryPerformanceCounter( &a );
-       mt_ticks_per_sec = a.QuadPart;
-       
-#else
-       #error Unsupported platform
-#endif
-
-}
-
 pci_pool_t *
 pci_pool_create (const char *name, struct mthca_dev *mdev,
         size_t size, size_t align, size_t allocation)
index ccf40d1..f969036 100644 (file)
@@ -22,7 +22,7 @@
 #include <mt_pci.h>
 #include <mt_pcipool.h>
 //#include <mt_byteorder.h>
-#include <mt_time.h>
+#include <complib/cl_timer.h>
 #include <hca_debug.h>
 
 
diff --git a/hw/mthca/kernel/mt_time.h b/hw/mthca/kernel/mt_time.h
deleted file mode 100644 (file)
index 3738ecf..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-#ifndef MT_TIME_H
-#define MT_TIME_H
-
-
-/* get time stamp */
-static inline volatile u64 MT_time_get_stamp(void)
-{
-       volatile u64 tsc;
-       
-#if defined(_WIN64) && (defined(IA64) || defined(_IA64_))
-       /* Itanium */
-
-       /* returns a value in units of 100 nsecs */
-       tsc = KeQueryInterruptTime();           
-
-#elif defined(_WIN64) && (defined(AMD64) || defined(_AMD64_))
-       /* x64 */
-
-       /* returns a value in units of Time-Stamp Counter (usually, clocks) */
-       tsc = __rdtsc();                
-
-#elif defined(_WIN32) && (defined(i386) || defined(_x86_))
-       /* x86 */
-
-       /* returns a value in units of Time-Stamp Counter (usually, clocks) */
-       __asm {                                          
-               lea ebx,tsc
-               rdtsc                            
-               mov  [ebx],eax           
-               mov  [ebx+4],edx                 
-       }
-#else
-       #error Unsupported platform
-#endif
-
-       return tsc;
-}
-
-extern u64 mt_ticks_per_sec;
-
-
-/* CONVERTIONS */
-#define MT_USECS_TO_TICKS(to)          ((mt_ticks_per_sec * (to)) / 1000000 )
-#define MT_MSECS_TO_TICKS(to)  MT_USECS_TO_TICKS(1000 * to)
-
-/* comparison */
-#define time_after(a,b)                                                ((INT64)(b) - (INT64)(a) < 0)
-#define time_before(a,b)                               time_after(b,a)
-#define time_after_eq(a,b)                             ((INT64)(a) - (INT64)(b) >= 0)
-#define time_before_eq(a,b)                    time_after_eq(b,a)
-
-
-#endif
-
index 9d2b566..739af0d 100644 (file)
@@ -56,38 +56,44 @@ void ibv_um_close(  struct ib_ucontext * h_um_ca )
        int err;
        ib_api_status_t         status;
        struct ib_ucontext *context_p = (struct ib_ucontext *)h_um_ca;
+       PREP_IBDEV_FOR_PRINT(context_p->device)
 
        HCA_ENTER(HCA_DBG_SHIM);
 
        context_p->is_removing = TRUE;
 
        if (atomic_read(&context_p->usecnt)) {
-               HCA_PRINT(TRACE_LEVEL_ERROR  ,HCA_DBG_SHIM  ,("resources are not released (cnt %d)\n", context_p->usecnt));
+               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;
        }
        
        err = ibv_dealloc_pd( context_p->pd );
        if (err) {
-               HCA_PRINT(TRACE_LEVEL_ERROR  ,HCA_DBG_SHIM  ,("ibv_dealloc_pd failed (%d)\n", err));
+               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  ,("mthca_dealloc_ucontext failed (%d)\n", err));
+               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  , ("pcs %p\n", PsGetCurrentProcess()) );
+       HCA_PRINT(TRACE_LEVEL_INFORMATION       ,HCA_DBG_SHIM,
+               ("pcs %p\n", PsGetCurrentProcess()) );
        status = IB_SUCCESS;
        goto end;
        
 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)));
+       HCA_PRINT_EXIT(TRACE_LEVEL_ERROR  , HCA_DBG_SHIM,
+               ("completes with ERROR status %s\n", IB_GET_ERR_STR(status)));
        return;
 }
 
index 837bb3d..03ffe43 100644 (file)
@@ -130,8 +130,7 @@ on_hca_fail:
                av->dgid[3] = cl_hton32(2);
        }
 
-#if 0
-       {
+       { // debug print
                int j;
 
                HCA_PRINT(TRACE_LEVEL_VERBOSE,HCA_DBG_LOW,("Created UDAV at %p/%08lx:\n",
@@ -140,7 +139,6 @@ on_hca_fail:
                        HCA_PRINT(TRACE_LEVEL_VERBOSE ,HCA_DBG_LOW ,("  [%2x] %08x\n",
                               j * 4, cl_ntoh32(((__be32 *) av)[j])));
        }
-#endif
 
        if (ah->type == MTHCA_AH_ON_HCA) {
                memcpy_toio((u8*)dev->av_table.av_map + index * MTHCA_AV_SIZE,
index 3913691..9125b67 100644 (file)
@@ -215,9 +215,9 @@ static int wait_go_bit(struct mthca_dev *dev, unsigned long timeout_usecs)
        if (!go_bit(dev))       return 0;
 
        interval.QuadPart = -(__int64)(((u64)(timeout_usecs) * 10) /    CMD_POLL_N_TRIES);
-       start = MT_time_get_stamp();
-       end = start + MT_USECS_TO_TICKS(timeout_usecs);
-       while (go_bit(dev) && time_before( MT_time_get_stamp(), end )) {
+       start = cl_get_time_stamp();
+       end = start + timeout_usecs;
+       while (go_bit(dev) && (cl_get_time_stamp() < end)) {
                KeDelayExecutionThread( KernelMode, FALSE, &interval );
        }
 
@@ -1617,21 +1617,19 @@ int mthca_MODIFY_QP(struct mthca_dev *dev, int trans, u32 num,
                                mailbox = NULL;
                }
        } else {
-       #if 0
-               {
+               { // debug print
                        int i;
                        HCA_PRINT(TRACE_LEVEL_VERBOSE  ,HCA_DBG_LOW  ,("Dumping QP context:\n"));
-                       HCA_PRINT(TRACE_LEVEL_INFORMATION   ,HCA_DBG_LOW   ,("  opt param mask: %08x\n", cl_ntoh32(*(__be32 *)mailbox->buf)));
+                       HCA_PRINT(TRACE_LEVEL_VERBOSE   ,HCA_DBG_LOW   ,("  opt param mask: %08x\n", cl_ntoh32(*(__be32 *)mailbox->buf)));
                        for (i = 0; i < 0x100 / 4; ++i) {
                                if (i % 8 == 0)
-                                       HCA_PRINT(TRACE_LEVEL_INFORMATION ,HCA_DBG_LOW ,("  [%02x] ", i * 4));
-                               HCA_PRINT(TRACE_LEVEL_INFORMATION ,HCA_DBG_LOW ,(" %08x",
+                                       HCA_PRINT(TRACE_LEVEL_VERBOSE ,HCA_DBG_LOW ,("  [%02x] ", i * 4));
+                               HCA_PRINT(TRACE_LEVEL_VERBOSE ,HCA_DBG_LOW ,(" %08x",
                                       cl_ntoh32(((__be32 *) mailbox->buf)[i + 2])));
                                if ((i + 1) % 8 == 0)
-                                       HCA_PRINT(TRACE_LEVEL_INFORMATION   ,HCA_DBG_LOW   ,("\n"));
+                                       HCA_PRINT(TRACE_LEVEL_VERBOSE   ,HCA_DBG_LOW   ,("\n"));
                        }
                }
-       #endif
        }
 
        if (trans == MTHCA_TRANS_ANY2RST) {
@@ -1639,21 +1637,19 @@ int mthca_MODIFY_QP(struct mthca_dev *dev, int trans, u32 num,
                                    (!!is_ee << 24) | num, op_mod,
                                    op[trans], CMD_TIME_CLASS_C, status);
 
-       #if 0
-               if (mailbox) {
+               if (mailbox) { // debug print
                        int i;
                        HCA_PRINT(TRACE_LEVEL_VERBOSE  ,HCA_DBG_LOW  ,("Dumping QP context:\n"));
-                       HCA_PRINT(TRACE_LEVEL_INFORMATION   ,HCA_DBG_LOW   ,(" %08x\n", cl_ntoh32(*(__be32 *)mailbox->buf)));
+                       HCA_PRINT(TRACE_LEVEL_VERBOSE   ,HCA_DBG_LOW   ,(" %08x\n", cl_ntoh32(*(__be32 *)mailbox->buf)));
                        for (i = 0; i < 0x100 / 4; ++i) {
                                if (i % 8 == 0)
-                                       HCA_PRINT(TRACE_LEVEL_INFORMATION   ,HCA_DBG_LOW   ,("[%02x] ", i * 4));
-                               HCA_PRINT(TRACE_LEVEL_INFORMATION ,HCA_DBG_LOW ,(" %08x",
+                                       HCA_PRINT(TRACE_LEVEL_VERBOSE   ,HCA_DBG_LOW   ,("[%02x] ", i * 4));
+                               HCA_PRINT(TRACE_LEVEL_VERBOSE ,HCA_DBG_LOW ,(" %08x",
                                       cl_ntoh32(((__be32 *) mailbox->buf)[i + 2])));
                                if ((i + 1) % 8 == 0)
-                                       HCA_PRINT(TRACE_LEVEL_INFORMATION   ,HCA_DBG_LOW   ,("\n"));
+                                       HCA_PRINT(TRACE_LEVEL_VERBOSE   ,HCA_DBG_LOW   ,("\n"));
                        }
                }
-       #endif
        } else
                err = mthca_cmd(dev, mailbox->dma, (!!is_ee << 24) | num,
                                op_mod, op[trans], CMD_TIME_CLASS_C, status);
index e9b210c..12564ba 100644 (file)
@@ -182,16 +182,16 @@ static inline void set_cqe_hw(struct mthca_cqe *cqe)
        cqe->owner = MTHCA_CQ_ENTRY_OWNER_HW;
 }
 
-static void dump_cqe(struct mthca_dev *dev, void *cqe_ptr)
+static void dump_cqe(u32 print_lvl, struct mthca_dev *dev, void *cqe_ptr)
 {
        __be32 *cqe = cqe_ptr;
        UNREFERENCED_PARAMETER(dev);
 
        (void) cqe;     /* avoid warning if mthca_dbg compiled away... */
-       HCA_PRINT(TRACE_LEVEL_INFORMATION,HCA_DBG_CQ,("CQE contents \n"));
-       HCA_PRINT(TRACE_LEVEL_INFORMATION,HCA_DBG_CQ,("\t[%2x] %08x %08x %08x %08x\n",0,
+       HCA_PRINT(print_lvl,HCA_DBG_CQ,("CQE contents \n"));
+       HCA_PRINT(print_lvl,HCA_DBG_CQ,("\t[%2x] %08x %08x %08x %08x\n",0,
                cl_ntoh32(cqe[0]), cl_ntoh32(cqe[1]), cl_ntoh32(cqe[2]), cl_ntoh32(cqe[3])));
-       HCA_PRINT(TRACE_LEVEL_INFORMATION,HCA_DBG_CQ,("\t[%2x] %08x %08x %08x %08x \n",16,
+       HCA_PRINT(print_lvl,HCA_DBG_CQ,("\t[%2x] %08x %08x %08x %08x \n",16,
                cl_ntoh32(cqe[4]), cl_ntoh32(cqe[5]), cl_ntoh32(cqe[6]), cl_ntoh32(cqe[7])));
 }
 
@@ -293,14 +293,13 @@ void mthca_cq_clean(struct mthca_dev *dev, u32 cqn, u32 qpn,
         */
        for (prod_index = cq->cons_index;
             cqe_sw(cq, prod_index & cq->ibcq.cqe);
-            ++prod_index)
+            ++prod_index) {
                if (prod_index == cq->cons_index + cq->ibcq.cqe)
                        break;
+       }
 
-       #if 0
-               HCA_PRINT(TRACE_LEVEL_VERBOSE,HCA_DBG_LOW,("Cleaning QPN %06x from CQN %06x; ci %d, pi %d\n",
-                         qpn, cqn, cq->cons_index, prod_index));
-       #endif
+       HCA_PRINT(TRACE_LEVEL_VERBOSE,HCA_DBG_LOW,("Cleaning QPN %06x from CQN %06x; ci %d, pi %d\n",
+                 qpn, cqn, cq->cons_index, prod_index));
 
        /*
         * Now sweep backwards through the CQ, removing CQ entries
@@ -347,7 +346,7 @@ static int handle_error_cqe(struct mthca_dev *dev, struct mthca_cq *cq,
                          "(QPN %06x, WQE @ %08x, CQN %06x, index %d)\n",
                          cl_ntoh32(cqe->my_qpn), cl_ntoh32(cqe->wqe),
                          cq->cqn, cq->cons_index));
-               dump_cqe(dev, cqe);
+               dump_cqe(TRACE_LEVEL_INFORMATION, dev, cqe);
        }
 
 
@@ -460,14 +459,12 @@ static inline int mthca_poll_one(struct mthca_dev *dev,
         */
        rmb();
 
-       #if 0
-       {
+       { // debug print
                HCA_PRINT(TRACE_LEVEL_VERBOSE,HCA_DBG_CQ,("%x/%d: CQE -> QPN %06x, WQE @ %08x\n",
                          cq->cqn, cq->cons_index, cl_ntoh32(cqe->my_qpn),
                          cl_ntoh32(cqe->wqe)));
-               dump_cqe(dev, cqe);
+               dump_cqe(TRACE_LEVEL_VERBOSE, dev, cqe);
        }
-       #endif
 
        is_error = (cqe->opcode & MTHCA_ERROR_CQE_OPCODE_MASK) ==
                MTHCA_ERROR_CQE_OPCODE_MASK;
@@ -898,18 +895,16 @@ void mthca_free_cq(struct mthca_dev *dev,
                HCA_PRINT(TRACE_LEVEL_WARNING  ,HCA_DBG_LOW  ,("HW2SW_CQ returned status 0x%02x\n", status));
        }
 
-       #if 0
-       {
+       { // debug print
                __be32 *ctx = mailbox->buf;
                int j;
 
-               HCA_PRINT(TRACE_LEVEL_ERROR ,HCA_DBG_LOW ,("context for CQN %x (cons index %x, next sw %d)\n",
+               HCA_PRINT(TRACE_LEVEL_VERBOSE ,HCA_DBG_LOW ,("context for CQN %x (cons index %x, next sw %d)\n",
                       cq->cqn, cq->cons_index,
                       cq->is_kernel ? !!next_cqe_sw(cq) : 0));
                for (j = 0; j < 16; ++j)
-                       HCA_PRINT(TRACE_LEVEL_ERROR   ,HCA_DBG_LOW   ,("[%2x] %08x\n", j * 4, cl_ntoh32(ctx[j])));
+                       HCA_PRINT(TRACE_LEVEL_VERBOSE   ,HCA_DBG_LOW   ,("[%2x] %08x\n", j * 4, cl_ntoh32(ctx[j])));
        }
-       #endif
 
        spin_lock_irq(&dev->cq_table.lock, &lh);
        mthca_array_clear(&dev->cq_table.cq,
index fcfb448..702dd46 100644 (file)
@@ -715,18 +715,16 @@ static void mthca_free_eq(struct mthca_dev *dev,
 
        dev->eq_table.arm_mask &= ~eq->eqn_mask;
 
-       #if 0
-       {
+       { // debug print
                HCA_PRINT(TRACE_LEVEL_VERBOSE  ,HCA_DBG_LOW  ,("Dumping EQ context %02x:\n", eq->eqn));
                for (i = 0; i < sizeof (struct mthca_eq_context) / 4; ++i) {
                        if (i % 4 == 0)
-                               HCA_PRINT(TRACE_LEVEL_INFORMATION   ,HCA_DBG_LOW   ,("[%02x] ", i * 4));
-                       HCA_PRINT(TRACE_LEVEL_INFORMATION   ,HCA_DBG_LOW   ,(" %08x", cl_ntoh32(*(u32*)((u8*)mailbox->buf + i * 4))));
+                               HCA_PRINT(TRACE_LEVEL_VERBOSE   ,HCA_DBG_LOW   ,("[%02x] ", i * 4));
+                       HCA_PRINT(TRACE_LEVEL_VERBOSE   ,HCA_DBG_LOW   ,(" %08x", cl_ntoh32(*(u32*)((u8*)mailbox->buf + i * 4))));
                        if ((i + 1) % 4 == 0)
-                               HCA_PRINT(TRACE_LEVEL_INFORMATION   ,HCA_DBG_LOW   ,("\n"));
+                               HCA_PRINT(TRACE_LEVEL_VERBOSE   ,HCA_DBG_LOW   ,("\n"));
                }
        }
-       #endif
 
        mthca_free_mr(dev, &eq->mr);
        for (i = 0; i < npages; ++i) {
index 3425d68..423620c 100644 (file)
@@ -191,13 +191,10 @@ int mthca_process_mad(struct ib_device *ibdev,
        u8 status;
        u16 slid = in_wc ? in_wc->recv.ud.remote_lid : cl_ntoh16(IB_LID_PERMISSIVE);
 
-
-#if 0
-       HCA_PRINT( TRACE_LEVEL_VERBOSE ,HCA_DBG_LOW,("mthca_process_mad: \n\tin: Class %02x, Method %02x, AttrId %x, AttrMod %x, ClSpec %x, Tid %I64x\n"),
+       HCA_PRINT( TRACE_LEVEL_VERBOSE ,HCA_DBG_LOW,("mthca_process_mad: \n\tin: Class %02x, Method %02x, AttrId %x, AttrMod %x, ClSpec %x, Tid %I64x\n",
                (u32)in_mad->mad_hdr.mgmt_class, (u32)in_mad->mad_hdr.method, 
                (u32)in_mad->mad_hdr.attr_id, in_mad->mad_hdr.attr_mod, 
                (u32)in_mad->mad_hdr.class_specific, in_mad->mad_hdr.tid ));
-#endif
 
        /* Forward locally generated traps to the SM */
        if (in_mad->mad_hdr.method == IB_MGMT_METHOD_TRAP &&
@@ -271,20 +268,11 @@ int mthca_process_mad(struct ib_device *ibdev,
        if (!out_mad->mad_hdr.status)
                smp_snoop(ibdev, port_num, in_mad);
 
-#if 0
-       //NB: excluded, because it is set in the shim. Being set here, it prevents shim MAD cache to work !
-       /* set return bit in status of directed route responses */
-       if (in_mad->mad_hdr.mgmt_class == IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE)
-               out_mad->mad_hdr.status |= cl_hton16(1 << 15);
-#endif 
-
-#if 0
        HCA_PRINT( TRACE_LEVEL_VERBOSE ,HCA_DBG_LOW,("mthca_process_mad: \n\tout: Class %02x, Method %02x, AttrId %x, AttrMod %x, ClSpec %x, Tid %I64x, Status %x\n",
                (u32)in_mad->mad_hdr.mgmt_class, (u32)in_mad->mad_hdr.method, 
                (u32)in_mad->mad_hdr.attr_id, in_mad->mad_hdr.attr_mod, 
                (u32)in_mad->mad_hdr.class_specific, in_mad->mad_hdr.tid,
                (u32)in_mad->mad_hdr.status ));
-#endif
 
        if (in_mad->mad_hdr.method == IB_MGMT_METHOD_TRAP_REPRESS) {
                /* no response for trap repress */
index 4000a4f..7417076 100644 (file)
@@ -97,7 +97,6 @@ static int find_mgm(struct mthca_dev *dev,
                goto out;
        }
 
-       #if 0
                HCA_PRINT(TRACE_LEVEL_VERBOSE,HCA_DBG_LOW,("Hash for %04x:%04x:%04x:%04x:"
                          "%04x:%04x:%04x:%04x is %04x\n",
                          cl_ntoh16(((__be16 *) gid)[0]),
@@ -109,7 +108,6 @@ static int find_mgm(struct mthca_dev *dev,
                          cl_ntoh16(((__be16 *) gid)[6]),
                          cl_ntoh16(((__be16 *) gid)[7]),
                          *hash));
-       #endif
 
        *index = *hash;
        *prev  = -1;
index e44a18f..ad469f0 100644 (file)
@@ -347,10 +347,9 @@ struct mthca_icm_table *mthca_alloc_icm_table(struct mthca_dev *dev,
                ++table->icm[i]->refcount;
        }
 
-#if 0
-       HCA_PRINT(TRACE_LEVEL_VERBOSE,HCA_DBG_LOW,("Allocated/max chunks %d:%d, reserved/max objects %#x:%#x, one/total size %#x:%#x at %lx \n",
+       HCA_PRINT(TRACE_LEVEL_VERBOSE,HCA_DBG_LOW,
+               ("Allocated/max chunks %d:%d, reserved/max objects %#x:%#x, one/total size %#x:%#x at %I64x \n",
                  i, num_icm, reserved, nobj, obj_size, nobj * obj_size, (unsigned long long) virt));
-#endif
 
        return table;
 
@@ -379,10 +378,10 @@ void mthca_free_icm_table(struct mthca_dev *dev, struct mthca_icm_table *table)
                        mthca_free_icm(dev, table->icm[i]);
                }
 
-#if 0
-       HCA_PRINT(TRACE_LEVEL_VERBOSE,HCA_DBG_LOW, ( "Released chunks %d, objects %#x, one/total size %#x:%#x at %lx \n",
-                 table->num_icm, table->num_obj, table->obj_size, table->num_obj * table->obj_size, (unsigned long long) table->virt));
-#endif
+       HCA_PRINT(TRACE_LEVEL_VERBOSE,HCA_DBG_LOW, 
+               ( "Released chunks %d, objects %#x, one/total size %#x:%#x at %I64x \n",
+                 table->num_icm, table->num_obj, table->obj_size, 
+                 table->num_obj * table->obj_size, (unsigned long long) table->virt));
        kfree(table);
 }
 
index b9766da..cafcb9c 100644 (file)
@@ -91,13 +91,13 @@ struct mthca_mpt_entry {
 #define MTHCA_MPT_STATUS_HW 0x00
 
 
-static void dump_mtt(__be64 *mtt_entry ,int list_len)
+static void dump_mtt(u32 print_lvl, __be64 *mtt_entry ,int list_len)
 {
        int i;
        UNREFERENCED_PARAMETER(mtt_entry);              // for release version
-       HCA_PRINT(TRACE_LEVEL_INFORMATION ,HCA_DBG_MEMORY ,("Dumping MTT entry len %d :\n",list_len));
+       HCA_PRINT(print_lvl ,HCA_DBG_MEMORY ,("Dumping MTT entry len %d :\n",list_len));
        for (i = 0; i < list_len && i < MTHCA_MAILBOX_SIZE / 8 - 2; i=i+4) {
-               HCA_PRINT(TRACE_LEVEL_INFORMATION ,HCA_DBG_MEMORY ,("[%02x]  %016I64x %016I64x %016I64x %016I64x\n",i,
+               HCA_PRINT(print_lvl ,HCA_DBG_MEMORY ,("[%02x]  %016I64x %016I64x %016I64x %016I64x\n",i,
                        cl_ntoh64(mtt_entry[i]),
                        cl_ntoh64(mtt_entry[i+1]),
                        cl_ntoh64(mtt_entry[i+2]),
@@ -106,13 +106,13 @@ static void dump_mtt(__be64 *mtt_entry ,int list_len)
 }
 
 
-static void dump_mpt(struct mthca_mpt_entry *mpt_entry )
+static void dump_mpt(u32 print_lvl, struct mthca_mpt_entry *mpt_entry )
 {
        int i;
        UNREFERENCED_PARAMETER(mpt_entry);              // for release version
-       HCA_PRINT(TRACE_LEVEL_INFORMATION ,HCA_DBG_MEMORY ,("Dumping MPT entry %08x :\n", mpt_entry->key));
+       HCA_PRINT(print_lvl ,HCA_DBG_MEMORY ,("Dumping MPT entry %08x :\n", mpt_entry->key));
        for (i = 0; i < sizeof (struct mthca_mpt_entry) / 4; i=i+4) {
-       HCA_PRINT(TRACE_LEVEL_INFORMATION ,HCA_DBG_MEMORY ,("[%02x]  %08x %08x %08x %08x \n",i,
+       HCA_PRINT(print_lvl ,HCA_DBG_MEMORY ,("[%02x]  %08x %08x %08x %08x \n",i,
                        cl_ntoh32(((__be32 *) mpt_entry)[i]),
                        cl_ntoh32(((__be32 *) mpt_entry)[i+1]),
                        cl_ntoh32(((__be32 *) mpt_entry)[i+2]),
@@ -335,9 +335,7 @@ int mthca_write_mtt(struct mthca_dev *dev, struct mthca_mtt *mtt,
                if (i & 1)
                        mtt_entry[i + 2] = 0;
                
-               #if 0
-                       dump_mtt(mtt_entry ,i);
-               #endif
+               dump_mtt(TRACE_LEVEL_VERBOSE, mtt_entry ,i);
                
                err = mthca_WRITE_MTT(dev, mailbox, (i + 1) & ~1, &status);
                if (err) {
@@ -451,7 +449,7 @@ int mthca_mr_alloc(struct mthca_dev *dev, u32 pd, int buffer_size_shift,
                                    mr->mtt->first_seg * MTHCA_MTT_SEG_SIZE);
 
        {
-               dump_mpt(mpt_entry);
+               dump_mpt(TRACE_LEVEL_VERBOSE, mpt_entry);
        }
 
        err = mthca_SW2HW_MPT(dev, mailbox,
@@ -689,7 +687,8 @@ static inline int mthca_check_fmr(struct mthca_fmr *fmr, u64 *page_list,
                return -EINVAL;
 
        /* Trust the user not to pass misaligned data in page_list */
-       #if 0
+       #ifdef WIN_TO_BE_CHANGED
+               //TODO: do we need that ?
                for (i = 0; i < list_len; ++i) {
                        if (page_list[i] & ~page_mask)
                                return -EINVAL;
index 01c53cd..1806b5b 100644 (file)
@@ -331,21 +331,21 @@ static int is_qp0(struct mthca_dev *dev, struct mthca_qp *qp)
 }
 
 
-static void dump_wqe(u32 *wqe_ptr , struct mthca_qp *qp_ptr)
+static void dump_wqe(u32 print_lvl, u32 *wqe_ptr , struct mthca_qp *qp_ptr)
 {
        __be32 *wqe = wqe_ptr;
 
        UNREFERENCED_PARAMETER(qp_ptr);
 
        (void) wqe;     /* avoid warning if mthca_dbg compiled away... */
-       HCA_PRINT(TRACE_LEVEL_INFORMATION,HCA_DBG_QP,("WQE contents  QPN 0x%06x \n",qp_ptr->qpn));
-       HCA_PRINT(TRACE_LEVEL_INFORMATION,HCA_DBG_QP,("WQE contents [%02x] %08x %08x %08x %08x \n",0
+       HCA_PRINT(print_lvl,HCA_DBG_QP,("WQE contents  QPN 0x%06x \n",qp_ptr->qpn));
+       HCA_PRINT(print_lvl,HCA_DBG_QP,("WQE contents [%02x] %08x %08x %08x %08x \n",0
                , cl_ntoh32(wqe[0]), cl_ntoh32(wqe[1]), cl_ntoh32(wqe[2]), cl_ntoh32(wqe[3])));
-       HCA_PRINT(TRACE_LEVEL_INFORMATION,HCA_DBG_QP,("WQE contents [%02x] %08x %08x %08x %08x \n",4
+       HCA_PRINT(print_lvl,HCA_DBG_QP,("WQE contents [%02x] %08x %08x %08x %08x \n",4
                , cl_ntoh32(wqe[4]), cl_ntoh32(wqe[5]), cl_ntoh32(wqe[6]), cl_ntoh32(wqe[7])));
-       HCA_PRINT(TRACE_LEVEL_INFORMATION,HCA_DBG_QP,("WQE contents [%02x] %08x %08x %08x %08x \n",8
+       HCA_PRINT(print_lvl,HCA_DBG_QP,("WQE contents [%02x] %08x %08x %08x %08x \n",8
                , cl_ntoh32(wqe[8]), cl_ntoh32(wqe[9]), cl_ntoh32(wqe[10]), cl_ntoh32(wqe[11])));
-       HCA_PRINT(TRACE_LEVEL_INFORMATION,HCA_DBG_QP,("WQE contents [%02x] %08x %08x %08x %08x \n",12
+       HCA_PRINT(print_lvl,HCA_DBG_QP,("WQE contents [%02x] %08x %08x %08x %08x \n",12
                , cl_ntoh32(wqe[12]), cl_ntoh32(wqe[13]), cl_ntoh32(wqe[14]), cl_ntoh32(wqe[15])));
 
 }
@@ -1676,9 +1676,7 @@ int mthca_tavor_post_send(struct ib_qp *ibqp, struct _ib_send_wr *wr,
                        op0   = opcode;
                }
 
-               #if 0
-                       dump_wqe( (u32*)qp->sq.last,qp);
-               #endif
+               dump_wqe( TRACE_LEVEL_VERBOSE, (u32*)qp->sq.last,qp);
 
                ++ind;
                if (unlikely(ind >= qp->sq.max))
@@ -1797,9 +1795,7 @@ int mthca_tavor_post_receive(struct ib_qp *ibqp, struct _ib_recv_wr *wr,
                if (!size0)
                        size0 = size;
 
-               #if 0
-                       dump_wqe( (u32*)wqe ,qp);
-               #endif
+               dump_wqe(TRACE_LEVEL_VERBOSE,  (u32*)wqe ,qp);
                
                ++ind;
                if (unlikely(ind >= qp->rq.max))
index 1a7243c..fe55440 100644 (file)
@@ -91,8 +91,6 @@ gid_to_index_lookup (
     return index;\r
 }\r
 \r
-#ifndef WIN_TO_BE_CHANGED\r
-\r
 ib_api_status_t\r
 map_itom_av_attr (\r
     IN         ib_ca_attr_t            *p_ca_attr,\r
@@ -135,54 +133,6 @@ map_itom_av_attr (
        return status;\r
 } \r
 \r
-#else\r
-void\r
-map_itom_av_attr (\r
-    IN         ib_ca_attr_t            *p_ca_attr,\r
-    IN         const ib_av_attr_t      *p_av_attr,\r
-    OUT                VAPI_ud_av_t            *p_hhul_av)\r
-{\r
-    uint8_t ver;\r
-    uint8_t tclass;\r
-    uint32_t flow_lbl;\r
-\r
-    p_hhul_av->sl            = p_av_attr->sl;\r
-    p_hhul_av->port          = p_av_attr->port_num;\r
-    p_hhul_av->dlid          = CL_NTOH16 (p_av_attr->dlid);\r
-       /*\r
-        * VAPI uses static rate as IPD.\r
-        * 0 is matched links.  3 is suitable for 4x to 1x.\r
-        */\r
-       p_hhul_av->static_rate   =\r
-               (p_av_attr->static_rate == IB_PATH_RECORD_RATE_10_GBS? 0 : 3);\r
-\r
-    p_hhul_av->src_path_bits = 0;\r
-    /* p_hhul_av->src_path_bits = p_av_attr->path_bits; */\r
-    UVP_PRINT(TRACE_LEVEL_INFORMATION ,UVP_DBG_AV ,\r
-              ("ib_av_attr->path_bits %d\n", p_av_attr->path_bits));\r
-    p_hhul_av->grh_flag      = (MT_bool)p_av_attr->grh_valid;\r
-\r
-    if (p_av_attr->grh_valid)\r
-    {\r
-        ib_grh_get_ver_class_flow (p_av_attr->grh.ver_class_flow,\r
-                                   &ver, &tclass, &flow_lbl);\r
-\r
-        p_hhul_av->hop_limit  = p_av_attr->grh.hop_limit;\r
-        p_hhul_av->sgid_index = \r
-            gid_to_index_lookup (p_ca_attr, \r
-                                 p_av_attr->port_num,\r
-                                 (uint8_t *) p_av_attr->grh.src_gid.raw); \r
-\r
-        cl_memcpy (p_hhul_av->dgid, p_av_attr->grh.dest_gid.raw, \r
-                   sizeof (IB_gid_t));\r
-        \r
-        p_hhul_av->traffic_class = tclass;\r
-        p_hhul_av->flow_label    = flow_lbl;\r
-    }\r
-} \r
-#endif\r
-\r
-\r
 ib_api_status_t\r
 mlnx_pre_create_av (\r
     IN         const ib_pd_handle_t            h_uvp_pd,\r
@@ -240,7 +190,6 @@ end:
 }\r
 \r
 \r
-#ifndef WIN_TO_BE_CHANGED\r
 void\r
 mlnx_post_create_av (\r
     IN         const ib_pd_handle_t            h_uvp_pd,\r
@@ -307,94 +256,6 @@ end:
        return;\r
 }\r
 \r
-#else\r
-void\r
-mlnx_post_create_av (\r
-    IN         const ib_pd_handle_t            h_uvp_pd,\r
-    IN         ib_api_status_t                 ioctl_status,\r
-    OUT                ib_av_handle_t                  *ph_uvp_av,\r
-    IN OUT     ci_umv_buf_t                    *p_umv_buf)\r
-{\r
-    ib_api_status_t status;\r
-    mlnx_ual_hobul_t *p_hobul;\r
-    mlnx_ual_pd_info_t *p_pd_info = (mlnx_ual_pd_info_t *)((void*)h_uvp_pd);\r
-    ib_av_attr_t *p_av_attr;\r
-#ifdef WIN_TO_BE_CHANGED\r
-    VAPI_ud_av_t hhul_av;\r
-#endif\r
-    mlnx_ual_av_info_t *p_new_av = NULL;\r
-\r
-    UVP_ENTER(UVP_DBG_AV);\r
-    CL_ASSERT (p_pd_info);\r
-    CL_ASSERT (p_umv_buf);\r
-\r
-    p_hobul = p_pd_info->p_hobul;\r
-    CL_ASSERT (p_hobul);\r
-\r
-    /* \r
-     * Set initial value for handle \r
-     */\r
-    *ph_uvp_av = NULL;\r
-  \r
-    status = ioctl_status;\r
-\r
-    if (IB_SUCCESS == status)\r
-    {\r
-       if (sizeof (ib_av_attr_t) != p_umv_buf->output_size) \r
-       {\r
-           UVP_PRINT(TRACE_LEVEL_ERROR ,UVP_DBG_AV ,\r
-               ("Priv buffer has different size\n"));\r
-           status = IB_ERROR;\r
-           goto cleanup;\r
-       }\r
-       p_av_attr = (ib_av_attr_t *) p_umv_buf->p_inout_buf;\r
-       CL_ASSERT (p_av_attr);\r
-\r
-       p_new_av = cl_zalloc (sizeof (mlnx_ual_av_info_t));\r
-\r
-#ifdef WIN_TO_BE_CHANGED\r
-       map_itom_av_attr (p_hobul->p_hca_attr, p_av_attr, &hhul_av);\r
-\r
-       if (HH_OK != \r
-           THHUL_pdm_create_ud_av (p_hobul->hhul_hca_hndl,\r
-           p_pd_info->hhul_pd_hndl,\r
-           &hhul_av,\r
-           &p_new_av->h_av))\r
-       {\r
-           UVP_PRINT(TRACE_LEVEL_ERROR ,UVP_DBG_AV ,\r
-               ("FAILED to create usermode UD AV\n"));\r
-           status = IB_ERROR;\r
-           goto cleanup;\r
-       }\r
-#endif\r
-\r
-       p_new_av->p_i_av_attr = p_av_attr;\r
-       p_new_av->h_uvp_pd = h_uvp_pd;\r
-       *ph_uvp_av = p_new_av;\r
-       p_umv_buf->p_inout_buf = NULL;\r
-    }\r
-    /* \r
-     * clean_up if required\r
-     */\r
-cleanup:\r
-    if ((IB_SUCCESS != status) && (IB_SUCCESS == ioctl_status))\r
-    {\r
-        if (p_new_av) \r
-        {\r
-            if (p_new_av->p_i_av_attr);\r
-            {\r
-                cl_free (p_new_av->p_i_av_attr);\r
-            }\r
-            cl_free (p_new_av);\r
-        }\r
-    }\r
-\r
-    UVP_EXIT(UVP_DBG_AV);\r
-    return;\r
-}\r
-\r
-#endif\r
-\r
 ib_api_status_t\r
 mlnx_pre_query_av (\r
        IN      const   ib_av_handle_t          h_uvp_av,\r
@@ -433,8 +294,6 @@ mlnx_post_query_av (
     UVP_EXIT(UVP_DBG_AV);\r
 }\r
 \r
-#ifndef WIN_TO_BE_CHANGED\r
-\r
 void mthca_set_av_params(      struct mthca_ah *ah_p, struct ibv_ah_attr *ah_attr );\r
 \r
 ib_api_status_t\r
@@ -474,55 +333,6 @@ mlnx_pre_modify_av (
        return IB_VERBS_PROCESSING_DONE;\r
 }\r
 \r
-#else\r
-ib_api_status_t\r
-mlnx_pre_modify_av (\r
-    IN         const ib_av_handle_t            h_uvp_av,\r
-    IN         const ib_av_attr_t              *p_addr_vector,\r
-    IN OUT     ci_umv_buf_t                    *p_umv_buf)\r
-{\r
-    ib_api_status_t status = IB_VERBS_PROCESSING_DONE;\r
-\r
-    mlnx_ual_av_info_t *p_av_info = (mlnx_ual_av_info_t *)((void*) h_uvp_av);\r
-    mlnx_ual_pd_info_t *p_pd_info;\r
-    mlnx_ual_hobul_t *p_hobul;\r
-#ifdef WIN_TO_BE_CHANGED\r
-    VAPI_ud_av_t hhul_av;\r
-#endif\r
-\r
-    UVP_ENTER(UVP_DBG_AV);\r
-    CL_ASSERT (p_umv_buf);\r
-\r
-    p_pd_info = (mlnx_ual_pd_info_t *)((void*) p_av_info->h_uvp_pd);\r
-    CL_ASSERT (p_pd_info);\r
-\r
-    p_hobul = p_pd_info->p_hobul;\r
-    CL_ASSERT (p_hobul);\r
-\r
-#ifdef WIN_TO_BE_CHANGED\r
-    map_itom_av_attr (p_hobul->p_hca_attr, p_addr_vector, &hhul_av);\r
-\r
-       if (HH_OK !=\r
-        THHUL_pdm_modify_ud_av (p_hobul->hhul_hca_hndl, \r
-                                p_av_info->h_av,\r
-                                &hhul_av))\r
-    {\r
-        UVP_PRINT(TRACE_LEVEL_ERROR ,UVP_DBG_AV ,\r
-                  ("Failed to modify AV\n"));\r
-        status = IB_ERROR;\r
-    }\r
-    else\r
-#endif                 \r
-    {\r
-        cl_memcpy (p_av_info->p_i_av_attr, p_addr_vector, sizeof (ib_av_attr_t));\r
-    }\r
-\r
-    UVP_EXIT(UVP_DBG_AV);\r
-\r
-    return status;\r
-}\r
-#endif\r
-\r
 void\r
 mlnx_post_modify_av (\r
     IN         const ib_av_handle_t    h_uvp_av,\r
@@ -544,8 +354,6 @@ mlnx_pre_destroy_av (
     return IB_VERBS_PROCESSING_DONE;\r
 }\r
 \r
-#ifndef WIN_TO_BE_CHANGED\r
-\r
 void\r
 mlnx_post_destroy_av (\r
     IN         const ib_av_handle_t            h_uvp_av,\r
@@ -560,46 +368,3 @@ mlnx_post_destroy_av (
     return;\r
 }\r
 \r
-#else\r
-void\r
-mlnx_post_destroy_av (\r
-    IN         const ib_av_handle_t            h_uvp_av,\r
-    IN         ib_api_status_t                 ioctl_status)\r
-{\r
-    mlnx_ual_hobul_t *p_hobul;\r
-    mlnx_ual_pd_info_t *p_pd_info;\r
-    mlnx_ual_av_info_t *p_av_info = (mlnx_ual_av_info_t *)((void*) h_uvp_av);\r
-\r
-    UVP_ENTER(UVP_DBG_AV);\r
-    CL_ASSERT (p_av_info);\r
-\r
-    p_pd_info = (mlnx_ual_pd_info_t *)((void*) p_av_info->h_uvp_pd);\r
-    CL_ASSERT (p_pd_info);\r
-\r
-    p_hobul = p_pd_info->p_hobul;\r
-    CL_ASSERT (p_hobul);\r
-\r
-#ifdef WIN_TO_BE_CHANGED\r
-    if (HH_OK !=\r
-        THHUL_pdm_destroy_ud_av (p_hobul->hhul_hca_hndl,\r
-                                 p_av_info->h_av))\r
-    {\r
-        UVP_PRINT(TRACE_LEVEL_ERROR ,UVP_DBG_AV ,\r
-                  ("Failed to destroy av\n"));\r
-    }\r
-#endif         \r
-   \r
-    /*\r
-        * We still have to clean resources even THHUL failed\r
-        */     \r
-    if (p_av_info->p_i_av_attr);\r
-    {\r
-        cl_free (p_av_info->p_i_av_attr);\r
-    }\r
-    cl_free (p_av_info);\r
-\r
-    UVP_EXIT(UVP_DBG_AV);\r
-    return;\r
-}\r
-\r
-#endif\r
index b74415c..80af5ab 100644 (file)
@@ -60,21 +60,13 @@ mlnx_get_mrw_interface (
     /*\r
      * Memory Window Verbs\r
      */\r
-#ifndef WIN_TO_BE_CHANGED\r
-       p_uvp->pre_create_mw    = NULL;\r
-       p_uvp->post_create_mw = NULL;\r
-       p_uvp->pre_query_mw     = NULL;\r
-       p_uvp->post_query_mw    = NULL;\r
-       p_uvp->pre_destroy_mw = NULL;\r
-       p_uvp->post_destroy_mw = NULL;\r
-#else\r
-    p_uvp->pre_create_mw  = mlnx_pre_create_mw;\r
-    p_uvp->post_create_mw = mlnx_post_create_mw;\r
-    p_uvp->pre_query_mw   = mlnx_pre_query_mw;\r
-    p_uvp->post_query_mw  = mlnx_post_query_mw;\r
-    p_uvp->pre_destroy_mw = mlnx_pre_destroy_mw;\r
-    p_uvp->post_destroy_mw = mlnx_post_destroy_mw;\r
-#endif\r
+       p_uvp->pre_create_mw    = NULL; // mlnx_pre_create_mw\r
+       p_uvp->post_create_mw = NULL;   // mlnx_post_create_mw\r
+       p_uvp->pre_query_mw     = NULL; // mlnx_pre_query_mw\r
+       p_uvp->post_query_mw    = NULL; // mlnx_post_query_mw\r
+       p_uvp->pre_destroy_mw = NULL;   // mlnx_pre_destroy_mw\r
+       p_uvp->post_destroy_mw = NULL;  // mlnx_post_destroy_mw\r
+\r
     /* register_pmr is not supported in user-mode */\r
 \r
     UVP_EXIT(UVP_DBG_SHIM);\r
@@ -235,211 +227,3 @@ mlnx_post_deregister_mr (
 }\r
 \r
  \r
-#ifdef WIN_TO_BE_CHANGED\r
-\r
-ib_api_status_t\r
-mlnx_pre_create_mw (\r
-    IN         const ib_pd_handle_t            h_uvp_pd,\r
-    IN OUT     ci_umv_buf_t                    *p_umv_buf)\r
-{\r
-    ib_api_status_t status = IB_SUCCESS;\r
-    mlnx_ual_pd_info_t *p_pd_info = (mlnx_ual_pd_info_t *)((void*) h_uvp_pd);\r
-    mlnx_ual_hobul_t *p_hobul;\r
-    mlnx_ual_mw_info_t *p_new_mw;\r
-\r
-    UVP_ENTER(UVP_DBG_SHIM);\r
-    CL_ASSERT(p_umv_buf);\r
-    CL_ASSERT(p_pd_info);\r
-\r
-    p_hobul = p_pd_info->p_hobul;\r
-    CL_ASSERT(p_hobul);\r
-\r
-    p_new_mw = cl_zalloc (sizeof (mlnx_ual_mw_info_t));\r
-    if (p_new_mw == NULL)\r
-    {\r
-       UVP_PRINT(TRACE_LEVEL_ERROR ,UVP_DBG_SHIM ,\r
-           ("Failed to alloc memory\n"));\r
-       status = IB_INSUFFICIENT_MEMORY;\r
-       goto cleanup;\r
-    }\r
-    p_new_mw->h_uvp_pd = h_uvp_pd;\r
-\r
-    p_umv_buf->input_size = p_umv_buf->output_size = \r
-       sizeof (mlnx_ual_mw_info_t *);\r
-\r
-    p_umv_buf->p_inout_buf = cl_zalloc (p_umv_buf->input_size);\r
-    if (p_umv_buf->p_inout_buf == NULL)\r
-    {\r
-       UVP_PRINT(TRACE_LEVEL_ERROR ,UVP_DBG_SHIM ,\r
-           ("Failed to alloc memory for priv buffer\n"));\r
-       status = IB_INSUFFICIENT_MEMORY;\r
-       goto cleanup;\r
-    }\r
-    p_umv_buf->status = IB_SUCCESS;\r
-    p_umv_buf->command = TRUE;\r
-\r
-    cl_memcpy (p_umv_buf->p_inout_buf, &p_new_mw, p_umv_buf->input_size);\r
-\r
-cleanup:\r
-    if (IB_SUCCESS != status)\r
-    {\r
-        if (p_new_mw)\r
-        {\r
-            cl_free (p_new_mw);\r
-        }\r
-    }\r
-\r
-    UVP_EXIT(UVP_DBG_SHIM);\r
-    return status;\r
-}\r
-\r
-\r
-void\r
-mlnx_post_create_mw (\r
-       IN              const   ib_pd_handle_t                          h_uvp_pd,\r
-       IN                              ib_api_status_t                         ioctl_status,\r
-       IN                              net32_t                                         rkey,\r
-               OUT                     ib_mw_handle_t                          *ph_uvp_mw,\r
-       IN                              ci_umv_buf_t                            *p_umv_buf )\r
-{\r
-    ib_api_status_t status;\r
-    mlnx_ual_pd_info_t *p_pd_info = (mlnx_ual_pd_info_t *)((void*) h_uvp_pd);\r
-    mlnx_ual_hobul_t *p_hobul;\r
-    mlnx_ual_mw_info_t *p_new_mw;\r
-\r
-    UVP_ENTER(UVP_DBG_SHIM);\r
-    CL_ASSERT(p_umv_buf);\r
-    CL_ASSERT(p_pd_info);\r
-\r
-    p_hobul = p_pd_info->p_hobul;\r
-    CL_ASSERT(p_hobul);\r
-    \r
-\r
-    status = ioctl_status;\r
-\r
-    CL_ASSERT (p_umv_buf->p_inout_buf);\r
-    cl_memcpy (&p_new_mw, p_umv_buf->p_inout_buf, p_umv_buf->input_size);\r
-    \r
-\r
-    *ph_uvp_mw = (ib_mw_handle_t) p_new_mw;\r
-\r
-    if (IB_SUCCESS == status)\r
-    {\r
-       if (IB_SUCCESS != p_umv_buf->status) \r
-       {\r
-           UVP_PRINT(TRACE_LEVEL_ERROR ,UVP_DBG_SHIM ,\r
-               ("Bad status %ld\n", p_umv_buf->status));\r
-           status = p_umv_buf->status;\r
-           goto cleanup;\r
-       }\r
-\r
-       p_new_mw->rkey = rkey;\r
-\r
-#ifdef WIN_TO_BE_CHANGED\r
-       if (HH_OK !=\r
-           THHUL_mwm_alloc_mw (p_hobul->hhul_hca_hndl,\r
-           rkey,\r
-           &p_new_mw->hhul_mw_hndl))\r
-       {\r
-           UVP_PRINT(TRACE_LEVEL_ERROR ,UVP_DBG_SHIM ,\r
-               ("thhul_alloc_mw failed\n"));\r
-           status = IB_ERROR;\r
-           goto cleanup;\r
-       }\r
-#endif \r
-    }\r
-    else\r
-    {\r
-       cl_free (p_new_mw);\r
-    }\r
-\r
-cleanup:\r
-    cl_free (p_umv_buf->p_inout_buf);\r
-    p_umv_buf->p_inout_buf = NULL;\r
-\r
-    UVP_EXIT(UVP_DBG_SHIM);\r
-    return;\r
-}\r
-\r
-\r
-ib_api_status_t\r
-mlnx_pre_query_mw (\r
-    IN         const ib_mw_handle_t            h_uvp_mw,\r
-    IN OUT     ci_umv_buf_t                    *p_umv_buf)\r
-{\r
-    UVP_ENTER(UVP_DBG_SHIM);\r
-    CL_ASSERT(p_umv_buf);\r
-    p_umv_buf->p_inout_buf = NULL;;\r
-    p_umv_buf->input_size = 0;\r
-    p_umv_buf->output_size = 0;\r
-    p_umv_buf->status = IB_SUCCESS;\r
-    p_umv_buf->command = TRUE;\r
-    UVP_EXIT(UVP_DBG_SHIM);\r
-    return IB_SUCCESS;\r
-}\r
-\r
-\r
-void\r
-mlnx_post_query_mw (\r
-       IN              const   ib_mw_handle_t                          h_uvp_mw,\r
-       IN                              ib_api_status_t                         ioctl_status,\r
-       IN                              net32_t                                         rkey,\r
-               OUT                     ib_pd_handle_t                          *ph_pd,\r
-       IN                              ci_umv_buf_t                            *p_umv_buf )\r
-{\r
-    UVP_ENTER(UVP_DBG_SHIM);\r
-    *ph_pd = ((mlnx_ual_mw_info_t *)((void*)h_uvp_mw))->h_uvp_pd;\r
-\r
-    UVP_EXIT(UVP_DBG_SHIM);\r
-    return;\r
-}\r
-\r
-\r
-ib_api_status_t\r
-mlnx_pre_destroy_mw (\r
-    IN         const ib_mw_handle_t            h_uvp_mw)\r
-{\r
-    UVP_ENTER(UVP_DBG_SHIM);\r
-    UVP_EXIT(UVP_DBG_SHIM);\r
-    return IB_SUCCESS;\r
-}\r
-\r
-\r
-void\r
-mlnx_post_destroy_mw (\r
-    IN         const ib_mw_handle_t            h_uvp_mw,\r
-    IN         ib_api_status_t                 ioctl_status)\r
-{\r
-    ib_api_status_t status = IB_SUCCESS;\r
-    mlnx_ual_pd_info_t *p_pd_info;\r
-    mlnx_ual_hobul_t *p_hobul;\r
-    mlnx_ual_mw_info_t *p_mw_info = (mlnx_ual_mw_info_t *)((void*) h_uvp_mw);\r
-\r
-    UVP_ENTER(UVP_DBG_SHIM);\r
-    CL_ASSERT(p_mw_info);\r
-\r
-    p_pd_info = (mlnx_ual_pd_info_t *)((void*) p_mw_info->h_uvp_pd);\r
-    CL_ASSERT(p_pd_info);\r
-\r
-    p_hobul = p_pd_info->p_hobul;\r
-    CL_ASSERT(p_hobul);\r
-\r
-#ifdef WIN_TO_BE_CHANGED\r
-    if (HH_OK !=\r
-        THHUL_mwm_free_mw (p_hobul->hhul_hca_hndl, p_mw_info->hhul_mw_hndl))\r
-    {\r
-        UVP_PRINT(TRACE_LEVEL_ERROR ,UVP_DBG_SHIM ,\r
-                  ("thhul_free_mw failed\n"));\r
-        status = IB_ERROR;\r
-    }\r
-#endif\r
-    if (status == IB_SUCCESS)\r
-    {\r
-        cl_free (p_mw_info);\r
-    }\r
-\r
-    UVP_EXIT(UVP_DBG_SHIM);\r
-    return;\r
-}\r
-\r
-#endif\r
index ca3e41b..d708f64 100644 (file)
@@ -66,23 +66,6 @@ mlnx_get_qp_interface (
     UVP_EXIT(UVP_DBG_SHIM);\r
 }\r
 \r
-\r
-#ifdef WIN_TO_BE_CHANGED\r
-IB_ts_t\r
-map_ibal_qp_type (ib_qp_type_t ibal_qp_type)\r
-{\r
-    if      (ibal_qp_type == IB_QPT_RELIABLE_CONN) return IB_TS_RC;\r
-    else if (ibal_qp_type == IB_QPT_UNRELIABLE_CONN) return IB_TS_UC;\r
-  //  else if (ibal_qp_type == IB_QPT_RELIABLE_DGRM) return IB_TS_RD;\r
-    else if (ibal_qp_type == IB_QPT_UNRELIABLE_DGRM) return IB_TS_UD;\r
-    else if (ibal_qp_type == IB_QPT_RAW_IPV6) return IB_TS_RAW;\r
-    else if (ibal_qp_type == IB_QPT_RAW_ETHER) return IB_TS_RAW;\r
-    else return IB_TS_UD;\r
-}\r
-#endif\r
-\r
-#ifndef WIN_TO_BE_CHANGED\r
-\r
 ib_api_status_t\r
        mlnx_pre_create_qp (\r
        IN              const ib_pd_handle_t            h_uvp_pd,\r
@@ -157,188 +140,6 @@ end:
                return status;\r
 }\r
 \r
-#else\r
-\r
-ib_api_status_t\r
-mlnx_pre_create_qp (\r
-    IN         const   ib_pd_handle_t          h_uvp_pd,\r
-    IN         const   ib_qp_create_t          *p_create_attr,\r
-    IN OUT     ci_umv_buf_t                    *p_umv_buf)\r
-{\r
-    ib_api_status_t status = IB_SUCCESS;\r
-    mlnx_ual_pd_info_t *p_pd_info = (mlnx_ual_pd_info_t *)((void *)h_uvp_pd);\r
-    mlnx_ual_hobul_t *p_hobul;\r
-    mlnx_ual_qp_info_t *p_new_qp = NULL;\r
-#ifdef WIN_TO_BE_CHANGED\r
-    HHUL_qp_init_attr_t ul_qp_init_attr;\r
-#endif\r
-    size_t size=0;\r
-\r
-    UVP_ENTER(UVP_DBG_SHIM);\r
-    CL_ASSERT(p_pd_info);\r
-    CL_ASSERT(p_umv_buf);\r
-    CL_ASSERT(p_create_attr);\r
-\r
-    p_hobul = p_pd_info->p_hobul;\r
-    CL_ASSERT(p_hobul);\r
-\r
-    do \r
-    {\r
-        /* CA should be initialized */\r
-#ifdef WIN_TO_BE_CHANGED\r
-        if (!p_hobul->p_hca_ul_info) \r
-        {\r
-            UVP_PRINT(TRACE_LEVEL_ERROR ,UVP_DBG_SHIM ,\r
-                      ("INVALID hca_ul_info buffer\n"));\r
-            status = IB_INVALID_CA_HANDLE;\r
-            break;\r
-        }\r
-        \r
-        if (!p_hobul->p_hca_ul_resources) \r
-        {\r
-            UVP_PRINT(TRACE_LEVEL_ERROR ,UVP_DBG_SHIM ,\r
-                      ("INVALID hca_ul_resources buffer\n"));\r
-            status = IB_RESOURCE_BUSY;\r
-            break;\r
-        }\r
-        if (!p_pd_info->p_pd_ul_resources) \r
-        {\r
-            UVP_PRINT(TRACE_LEVEL_ERROR ,UVP_DBG_SHIM ,\r
-                      ("INVALID pd_ul_resources buffer\n"));\r
-            status = IB_RESOURCE_BUSY;\r
-            break;\r
-        }\r
-#endif\r
-\r
-        p_new_qp = cl_zalloc (sizeof(mlnx_ual_qp_info_t));\r
-        if (!p_new_qp) \r
-        {\r
-            UVP_PRINT(TRACE_LEVEL_ERROR ,UVP_DBG_SHIM ,\r
-                      ("Failed alloc new QP\n"));\r
-            status = IB_INSUFFICIENT_MEMORY;\r
-            break;\r
-        }\r
-\r
-#ifdef WIN_TO_BE_CHANGED\r
-        p_new_qp->p_qp_ul_resources = \r
-                cl_zalloc(p_hobul->p_hca_ul_info->qp_ul_resources_sz);\r
-        if (!p_new_qp->p_qp_ul_resources) \r
-        {\r
-            UVP_PRINT(TRACE_LEVEL_ERROR ,UVP_DBG_SHIM ,\r
-                      ("Failed alloc new QP UL resources\n"));\r
-            status = IB_INSUFFICIENT_MEMORY;\r
-            break;\r
-        }\r
-        cl_memclr (&ul_qp_init_attr, sizeof (HHUL_qp_init_attr_t));\r
-\r
-        ul_qp_init_attr.qp_cap.max_oust_wr_sq = p_create_attr->sq_depth;\r
-        ul_qp_init_attr.qp_cap.max_oust_wr_rq = p_create_attr->rq_depth;\r
-        ul_qp_init_attr.qp_cap.max_sg_size_sq = p_create_attr->sq_sge;\r
-        ul_qp_init_attr.qp_cap.max_sg_size_rq = p_create_attr->rq_sge;\r
-        ul_qp_init_attr.ts_type = map_ibal_qp_type (p_create_attr->qp_type);\r
-        ul_qp_init_attr.srq = HHUL_INVAL_SRQ_HNDL;\r
-        /*\r
-         * save the qp_type to qp_info to use later on\r
-         */\r
-        p_new_qp->type = ul_qp_init_attr.ts_type;\r
-        ul_qp_init_attr.sq_sig_type =\r
-           (p_create_attr->sq_signaled) ? VAPI_SIGNAL_ALL_WR:VAPI_SIGNAL_REQ_WR;\r
-        ul_qp_init_attr.rq_sig_type = VAPI_SIGNAL_ALL_WR;\r
-        ul_qp_init_attr.pd    = p_pd_info->hhul_pd_hndl; \r
-        ul_qp_init_attr.sq_cq = \r
-            ((mlnx_ual_cq_info_t *)(p_create_attr->h_sq_cq))->hhul_cq_hndl; \r
-        ul_qp_init_attr.rq_cq = \r
-            ((mlnx_ual_cq_info_t *)(p_create_attr->h_rq_cq))->hhul_cq_hndl; \r
-\r
-        if (HH_OK != \r
-            THHUL_qpm_create_qp_prep (p_hobul->hhul_hca_hndl,\r
-                                      &ul_qp_init_attr,\r
-                                      &p_new_qp->hhul_qp_hndl,\r
-                                      &p_new_qp->ul_qp_cap,\r
-                                      p_new_qp->p_qp_ul_resources))\r
-        {\r
-            UVP_PRINT(TRACE_LEVEL_ERROR ,UVP_DBG_SHIM ,\r
-                      ("Calling THHUL_qpm_create_qp_prep Failed\n"));\r
-            status = IB_RESOURCE_BUSY;\r
-            break;\r
-        }\r
-\r
-        /* \r
-         * Store the parent PD of this QP\r
-         */    \r
-        p_new_qp->h_uvp_pd = h_uvp_pd;\r
-           \r
-        size = p_hobul->p_hca_ul_info->qp_ul_resources_sz + \r
-               sizeof (uint32_t) + sizeof (mlnx_ual_qp_info_t *);\r
-#endif\r
-        p_umv_buf->p_inout_buf = cl_zalloc(size);\r
-        if (!p_umv_buf->p_inout_buf)\r
-        {\r
-            UVP_PRINT(TRACE_LEVEL_ERROR ,UVP_DBG_SHIM ,\r
-                      ("Failed alloc user private buffer\n"));\r
-            status = IB_INSUFFICIENT_MEMORY;\r
-            break;\r
-        }\r
-            \r
-        /* \r
-         * We only set the input_size up to qp_ul_resources_sz + sizeof (qp_idx)\r
-         * The rest of the buffer we store the pointer to our allocated\r
-         * qp_info struct in order to retrieve it later in the post.\r
-         */\r
-        p_umv_buf->input_size = p_umv_buf->output_size = \r
-               (uint32_t)size - sizeof (mlnx_ual_qp_info_t *);\r
-\r
-#ifdef WIN_TO_BE_CHANGED\r
-        cl_memcpy (p_umv_buf->p_inout_buf,\r
-                   p_new_qp->p_qp_ul_resources,\r
-                   p_hobul->p_hca_ul_info->qp_ul_resources_sz);\r
-#endif\r
-        /* \r
-         * Store the pointer of our qp_info struct to inout_buf and retrieve\r
-         * it later in the post\r
-         */\r
-        cl_memcpy ( ( (uint8_t *)p_umv_buf->p_inout_buf + size - \r
-                     sizeof (mlnx_ual_qp_info_t *)),\r
-                   &p_new_qp,\r
-                   sizeof (mlnx_ual_qp_info_t *));\r
-       p_umv_buf->command = TRUE;\r
-        \r
-    } while (0);\r
-\r
-    /* \r
-     * clean_up if required \r
-     */\r
-    if (IB_SUCCESS != status) \r
-    {\r
-        if (p_new_qp) \r
-        {\r
-#ifdef WIN_TO_BE_CHANGED\r
-            if (p_new_qp->hhul_qp_hndl)\r
-            {\r
-               THHUL_qpm_destroy_qp_done (p_hobul->hhul_hca_hndl, \r
-                                                  p_new_qp->hhul_qp_hndl);\r
-            }\r
-#endif                                         \r
-            if (p_new_qp->p_qp_ul_resources);\r
-            {\r
-                cl_free (p_new_qp->p_qp_ul_resources);\r
-            }\r
-            cl_free (p_new_qp);\r
-        }\r
-       if (p_umv_buf->p_inout_buf)\r
-       {\r
-           cl_free ( p_umv_buf->p_inout_buf );\r
-       }\r
-    }\r
-\r
-    UVP_EXIT(UVP_DBG_SHIM);\r
-    return IB_SUCCESS;\r
-}\r
-\r
-#endif\r
-\r
-#ifndef WIN_TO_BE_CHANGED\r
-\r
 void\r
        mlnx_post_create_qp (\r
                IN              const ib_pd_handle_t                            h_uvp_pd,\r
@@ -396,99 +197,6 @@ end:
        return;\r
 }\r
 \r
-#else\r
-\r
-void\r
-mlnx_post_create_qp (\r
-       IN              const   ib_pd_handle_t                          h_uvp_pd,\r
-       IN                              ib_api_status_t                         ioctl_status,\r
-               OUT                     ib_qp_handle_t                          *ph_uvp_qp,\r
-       IN                              ci_umv_buf_t                            *p_umv_buf )\r
-{\r
-       mlnx_ual_pd_info_t *p_pd_info = (mlnx_ual_pd_info_t *)((void*)h_uvp_pd);\r
-       mlnx_ual_hobul_t *p_hobul;\r
-       mlnx_ual_qp_info_t *p_new_qp;\r
-       size_t buf_size=0;\r
-\r
-       UVP_ENTER(UVP_DBG_QP);\r
-       CL_ASSERT(p_pd_info);\r
-       CL_ASSERT(p_umv_buf);\r
-\r
-       p_hobul = p_pd_info->p_hobul;\r
-       CL_ASSERT(p_hobul);\r
-\r
-#ifdef WIN_TO_BE_CHANGED\r
-       buf_size = p_hobul->p_hca_ul_info->qp_ul_resources_sz + \r
-               sizeof (uint32_t) + sizeof (mlnx_ual_qp_info_t *);\r
-#endif\r
-\r
-       /* Retrieve our qp_info back from priv buffer */\r
-       cl_memcpy (&p_new_qp, ((uint8_t *)p_umv_buf->p_inout_buf + buf_size -\r
-               sizeof (mlnx_ual_qp_info_t *)), sizeof (mlnx_ual_qp_info_t *));\r
-       CL_ASSERT(p_new_qp);\r
-\r
-       *ph_uvp_qp = (ib_qp_handle_t) p_new_qp;\r
-\r
-       if ( ioctl_status == IB_SUCCESS )\r
-       {\r
-               if (IB_SUCCESS != p_umv_buf->status) \r
-               {\r
-                       UVP_PRINT(TRACE_LEVEL_ERROR ,UVP_DBG_QP ,\r
-                               ("Bad status %ld\n", p_umv_buf->status));\r
-                       goto err;\r
-               }\r
-               else if ((buf_size - sizeof (mlnx_ual_qp_info_t *)) != \r
-                       p_umv_buf->output_size) \r
-               {\r
-                       UVP_PRINT(TRACE_LEVEL_ERROR ,UVP_DBG_QP ,\r
-                               ("Bad user priv buffer size exp = %d, res = %ld\n",\r
-                               buf_size, p_umv_buf->output_size));\r
-                       goto err;\r
-               }\r
-\r
-#ifdef WIN_TO_BE_CHANGED\r
-               cl_memcpy (p_new_qp->p_qp_ul_resources,\r
-                       p_umv_buf->p_inout_buf,\r
-                       p_hobul->p_hca_ul_info->qp_ul_resources_sz);\r
-\r
-               cl_memcpy (&p_new_qp->qp_idx,\r
-                       ((uint8_t *)p_umv_buf->p_inout_buf + \r
-                       p_hobul->p_hca_ul_info->qp_ul_resources_sz),\r
-                       sizeof (uint32_t));\r
-\r
-               if (HH_OK !=\r
-                       THHUL_qpm_create_qp_done (p_hobul->hhul_hca_hndl,\r
-                       p_new_qp->hhul_qp_hndl,\r
-                       p_new_qp->qp_idx,\r
-                       p_new_qp->p_qp_ul_resources))\r
-               {\r
-                       UVP_PRINT(TRACE_LEVEL_ERROR ,UVP_DBG_QP ,\r
-                               ("Call THHUL_qpm_create_qp_done Failed\n"));\r
-                       goto err;\r
-               }\r
-#endif\r
-               UVP_PRINT(TRACE_LEVEL_INFORMATION ,UVP_DBG_QP ,\r
-                       ("Newly created QP qp_idx 0x%x\n",p_new_qp->qp_idx)); \r
-       }\r
-       else\r
-       {\r
-err:\r
-               if (p_new_qp->p_qp_ul_resources)\r
-                       cl_free (p_new_qp->p_qp_ul_resources);\r
-\r
-               cl_free (p_new_qp);\r
-               *ph_uvp_qp = NULL;\r
-       }\r
-\r
-       cl_free (p_umv_buf->p_inout_buf);\r
-       p_umv_buf->p_inout_buf = NULL;\r
-\r
-       UVP_EXIT(UVP_DBG_QP);\r
-       return;\r
-}\r
-\r
-#endif\r
-\r
 ib_api_status_t\r
 mlnx_pre_modify_qp (\r
     IN         const ib_qp_handle_t            h_uvp_qp,\r
@@ -612,8 +320,6 @@ mlnx_pre_destroy_qp (
     return IB_SUCCESS;\r
 }\r
 \r
-#ifndef WIN_TO_BE_CHANGED\r
-\r
 void\r
 mlnx_post_destroy_qp (\r
        IN              const ib_qp_handle_t            h_uvp_qp,\r
@@ -636,47 +342,3 @@ mlnx_post_destroy_qp (
     return;\r
 }\r
 \r
-#else\r
-\r
-void\r
-mlnx_post_destroy_qp (\r
-    IN         const ib_qp_handle_t            h_uvp_qp,\r
-    IN         ib_api_status_t                 ioctl_status)\r
-{\r
-    mlnx_ual_qp_info_t *p_qp_info = (mlnx_ual_qp_info_t *)((void *) h_uvp_qp);\r
-    mlnx_ual_pd_info_t *p_pd_info;\r
-    mlnx_ual_hobul_t *p_hobul;\r
-\r
-    UNREFERENCED_PARAMETER(ioctl_status);\r
-\r
-    UVP_ENTER(UVP_DBG_SHIM);\r
-    CL_ASSERT(p_qp_info);\r
-\r
-    p_pd_info = (mlnx_ual_pd_info_t *)((void *)p_qp_info->h_uvp_pd);\r
-    CL_ASSERT(p_pd_info);\r
\r
-    p_hobul = p_pd_info->p_hobul;      \r
-    CL_ASSERT(p_hobul);\r
-\r
-#ifdef WIN_TO_BE_CHANGED\r
-    if (HH_OK !=\r
-        THHUL_qpm_destroy_qp_done (p_hobul->hhul_hca_hndl, \r
-                                   p_qp_info->hhul_qp_hndl))\r
-    {\r
-        UVP_PRINT(TRACE_LEVEL_ERROR ,UVP_DBG_SHIM ,\r
-                  ("THHUL_destroy_qp_done failed\n"));\r
-    }\r
-#endif\r
-    if (p_qp_info->p_qp_ul_resources);\r
-    {\r
-        cl_free (p_qp_info->p_qp_ul_resources);\r
-        p_qp_info->p_qp_ul_resources = NULL; \r
-    }\r
-\r
-    cl_free (p_qp_info);\r
-\r
-    UVP_EXIT(UVP_DBG_SHIM);\r
-    return;\r
-}\r
-\r
-#endif\r
index af4fd47..6459d1b 100644 (file)
@@ -96,8 +96,8 @@ static struct ibv_context_ops mthca_ctx_ops = {
        NULL,   // mthca_query_port,
        mthca_alloc_pd,
        mthca_free_pd,
-       mthca_reg_mr,
-       mthca_dereg_mr,
+       NULL,   // mthca_reg_mr,
+       NULL,   // mthca_dereg_mr,
        mthca_create_cq_pre,
        mthca_create_cq_post,
        mthca_poll_cq,
index 1c1c78a..2812fe0 100644 (file)
@@ -266,10 +266,6 @@ extern     struct ibv_pd *mthca_alloc_pd(struct ibv_context *context,
 
 extern int mthca_free_pd(struct ibv_pd *pd);
 
-extern struct ibv_mr *mthca_reg_mr(struct ibv_pd *pd, void *addr,
-                                  size_t length, enum ibv_access_flags access);
-extern int mthca_dereg_mr(struct ibv_mr *mr);
-
 extern struct ibv_cq *mthca_create_cq_pre(struct ibv_context *context, int *cqe,
                                 struct ibv_create_cq *req);
 extern struct ibv_cq *mthca_create_cq_post(struct ibv_context *context, 
index c98ab2d..dfc587f 100644 (file)
@@ -159,16 +159,16 @@ static inline void update_cons_index(struct mthca_cq *cq, int incr)
 }
 
 
-static void dump_cqe(void *cqe_ptr)
+static void dump_cqe(uint32_t print_lvl, void *cqe_ptr)
 {
        uint32_t *cqe = cqe_ptr;
        int i;
        (void) cqe;     /* avoid warning if mthca_dbg compiled away... */
 
-       UVP_PRINT(TRACE_LEVEL_INFORMATION,UVP_DBG_CQ,("CQE content \n "));
-       UVP_PRINT(TRACE_LEVEL_INFORMATION,UVP_DBG_CQ,(" [%2x] %08x %08x %08x %08x \n",0
+       UVP_PRINT(print_lvl,UVP_DBG_CQ,("CQE content \n "));
+       UVP_PRINT(print_lvl,UVP_DBG_CQ,(" [%2x] %08x %08x %08x %08x \n",0
                , cl_ntoh32(cqe[0]), cl_ntoh32(cqe[1]), cl_ntoh32(cqe[2]), cl_ntoh32(cqe[3])));
-       UVP_PRINT(TRACE_LEVEL_INFORMATION,UVP_DBG_CQ,(" [%2x] %08x %08x %08x %08x\n",16
+       UVP_PRINT(print_lvl,UVP_DBG_CQ,(" [%2x] %08x %08x %08x %08x\n",16
                , cl_ntoh32(cqe[4]), cl_ntoh32(cqe[5]), cl_ntoh32(cqe[6]), cl_ntoh32(cqe[7])));
        
 }
@@ -187,7 +187,7 @@ static int handle_error_cqe(struct mthca_cq *cq,
                       "(QPN %06x, WQE @ %08x, CQN %06x, index %d)\n",
                       cl_ntoh32(cqe->my_qpn), cl_ntoh32(cqe->wqe),
                       cq->cqn, cq->cons_index));
-               dump_cqe(cqe);
+               dump_cqe(TRACE_LEVEL_VERBOSE, cqe);
        }
 
        /*
@@ -302,11 +302,11 @@ static inline int mthca_poll_one(struct mthca_cq *cq,
         */
        rmb();
 
-       if(0){
+       { // debug print
                UVP_PRINT(TRACE_LEVEL_VERBOSE,UVP_DBG_CQ,("%x/%d: CQE -> QPN %06x, WQE @ %08x\n",
                          cq->cqn, cq->cons_index, cl_ntoh32(cqe->my_qpn),
                          cl_ntoh32(cqe->wqe)));
-               dump_cqe(cqe);
+               dump_cqe(TRACE_LEVEL_VERBOSE,cqe);
        }
        
        qpn = cl_ntoh32(cqe->my_qpn);
index c0ea26e..4052a75 100644 (file)
@@ -73,19 +73,19 @@ static enum mthca_wr_opcode conv_ibal_wr_opcode(struct _ib_send_wr *wr)
 }
 
 
-static void dump_wqe(uint32_t *wqe_ptr , struct mthca_qp *qp_ptr)
+static void dump_wqe(uint32_t print_lvl, uint32_t *wqe_ptr , struct mthca_qp *qp_ptr)
 {
        net32_t *wqe = wqe_ptr;
 
        (void) wqe;     /* avoid warning if mthca_dbg compiled away... */
-       UVP_PRINT(TRACE_LEVEL_INFORMATION,UVP_DBG_QP,("WQE contents  QPN 0x%06x \n",qp_ptr->ibv_qp.qp_num));
-       UVP_PRINT(TRACE_LEVEL_INFORMATION,UVP_DBG_QP,("WQE contents [%02x] %08x %08x %08x %08x \n",0
+       UVP_PRINT(print_lvl,UVP_DBG_QP,("WQE contents  QPN 0x%06x \n",qp_ptr->ibv_qp.qp_num));
+       UVP_PRINT(print_lvl,UVP_DBG_QP,("WQE contents [%02x] %08x %08x %08x %08x \n",0
                , cl_ntoh32(wqe[0]), cl_ntoh32(wqe[1]), cl_ntoh32(wqe[2]), cl_ntoh32(wqe[3])));
-       UVP_PRINT(TRACE_LEVEL_INFORMATION,UVP_DBG_QP,("WQE contents [%02x] %08x %08x %08x %08x \n",4
+       UVP_PRINT(print_lvl,UVP_DBG_QP,("WQE contents [%02x] %08x %08x %08x %08x \n",4
                , cl_ntoh32(wqe[4]), cl_ntoh32(wqe[5]), cl_ntoh32(wqe[6]), cl_ntoh32(wqe[7])));
-       UVP_PRINT(TRACE_LEVEL_INFORMATION,UVP_DBG_QP,("WQE contents [%02x] %08x %08x %08x %08x \n",8
+       UVP_PRINT(print_lvl,UVP_DBG_QP,("WQE contents [%02x] %08x %08x %08x %08x \n",8
                , cl_ntoh32(wqe[8]), cl_ntoh32(wqe[9]), cl_ntoh32(wqe[10]), cl_ntoh32(wqe[11])));
-       UVP_PRINT(TRACE_LEVEL_INFORMATION,UVP_DBG_QP,("WQE contents [%02x] %08x %08x %08x %08x \n",12
+       UVP_PRINT(print_lvl,UVP_DBG_QP,("WQE contents [%02x] %08x %08x %08x %08x \n",12
                , cl_ntoh32(wqe[12]), cl_ntoh32(wqe[13]), cl_ntoh32(wqe[14]), cl_ntoh32(wqe[15])));
 
 }
@@ -349,8 +349,7 @@ int mthca_tavor_post_send(struct ibv_qp *ibqp, struct _ib_send_wr *wr,
                        op0   = opcode;
                }
                
-               if(0)
-                       dump_wqe( (uint32_t*)qp->sq.last,qp);
+               dump_wqe( TRACE_LEVEL_VERBOSE, (uint32_t*)qp->sq.last,qp);
                
                ++ind;
                if (unlikely(ind >= qp->sq.max))
index ca2af0b..1071324 100644 (file)
@@ -79,47 +79,6 @@ int mthca_free_pd(struct ibv_pd *ibv_pd)
        return 0;
 }
 
-static struct ibv_mr *__mthca_reg_mr(struct ibv_pd *pd, void *addr,
-                                    size_t length, uint64_t hca_va,
-                                    enum ibv_access_flags access)
-{
-       struct ibv_mr *mr;
-       struct ibv_reg_mr cmd;
-
-       mr = cl_malloc(sizeof *mr);
-       if (!mr)
-               return NULL;
-
-#ifdef WIN_TO_BE_CHANGED
-       if (ibv_cmd_reg_mr(pd, addr, length, hca_va,
-                          access, mr, &cmd, sizeof cmd)) {
-               cl_free(mr);
-               return NULL;
-       }
-#endif
-       return mr;
-}
-
-struct ibv_mr *mthca_reg_mr(struct ibv_pd *pd, void *addr,
-                           size_t length, enum ibv_access_flags access)
-{
-       return __mthca_reg_mr(pd, addr, length, (uintptr_t) addr, access);
-}
-
-int mthca_dereg_mr(struct ibv_mr *mr)
-{
-       int ret;
-
-#ifdef WIN_TO_BE_CHANGED
-       ret = ibv_cmd_dereg_mr(mr);
-       if (ret)
-               return ret;
-#endif
-
-       cl_free(mr);
-       return 0;
-}
-
 /* allocate create_cq infrastructure  and fill it's request parameters structure */
 struct ibv_cq *mthca_create_cq_pre(struct ibv_context *context, int *p_cqe,
                               struct ibv_create_cq *req)
@@ -263,132 +222,6 @@ static int align_queue_size(struct ibv_context *context, int size, int spare)
                return size + spare;
 }
 
-#ifdef WIN_TO_BE_CHANGED
-struct ibv_srq *mthca_create_srq(struct ibv_pd *pd,
-                                struct ibv_srq_init_attr *attr)
-{
-       struct mthca_create_srq      cmd;
-       struct mthca_create_srq_resp resp;
-       struct mthca_srq            *srq;
-       int                          ret;
-
-       /* Sanity check SRQ size before proceeding */
-       if (attr->attr.max_wr > 16 << 20 || attr->attr.max_sge > 64)
-               return NULL;
-
-       srq = cl_malloc(sizeof *srq);
-       if (!srq)
-               return NULL;
-
-       cl_spinlock_construct(&srq->lock);
-       if (cl_spinlock_init(&srq->lock))
-               goto err;
-
-       srq->max     = align_queue_size(pd->context, attr->attr.max_wr, 1);
-       srq->max_gs  = attr->attr.max_sge;
-       srq->counter = 0;
-
-       if (mthca_alloc_srq_buf(pd, &attr->attr, srq))
-               goto err;
-
-       srq->mr = __mthca_reg_mr(pd, srq->buf, srq->buf_size, 0, 0);
-       if (!srq->mr)
-               goto err_free;
-
-       srq->mr->context = pd->context;
-
-       if (mthca_is_memfree(pd->context)) {
-               srq->db_index = mthca_alloc_db(to_mctx(pd->context)->db_tab,
-                                              MTHCA_DB_TYPE_SRQ, &srq->db);
-               if (srq->db_index < 0)
-                       goto err_unreg;
-
-               cmd.db_page  = db_align(srq->db);
-               cmd.db_index = srq->db_index;
-       }
-
-       cmd.lkey = srq->mr->lkey;
-
-#ifdef WIN_TO_BE_CHANGED
-       ret = ibv_cmd_create_srq(pd, &srq->ibv_srq, attr,
-                                &cmd.ibv_cmd, sizeof cmd,
-                                &resp.ibv_resp, sizeof resp);
-       if (ret)
-               goto err_db;
-
-       srq->srqn = resp.srqn;
-
-       if (mthca_is_memfree(pd->context))
-               mthca_set_db_qn(srq->db, MTHCA_DB_TYPE_SRQ, srq->srqn);
-
-       return &srq->ibv_srq;
-
-err_db:
-#endif
-       if (mthca_is_memfree(pd->context))
-               mthca_free_db(to_mctx(pd->context)->db_tab, MTHCA_DB_TYPE_SRQ,
-                             srq->db_index);
-
-err_unreg:
-       mthca_dereg_mr(srq->mr);
-
-err_free:
-       cl_free(srq->wrid);
-#ifdef NOT_USE_VIRTUAL_ALLOC   
-       cl_free(srq->buf);
-#else
-       VirtualFree( srq->buf, 0, MEM_RELEASE);
-#endif
-
-err:
-       cl_free(srq);
-
-       return NULL;
-}
-
-int mthca_modify_srq(struct ibv_srq *srq,
-                    struct ibv_srq_attr *attr,
-                    enum ibv_srq_attr_mask attr_mask)
-{
-       struct ibv_modify_srq cmd;
-
-#ifdef WIN_TO_BE_CHANGED
-       return ibv_cmd_modify_srq(srq, attr, attr_mask, &cmd, sizeof cmd);
-#else
-       return -ENOSYS;
-#endif
-}
-
-int mthca_destroy_srq(struct ibv_srq *srq)
-{
-       int ret;
-
-#ifdef WIN_TO_BE_CHANGED
-       ret = ibv_cmd_destroy_srq(srq);
-       if (ret)
-               return ret;
-#endif
-
-       if (mthca_is_memfree(srq->context))
-               mthca_free_db(to_mctx(srq->context)->db_tab, MTHCA_DB_TYPE_SRQ,
-                             to_msrq(srq)->db_index);
-
-       mthca_dereg_mr(to_msrq(srq)->mr);
-
-       cl_spinlock_destroy(&((struct mthca_srq *)srq)->lock);
-
-#ifdef NOT_USE_VIRTUAL_ALLOC   
-       cl_free(to_msrq(srq)->buf);
-#else
-       VirtualFree( to_msrq(srq)->buf, 0, MEM_RELEASE);
-#endif
-       cl_free(to_msrq(srq)->wrid);
-       cl_free(to_msrq(srq));
-
-       return 0;
-}
-#endif
-
 struct ibv_qp *mthca_create_qp_pre(struct ibv_pd *pd, 
        struct ibv_qp_init_attr *attr, struct ibv_create_qp *req)
 {
index e1dee1a..435b923 100644 (file)
@@ -426,14 +426,6 @@ struct ibv_qp {
        uint32_t                qp_num;
        enum ibv_qp_state       state;
        ib_qp_type_t    qp_type;
-
-#ifdef WIN_TO_BE_CHANGED       
-       struct ibv_context     *context;
-       HANDLE          mutex;
-       void                   *qp_context;
-       pthread_cond_t          cond;
-       uint32_t                events_completed;
-#endif
 };
 
 struct ibv_cq {