[ofw] WinVerbs v2

Sean Hefty sean.hefty at intel.com
Tue Feb 19 16:24:50 PST 2008


Updated based on feedback.  Major changes from previous version:

Simplied GID definition
Changed enums to #defines for flag definitions
Changed UINT32 to SIZE_T for most local attribute values
Removed SRQ structures in favor of call parameters
Removed atomic structures in favor of call parameters
Created separate datagram and connected QP interfaces
Defined memory registration access and QP modification flags
Removed MR_HANDLE in favor of just using the LKey/RKey directly

All changes are also posted at:

	http://www.openfabrics.org/git/~shefty/winrdma.git

Please respond with any other comments.  Otherwise, I think this
is close enough that I'm planning on moving forward with
implementing portions of the API.  I'm more concerned
about exposing the benefits provided by overlapped operations than
re-working all of verbs; although, a couple of the changes do
make it a little easier to phase the development.

Signed-off-by: Sean Hefty <sean.hefty at intel.com>

/*
 * Copyright (c) 1996-2008 Intel Corporation. All rights reserved.
 *
 * This software is available to you under the OpenIB.org BSD license
 * below:
 *
 *     Redistribution and use in source and binary forms, with or
 *     without modification, are permitted provided that the following
 *     conditions are met:
 *
 *      - Redistributions of source code must retain the above
 *        copyright notice, this list of conditions and the following
 *        disclaimer.
 *
 *      - Redistributions in binary form must reproduce the above
 *        copyright notice, this list of conditions and the following
 *        disclaimer in the documentation and/or other materials
 *        provided with the distribution.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AWV
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

#pragma once

#ifndef _WINVERBS_H_
#define _WINVERBS_H_

#include <winsock2.h>
#include <unknwn.h>
#include "wvstatus.h"

typedef union _WV_GID					// Network byte order
{
	UINT8			Raw[16];

}	WV_GID;

// Device/port capability flags
#define WV_DEVICE_RESIZE_MAX_WR		0x00000001
#define WV_DEVICE_BAD_PKEY_COUNTER	0x00000002
#define WV_DEVICE_BAD_QKEY_COUNTER	0x00000004
// reserved				0x00000008
#define WV_DEVICE_PATH_MIGRATION	0x00000010
#define WV_DEVICE_CHANGE_PHYSICAL_PORT	0x00000020
#define WV_DEVICE_AH_PORT_CHECKING	0x00000040
#define WV_DEVICE_QP_STATE_MODIFIER	0x00000080
#define WV_DEVICE_SHUTDOWN_PORT		0x00000100
#define WV_DEVICE_INIT_TYPE		0x00000200
#define WV_DEVICE_PORT_ACTIVE_EVENT	0x00000400
#define WV_DEVICE_SYSTEM_IMAGE_GUID	0x00000800
#define WV_DEVICE_RC_RNR_NAK_GENERATION	0x00001000
#define WV_DEVICE_SRQ_RESIZE		0x00002000
#define WV_DEVICE_BATCH_NOTIFY_CQ	0x00004000

typedef enum _WV_ATOMIC_CAPABILITIES
{
	WvAtomicNone,
	WvAtomicHca,
	WvAtomicNode

}	WV_ATOMIC_CAPABILITIES;

typedef struct _WV_DEVICE_ATTRIBUTES
{
	UINT8			FwVersion[64];
	UINT64			NodeGuid;
	UINT64			SystemImageGuid;
	UINT32			VendorId;
	UINT32			VendorPartId;
	UINT32			HwVersion;
	DWORD			CapabilityFlags;
	WV_ATOMIC_CAPABILITIES	AtomicCapability;
	DWORD			PageSizeCapabilityFlags;
	SIZE_T			MaxMrSize;
	SIZE_T			MaxQp;
	SIZE_T			MaxQpWr;
	SIZE_T			MaxSge;
	SIZE_T			MaxCq;
	SIZE_T			MaxCqEntries;
	SIZE_T			MaxMr;
	SIZE_T			MaxPd;
	SIZE_T			MaxQpResponderResources;
	SIZE_T			MaxResponderResources;
	SIZE_T			MaxQpInitiatorDepth;
	SIZE_T			MaxMw;
	SIZE_T			MaxMulticast;
	SIZE_T			MaxQpAttach;
	SIZE_T			MaxMulticastQp;
	SIZE_T			MaxAh;
	SIZE_T			MaxFmr;
	SIZE_T			MaxMapPerFmr;
	SIZE_T			MaxSrq;
	SIZE_T			MaxSrqWr;
	SIZE_T			MaxSrqSge;
	SIZE_T			MaxPkeys;
	UINT8			LocalAckDelay;
	UINT8			PhysPortCount;

}	WV_DEVICE_ATTRIBUTES;

typedef enum _WV_PORT_STATE
{
	WvPortNop,
	WvPortDown,
	WvPortInit,
	WvPortArmed,
	WvPortActive,
	WvPortActiveDefer

}	WV_PORT_STATE;

typedef struct _WV_PORT_ATTRIBUTES
{
	DWORD			PortCabilityFlags;
	WV_PORT_STATE		State;
	UINT32			MaxMtu;
	UINT32			ActiveMtu;
	UINT32			GidTableLength;
	UINT32			MaxMessageSize;
	UINT32			BadPkeyCounter;
	UINT32			QkeyViolationCounter;
	UINT16			PkeyTableLength;
	UINT16			Lid;
	UINT16			SmLid;
	UINT8			Lmc;
	UINT8			MaxVls;
	UINT8			SmSl;
	UINT8			SubneTimeout;
	UINT8			InitTypeReply;
	UINT8			ActiveWidth;
	UINT8			ActiveSpeed;
	UINT8			PhysicalState;

}	WV_PORT_ATTRIBUTES;

typedef struct _WV_ADDRESS
{
	SOCKET_ADDRESS		Address;
	UINT64			DeviceGuid;
	UINT16			Pkey;
	UINT8			PortNumber;

}	WV_ADDRESS;

typedef struct _WV_ADDRESS_LIST
{
	SIZE_T			Count;
	WV_ADDRESS		Address[1];

}	WV_ADDRESS_LIST;

typedef enum _WV_DEVICE_EVENT_TYPE
{
	WvDeviceError,
	WvDevicePortActive,
	WvDevicePortDown

}	WV_DEVICE_EVENT_TYPE;

typedef struct _WV_DEVICE_EVENT
{
	HRESULT			Status;
	WV_DEVICE_EVENT_TYPE	Type;
	UINT8			PortNumber;

}	WV_DEVICE_EVENT;

typedef enum _WV_CQ_NOTIFY_TYPE
{
	WvCqSolicited		= 1,
	WvCqNextCompletion

}	WV_CQ_NOTIFY_TYPE;

typedef enum _WV_COMPLETION_OPCODE
{
	WvWcSend,
	WvWcRdmaWrite,
	WvWcRecv,
	WvWcRdmaRead,
	WvWcBindWindow,
	WvWcFetchAdd,
	WvWcCompareExchange,
	WvWcRecvRdmaWrite

}	WV_COMPLETION_OPCODE;

typedef enum _WV_COMPLETION_STATUS
{
	WvWcSuccess,
	WvWcLocalLengthError,
	WvWcLocalOpError,
	WvWcLocalProtectionError,
	WvWcWrFlushedError,
	WvWcBindWindowError,
	WvWcRemoteAccessError,
	WvWcRemoteOpError,
	WvWcRnrRetryError,
	WvWcTimeoutRetryError,
	WvWcRemoteInvalidRequestError,
	WvWcBadResponseError,
	WvWcLocalAccessError,
	WvWcUnknownError

}	WV_COMPLETION_STATUS;

// Completion flags
#define WV_WC_IMMEDIATE		0x00000001
// reserved			0x00000002
#define	WV_WC_GRH_VALID		0x00000004

typedef struct _WV_COMPLETION
{
	void*			QpContext;
	UINT64			WrId;
	WV_COMPLETION_OPCODE	Opcode;
	UINT32			Length;
	UINT64			VendorCode;
	WV_COMPLETION_STATUS	Status;

	// Receive completion data
	DWORD			Flags;
	UINT32			ImmediateData;		// Network byte order
	UINT32			SourceQpn;		// Network byte order
	UINT16			PkeyIndex;
	UINT16			SLid;			// Network byte order
	UINT8			SL;
	UINT8			DLidPathBits;

}	WV_COMPLETION;

// Access flags
#define WV_ACCESS_REMOTE_READ	0x00000001
#define WV_ACCESS_REMOTE_WRITE	0x00000002
#define WV_ACCESS_REMOTE_ATOMIC	0x00000004
#define WV_ACCESS_LOCAL_WRITE	0x00000008
#define WV_ACCESS_MW_BIND	0x00000010

// Send queue operation flags
#define WV_SEND_IMMEDIATE	0X00000001
#define WV_SEND_FENCE		0X00000002
#define WV_SEND_SIGNALED	0X00000004
#define WV_SEND_SOLICITED	0X00000008
#define WV_SEND_INLINE		0X00000010
#define WV_SEND_LOCAL		0X00000020

typedef struct _WV_SGE
{
	UINT64			Address;
	UINT32			Length;
	UINT32			Lkey;

}	WV_SGE;

typedef struct _WV_SEND_DATAGRAM
{
	UINT64				WrId;
	interface IWVAddressHandle*	pAddressHandle;

	WV_SGE*			pSgl;
	SIZE_T			nSge;
	DWORD			Flags;
	UINT32			ImmediateData;		// Network byte order
	UINT32			DestinationQpn;		// Network byte order
	UINT32			DestinationQkey;	// Network byte order
	UINT16			PkeyIndex;

}	WV_SEND_DATAGRAM;

typedef struct _WV_GRH
{
	UINT32			VersionClassFlow;
	UINT16			Reserved1;
	UINT8			Reserved2;
	UINT8			HopLimit;
	WV_GID			SGid;
	WV_GID			DGid;

}	WV_GRH;

typedef struct _WV_ADDRESS_VECTOR
{
	WV_GRH			Grh;
	BOOL			GrhValid;
	UINT16			DLid;			// Network byte order
	UINT8			ServiceLevel;
	UINT8			SourcePathBits;
	UINT8			StaticRate;
	UINT8			PortNumber;

}	WV_ADDRESS_VECTOR;

typedef enum _WV_QP_TYPE
{
	WvQpTypeRc,
	WvQpTypeUc,
	WvQpTypeReserved,
	WvQpTypeUd

}	WV_QP_TYPE;

typedef enum _WV_QP_STATE
{
	WvQpStateReset		= (1 << 0),
	WvQpStateInit		= (1 << 1),
	WvQpStateRtr		= (1 << 2),
	WvQpStateRts		= (1 << 3),
	WvQpStateSqd		= (1 << 4),
	WvQpStateSqdDraining	= WvQpStateSqd | (1 << 5),
	WvQpStateSqdDrained	= WvQpStateSqd | (1 << 6),
	WvQpStateSqerr		= (1 << 7),
	WvQpStateError		= (1 << 8),
	WvQpStateTimeWait	= 0xdead0000

}	WV_QP_STATE;

typedef enum _WV_APM_STATE
{
	WvApmMigrated = 1,
	WvApmRearm,
	WvApmArmed

}	WV_APM_STATE;

typedef struct _WV_QP_CREATE
{
	interface IWVCompletionQueue*		pSendCq;
	interface IWVCompletionQueue*		pReceiveCq;
	interface IWVSharedReceiveQueue*	pSharedReceiveQueue;
	void*			Context;

	SIZE_T			SendDepth;
	SIZE_T			SendSge;
	SIZE_T			ReceiveDepth;
	SIZE_T			ReceiveSge;

	WV_QP_TYPE		QpType;
	BOOL			SignalSends;

}	WV_QP_CREATE;

// QP attribute mask
#define WV_QP_ATTR_STATE			0x00000001
#define WV_QP_ATTR_CURRENT_STATE		0x00000002
#define WV_QP_ATTR_ENABLE_SQD_ASYNC_NOTIFY	0x00000004
#define WV_QP_ATTR_ACCESS_FLAGS			0x00000008
#define WV_QP_ATTR_PKEY_INDEX			0x00000010
#define WV_QP_ATTR_PORT				0x00000020
#define WV_QP_ATTR_QKEY				0x00000040
#define WV_QP_ATTR_AV				0x00000080
#define WV_QP_ATTR_PATH_MTU			0x00000100
#define WV_QP_ATTR_TIMEOUT			0x00000200
#define WV_QP_ATTR_RETRY_COUNT			0x00000400
#define WV_QP_ATTR_RNR_RETRY			0x00000800
#define WV_QP_ATTR_RQ_PSN			0x00001000
#define WV_QP_ATTR_INITIATOR_DEPTH		0x00002000
#define WV_QP_ATTR_ALTERNATE_AV			0x00004000
#define WV_QP_ATTR_MIN_RNR_TIMER		0x00008000
#define WV_QP_ATTR_SQ_PSN			0x00010000
#define WV_QP_ATTR_RESPONDER_RESOURCES		0x00020000
#define WV_QP_ATTR_PATH_MIG_STATE		0x00040000
#define WV_QP_ATTR_CAPABILITIES			0x00080000
#define WV_QP_ATTR_DESTINATION_QPN		0x00100000

typedef struct _WV_QP_ATTRIBUTES
{
	interface IWVProtectionDomain*		pPd;
	interface IWVCompletionQueue*		pSendCq;
	interface IWVCompletionQueue*		pReceiveCq;
	interface IWVSharedReceiveQueue*	pSharedReceiveQueue;

	SIZE_T			SendDepth;
	SIZE_T			SendSge;
	SIZE_T			ReceiveDepth;
	SIZE_T			ReceiveSge;
	SIZE_T			MaxInlineSend;
	SIZE_T			InitiatorDepth;
	SIZE_T			ResponderResources;

	WV_QP_TYPE		QpType;
	WV_QP_STATE		CurrentQpState;
	WV_QP_STATE		QpState;
	WV_APM_STATE		ApmState;
	UINT32			Qpn;			// Network byte order
	UINT32			DestinationQpn;		// Network byte order
	UINT32			Qkey;			// Network byte order
	UINT32			SendPsn;		// Network byte order
	UINT32			ReceivePsn;		// Network byte order

	WV_ADDRESS_VECTOR	PrimaryAddressVector;
	WV_ADDRESS_VECTOR	AlternateAddressVector;
	DWORD			AccessFlags;
	BOOL			SignalSends;
	UINT16			PkeyIndex;

	UINT8			PathMtu;
	UINT8			LocalAckTimeout;
	UINT8			SequenceErrorRetryCount;
	UINT8			RnrRetryCount;

}	WV_QP_ATTRIBUTES;

typedef enum _WV_QP_EVENT_TYPE
{
	WvQpError,
	WvQpModify,
	WvQpCommunicationEstablish,
	WvQpPathMigration,
	WvQpSendQueueDrained,
	WvQpLastSrqRequest

}	WV_QP_EVENT_TYPE;

typedef struct _WV_QP_EVENT
{
	HRESULT			Status;
	WV_QP_EVENT_TYPE	Type;

}	WV_QP_EVENT;

typedef enum _WV_CM_EVENT_TYPE
{
	WvCmEventAddrResolved,
	WvCmEventAddrError,
	WvCmEventRouteResolved,
	WvCmEventRouteError,
	WvCmEventConnectRequest,
	WvCmEventLookupRequest = WvCmEventConnectRequest,
	WvCmEventConnectResponse,
	WvCmEventConnectError,
	WvCmEventUnreachable,
	WvCmEventRejected,
	WvCmEventEstablished,
	WvCmEventDisconnected,
	WvCmEventDeviceRemoval,
	WvCmEventMulticastJoin,
	WvCmEventMulticastError

}	WV_CM_EVENT_TYPE;

#define WV_CM_UDP_QKEY		0x01234567

typedef struct _WV_CONNECT_PARAM
{
	const VOID*		pPrivateData;
	SIZE_T			PrivateDataLength;
	SIZE_T			ResponderResources;
	SIZE_T			InitiatorDepth;
	UINT8			RetryCount;		// Ignored when accepting
	UINT8			RnrRetryCount;

}	WV_CONNECT_PARAM;

typedef struct _WV_CONNECT_EVENT
{
	WV_CM_EVENT_TYPE	Event;
	HRESULT			Status;
	WV_CONNECT_PARAM	Connect;

}	WV_CONNECT_EVENT;

typedef struct _WV_CONNECT_ATTRIBUTES
{
	SOCKET_ADDRESS		LocalAddress;
	SOCKET_ADDRESS		PeerAddress;
	WV_CONNECT_EVENT	LastEvent;

}	WV_CONNECT_ATTRIBUTES;

typedef struct _WV_DATAGRAM_PARAM
{
	const VOID*		pPrivateData;
	SIZE_T			PrivateDataLength;
	WV_ADDRESS_VECTOR	AddressVector;
	UINT32			Qpn;
	UINT32			Qkey;

}	WV_DATAGRAM_PARAM;


typedef struct _WV_DATAGRAM_EVENT
{
	WV_CM_EVENT_TYPE	Event;
	HRESULT			Status;
	WV_DATAGRAM_PARAM	Datagram;

}	WV_DATAGRAM_EVENT;


typedef struct _WV_DATAGRAM_ATTRIBUTES
{
	SOCKET_ADDRESS		LocalAddress;
	SOCKET_ADDRESS		PeerAddress;
	WV_DATAGRAM_EVENT	LastEvent;

}	WV_DATAGRAM_ATTRIBUTES;


#undef INTERFACE
#define INTERFACE IWVOverlapped
// {64687592-aa67-4b55-bc4b-e189bdd2fc4f}
DEFINE_GUID(IID_IWVOverlapped, 0x64687592, 0xaa67, 0x4b55,
	    0xbc, 0x4b, 0xe1, 0x89, 0xbd, 0xd2, 0xfc, 0x4f);

DECLARE_INTERFACE_(IWVOverlapped, IUnknown)
{
	// 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
	STDMETHOD(CancelOverlappedRequests)(
		THIS
		) PURE;

	STDMETHOD(GetOverlappedResult)(
		THIS_
		__inout_opt OVERLAPPED *pOverlapped,
		__out SIZE_T *pNumberOfBytesTransferred,
		__in BOOL bWait
		) PURE;
};


#undef INTERFACE
#define INTERFACE IWVCompletionQueue
// {a5f6a8de-18a6-4086-aa93-7b66607a290a}
DEFINE_GUID(IID_IWVCompletionQueue, 0xa5f6a8de, 0x18a6, 0x4086,
	    0xaa, 0x93, 0x7b, 0x66, 0x60, 0x7a, 0x29, 0x0a);

DECLARE_INTERFACE_(IWVCompletionQueue, 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 SIZE_T *pNumberOfBytesTransferred,
		__in BOOL bWait
		) PURE;

	// IWVCompletionQueue methods
	STDMETHOD(Resize)(
		THIS_
		__inout SIZE_T* pEntries
		) PURE;

	STDMETHOD(Peek)(
		THIS_
		__out SIZE_T* pCompletedEntries
		) PURE;

	STDMETHOD(Notify)(
		THIS_
		__in WV_CQ_NOTIFY_TYPE Type,
		__in OVERLAPPED* pOverlapped
		) PURE;

	STDMETHOD(BatchNotify)(
		THIS_
		__in SIZE_T CompletedEntries,
		__in OVERLAPPED* pOverlapped
		) PURE;

	STDMETHOD_(SIZE_T,Poll)(
		THIS_
		__inout_ecount(Entries) WV_COMPLETION* pCompletions[],
		__in SIZE_T Entries
		) PURE;
};


#undef INTERFACE
#define INTERFACE IWVMemoryWindow
// {e8ae206f-b31f-4709-8dc9-6e87625f93fc}
DEFINE_GUID(IID_IWVMemoryWindow, 0xe8ae206f, 0xb31f, 0x4709,
	    0x8d, 0xc9, 0x6e, 0x87, 0x62, 0x5f, 0x93, 0xfc);

DECLARE_INTERFACE_(IWVMemoryWindow, IUnknown)
{
	// IUnknown methods
	__override STDMETHOD(QueryInterface)(
		THIS_
		REFIID riid,
		LPVOID FAR* ppvObj
		) PURE;

	__override STDMETHOD_(ULONG,AddRef)(
		THIS
		) PURE;

	__override STDMETHOD_(ULONG,Release)(
		THIS
		) PURE;
};


#undef INTERFACE
#define INTERFACE IWVAddressHandle
// {95903fde-fdac-4007-92b7-e01286cd36e8}
DEFINE_GUID(IID_IWVAddressHandle, 0x95903fde, 0xfdac, 0x4007,
	    0x92, 0xb7, 0xe0, 0x12, 0x86, 0xcd, 0x36, 0xe8);

DECLARE_INTERFACE_(IWVAddressHandle, IUnknown)
{
	// IUnknown methods
	__override STDMETHOD(QueryInterface)(
		THIS_
		REFIID riid,
		LPVOID FAR* ppvObj
		) PURE;

	__override STDMETHOD_(ULONG,AddRef)(
		THIS
		) PURE;

	__override STDMETHOD_(ULONG,Release)(
		THIS
		) PURE;
};


#undef INTERFACE
#define INTERFACE IWVSharedReceiveQueue
// {b2bf30e4-8c2e-4659-ac7a-4c5e0d2c7114}
DEFINE_GUID(IID_IWVSharedReceiveQueue, 0xb2bf30e4, 0x8c2e, 0x4659,
	    0xac, 0x7a, 0x4c, 0x5e, 0x0d, 0x2c, 0x71, 0x14);

DECLARE_INTERFACE_(IWVSharedReceiveQueue, 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 SIZE_T *pNumberOfBytesTransferred,
		__in BOOL bWait
		) PURE;

	// IWVSharedReceiveQueue methods
	STDMETHOD(Query)(
		THIS_
		__out SIZE_T* pMaxWr,
		__out SIZE_T* pMaxSge,
		__out SIZE_T* pSrqLimit
		) PURE;

	STDMETHOD(Modify)(
		THIS_
		__in SIZE_T MaxWr,
		__in SIZE_T SrqLimit
		) PURE;

	STDMETHOD(PostReceive)(
		THIS_
		__in UINT64 WrId,
		__in_ecount(nSge) const WV_SGE* pSgl,
		__in SIZE_T nSge
		) PURE;

	/* Signaled on limit reached event */
	STDMETHOD(Notify)(
		THIS_
		__in OVERLAPPED* pOverlapped
		) PURE;
};


