[CORE,HW] remove PDO from the upper HCA interface. [mlnx: 4197]
authorleonidk <leonidk@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Sun, 29 Mar 2009 15:40:56 +0000 (15:40 +0000)
committerleonidk <leonidk@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Sun, 29 Mar 2009 15:40:56 +0000 (15:40 +0000)
This patch removes p_hca_dev field of the upper CA interface (ci_interface_t), which contains PDO of HCA device.
IBBUS, now sitting over HCA, gets this PDO in add_device function and stores it (in this patch) in new p_hca_dev field in IBAL CA object.
All the usages of ci_interface_t.p_hca_dev  field is replaced by usage of p_hca_dev in IBAL CA object.

p_hca_obj field, added in 2019 patch in RDMA_INTERFACE_VERBS, removed and placed instead of p_hca_dev in ci_interface_t.

Removing of PDO filed from the interface required changing of ib_register_ca prototype (for technical reasons).
It is - an interface function, so the interface version number was increased (IB_CI_INTERFACE_VERSION=5).

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

core/al/al_ca.h
core/al/kernel/al_mgr.c
core/bus/kernel/bus_iou_mgr.c
core/bus/kernel/bus_pnp.c
core/bus/kernel/bus_port_mgr.c
core/winmad/kernel/wm_driver.c
core/winverbs/kernel/wv_driver.c
inc/iba/ib_ci.h
inc/kernel/iba/ib_ci_ifc.h
inc/kernel/rdma/verbs.h

index afd38b1..5c01343 100644 (file)
@@ -50,6 +50,7 @@ typedef struct _ib_ca
        cl_list_item_t                  list_item;\r
 #if defined(CL_KERNEL)\r
        ib_ca_handle_t                  h_um_ca;\r
+       PDEVICE_OBJECT                  p_hca_dev;\r
 #endif\r
 \r
 }      ib_ca_t;\r
