[ofw] [PATCH] winmad: fixup return values

Hefty, Sean sean.hefty at intel.com
Fri Jun 11 09:52:23 PDT 2010


Winmad simply returns the status values defined by IBAL.  Convert
Those values into winmad define status values and align those values
with errno.  This matches the expectations of libibumad.

As part of the cleanup, convert the check for success from IB_SUCCESS
to IB_WCS_SUCCESS.  Both are defined as 0, so there's no functional change,
but the mad status is a 'work completion status' value, not an API status
value.

Finally, return the correct status value when canceling a read request.

Signed-off-by: Sean Hefty <sean.hefty at intel.com>
---
I don't believe these changes will have any noticeable impact on the
existing libraries and applications.  The status of cancel is not
checked, and the status of a mad is simply compared against success,
since error codes are osm vendor specific.

Index: core/winmad/kernel/wm_provider.c
===================================================================
--- core/winmad/kernel/wm_provider.c	(revision 2820)
+++ core/winmad/kernel/wm_provider.c	(working copy)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008 Intel Corporation. All rights reserved.
+ * Copyright (c) 2008-2010 Intel Corporation. All rights reserved.
  *
  * This software is available to you under the OpenIB.org BSD license
  * below:
@@ -407,9 +407,10 @@
 void WmSendHandler(ib_mad_svc_handle_t hService, void *Context,
 				   ib_mad_element_t *pMad)
 {
-	if (pMad->status == IB_SUCCESS) {
+	if (pMad->status == IB_WCS_SUCCESS) {
 		((WM_REGISTRATION *) Context)->pDevice->IbInterface.put_mad(pMad);
 	} else {
+		pMad->status = WM_IO_TIMEOUT;
 		WmReceiveHandler(hService, Context, pMad);
 	}
 }
@@ -417,10 +418,11 @@
 void WmProviderCancel(WM_PROVIDER *pProvider, WDFREQUEST Request)
 {
 	WDFREQUEST	request;
-	NTSTATUS	status;
+	NTSTATUS	status, result;
 
 	WdfObjectAcquireLock(pProvider->ReadQueue);
 	status = WdfIoQueueRetrieveNextRequest(pProvider->ReadQueue, &request);
+	result = status;
 
 	while (NT_SUCCESS(status)) {
 		WdfRequestComplete(request, STATUS_CANCELLED);
@@ -428,5 +430,5 @@
 	}
 	WdfObjectReleaseLock(pProvider->ReadQueue);
 
-	WdfRequestComplete(Request, status);
+	WdfRequestComplete(Request, result);
 }
Index: core/winmad/wm_ioctl.h
===================================================================
--- core/winmad/wm_ioctl.h	(revision 2820)
+++ core/winmad/wm_ioctl.h	(working copy)
@@ -98,6 +98,9 @@
 
 }	WM_IO_MAD_AV;
 
+#define WM_IO_SUCCESS 0
+#define WM_IO_TIMEOUT 138
+
 #pragma warning(push)
 #pragma warning(disable: 4200)
 typedef struct _WM_IO_MAD
Index: inc/user/iba/winmad.h
===================================================================
--- inc/user/iba/winmad.h	(revision 2820)
+++ inc/user/iba/winmad.h	(working copy)
@@ -72,6 +72,9 @@
 
 }	WM_MAD_AV;
 
+#define WM_SUCCESS 0
+#define WM_TIMEOUT 138
+
 #pragma warning(push)
 #pragma warning(disable: 4200)
 typedef struct _WM_MAD

-------------- next part --------------
A non-text attachment was scrubbed...
Name: wm.patch
Type: application/octet-stream
Size: 2123 bytes
Desc: wm.patch
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20100611/fec59ed5/attachment.obj>


More information about the ofw mailing list