#undef INTERFACE
#define INTERFACE IWVQueuePair
// {a847c13c-e617-489c-b0ab-2da73eb0adfd}
DEFINE_GUID(IID_IWVQueuePair, 0xa847c13c, 0xe617, 0x489c,
	    0xb0, 0xab, 0x2d, 0xa7, 0x3e, 0xb0, 0xad, 0xfd);

DECLARE_INTERFACE_(IWVQueuePair, 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 SIZE_T *pNumberOfBytesTransferred,
		__in BOOL bWait
		) PURE;

	// IWVQueuePair methods
	STDMETHOD(Query)(
		THIS_
		__out WV_QP_ATTRIBUTES* pAttributes
		) PURE;

	STDMETHOD(Modify)(
		THIS_
		__in WV_QP_ATTRIBUTES* pAttributes,
		__in DWORD Options,
		__in OVERLAPPED* pOverlapped
		) PURE;

	STDMETHOD(PostReceive)(
		THIS_
		__in UINT64 WrId,
		__in_ecount(nSge) const WV_SGE* pSgl,
		__in SIZE_T nSge
		) PURE;

	STDMETHOD(Notify)(
		THIS_
		__in OVERLAPPED* pOverlapped
		) PURE;

	STDMETHOD(GetEvent)(
		THIS_
		__out WV_QP_EVENT* pEvent
		) PURE;
};


