[ofw] [RFC] [PATCH] winverbs: changes to support rdma_cm

Sean Hefty sean.hefty at intel.com
Wed Dec 17 14:33:57 PST 2008


I've implemented the connection-oriented calls to WinVerbs and an librdmacm
compatibility library.  The following changes to the WinVerbs interfaces are the
result of those changes.

Since winverbs has only been released as a technology preview, use of the
updated library will require that applications recompile.  I changed the
provider interface GUID to prevent mixing pre-built apps with an updated
library.

The main change is folding the Listen class into the Endpoint classes.  The
kernel code ended up treating the two the same, plus this simplifies librdmacm
compat library support.

I'm only posting the header file for comments now.  All changes will be posted
after they've been tested and before being committed to SVN.

Signed-off-by: Sean Hefty <sean.hefty at intel.com>
---
Index: winverbs.h
===================================================================
--- winverbs.h	(revision 1794)
+++ winverbs.h	(working copy)
@@ -35,6 +35,7 @@
 #include <initguid.h>
 
 #include <winsock2.h>
+#include <ws2tcpip.h>
 #include <unknwn.h>
 #include <rdma\wvstatus.h>
 
@@ -156,22 +157,14 @@
 
 }	WV_PORT_ATTRIBUTES;
 
-typedef struct _WV_ADDRESS
+typedef struct _WV_DEVICE_ADDRESS
 {
-	SOCKET_ADDRESS	Address;
-	NET64			DeviceGuid;
-	NET16			Pkey;
-	UINT8			PortNumber;
+	NET64				DeviceGuid;
+	NET16				Pkey;
+	UINT8				PortNumber;
 
-}	WV_ADDRESS;
+}	WV_DEVICE_ADDRESS;
 
-typedef struct _WV_ADDRESS_LIST
-{
-	SIZE_T			Count;
-	WV_ADDRESS		Address[1];
-
-}	WV_ADDRESS_LIST;
-
 // Port notification flags
 #define WV_EVENT_ERROR				0x00000001
 #define WV_EVENT_STATE				0x00000002
@@ -476,8 +469,6 @@
 
 #define WV_CM_UDP_QKEY	0x01234567
 
-#pragma warning(push)
-#pragma warning(disable: 4200)
 typedef struct _WV_CONNECT_PARAM
 {
 	SIZE_T				DataLength;
@@ -486,7 +477,7 @@
 	UINT8				RetryCount;			//
Ignored when accepting
 	UINT8				RnrRetryCount;
 	UINT8				Reserved[2];
-	UINT8				Data[];
+	UINT8				Data[56];
 
 }	WV_CONNECT_PARAM;
 
@@ -496,27 +487,39 @@
 	WV_ADDRESS_VECTOR	AddressVector;
 	NET32				Qpn;
 	NET32				Qkey;
-	UINT8				Data[];
+	UINT8				Data[56];
 
 }	WV_DATAGRAM_PARAM;
-#pragma warning(pop)
 
+typedef union _WV_SOCKADDR
+{
+	SOCKADDR			Sa;
+	SOCKADDR_IN			Sin;
+	SOCKADDR_IN6		Sin6;
+
+}	WV_SOCKADDR;
+
 typedef struct _WV_CONNECT_ATTRIBUTES
 {
-	WV_ADDRESS			LocalAddress;
-	SOCKET_ADDRESS		PeerAddress;
+	WV_SOCKADDR			LocalAddress;
+	WV_SOCKADDR			PeerAddress;
+	WV_DEVICE_ADDRESS	Device;
 	WV_CONNECT_PARAM	Param;
 
 }	WV_CONNECT_ATTRIBUTES;
 
 typedef struct _WV_DATAGRAM_ATTRIBUTES
 {
-	WV_ADDRESS			LocalAddress;
-	SOCKET_ADDRESS		PeerAddress;		// Specify when querying
+	WV_SOCKADDR			LocalAddress;
+	WV_SOCKADDR			PeerAddress;		// Specify when
querying
+	WV_DEVICE_ADDRESS	Device;
 	WV_DATAGRAM_PARAM	Param;
 
 }	WV_DATAGRAM_ATTRIBUTES;
 
+// Endpoint options
+#define WV_EP_OPTION_ROUTE				0x00000001
+
 #undef INTERFACE
 #define INTERFACE IWVOverlapped
 // {64687592-aa67-4b55-bc4b-e189bdd2fc4f}
@@ -1126,15 +1129,27 @@
 		) PURE;
 
 	// IWVEndpoint methods
