[openib-general] [PATCH][iWARP] Another CM Verbs Approach

Tom Tucker tom at ammasso.com
Fri Aug 26 10:46:26 PDT 2005


Sean/Roland:

I think there is general concensus that having CM verbs
in the ib_device structure is disgusting. This patch moves 
these verbs to the ib_cm.h file and adds a device 
capabilities flag that indicates whether or not 
the device has CM verbs.

I know this is not exactly what everyone is looking for, 
but I hope it is workable given the practical realities 
we face relative to host stack integration and the need to
support devices that establish connections internally.

I know Roland has said we can "go wild" in our own branch,
but I really don't want to do something that is not 
going to be acceptable to the community at large.

So here's another shot, please tell me what you think.

This patch is to the include directory of the iWARP 
branch.

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

Index: ib_cm.h
===================================================================
--- ib_cm.h	(revision 3120)
+++ ib_cm.h	(working copy)
@@ -39,6 +39,7 @@
 
 #include <ib_mad.h>
 #include <ib_sa.h>
+#include <linux/in.h>
 
 enum ib_cm_state {
 	IB_CM_IDLE,
@@ -555,6 +556,96 @@
 	u8			private_data_len;
 };
 
+/* iWARP connection attributes. */
+struct ib_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 ib_conn_results {
+	int			errno;
+	struct ib_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 ib_conn_request {
+	int			cr_id;
+	struct ib_conn_attr     conn_attr;
+        u8			*private_data;
+	int 			private_data_len;
+};
+
+/* Connection events. */
+enum ib_cmv_event_type {
+	IB_EVENT_ACTIVE_CONNECT_RESULTS,
+	IB_EVENT_CONNECT_REQUEST
+};
+
+struct ib_cmv_event {
+	struct ib_device	*device;
+	union {
+		struct ib_conn_results 	active_results;
+		struct ib_conn_request 	conn_request;
+	} element;
+	enum ib_cmv_event_type	event;
+};
+
+/* Listening endpoint. */
+struct ib_listen_ep_attr {
+	void		(*event_handler)(struct ib_cmv_event *, void *);
+	void		*listen_context;
+	struct in_addr   addr;
+	u16		 port;
+	int		 backlog;
+};
+
+struct ib_listen_ep {
+	struct ib_device	*device;
+	void			(*event_handler)(struct ib_cmv_event *,
void *);
+	void			*listen_context;
+	struct in_addr  	addr;
+	u16			port;
+	int			backlog;
+};
+
+struct ib_cmv {
+
+	int                        (*connect_qp)(struct ib_qp *qp, 
+						 struct ib_conn_attr*
attr,
+						 void
(*event_handler)(struct ib_cmv_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 ib_conn_request*
req);
+
+	struct ib_listen_ep *      (*create_listen_ep)(struct
ib_listen_ep_attr *);
+
+	int                        (*destroy_listen_ep)(struct
ib_listen_ep *ep);
+
+};
+
 /**
  * ib_send_cm_sidr_rep - Sends a service ID resolution request to the
  *   remote node.
@@ -565,4 +656,5 @@
 int ib_send_cm_sidr_rep(struct ib_cm_id *cm_id,
 			struct ib_cm_sidr_rep_param *param);
 
+
 #endif /* IB_CM_H */
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_CMV                   = <1<<15)
 };
 
 enum ib_atomic_cap {
@@ -804,6 +806,7 @@
 	struct ib_gid_cache   **gid_cache;
 };
 
+struct ib_cmv;
 struct ib_device {
 	struct device                *dma_device;
 
@@ -820,6 +823,8 @@
 
 	u32                           flags;
 
+	struct ib_cmv              *ibcmv;
+
 	int		           (*query_device)(struct ib_device
*device,
 						   struct ib_device_attr
*device_attr);
 	int		           (*query_port)(struct ib_device
*device,




More information about the general mailing list