#undef INTERFACE
#define INTERFACE IWVConnectQueuePair
// {A791309C-4244-4194-AD63-7D372CADE5E0}
DEFINE_GUID(IID_IWVConnectQueuePair, 0xa791309c, 0x4244, 0x4194,
	    0xad, 0x63, 0x7d, 0x37, 0x2c, 0xad, 0xe5, 0xe0);

DECLARE_INTERFACE_(IWVConnectQueuePair, IWVQueuePair)
{
	// 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 SIZE_T *pNumberOfBytesTransferred,
		__in BOOL bWait
		) PURE;

	// IWVQueuePair methods
	STDMETHOD(Query)(
		THIS_
		__out WV_QP_ATTRIBUTES* pAttributes
		) PURE;

	STDMETHOD(Modify)(
		THIS_
		__in WV_QP_ATTRIBUTES* pAttributes,
		__in DWORD Options,
		__in OVERLAPPED* pOverlapped
		) PURE;

	STDMETHOD(PostReceive)(
		THIS_
		__in UINT64 WrId,
		__in_ecount(nSge) const WV_SGE* pSgl,
		__in SIZE_T nSge
		) PURE;

	STDMETHOD(Notify)(
		THIS_
		__in OVERLAPPED* pOverlapped
		) PURE;

	STDMETHOD(GetEvent)(
		THIS_
		__out WV_QP_EVENT* pEvent
		) PURE;

	// IWVConnectQueuePair methods
	STDMETHOD(Send)(
		THIS_
		__in UINT64 WrId,
		__in_ecount(nSge) const WV_SGE* pSgl,
		__in SIZE_T nSge,
		__in DWORD Flags,
		__in UINT32 ImmediateData
		) PURE;

	STDMETHOD(Read)(
		THIS_
		__in UINT64 WrId,
		__in_ecount(nSge) const WV_SGE* pSgl,
		__in SIZE_T nSge,
		__in DWORD Flags,
		__in UINT64 Address,
		__in UINT32 Rkey
		) PURE;

	STDMETHOD(Write)(
		THIS_
		__in UINT64 WrId,
		__in_ecount(nSge) const WV_SGE* pSgl,
		__in SIZE_T nSge,
		__in DWORD Flags,
		__in UINT32 ImmediateData,
		__in UINT64 Address,
		__in UINT32 Rkey
		) PURE;

	STDMETHOD(CompareExchange)(
		THIS_
		__in UINT64 WrId,
		__in const WV_SGE* pSgl,
		__in DWORD Flags,
		__in UINT64 Compare,
		__in UINT64 Exchange,
		__in UINT64 Address,
		__in UINT32 Rkey
		) PURE;

	STDMETHOD(FetchAdd)(
		THIS_
		__in UINT64 WrId,
		__in const WV_SGE* pSgl,
		__in DWORD Flags,
		__in UINT64 Value,
		__in UINT64 Address,
		__in UINT32 Rkey
		) PURE;

	STDMETHOD(BindMemoryWindow)(
		THIS_
		__in IWVMemoryWindow* pMw,
		__in UINT64 WrID,
		__in UINT32 Lkey,
		__in DWORD AccessFlags,
		__in DWORD SendFlags,
		__in_bcount(BufferLength) const VOID* pBuffer,
		__in SIZE_T BufferLength,
		__out UINT32 *Rkey
		) PURE;
};


