[ofw] [PATCH] winmad: add support for opensm

Sean Hefty sean.hefty at intel.com
Thu Oct 8 12:05:03 PDT 2009


In order to support opensm running over winmad (via the libibumad),
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 at intel.com>
---
I tested that the ib-diags still work with this patch, but I
don't have a way to verify that the IsSM bit is actually being set
correctly until the port of opensm is complete enough to run.


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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: reg-sm.patch
Type: application/octet-stream
Size: 3369 bytes
Desc: not available
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20091008/9bf4a9da/attachment.obj>


More information about the ofw mailing list