In order to support opensm running over winmad (via the libibumad),
authorshefty <shefty@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Tue, 3 Nov 2009 16:45:38 +0000 (16:45 +0000)
committershefty <shefty@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Tue, 3 Nov 2009 16:45:38 +0000 (16:45 +0000)
we need to set the IsSM PortInfo capability bit when it is present.
We do this in the winmad driver based on the user registering for
unsolicted directed route SMPs.  The bit is unset when that user goes
away.

In order to set the capability bit, we need to add ib_modify_ca()
to the IB_AL interface.  The interface GUID is updated as a result.

For opensm, a call to umad_register (directly or indirectly through
another library), should result in setting the IsSM capability bit
correctly.  No additional work is required, such as calling
umad_get_issm_path and opening a separate file, as is done on linx.
This will require a platform specific handling in the opensm code.

Signed-off-by: Sean Hefty <sean.hefty@intel.com>
git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@2536 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

core/winmad/kernel/wm_reg.c
core/winmad/kernel/wm_reg.h
inc/kernel/iba/ib_al_ifc.h

index 6e352a9..c9900da 100644 (file)
@@ -89,11 +89,12 @@ static int WmConvertMethods(ib_mad_svc_t *svc, WM_IO_REGISTER *pAttributes)
 \r
 static NTSTATUS WmRegInit(WM_REGISTRATION *pRegistration, WM_IO_REGISTER *pAttributes)\r
 {\r
-       WM_IB_DEVICE    *dev;\r
-       ib_qp_create_t  attr;\r
-       ib_mad_svc_t    svc;\r
-       ib_api_status_t ib_status;\r
-       NTSTATUS                status;\r
+       WM_IB_DEVICE            *dev;\r
+       ib_qp_create_t          attr;\r
+       ib_mad_svc_t            svc;\r
+       ib_port_attr_mod_t      port_cap;\r
+       ib_api_status_t         ib_status;\r
+       NTSTATUS                        status;\r
 \r
        RtlZeroMemory(&attr, sizeof attr);\r
        if (pAttributes->Qpn == 0) {\r
@@ -109,6 +110,7 @@ static NTSTATUS WmRegInit(WM_REGISTRATION *pRegistration, WM_IO_REGISTER *pAttri
                return STATUS_NO_SUCH_DEVICE;\r
        }\r
 \r
+       pRegistration->PortNum = pAttributes->Port;\r
        if (--pAttributes->Port > dev->PortCount) {\r
                status = STATUS_INVALID_PORT_HANDLE;\r
                goto err1;\r
@@ -161,6 +163,18 @@ static NTSTATUS WmRegInit(WM_REGISTRATION *pRegistration, WM_IO_REGISTER *pAttri
                goto err5;\r
        }\r
 \r
+       if (svc.mgmt_class == IB_MCLASS_SUBN_DIR && svc.support_unsol) {\r
+               port_cap.cap.sm = 1;\r
+               ib_status = dev->IbInterface.modify_ca(pRegistration->hCa,\r
+                                                                                          pRegistration->PortNum,\r
+                                                                                          IB_CA_MOD_IS_SM, &port_cap);\r
+               if (ib_status != IB_SUCCESS) {\r
+                       status = STATUS_UNSUCCESSFUL;\r
+                       goto err5;\r
+               }\r
+               pRegistration->PortCapMask = IB_CA_MOD_IS_SM;\r
+       }\r
+\r
        pRegistration->pDevice = dev;\r
        return STATUS_SUCCESS;\r
 \r
@@ -270,10 +284,20 @@ void WmRegFree(WM_REGISTRATION *pRegistatration)
 \r
 void WmRegRemoveHandler(WM_REGISTRATION *pRegistration)\r
 {\r
+       ib_port_attr_mod_t      port_cap;\r
+\r
        if (pRegistration->pDevice == NULL) {\r
                return;\r
        }\r
 \r
+       if (pRegistration->PortCapMask) {\r
+               RtlZeroMemory(&port_cap.cap, sizeof(port_cap.cap));\r
+               pRegistration->pDevice->IbInterface.modify_ca(pRegistration->hCa,\r
+                                                                                                         pRegistration->PortNum,\r
+                                                                                                         pRegistration->PortCapMask,\r
+                                                                                                         &port_cap);\r
+       }\r
+\r
        WmProviderDeregister(pRegistration->pProvider, pRegistration);\r
        pRegistration->pDevice->IbInterface.destroy_qp(pRegistration->hQp, NULL);\r
        pRegistration->pDevice->IbInterface.dealloc_pd(pRegistration->hPd, NULL);\r
index 7de4acc..5f947e4 100644 (file)
@@ -46,10 +46,12 @@ typedef struct _WM_REGISTRATION
 \r
        ib_al_handle_t                  hIbal;\r
        ib_ca_handle_t                  hCa;\r
+       UINT8                                   PortNum;\r
        ib_pd_handle_t                  hPd;\r
        ib_qp_handle_t                  hQp;\r
        ib_pool_key_t                   hMadPool;\r
        ib_mad_svc_handle_t             hService;\r
+       ib_ca_mod_t                             PortCapMask;\r
 \r
        SIZE_T                                  Id;\r
        LONG                                    Ref;\r
index 18faa8e..dc98869 100644 (file)
@@ -663,6 +663,7 @@ typedef struct _ib_al_ifc
        ib_pfn_sync_destroy_t           sync_destroy;\r
        ib_pfn_open_ca_t                        open_ca;\r
        ib_pfn_query_ca_t                       query_ca;\r
+       ib_pfn_modify_ca_t                      modify_ca;\r
        ib_pfn_get_ca_dev_t                     get_dev;\r
        ib_pfn_close_ca_t                       close_ca;\r
        ib_pfn_alloc_pd_t                       alloc_pd;\r
@@ -769,6 +770,6 @@ typedef struct _ib_al_ifc
  * on purpose so that it can be instantiated only once where it is actually\r
  * needed.  See the DDK docs section "Using GUIDs in Drivers" for more info.\r
  */\r
-/* {707A1BDE-BF9F-4565-8FDD-144EF6514FE8} */\r
+// {96234E89-496F-4dfb-AA90-FCE82BCEC8A8}\r
 DEFINE_GUID(GUID_IB_AL_INTERFACE, \r
-0x707a1bde, 0xbf9f, 0x4565, 0x8f, 0xdd, 0x14, 0x4e, 0xf6, 0x51, 0x4f, 0xe8);\r
+0x96234e89, 0x496f, 0x4dfb, 0xaa, 0x90, 0xfc, 0xe8, 0x2b, 0xce, 0xc8, 0xa8);\r