#undef INTERFACE
#define INTERFACE IWVDatagramQueuePair
// {3BA2F15E-D961-4df8-8FC2-6043A6D67826}
DEFINE_GUID(IID_IWVDatagramQueuePair, 0x3ba2f15e, 0xd961, 0x4df8,
	    0x8f, 0xc2, 0x60, 0x43, 0xa6, 0xd6, 0x78, 0x26);

DECLARE_INTERFACE_(IWVDatagramQueuePair, IWVQueuePair)
{
	// 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 SIZE_T *pNumberOfBytesTransferred,
		__in BOOL bWait
		) PURE;

	// IWVQueuePair methods
	STDMETHOD(Query)(
		THIS_
		__out WV_QP_ATTRIBUTES* pAttributes
		) PURE;

	STDMETHOD(Modify)(
		THIS_
		__in WV_QP_ATTRIBUTES* pAttributes,
		__in DWORD Options,
		__in OVERLAPPED* pOverlapped
		) PURE;

	STDMETHOD(PostReceive)(
		THIS_
		__in UINT64 WrId,
		__in_ecount(nSge) const WV_SGE* pSgl,
		__in SIZE_T nSge
		) PURE;

	STDMETHOD(Notify)(
		THIS_
		__in OVERLAPPED* pOverlapped
		) PURE;

	STDMETHOD(GetEvent)(
		THIS_
		__out WV_QP_EVENT* pEvent
		) PURE;

	// IWVDatagramQueuePair Methods
	STDMETHOD(Send)(
		THIS_
		__in UINT64 WrId,
		__in IWVAddressHandle* pAddressHandle,
		__in WV_SGE* pSgl,
		__in DWORD Flags,
		__in UINT32 DestinationQpn,
		__in UINT32 DestinationQkey,
		__in UINT16 PkeyIndex
		) PURE;

	STDMETHOD(SendMessage)(
		THIS_
		__in WV_SEND_DATAGRAM* pSend
		) PURE;

	STDMETHOD(AttachMulticast)(
		THIS_
		__in WV_GID *pGid,
		__in UINT16 LID
		) PURE;

	STDMETHOD(DetachMulticast)(
		THIS_
		__in WV_GID *pGid,
		__in UINT16 LID
		) PURE;
};