+	STDMETHOD(Modify)(
+		THIS_
+		__in DWORD Option,
+		__in_bcount_opt(OptionLength) const VOID* pOptionData,
+		__in SIZE_T OptionLength
+		) PURE;
+
 	STDMETHOD(BindAddress)(
 		THIS_
-		__in const struct sockaddr* pAddress
+		__in SOCKADDR* pAddress
 		) PURE;
 
+	STDMETHOD(Listen)(
+		THIS_
+		__in SIZE_T Backlog
+		) PURE;
+
 	STDMETHOD(Reject)(
 		THIS_
-		__in_bcount_opt(PrivateDataLength) const VOID* pPrivateData,
-		__in SIZE_T PrivateDataLength
+		__in_bcount_opt(UserDataLength) const VOID* pUserData,
+		__in SIZE_T UserDataLength
 		) PURE;
 };
 
@@ -1175,21 +1190,40 @@
 		) PURE;
 
 	// IWVEndpoint methods
+	__override STDMETHOD(Modify)(
+		THIS_
+		__in DWORD Option,
+		__in_bcount_opt(OptionLength) const VOID* pOptionData,
+		__in SIZE_T OptionLength
+		) PURE;
+
 	__override STDMETHOD(BindAddress)(
 		THIS_
-		__in const struct sockaddr* pAddress
+		__in SOCKADDR* pAddress
 		) PURE;
 
+	__override STDMETHOD(Listen)(
+		THIS_
+		__in SIZE_T Backlog
+		) PURE;
+
 	__override STDMETHOD(Reject)(
 		THIS_
-		__in_bcount_opt(PrivateDataLength) const VOID* pPrivateData,
-		__in SIZE_T PrivateDataLength
+		__in_bcount_opt(UserDataLength) const VOID* pUserData,
+		__in SIZE_T UserDataLength
 		) PURE;
 
 	// IWVConnectEndpoint methods
+	STDMETHOD(GetRequest)(
+		THIS_
+		__in IWVConnectEndpoint* pEndpoint,
+		__in_opt OVERLAPPED* pOverlapped
+		) PURE;
+
 	STDMETHOD(Connect)(
 		THIS_
 		__in IWVConnectQueuePair* pQp,
+		__in const SOCKADDR* pAddress,
 		__in WV_CONNECT_PARAM* pParam,
 		__in_opt OVERLAPPED* pOverlapped
 		) PURE;
@@ -1202,8 +1236,7 @@
 		) PURE;
 
 	STDMETHOD(Disconnect)(
-		THIS_
-		__in_opt OVERLAPPED* pOverlapped
+		THIS
 		) PURE;
 
 	STDMETHOD(NotifyDisconnect)(
@@ -1254,23 +1287,41 @@
 		) PURE;
 
 	// IWVEndpoint methods
+	__override STDMETHOD(Modify)(
+		THIS_
+		__in DWORD Option,
+		__in_bcount_opt(OptionLength) const VOID* pOptionData,
+		__in SIZE_T OptionLength
+		) PURE;
+
 	__override STDMETHOD(BindAddress)(
 		THIS_
-		__in const struct sockaddr* pAddress
+		__in SOCKADDR* pAddress
 		) PURE;
 
+	__override STDMETHOD(Listen)(
+		THIS_
+		__in SIZE_T Backlog
+		) PURE;
+
 	__override STDMETHOD(Reject)(
 		THIS_
-		__in_bcount_opt(PrivateDataLength) const VOID* pPrivateData,
-		__in SIZE_T PrivateDataLength
+		__in_bcount_opt(UserDataLength) const VOID* pUserData,
+		__in SIZE_T UserDataLength
 		) PURE;
 
 	// IWVDatagramEndpoint methods
+	STDMETHOD(GetRequest)(
+		THIS_
+		__in IWVDatagramEndpoint* pEndpoint,
+		__in_opt OVERLAPPED* pOverlapped
+		) PURE;
+
 	STDMETHOD(Lookup)(
 		THIS_
-		__in const struct sockaddr* pAddress,
-		__in_bcount_opt(PrivateDataLength) const VOID* pPrivateData,
-		__in SIZE_T PrivateDataLength,
+		__in const SOCKADDR* pAddress,
+		__in_bcount_opt(UserDataLength) const VOID* pUserData,
+		__in SIZE_T UserDataLength,
 		__in_opt OVERLAPPED* pOverlapped
 		) PURE;
 
@@ -1282,13 +1333,13 @@
 
 	STDMETHOD(JoinMulticast)(
 		THIS_
-		__in const struct sockaddr* pAddress,
+		__in const SOCKADDR* pAddress,
 		__in_opt OVERLAPPED* pOverlapped
 		) PURE;
 
 	STDMETHOD(LeaveMulticast)(
 		THIS_
-		__in const struct sockaddr* pAddress,
+		__in const SOCKADDR* pAddress,
 		__in_opt OVERLAPPED* pOverlapped
 		) PURE;
 
