[openib-general] [PATCH 1/3] iWARP Header Files

Tom Tucker tom at opengridcomputing.com
Wed Mar 15 13:18:15 PST 2006


This patch includes the modifications necessary to the IB verbs file 
and specifies an initial iWARP CM verbs interface
        include/rdma/ib_verbs.h
        include/rdma/iw_cm.h

Signed-off-by: Tom Tucker <tom at opengridcomputing.com>

Index: infiniband/include/rdma/ib_verbs.h
===================================================================
--- infiniband/include/rdma/ib_verbs.h	(revision 5842)
+++ infiniband/include/rdma/ib_verbs.h	(working copy)
@@ -101,6 +101,9 @@
 	IB_DEVICE_RC_RNR_NAK_GEN	= (1<<12),
 	IB_DEVICE_SRQ_RESIZE		= (1<<13),
 	IB_DEVICE_N_NOTIFY_CQ		= (1<<14),
+	IB_DEVICE_ZERO_STAG  		= (1<<15),
+	IB_DEVICE_MEM_WINDOW  		= (1<<16),
+	IB_DEVICE_SEND_W_INV          	= (1<<17),
 };
 
 enum ib_atomic_cap {
@@ -824,6 +827,7 @@
 	struct ib_gid_cache   **gid_cache;
 };
 