#undef INTERFACE
#define INTERFACE IWVProtectionDomain
// {a5633a12-dffc-4060-927d-9a600d7efb63}
DEFINE_GUID(IID_IWVProtectionDomain, 0xa5633a12, 0xdffc, 0x4060,
	    0x92, 0x7d, 0x9a, 0x60, 0x0d, 0x7e, 0xfb, 0x63);

DECLARE_INTERFACE_(IWVProtectionDomain, IUnknown)
{
	// IUnknown methods
	__override STDMETHOD(QueryInterface)(
		THIS_
		REFIID riid,
		LPVOID FAR* ppvObj
		) PURE;

	__override STDMETHOD_(ULONG,AddRef)(
		THIS
		) PURE;

	__override STDMETHOD_(ULONG,Release)(
		THIS
		) PURE;

	// IWVProtectionDomain methods
	STDMETHOD(CreateSharedReceiveQueue)(
		THIS_
		__in SIZE_T MaxWr,
		__in SIZE_T MaxSge,
		__in SIZE_T SrqLimit,
		__deref_out IWVSharedReceiveQueue** ppSrq
		) PURE;

	STDMETHOD(CreateQueuePair)(
		THIS_
		__in WV_QP_CREATE* pAttributes,
		__deref_out IWVQueuePair** ppQp
		) PURE;

	STDMETHOD(RegisterMemory)(
		THIS_
		__in_bcount(BufferLength) const VOID* pBuffer,
		__in SIZE_T BufferLength,
		__in DWORD AccessFlags,
		__in OVERLAPPED* pOverlapped,
		__out UINT32* pLkey,
		__out UINT32* pRkey
		) PURE;

	STDMETHOD(DeregisterMemory)(
		THIS_
		__in UINT32 Lkey,
		__in OVERLAPPED* pOverlapped
		) PURE;

	STDMETHOD(AllocateMemoryWindow)(
		THIS_
		__deref_out IWVMemoryWindow** ppMw
		) PURE;

	STDMETHOD(CreateAddressHandle)(
		THIS_
		__in WV_ADDRESS_VECTOR* pAddress,
		__deref_out IWVAddressHandle** ppAh
		) PURE;
};


