[ofa-general] PATCH[5/6] Windows port of libibmad - rpc.c, sa.c, serv.c, smp.c, vendor.c

Sean Hefty sean.hefty at intel.com
Thu Dec 18 16:31:49 PST 2008


>-static pthread_mutex_t rpclock = PTHREAD_MUTEX_INITIALIZER;
>+static cl_plock_t rpclock;

There's a complib mutex implementation available.  plock is a reader/writer
lock.

>-	pthread_mutex_lock(&rpclock);
>+	cl_plock_acquire(&rpclock);
> }
>
> void
> madrpc_unlock(void)
> {
>-	pthread_mutex_unlock(&rpclock);
>+	cl_plock_release(&rpclock);

The lock is only acquired/released to serialize access.

>-void
>+MAD_EXPORT void
> madrpc_init(char *dev_name, int dev_port, int *mgmt_classes, int num_classes)
> {
> 	if (umad_init() < 0)
>@@ -314,7 +321,7 @@
> 		IBPANIC("too many classes %d requested", num_classes);
>
> 	while (num_classes--) {
>-		int rmpp_version = 0;
>+		uint8_t rmpp_version = 0;
> 		int mgmt = *mgmt_classes++;
>
> 		if (mgmt == IB_SA_CLASS)
>@@ -322,6 +329,7 @@
> 		if (mad_register_client(mgmt, rmpp_version) < 0)
> 			IBPANIC("client_register for mgmt class %d failed",
mgmt);
> 	}
>+	cl_plock_init(&rpclock);

Most complib objects also have construct and destroy calls that should be
invoked.  Maybe you can avoid the construct call here, but I'm not sure about
destroy.


- Sean




More information about the general mailing list