[openib-general] [PATCH][iWARP] IW CM Verbs

Tom Tucker tom at ammasso.com
Fri Aug 26 11:44:25 PDT 2005


This is a cleaned up version of the iWARP CM verbs based 
on feedback from Roland and Sean. I've added a new file to 
contain the iw specific types and changed the iw specific
type prefix to iw_.

Please comment, and if it looks good, I'll commit this to the
iWARP branch tonight.

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

Index: ib_verbs.h
===================================================================
--- ib_verbs.h	(revision 3120)
+++ ib_verbs.h	(working copy)
@@ -59,7 +59,8 @@
 enum ib_node_type {
 	IB_NODE_CA 	= 1,
 	IB_NODE_SWITCH,
-	IB_NODE_ROUTER
+	IB_NODE_ROUTER,
+	IB_NODE_RNIC
 };
 
 enum ib_device_cap_flags {
@@ -78,6 +79,7 @@
 	IB_DEVICE_RC_RNR_NAK_GEN	= (1<<12),
 	IB_DEVICE_SRQ_RESIZE		= (1<<13),
 	IB_DEVICE_N_NOTIFY_CQ		= (1<<14),
+	IB_DEVICE_IWCM                  = (1<<15)
 };
 
 enum ib_atomic_cap {
@@ -804,6 +806,7 @@
 	struct ib_gid_cache   **gid_cache;
 };
 
+struct iw_cm;
 struct ib_device {
 	struct device                *dma_device;
 
@@ -820,6 +823,8 @@
 
 	u32                           flags;
 
+	struct iw_cm                  *iwcm;
+
 	int		           (*query_device)(struct ib_device
*device,
 						   struct ib_device_attr
*device_attr);
 	int		           (*query_port)(struct ib_device
*device,
Index: iw_cm.h
===================================================================
--- iw_cm.h	(revision 0)
+++ iw_cm.h	(revision 0)
@@ -0,0 +1,127 @@
+/*
+ * Copyright (c) 2005 Ammasso, 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>
+
+/* iWARP connection attributes. */
+struct iw_conn_attr {
+	struct in_addr	 	local_addr;	
+	struct in_addr	 	remote_addr;	
+	u16 			local_port;
+	u16 			remote_port;
+};
+
+/* This is provided in the event generated when 
+ * a remote peer accepts our connect request
+ */
+struct iw_conn_results {
+	int			errno;
+	struct iw_conn_attr     conn_attr;
+        u8			*private_data;
+	int 			private_data_len;
+};
+
+/* This is provided in the event generated by a remote
+ * connect request to a listening endpoint
+ */
+struct iw_conn_request {
+	int			cr_id;
+	struct iw_conn_attr     conn_attr;
+        u8			*private_data;
+	int 			private_data_len;
+};
+
+/* Connection events. */
+enum iw_cm_event_type {
+	IW_EVENT_ACTIVE_CONNECT_RESULTS,
+	IW_EVENT_CONNECT_REQUEST
+};
+
+struct iw_cm_event {
+	struct iw_device	*device;
+	union {
+		struct iw_conn_results 	active_results;
+		struct iw_conn_request 	conn_request;
+	} element;
+	enum iw_cm_event_type	event;
+};
+
+/* Listening endpoint. */
+struct iw_listen_ep_attr {
+	void		(*event_handler)(struct iw_cm_event *, void *);
+	void		*listen_context;
+	struct in_addr   addr;
+	u16		 port;
+	int		 backlog;
+};
+
+struct iw_listen_ep {
+	struct iw_device	*device;
+	void			(*event_handler)(struct iw_cm_event *,
void *);
+	void			*listen_context;
+	struct in_addr  	addr;
+	u16			port;
+	int			backlog;
+};
+
+struct iw_cm {
+
+	int                        (*connect_qp)(struct ib_qp *qp, 
+						 struct iw_conn_attr*
attr,
+						 void
(*event_handler)(struct iw_cm_event*, void*),
+						 void* context,
+						 u8 *pdata,
+						 int pdata_len
+						 );
+
+	int                        (*accept_cr)(int cr_id, 
+						struct ib_qp *qp, 
+						u8 *pdata, 
+						int pdata_len); 
+
+	int                        (*reject_cr)(int cr_id, 
+						struct ib_qp *qp, 
+						u8 *pdata, 
+						int pdata_len); 
+
+	int                        (*query_cr)(int cr_id, 
+					       struct iw_conn_request*
req);
+
+	struct iw_listen_ep *      (*create_listen_ep)(struct
iw_listen_ep_attr *);
+
+	int                        (*destroy_listen_ep)(struct
iw_listen_ep *ep);
+
+};
+
+#endif /* IW_CM_H */




More information about the general mailing list