#undef INTERFACE
#define INTERFACE IWVEndpoint
// {eb2fbd8e-b9b6-4b24-9a5e-94c26ae265f0}
DEFINE_GUID(IID_IWVEndpoint, 0xeb2fbd8e, 0xb9b6, 0x4b24,
	    0x9a, 0x5e, 0x94, 0xc2, 0x6a, 0xe2, 0x65, 0xf0);

DECLARE_INTERFACE_(IWVEndpoint, 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 SIZE_T *pNumberOfBytesTransferred,
		__in BOOL bWait
		) PURE;

	// IWVEndpoint methods
	STDMETHOD(BindAddress)(
		THIS_
		__in const struct sockaddr* pAddress
		) PURE;

	STDMETHOD(ResolveAddress)(
		THIS_
		__in const struct sockaddr* pDestinationAddress,
		__in DWORD Milliseconds,
		__in OVERLAPPED* pOverlapped
		) PURE;

	STDMETHOD(ResolveRoute)(
		THIS_
		__in DWORD Milliseconds,
		__in OVERLAPPED* pOverlapped
		) PURE;

	STDMETHOD(Reject)(
		THIS_
		__in_bcount_opt(PrivateDataLength) const VOID* pPrivateData,
		__in SIZE_T PrivateDataLength
		) PURE;
};