+struct iw_cm_verbs;
 struct ib_device {
 	struct device                *dma_device;
 
@@ -840,6 +844,8 @@
 
 	u32                           flags;
 
+	struct iw_cm_verbs*           iwcm;
+
 	int		           (*query_device)(struct ib_device *device,
 						   struct ib_device_attr *device_attr);
 	int		           (*query_port)(struct ib_device *device,
Index: infiniband/include/rdma/iw_cm.h
===================================================================
--- infiniband/include/rdma/iw_cm.h	(revision 0)
+++ infiniband/include/rdma/iw_cm.h	(revision 0)
@@ -0,0 +1,170 @@
+/*
+ * Copyright (c) 2005 Network Appliance, Inc. All rights reserved.
+ * Copyright (c) 2005 Open Grid Computing, Inc. All rights reserved.
+ *
+ * This software is available to you under a choice of one of two
+ * licenses.  You may choose to be licensed under the terms of the GNU
+ * General Public License (GPL) Version 2, available from the file
+ * COPYING in the main directory of this source tree, or 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 AND
+ * 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.
+ */
+#if !defined(IW_CM_H)
+#define IW_CM_H
+
+#include <linux/in.h>
+#include <rdma/ib_cm.h>
+
+struct iw_cm_id;
+struct iw_cm_event;
+
+/* Event Delivery Schedule
+ *
+ * Active Side:
+ * - CONNECT_REPLY [ACCEPTED]   - CM_ID <- ESTABLISHED, QP <- RTS
+ *                 [REJECTED]   - CM_ID <- IDLE
+ *                 [TIMEOUT]    - CM_ID <- IDLE
+ *                 [EINVAL]     - CM_ID <- IDLE
+ *
+ * Passive Side:
+ * - CONNECT_REQUEST [0]        - CM_ID <- CONN_RECV
+ * - ESTABLISHED [0]            - CM_ID <- ESTABLISHED, QP <- RTS
+ *
+ * Normal Shutdown
+ * - DISCONNECT[0]              - CM_ID <- CLOSING, QP <- SQD
+ * - CLOSE[0]			- CM_ID <- IDLE,    QP <- IDLE
+ * 
+ * Abortive Shutdown
+ * - CLOSE[TIMEOUT]		- CM_ID <- IDLE, QP <- ERROR
+ *        [RESET]               - CM_ID <- IDLE, QP <- ERROR
+ */
+enum iw_cm_event_type {
+	IW_CM_EVENT_CONNECT_REQUEST = 1, /* connect request received */
+	IW_CM_EVENT_CONNECT_REPLY,	 /* reply from active connect request */
+	IW_CM_EVENT_ESTABLISHED,	 /* passive side accept successful */
+	IW_CM_EVENT_DISCONNECT,		 /* orderly shutdown */
+	IW_CM_EVENT_CLOSE		 /* close complete */
+};
+enum iw_cm_event_status {
+	IW_CM_EVENT_STATUS_OK = 0,	 /* request successful */
+	IW_CM_EVENT_STATUS_ACCEPTED = 0, /* connect request accepted */
+	IW_CM_EVENT_STATUS_REJECTED,	 /* connect request rejected */
+	IW_CM_EVENT_STATUS_TIMEOUT,	 /* the operation timed out */
+	IW_CM_EVENT_STATUS_RESET,	 /* reset from remote peer */
+	IW_CM_EVENT_STATUS_EINVAL,	 /* asynchronous failure for bad parm */
+};
+
+struct iw_cm_event {
+	enum iw_cm_event_type event;
+	enum iw_cm_event_status status;
+	u32 provider_id;
+	struct sockaddr_in local_addr;
+	struct sockaddr_in remote_addr;
+	void *private_data;
+	u8 private_data_len;
+};
+
+typedef int (*iw_cm_handler)(struct iw_cm_id *cm_id,
+			     struct iw_cm_event *event);
+
+enum iw_cm_state {
+	IW_CM_STATE_IDLE,             /* unbound, inactive */
+	IW_CM_STATE_LISTEN,           /* listen waiting for connect */
+	IW_CM_STATE_CONN_RECV,        /* inbound waiting for user accept */
+	IW_CM_STATE_CONN_SENT,        /* outbound waiting for peer accept */
+	IW_CM_STATE_ESTABLISHED,      /* established */
+	IW_CM_STATE_CLOSING,	      /* disconnect */
+	IW_CM_STATE_DESTROYING        /* object being deleted */
+};
+
+typedef void (*iw_event_handler)(struct iw_cm_id *cm_id,
+				 struct iw_cm_event *event);
+struct iw_cm_id {
+	iw_cm_handler	        cm_handler;      /* client callback function */
+	void		        *context;	 /* context to provide to client cb */
+	enum iw_cm_state        state;
+	struct ib_device        *device;	 
+	struct ib_qp            *qp;             /* If the qp is null, use qp_num */
+	u32                     qp_num;
+	struct sockaddr_in      local_addr;
+	struct sockaddr_in      remote_addr;
+	u64                     provider_id;     /* device handle for this conn. */
+	iw_event_handler        event_handler;   /* callback for IW CM Provider events */
+};
+
+/**
+ * iw_create_cm_id - Allocate a communication identifier.
+ * @device: Device associated with the cm_id.  All related communication will
+ * be associated with the specified device.
+ * @cm_handler: Callback invoked to notify the user of CM events.
+ * @context: User specified context associated with the communication
+ *   identifier.
+ *
+ * Communication identifiers are used to track connection states, 
+ * addr resolution requests, and listen requests.
+ */
+struct iw_cm_id *iw_create_cm_id(struct ib_device *device,
+				 iw_cm_handler cm_handler,
+				 void *context);
+
+/* This is provided in the event generated when 
+ * a remote peer accepts our connect request
+ */
+
+struct iw_cm_verbs {
+	int	(*connect)(struct iw_cm_id *cm_id,
+			  const void *pdata, u8 pdata_len);
+	
+	int	(*accept)(struct iw_cm_id *cm_id, 
+			  const void *pdata, u8 pdata_len);
+
+	int	(*reject)(struct iw_cm_id *cm_id, 
+			  const void *pdata, u8 pdata_len);
+
+	int	(*getpeername)(struct iw_cm_id *cm_id,
+			       struct sockaddr_in *local_addr,
+			       struct sockaddr_in *remote_addr);
+
+	int	(*create_listen)(struct iw_cm_id *cm_id,
+				 int backlog);
+
+	int	(*destroy_listen)(struct iw_cm_id *cm_id);
+
+};
+
+struct iw_cm_id *iw_create_cm_id(struct ib_device *device,
+				 iw_cm_handler cm_handler, void *context);
+void iw_destroy_cm_id(struct iw_cm_id *cm_id);
+int iw_cm_listen(struct iw_cm_id *cm_id, int backlog);
+int iw_cm_reject(struct iw_cm_id *cm_id, const void *private_data,
+		 u8 private_data_len);
+int iw_cm_accept(struct iw_cm_id *cm_id, const void *private_data,
+		 u8 private_data_len);
+int iw_cm_connect(struct iw_cm_id *cm_id, const void *pdata, u8 pdata_len);
+int iw_cm_bind_qp(struct iw_cm_id *cm_id, struct ib_qp *qp);
+int iw_cm_init_qp_attr(struct iw_cm_id *cm_id, struct ib_qp_attr *qp_attr,
+		       int *qp_attr_mask);
+int iw_cm_disconnect(struct iw_cm_id *cm_id, int abrupt);
+
+#endif /* IW_CM_H */




More information about the general mailing list