index 1c7ab56..707e334 100644 (file)
@@ -256,7 +256,9 @@ __free_al_mgr(
  */\r
 ib_api_status_t\r
 ib_register_ca(\r
-       IN              const   ci_interface_t*                         p_ci )\r
+       IN              const   ci_interface_t*                         p_ci,\r
+       IN              const   PDEVICE_OBJECT                          p_hca_dev\r
+       )\r
 {\r
        ib_api_status_t         status;\r
 \r
@@ -283,7 +285,7 @@ ib_register_ca(
        }\r
 \r
        /* Construct and initialize the CA structure. */\r
-       status = create_ci_ca( &gp_al_mgr->obj, p_ci );\r
+       status = create_ci_ca( &gp_al_mgr->obj, p_ci, p_hca_dev );\r
        if( status != IB_SUCCESS )\r
        {\r
                AL_PRINT( TRACE_LEVEL_ERROR, AL_DBG_ERROR,\r
index 928b165..2b46404 100644 (file)
@@ -417,7 +417,7 @@ free_iou_mgr(
                {\r
                        /* Invalidate bus relations for the HCA. */\r
                        IoInvalidateDeviceRelations(\r
-                               p_ext->h_ca->obj.p_ci_ca->verbs.p_hca_dev, BusRelations );\r
+                               p_ext->h_ca->p_hca_dev, BusRelations );\r
 \r
                        /* Release the reference on the CA object. */\r
                        deref_al_obj( &p_ext->h_ca->obj );\r
@@ -787,7 +787,7 @@ iou_mgr_iou_add(
 \r
        /* Tell the PnP Manager to rescan for the HCA's bus relations. */\r
        IoInvalidateDeviceRelations(\r
-                       p_iou_ext->pdo.h_ca->obj.p_ci_ca->verbs.p_hca_dev, BusRelations );\r
+                       p_iou_ext->pdo.h_ca->p_hca_dev, BusRelations );\r
 \r
        /* Invalidate removal relations for the bus driver. */\r
        IoInvalidateDeviceRelations(\r
@@ -885,7 +885,7 @@ iou_mgr_iou_remove(
 \r
        /* Invalidate bus relations for the HCA. */\r
        IoInvalidateDeviceRelations(\r
-               p_ext->h_ca->obj.p_ci_ca->verbs.p_hca_dev, BusRelations );\r
+               p_ext->h_ca->p_hca_dev, BusRelations );\r
 \r
        /* free PNP context */\r
        cl_free( p_ctx );\r
@@ -1561,7 +1561,7 @@ iou_query_interface(
                p_ext = p_dev_obj->DeviceExtension;\r
                if( !p_ext->h_ca ||\r
                        !p_ext->b_present ||\r
-                       !p_ext->h_ca->obj.p_ci_ca->verbs.p_hca_dev ||\r
+                       !p_ext->h_ca->p_hca_dev ||\r
                        p_ext->b_reported_missing )\r
                {\r
                        return STATUS_NO_SUCH_DEVICE;\r
@@ -1569,7 +1569,7 @@ iou_query_interface(
 \r
 \r
                status = cl_fwd_query_ifc(\r
-                       p_ext->h_ca->obj.p_ci_ca->verbs.p_hca_dev, p_io_stack );\r
+                       p_ext->h_ca->p_hca_dev, p_io_stack );\r
        }\r
        else\r
        {\r
index 59978ca..661a120 100644 (file)
@@ -47,6 +47,7 @@
 #include "iba/ib_ci_ifc.h"\r
 #include "iba/ib_cm_ifc.h"\r
 #include "al_cm_cep.h"\r
+#include "al_mgr.h"\r
 \r
 \r
 /* Interface names are generated by IoRegisterDeviceInterface. */\r
@@ -460,8 +461,11 @@ fdo_start(
        }\r
        p_ext->hca_ifc_taken = TRUE;\r
 \r
+       /* bind BFI to HCA by CA GUID. Have to be before ib_register_ca */\r
+       p_bfi->ca_guid = p_ext->hca_ifc.Verbs.guid;\r
+\r
        /* register HCA */\r
-       ib_status = ib_register_ca( &p_ext->hca_ifc.Verbs );\r
+       ib_status = ib_register_ca( &p_ext->hca_ifc.Verbs, p_ext->cl_ext.p_pdo );\r
        if( ib_status != IB_SUCCESS )\r
        {\r
                BUS_TRACE_EXIT( BUS_DBG_ERROR, ("ib_register_ca returned %s.\n",\r
@@ -469,9 +473,6 @@ fdo_start(
                return STATUS_UNSUCCESSFUL;\r
        }\r
 \r
-       /* bind BFI to HCA by CA GUID */\r
-       p_bfi->ca_guid = p_ext->hca_ifc.Verbs.guid;\r
-\r
        BUS_TRACE_EXIT(BUS_DBG_PNP, ("%s bound to CA guid %I64x\n",\r
                                                                        p_bfi->whoami,p_bfi->ca_guid));\r
        return status;\r
index c11150a..bf5dec0 100644 (file)
@@ -415,7 +415,7 @@ free_port_mgr(
                {\r
                        /* Invalidate bus relations for the HCA. */\r
                        IoInvalidateDeviceRelations(\r
-                               p_ext->h_ca->obj.p_ci_ca->verbs.p_hca_dev, BusRelations );\r
+                               p_ext->h_ca->p_hca_dev, BusRelations );\r
 \r
                        /* Release the reference on the CA object. */\r
                        deref_al_obj( &p_ext->h_ca->obj );\r
@@ -925,7 +925,7 @@ port_mgr_port_add(
 \r
                /* Tell the PnP Manager to rescan for the HCA's bus relations. */\r
                IoInvalidateDeviceRelations(\r
-                       p_port_ext->pdo.h_ca->obj.p_ci_ca->verbs.p_hca_dev, BusRelations );\r
+                       p_port_ext->pdo.h_ca->p_hca_dev, BusRelations );\r
        }\r
 \r
        /* Invalidate removal relations for the bus driver. */\r
@@ -985,7 +985,7 @@ cl_status_t _port_mgr_pkey_rem(     IN      pkey_array_t    *pkeys,
 \r
        /* Tell the PnP Manager to rescan for the HCA's bus relations. */\r
        IoInvalidateDeviceRelations(\r
-               p_port_ext->pdo.h_ca->obj.p_ci_ca->verbs.p_hca_dev, BusRelations );\r
+               p_port_ext->pdo.h_ca->p_hca_dev, BusRelations );\r
 \r
        BUS_EXIT( BUS_DBG_PNP );\r
        return CL_SUCCESS;\r
@@ -1125,7 +1125,7 @@ cl_status_t _port_mgr_pkey_add( IN        pkey_array_t    *req_pkeys,
 \r
        /* Tell the PnP Manager to rescan for the HCA's bus relations. */\r
        IoInvalidateDeviceRelations(\r
-               pmatched_guid_ext->pdo.h_ca->obj.p_ci_ca->verbs.p_hca_dev, BusRelations );\r
+               pmatched_guid_ext->pdo.h_ca->p_hca_dev, BusRelations );\r
 \r
        /* Invalidate removal relations for the bus driver. */\r
        IoInvalidateDeviceRelations(\r
@@ -1267,7 +1267,7 @@ port_mgr_port_remove(
 \r
        /* Invalidate bus relations for the HCA. */\r
        IoInvalidateDeviceRelations(\r
-               p_ext->h_ca->obj.p_ci_ca->verbs.p_hca_dev, BusRelations );\r
+               p_ext->h_ca->p_hca_dev, BusRelations );\r
 \r
        /* Free PNP context memory */\r
        cl_free( p_ctx );\r
@@ -1796,7 +1796,7 @@ port_query_location(
                return STATUS_NO_SUCH_DEVICE;\r
        }\r
 \r
-       p_hca_dev = p_ext->pdo.h_ca->obj.p_ci_ca->verbs.p_hca_dev;\r
+       p_hca_dev = p_ext->pdo.h_ca->p_hca_dev;\r
 \r
        /* Get the length of the HCA's location. */\r
        status = IoGetDeviceProperty( p_hca_dev,\r
@@ -2017,14 +2017,14 @@ port_query_interface(
                p_ext = p_dev_obj->DeviceExtension;\r
                if( !p_ext->h_ca ||\r
                        !p_ext->b_present ||\r
-                       !p_ext->h_ca->obj.p_ci_ca->verbs.p_hca_dev ||\r
+                       !p_ext->h_ca->p_hca_dev ||\r
                        p_ext->b_reported_missing )\r
                {\r
                        return STATUS_NO_SUCH_DEVICE;\r
                }\r
 \r
                status = cl_fwd_query_ifc(\r
-                       p_ext->h_ca->obj.p_ci_ca->verbs.p_hca_dev, p_io_stack );\r
+                       p_ext->h_ca->p_hca_dev, p_io_stack );\r
        }\r
        else\r
        {\r
index 57caf09..b5b79e5 100644 (file)
@@ -233,7 +233,7 @@ static ib_ca_attr_t *WmQueryCaAttributes(WM_IB_DEVICE *pDevice)
 \r
        size = 0;\r
        ib_status = pDevice->VerbsInterface.Verbs.\r
-                               query_ca(pDevice->VerbsInterface.p_hca_obj, NULL, &size, NULL);\r
+                               query_ca(pDevice->VerbsInterface.Verbs.p_hca_obj, NULL, &size, NULL);\r
        if (ib_status != IB_INSUFFICIENT_MEMORY) {\r
                attr = NULL;\r
                goto out;\r
@@ -245,7 +245,7 @@ static ib_ca_attr_t *WmQueryCaAttributes(WM_IB_DEVICE *pDevice)
        }\r
 \r
        ib_status = pDevice->VerbsInterface.Verbs.\r
-                               query_ca(pDevice->VerbsInterface.p_hca_obj, attr, &size, NULL);\r
+                               query_ca(pDevice->VerbsInterface.Verbs.p_hca_obj, attr, &size, NULL);\r
        if (ib_status != IB_SUCCESS) {\r
                ExFreePool(attr);\r
                attr = NULL;\r
index 697eb63..e317058 100644 (file)
@@ -477,7 +477,7 @@ static NTSTATUS WvPowerD0Entry(WDFDEVICE Device, WDF_POWER_DEVICE_STATE Previous
        if (!NT_SUCCESS(status)) {\r
                return status;\r
        }\r
-       dev->hDevice = dev->Interface.p_hca_obj;\r
+       dev->hDevice = dev->Interface.Verbs.p_hca_obj;\r
 \r
        KeAcquireGuardedMutex(&Lock);\r
        create = IsListEmpty(&DevList);\r
index 0dc108e..6867d63 100644 (file)
@@ -2793,10 +2793,10 @@ typedef struct _ci_interface
        net64_t                         guid;\r
 \r
        /*\r
-        * Device object of the HCA.  In Windows, this is a pointer to the PDO\r
-        * for the HCA device.\r
+        * Handle, returned by open_ca function of HCA upper interface (ci_interface_t)\r
+        * It has ib_ca_handle_t type\r
         */\r
-       void                            *p_hca_dev;\r
+       void                            *p_hca_obj;\r
 \r
        /*\r
         * Vendor ID, Device ID, Device Revision of the HCA\r
@@ -2936,7 +2936,9 @@ typedef struct _ci_interface
 */\r
 AL_EXPORT ib_api_status_t\r
 ib_register_ca (\r
-       IN              const   ci_interface_t                          *p_ci );\r
+       IN              const   ci_interface_t*                         p_ci,\r
+       IN              const   PDEVICE_OBJECT                          p_hca_dev\r
+       );\r
 /*\r
 * DESCRIPTION\r
 *      This routine is called by a HCA kernel mode driver to inform the\r
@@ -2950,6 +2952,8 @@ ib_register_ca (
 *      p_ci\r
 *              [in] Pointer to the ci_interface_t structure that has the function\r
 *              vector to support verbs functionality.\r
+*      p_hca_dev\r
+*              PDO of HCA device\r
 *\r
 * RETURN VALUE\r
 *      IB_SUCCESS\r
index 6ca716e..42e1859 100644 (file)
 *********/\r
 \r
 \r
-#define IB_CI_INTERFACE_VERSION                (4)\r
+#define IB_CI_INTERFACE_VERSION                (5)\r
 \r
 \r
 /* Function type for ib_register_ca.  Match the definition in ib_ci.h */\r
 typedef ib_api_status_t\r
 (*ib_pfn_register_ca_t)(\r
-       IN              const   ci_interface_t* const           p_ci );\r
+       IN              const   ci_interface_t* const           p_ci,\r
+       IN              const   PDEVICE_OBJECT                          p_hca_dev\r
+       );\r
 \r
 \r
 /* Function type for ib_deregister_ca.  Matches the definition in ib_ci.h */\r
index b4cf7a1..67f5eac 100644 (file)
@@ -57,7 +57,6 @@ typedef struct _RDMA_INTERFACE_VERBS
 {\r
        INTERFACE               InterfaceHeader;\r
        ci_interface_t  Verbs;\r
-       void *                  p_hca_obj;\r
 \r
 }      RDMA_INTERFACE_VERBS;\r
 \r