#undef INTERFACE
#define INTERFACE IWVConnectEndpoint
// {ac670274-1934-4759-a39c-eee01a8130b3}
DEFINE_GUID(IID_IWVConnectEndpoint, 0xac670274, 0x1934, 0x4759,
	    0xa3, 0x9c, 0xee, 0xe0, 0x1a, 0x81, 0x30, 0xb3);

DECLARE_INTERFACE_(IWVConnectEndpoint, IWVEndpoint)
{
	// 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 SIZE_T *pNumberOfBytesTransferred,
		__in BOOL bWait
		) PURE;

	// IWVEndpoint methods
	__override STDMETHOD(BindAddress)(
		THIS_
		__in const struct sockaddr* pAddress
		) PURE;

	__override STDMETHOD(ResolveAddress)(
		THIS_
		__in const struct sockaddr* pDestinationAddress,
		__in DWORD Milliseconds,
		__in OVERLAPPED* pOverlapped
		) PURE;

	__override STDMETHOD(ResolveRoute)(
		THIS_
		__in DWORD Milliseconds,
		__in OVERLAPPED* pOverlapped
		) PURE;

	__override STDMETHOD(Reject)(
		THIS_
		__in_bcount_opt(PrivateDataLength) const VOID* pPrivateData,
		__in SIZE_T PrivateDataLength
		) PURE;

	// IWVConnectEndpoint methods
	STDMETHOD(CreateQueuePair)(
		THIS_
		__in IWVProtectionDomain* pPd,
		__in WV_QP_CREATE* pAttributes,
		__deref_out IWVConnectQueuePair** ppQp
		) PURE;

	STDMETHOD(Connect)(
		THIS_
		__in WV_CONNECT_PARAM* pParam,
		__in OVERLAPPED* pOverlapped
		) PURE;

	STDMETHOD(Accept)(
		THIS_
		__in WV_CONNECT_PARAM* pParam,
		__in OVERLAPPED* pOverlapped
		) PURE;

	STDMETHOD(Disconnect)(
		THIS_
		__in OVERLAPPED* pOverlapped
		) PURE;

	STDMETHOD(Query)(
		THIS_
		__out WV_CONNECT_ATTRIBUTES* pAttributes
		) PURE;
};


#undef INTERFACE
#define INTERFACE IWVDatagramEndpoint
// {1d879de6-f2af-4a8a-8893-52e0ab868130}
DEFINE_GUID(IID_IWVDatagramEndpoint, 0x1d879de6, 0xf2af, 0x4a8a,
	    0x88, 0x93, 0x52, 0xe0, 0xab, 0x86, 0x81, 0x30);

DECLARE_INTERFACE_(IWVDatagramEndpoint, IWVEndpoint)
{
	// 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 SIZE_T *pNumberOfBytesTransferred,
		__in BOOL bWait
		) PURE;

	// IWVEndpoint methods
	__override STDMETHOD(BindAddress)(
		THIS_
		__in const struct sockaddr* pAddress
		) PURE;

	__override STDMETHOD(ResolveAddress)(
		THIS_
		__in const struct sockaddr* pDestinationAddress,
		__in DWORD Milliseconds,
		__in OVERLAPPED* pOverlapped
		) PURE;

	__override STDMETHOD(ResolveRoute)(
		THIS_
		__in DWORD Milliseconds,
		__in OVERLAPPED* pOverlapped
		) PURE;

	__override STDMETHOD(Reject)(
		THIS_
		__in_bcount_opt(PrivateDataLength) const VOID* pPrivateData,
		__in SIZE_T PrivateDataLength
		) PURE;

	// IWVDatagramEndpoint methods
	__override STDMETHOD(CreateQueuePair)(
		THIS_
		__in IWVProtectionDomain* pPd,
		__in WV_QP_CREATE* pAttributes,
		__deref_out IWVDatagramQueuePair** ppQp
		) PURE;

	STDMETHOD(Lookup)(
		THIS_
		__in_bcount_opt(PrivateDataLength) const VOID* pPrivateData,
		__in SIZE_T PrivateDataLength,
		__in OVERLAPPED* pOverlapped
		) PURE;

	STDMETHOD(Accept)(
		THIS_
		__in WV_DATAGRAM_PARAM* pParam,
		__in OVERLAPPED* pOverlapped
		) PURE;

	STDMETHOD(JoinMulticast)(
		THIS_
		__in const struct sockaddr* pAddress,
		__in OVERLAPPED* pOverlapped
		) PURE;

	STDMETHOD(LeaveMulticast)(
		THIS_
		__in const struct sockaddr* pAddress,
		__in OVERLAPPED* pOverlapped
		) PURE;

	STDMETHOD(Query)(
		THIS_
		__out WV_DATAGRAM_ATTRIBUTES* pAttributes
		) PURE;
};