@@ -1300,50 +1351,6 @@
 
 
 #undef INTERFACE
-#define INTERFACE IWVListen
-// {5b839fd4-7410-441f-a2d9-5d75b1d8599b}
-DEFINE_GUID(IID_IWVListen, 0x5b839fd4, 0x7410, 0x441f,
-			0xa2, 0xd9, 0x5d, 0x75, 0xb1, 0xd8, 0x59, 0x9b);
-
-DECLARE_INTERFACE_(IWVListen, IWVOverlapped)
-{
-	// IUnknown methods
-	__override STDMETHOD(QueryInterface)(
-		THIS_
-		REFIID riid,
-		LPVOID FAR* ppvObj
-		) PURE;
-
-	__override STDMETHOD_(ULONG,AddRef)(
-		THIS
-		) PURE;
-
-	__override STDMETHOD_(ULONG,Release)(
-		THIS
-		) PURE;
-
-	// IWVOverlapped methods
-	__override STDMETHOD(CancelOverlappedRequests)(
-		THIS
-		) PURE;
-
-	__override STDMETHOD(GetOverlappedResult)(
-		THIS_
-		__inout_opt OVERLAPPED *pOverlapped,
-		__out DWORD *pNumberOfBytesTransferred,
-		__in BOOL bWait
-		) PURE;
-
-	// IWVListen methods
-	STDMETHOD(GetRequest)(
-		THIS_
-		__in IWVEndpoint* pEndpoint,
-		__in_opt OVERLAPPED* pOverlapped
-		) PURE;
-};
-
-
-#undef INTERFACE
 #define INTERFACE IWVDevice
 // {244af78c-b1ac-40e4-9896-271d58d591b8}
 DEFINE_GUID(IID_IWVDevice, 0x244af78c, 0xb1ac, 0x40e4,
@@ -1397,6 +1404,13 @@
 		__out WV_GID* pGid
 		) PURE;
 
+	STDMETHOD(FindGid)(
+		THIS_
+		__in UINT8 PortNumber,
+		__in WV_GID* pGid,
+		__out DWORD* pIndex
+		) PURE;
+
 	STDMETHOD(QueryPkey)(
 		THIS_
 		__in UINT8 PortNumber,
@@ -1404,6 +1418,13 @@
 		__out NET16* pPkey
 		) PURE;
 
+	STDMETHOD(FindPkey)(
+		THIS_
+		__in UINT8 PortNumber,
+		__in NET16 Pkey,
+		__out DWORD* pIndex
+		) PURE;
+
 	STDMETHOD(CreateCompletionQueue)(
 		THIS_
 		__inout SIZE_T *pEntries,
@@ -1426,9 +1447,9 @@
 
 #undef INTERFACE
 #define INTERFACE IWVProvider
-// {6901010c-17af-4894-a1dc-794d3611f262}
-DEFINE_GUID(IID_IWVProvider, 0x6901010c, 0x17af, 0x4894,
-			0xa1, 0xdc, 0x79, 0x4d, 0x36, 0x11, 0xf2, 0x62);
+// {060E95D6-EC54-43b2-83FC-B578FD037259}
+DEFINE_GUID(IID_IWVProvider, 0x60e95d6, 0xec54, 0x43b2,
+			0x83, 0xfc, 0xb5, 0x78, 0xfd, 0x3, 0x72, 0x59);
 
 DECLARE_INTERFACE_(IWVProvider, IUnknown)
 {
@@ -1464,10 +1485,10 @@
 		__out WV_DEVICE_ATTRIBUTES* pAttributes
 		) PURE;
 
-	STDMETHOD(QueryAddressList)(
+	STDMETHOD(TranslateAddress)(
 		THIS_
-		__inout_bcount_part_opt(*pBufferSize, *pBufferSize)
WV_ADDRESS_LIST* pAddressList,
-		__inout SIZE_T* pBufferSize
+		__in SOCKADDR* pAddress,
+		__out WV_DEVICE_ADDRESS* pDeviceAddress
 		) PURE;
 
 	STDMETHOD(OpenDevice)(
@@ -1485,13 +1506,6 @@
 		THIS_
 		__deref_out IWVDatagramEndpoint** ppDatagramEndpoint
 		) PURE;
-
-	STDMETHOD(CreateListen)(
-		THIS_
-		__in const struct sockaddr* pAddress,
-		__in SIZE_T Backlog,
-		__deref_out IWVListen** ppListen
-		) PURE;
 };
 
 __declspec(dllexport) HRESULT WvGetObject(REFIID riid, LPVOID FAR* ppvObj);





More information about the ofw mailing list