[ofw] [RFC] [PATCH 3/12] winverbs: define IOCTL interface

Sean Hefty sean.hefty at intel.com
Fri Mar 14 22:59:06 PDT 2008


WinVerb IOCTL interface.

This file will be shared by userspace and the kernel.  All data structures
are defined to produce the same layout for 32-bit and 64-bit mode
with proper data alignment, without the need for packing or compile
added padding.

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

Index: core/winverbs/wv_ioctl.h
===================================================================
--- core/winverbs/wv_ioctl.h	(revision 0)
+++ core/winverbs/wv_ioctl.h	(revision 0)
@@ -0,0 +1,404 @@
+/*
+ * Copyright (c) 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 _WV_IOCTL_H_
+#define _WV_IOCTL_H_
+
+#include <winioctl.h>
+
+#define WV_IOCTL(f)	CTL_CODE(FILE_DEVICE_INFINIBAND, f, METHOD_BUFFERED,\
+							 FILE_READ_DATA | FILE_WRITE_DATA)
+
+// IOCTL
+// input parameter / output parameter
+#define WV_IOCTL_GUID_QUERY				WV_IOCTL(0x801)
+// none / WV_IO_GUID_LIST
+
+#define WV_IOCTL_LIBRARY_QUERY			WV_IOCTL(0x802)
+// UINT64 Guid / LibraryName[32]
+
+#define WV_IOCTL_DEVICE_OPEN			WV_IOCTL(0x803)
+// WV_IO_ID / WV_IO_ID
+
+#define WV_IOCTL_DEVICE_CLOSE			WV_IOCTL(0x804)
+// UINT64 Id / none
+
+#define WV_IOCTL_DEVICE_QUERY			WV_IOCTL(0x805)
+// UINT64 Id / WV_IO_DEVICE_ATTRIBUTES
+
+#define WV_IOCTL_DEVICE_PORT_QUERY		WV_IOCTL(0x806)
+// WV_IO_DEVICE_PORT_QUERY / WV_IO_PORT_ATTRIBUTES == WV_PORT_ATTRIBUTES
+
+#define WV_IOCTL_DEVICE_GID_QUERY		WV_IOCTL(0x807)
+// WV_IO_DEVICE_PORT_QUERY / WV_IO_GID[] == WV_GID[]
+
+#define WV_IOCTL_DEVICE_PKEY_QUERY		WV_IOCTL(0x808)
+// WV_IO_DEVICE_PORT_QUERY / UINT16 Pkey[]
+
+#define WV_IOCTL_DEVICE_NOTIFY			WV_IOCTL(0x809)
+// UINT64 Id / WV_IO_EVENT
+
+#define WV_IOCTL_PD_ALLOCATE			WV_IOCTL(0x80A)
+// WV_IO_ID / WV_IO_ID
+
+#define WV_IOCTL_PD_DEALLOCATE			WV_IOCTL(0x80B)
+// UINT64 Id / none
+
+#define WV_IOCTL_MEMORY_REGISTER		WV_IOCTL(0x80C)
+// WV_IO_MEMORY_REGISTER / WV_IO_MEMORY_KEYS
+
+#define WV_IOCTL_MEMORY_DEREGISTER		WV_IOCTL(0x80D)
+// WV_IO_MEMORY_DEREGISTER / ci_umv_buf_t
+
+#define WV_IOCTL_MW_ALLOCATE			WV_IOCTL(0x80E)
+// WV_IO_ID / WV_IO_ID
+
+#define WV_IOCTL_MW_DEALLOCATE			WV_IOCTL(0x80F)
+// UINT64 Id / none
+
+#define WV_IOCTL_AH_CREATE				WV_IOCTL(0x810)
+// WV_IO_AH_CREATE / WV_IO_ID
+
+#define WV_IOCTL_AH_DESTROY				WV_IOCTL(0x811)
+// UINT64 Id / none
+
+#define WV_IOCTL_CQ_CREATE				WV_IOCTL(0x812)
+// WV_IO_ID / WV_IO_ID
+
+#define WV_IOCTL_CQ_RESIZE				WV_IOCTL(0x813)
+// WV_IO_ID / WV_IO_ID
+
+#define WV_IOCTL_CQ_NOTIFY				WV_IOCTL(0x814)
+// WV_IO_ID / none
+
+#define WV_IOCTL_CQ_BATCH_NOTIFY		WV_IOCTL(0x815)
+// WV_IO_ID / none
+
+#define WV_IOCTL_CQ_DESTROY				WV_IOCTL(0x816)
+// UINT64 Id / none
+
+#define WV_IOCTL_SRQ_CREATE				WV_IOCTL(0x817)
+// WV_IO_SRQ_ATTRIBUTES / WV_IO_ID
+
+#define WV_IOCTL_SRQ_QUERY				WV_IOCTL(0x818)
+// WV_IO_ID / WV_IO_SRQ_ATTRIBUTES
+
+#define WV_IOCTL_SRQ_MODIFY				WV_IOCTL(0x819)
+// WV_IO_SRQ_ATTRIBUTES / UINT32 VerbInfo
+
+#define WV_IOCTL_SRQ_NOTIFY				WV_IOCTL(0x81A)
+// UINT64 Id / none
+
+#define WV_IOCTL_SRQ_DESTROY			WV_IOCTL(0x81B)
+// UINT64 Id / none
+
+#define WV_IOCTL_QP_CREATE				WV_IOCTL(0x81C)
+// WV_IO_QP_CREATE / WV_IO_ID
+
+#define WV_IOCTL_QP_QUERY				WV_IOCTL(0x81D)
+// WV_IO_ID / WV_IO_QP_ATTRIBUTES
+
+#define WV_IOCTL_QP_MODIFY				WV_IOCTL(0x81E)
+// WV_IO_QP_ATTRIBUTES / none
+
+#define WV_IOCTL_QP_DESTROY				WV_IOCTL(0x81F)
+// UINT64 Id / none
+
+// TODO
+#define WV_IOCTL_ADDRESS_QUERY			WV_IOCTL(0x820)
+#define WV_IOCTL_EP_CREATE				WV_IOCTL(0x821)
+#define WV_IOCTL_EP_BIND				WV_IOCTL(0x822)
+#define WV_IOCTL_EP_REJECT				WV_IOCTL(0x823)
+#define WV_IOCTL_EP_CONNECT				WV_IOCTL(0x824)
+#define WV_IOCTL_EP_ACCEPT				WV_IOCTL(0x825)
+#define WV_IOCTL_EP_DISCONNECT			WV_IOCTL(0x826)
+#define WV_IOCTL_EP_DISCONNECT_NOTIFY	WV_IOCTL(0x827)
+#define WV_IOCTL_EP_QUERY				WV_IOCTL(0x828)
+#define WV_IOCTL_EP_LOOKUP				WV_IOCTL(0x829)
+#define WV_IOCTL_EP_MULTICAST_JOIN		WV_IOCTL(0x82A)
+#define WV_IOCTL_EP_MULTICAST_LEAVE		WV_IOCTL(0x82B)
+#define WV_IOCTL_EP_DESTROY				WV_IOCTL(0x82C)
+#define WV_IOCTL_LISTEN					WV_IOCTL(0x82D)
+#define WV_IOCTL_LISTEN_GET_REQUEST		WV_IOCTL(0x82E)
+#define WV_IOCTL_LISTEN_DESTROY			WV_IOCTL(0x82F)
+
+#define WV_IOCTL_MIN					0x800
+#define WV_IOCTL_MAX					0x830
+
+// Device specific data follows input / output structures.
+typedef struct _WV_IO_ID
+{
+	UINT64			Id;
+	UINT32			VerbInfo;
+	UINT32			Data;
+
+}	WV_IO_ID;
+
+typedef struct _WV_IO_GUID_LIST
+{
+	UINT64			Count;
+	UINT64			Guid[1];
+
+}	WV_IO_GUID_LIST;
+
+#define WV_IO_ATOMIC_NONE	0
+#define WV_IO_ATOMIC_HCA	1
+#define WV_IO_ATOMIC_NODE	2
+
+typedef struct _WV_IO_DEVICE_ATTRIBUTES
+{
+	UINT8			FwVersion[64];
+	UINT64			NodeGuid;
+	UINT64			SystemImageGuid;
+	UINT32			VendorId;
+	UINT32			VendorPartId;
+	UINT32			HwVersion;
+	UINT32			CapabilityFlags;
+	UINT32			AtomicCapability;
+	UINT32			PageSizeCapabilityFlags;
+	UINT32			MaxMrSize;
+	UINT32			MaxQp;
+	UINT32			MaxQpWr;
+	UINT32			MaxSge;
+	UINT32			MaxCq;
+	UINT32			MaxCqEntries;
+	UINT32			MaxMr;
+	UINT32			MaxPd;
+	UINT32			MaxQpResponderResources;
+	UINT32			MaxResponderResources;
+	UINT32			MaxQpInitiatorDepth;
+	UINT32			MaxInlineSend;
+	UINT32			MaxMw;
+	UINT32			MaxMulticast;
+	UINT32			MaxQpAttach;
+	UINT32			MaxMulticastQp;
+	UINT32			MaxAh;
+	UINT32			MaxFmr;
+	UINT32			MaxMapPerFmr;
+	UINT32			MaxSrq;
+	UINT32			MaxSrqWr;
+	UINT32			MaxSrqSge;
+	UINT32			MaxPkeys;
+	UINT8			LocalAckDelay;
+	UINT8			PhysPortCount;
+	UINT8			Reserved[2];
+
+}	WV_IO_DEVICE_ATTRIBUTES;
+
+typedef struct _WV_IO_DEVICE_PORT_QUERY
+{
+	UINT64			Id;
+	UINT8			PortNumber;
+	UINT8			Reserved[7];
+
+}	WV_IO_DEVICE_PORT_QUERY;
+
+#define WV_IO_PORT_NOP			0
+#define WV_IO_PORT_DOWN			1
+#define WV_IO_PORT_INIT			2
+#define WV_IO_PORT_ARMED		3
+#define WV_IO_PORT_ACTIVE		4
+#define WV_IO_PORT_ACTIVEDEFER	5
+
+typedef struct _WV_IO_PORT_ATTRIBUTES
+{
+	UINT32			PortCabilityFlags;
+	UINT32			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;
+	UINT8			Reserved[2];
+
+}	WV_IO_PORT_ATTRIBUTES;
+
+typedef struct _WV_IO_GID
+{
+	UINT8			Gid[16];
+
+}	WV_IO_GID;
+
+typedef struct _WV_IO_EVENT
+{
+	UINT32			Status;
+	UINT32			Type;
+	UINT8			PortNumber;
+	UINT8			Reserved[3];
+
+}	WV_IO_EVENT;
+
+typedef struct _WV_IO_MEMORY_REGISTER
+{
+	WV_IO_ID		Id;
+	UINT64			Address;
+	UINT64			BufferLength;
+	UINT32			AccessFlags;
+	UINT32			Reserved;			
+
+}	WV_IO_MEMORY_REGISTER;
+
+typedef struct _WV_IO_MEMORY_KEYS
+{
+	UINT32			VerbInfo;
+	UINT32			Lkey;
+	UINT32			Rkey;
+
+}	WV_IO_MEMORY_KEYS;
+
+typedef struct _WV_IN_MEMORY_DEREGISTER
+{
+	UINT32			VerbInfo;
+	UINT32			Lkey;
+
+}	WV_IN_MEMORY_DEREGISTER;
+
+typedef struct _WV_IO_AV
+{
+	UINT32			VersionClassFlow;
+	UINT16			Reserved1;
+	UINT8			Reserved2;
+	UINT8			HopLimit;
+	UINT8			SGid[16];
+	UINT8			DGid[16];
+
+	UINT16			GrhValid;
+	UINT16			DLid;				// Network byte order
+	UINT8			ServiceLevel;
+	UINT8			SourcePathBits;
+	UINT8			StaticRate;
+	UINT8			PortNumber;
+
+}	WV_IO_AV;
+
+typedef struct _WV_IO_AH_CREATE
+{
+	WV_IO_ID		Id;
+	WV_IO_AV		AddressVector;
+
+}	WV_IO_AH_CREATE;
+
+typedef struct _WV_IO_SRQ_ATTRIBUTES
+{
+	WV_IO_ID		Id;
+	UINT32			MaxWr;
+	UINT32			MaxSge;
+	UINT32			SrqLimit;
+	UINT32			Reserved;
+
+}	WV_IO_SRQ_ATTRIBUTES;
+
+typedef struct _WV_IO_QP_CREATE
+{
+	WV_IO_ID		Id;
+	UINT64			SendCqId;
+	UINT64			ReceiveCqId;
+	UINT64			SrqId;
+
+	UINT32			SendDepth;
+	UINT32			SendSge;
+	UINT32			ReceiveDepth;
+	UINT32			ReceiveSge;
+	UINT32			MaxInlineSend;
+	UINT32			InitiatorDepth;
+	UINT32			ResponderResources;
+
+	UINT8			QpType;
+	UINT8			SignalSends;
+	UINT8			Reserved[2];
+
+}	WV_IO_QP_CREATE;
+
+typedef struct _WV_IO_QP_ATTRIBUTES
+{
+	WV_IO_ID		Id;
+	UINT32			SendDepth;
+	UINT32			SendSge;
+	UINT32			ReceiveDepth;
+	UINT32			ReceiveSge;
+	UINT32			MaxInlineSend;
+	UINT32			InitiatorDepth;
+	UINT32			ResponderResources;
+
+	UINT32			Options;
+	UINT8			QpType;
+	UINT8			CurrentQpState;
+	UINT8			QpState;
+	UINT8			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_IO_AV		PrimaryAddressVector;
+	WV_IO_AV		AlternateAddressVector;
+	UINT32			AccessFlags;
+	UINT16			SignalSends;
+	UINT16			PkeyIndex;
+
+	UINT8			PathMtu;
+	UINT8			LocalAckTimeout;
+	UINT8			SequenceErrorRetryCount;
+	UINT8			RnrRetryCount;
+	UINT8			Reserved[4];
+
+}	WV_IO_QP_ATTRIBUTES;
+
+// TODO:
+//WV_IO_ADDRESS_QUERY
+//WV_IO_EP_CREATE
+//WV_IO_EP_BIND
+//WV_IO_EP_REJECT
+//WV_IO_EP_CONNECT
+//WV_IO_EP_ACCEPT
+//WV_IO_EP_DISCONNECT
+//WV_IO_EP_DISCONNECT_NOTIFY
+//WV_IO_EP_QUERY
+//WV_IO_EP_LOOKUP
+//WV_IO_EP_MULTICAST_JOIN
+//WV_IO_EP_MULTICAST_LEAVE
+//WV_IO_LISTEN
+//WV_IO_LISTEN_GET_REQUEST
+
+#endif // _WV_IOCTL_H_
\ No newline at end of file





More information about the ofw mailing list