#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 SIZE_T *pNumberOfBytesTransferred,
		__in BOOL bWait
		) PURE;

	// IWVListen methods
	STDMETHOD(Accept)(
		THIS_
		__in IWVEndpoint* pEndpoint,
		__in OVERLAPPED* pOverlapped
		) PURE;
};


#undef INTERFACE
#define INTERFACE IWVDevice
// {244af78c-b1ac-40e4-9896-271d58d591b8}
DEFINE_GUID(IID_IWVDevice, 0x244af78c, 0xb1ac, 0x40e4,
	    0x98, 0x96, 0x27, 0x1d, 0x58, 0xd5, 0x91, 0xb8);

DECLARE_INTERFACE_(IWVDevice, 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 SIZE_T *pNumberOfBytesTransferred,
		__in BOOL bWait
		) PURE;

	// IWVDevice methods
	STDMETHOD(Query)(
		THIS_
		__out_bcount_part_opt(*pBufferSize, *pBufferSize) WV_DEVICE_ATTRIBUTES* pAttributes,
		__inout SIZE_T* pBufferSize
		) PURE;

	STDMETHOD(QueryPort)(
		THIS_
		__in UINT8 PortNumber,
		__out_bcount_part_opt(*pBufferSize, *pBufferSize) WV_PORT_ATTRIBUTES* pAttributes,
		__inout SIZE_T* pBufferSize
		) PURE;

	STDMETHOD(QueryGid)(
		THIS_
		__in UINT8 PortNumber,
		__in DWORD Index,
		__out WV_GID* pGid
		) PURE;

	STDMETHOD(QueryPkey)(
		THIS_
		__in UINT8 PortNumber,
		__in DWORD Index,
		__out UINT16* pPkey
		) PURE;

	STDMETHOD(CreateCompletionQueue)(
		THIS_
		__inout SIZE_T *pEntries,
		__deref_out IWVCompletionQueue** ppCq
		) PURE;

	STDMETHOD(AllocateProtectionDomain)(
		THIS_
		__deref_out IWVProtectionDomain** ppPd
		) PURE;

	STDMETHOD(Notify)(
		THIS_
		__in OVERLAPPED* pOverlapped
		) PURE;

	STDMETHOD(GetEvent)(
		THIS_
		__in WV_DEVICE_EVENT* pEvent
		) PURE;
};


#undef INTERFACE
#define INTERFACE IWVProvider
// {6901010c-17af-4894-a1dc-794d3611f262}
DEFINE_GUID(IID_IIWVProvider, 0x6901010c, 0x17af, 0x4894,
	    0xa1, 0xdc, 0x79, 0x4d, 0x36, 0x11, 0xf2, 0x62);

DECLARE_INTERFACE_(IWVProvider, IUnknown)
{
	// IUnknown methods
	__override STDMETHOD(QueryInterface)(
		THIS_
		REFIID riid,
		LPVOID FAR* ppvObj
		) PURE;

	__override STDMETHOD_(ULONG,AddRef)(
		THIS
		) PURE;

	__override STDMETHOD_(ULONG,Release)(
		THIS
		) PURE;

	// IWVProvider methods
	STDMETHOD(QueryDeviceList)(
		THIS_
		__inout_bcount_part_opt(*pBufferSize, *pBufferSize) UINT64* pGuidList,
		__inout SIZE_T* pBufferSize
		) PURE;

	STDMETHOD(QueryDevice)(
		THIS_
		__in UINT64 Guid,
		__inout_bcount_part_opt(*pBufferSize, *pBufferSize) WV_DEVICE_ATTRIBUTES* pAttributes,
		__inout SIZE_T* pBufferSize
		) PURE;

	STDMETHOD(QueryAddressList)(
		THIS_
		__inout_bcount_part_opt(*pBufferSize, *pBufferSize) WV_ADDRESS_LIST* pAddressList,
		__inout SIZE_T* pBufferSize
		) PURE;

	STDMETHOD(OpenDevice)(
		THIS_
		__in UINT64 Guid,
		__deref_out IWVDevice** ppDevice
		) PURE;

	STDMETHOD(CreateConnectEndpoint)(
		THIS_
		__deref_out IWVConnectEndpoint** ppConnectEndpoint
		) PURE;

	STDMETHOD(CreateDatagramEndpoint)(
		THIS_
		__deref_out IWVDatagramEndpoint** ppDatagramEndpoint
		) PURE;

	STDMETHOD(CreateListen)(
		THIS_
		__in const struct sockaddr* pAddress,
		__in SIZE_T backlog,
		__deref_out IWVListen** ppListen
		) PURE;
};

#endif // _WINVERBS_H_




More information about the ofw mailing list