[openib-general] [PATCH] [RFC] updated CM API

Sean Hefty mshefty at ichips.intel.com
Mon Jan 10 17:57:11 PST 2005


The following patch updates the CM API to match the intermediate implementation
that I have.  (See separate patch.)  I'm posting this separately in order to
get comments from users of the API.

- Sean

Index: include/ib_cm.h
===================================================================
--- include/ib_cm.h	(revision 1505)
+++ include/ib_cm.h	(working copy)
@@ -51,10 +51,6 @@
 	IB_CM_MRA_REP_SENT,
 	IB_CM_MRA_REP_RCVD,
 	IB_CM_ESTABLISHED,
-	IB_CM_LAP_SENT,
-	IB_CM_LAP_RCVD,
-	IB_CM_MRA_LAP_SENT,
-	IB_CM_MRA_LAP_RCVD,
 	IB_CM_DREQ_SENT,
 	IB_CM_DREQ_RCVD,
 	IB_CM_TIMEWAIT,
@@ -63,29 +59,100 @@
 };
 
 enum ib_cm_event_type {
-	IB_CM_REQ_TIMEOUT,
+	IB_CM_REQ_ERROR,
 	IB_CM_REQ_RECEIVED,
-	IB_CM_REP_TIMEOUT,
+	IB_CM_REP_ERROR,
 	IB_CM_REP_RECEIVED,
 	IB_CM_RTU_RECEIVED,
-	IB_CM_DREQ_TIMEOUT,
+	IB_CM_DREQ_ERROR,
 	IB_CM_DREQ_RECEIVED,
 	IB_CM_DREP_RECEIVED,
 	IB_CM_MRA_RECEIVED,
-	IB_CM_LAP_TIMEOUT,
+	IB_CM_LAP_ERROR,
 	IB_CM_LAP_RECEIVED,
-	IB_CM_APR_RECEIVED
+	IB_CM_APR_RECEIVED,
+	IB_CM_SIDR_REQ_ERROR,
+	IB_CM_SIDR_REQ_RECEIVED,
+	IB_CM_SIDR_REP_RECEIVED
 };
 
+struct ib_cm_id;
+
+struct ib_cm_req_event_param {
+	struct ib_cm_id		*listen_id;
+	u64			service_id;
+	struct ib_device	*device;
+	u8			port;
+
+	struct ib_sa_path_rec	*primary_path;
+	struct ib_sa_path_rec	*alternate_path;
+
+	u64			remote_ca_guid;
+	u32			remote_qkey;
+	u32			remote_qpn;
+	enum ib_qp_type		qp_type;
+
+	u32	starting_psn;
+	u8	responder_resources;
+	u8	initiator_depth;
+	int	local_cm_response_timeout:5;
+	int	flow_control:1;
+	int	remote_cm_response_timeout:5;
+	int	retry_count:3;
+	int	rnr_retry_count:3;
+	int	srq:1;
+};
+
+struct ib_cm_rep_event_param {
+	u64	remote_ca_guid;
+	u32	remote_qkey;
+	u32	remote_qpn;
+	u32	starting_psn;
+	u8	responder_resources;
+	u8	initiator_depth;
+	int	target_ack_delay:5;
+	int	failover_accepted:2;
+	int	flow_control:1;
+	int	rnr_retry_count:3;
+	int	srq:1;
+};
+
+struct ib_cm_rej_event_param {
+	u16	reason;
+	u8	ari_length;
+	u8	*ari;
+};
+
+struct ib_cm_mra_event_param {
+	u8	service_timeout;
+};
+
+/*
+struct ib_cm_lap_event_param {
+};
+
+struct ib_cm_apr_event_param {
+};
+*/
+
 struct ib_cm_event {
-	/* a whole lot more stuff goes here */
+	enum ib_cm_event_type	event;
+	union {
+		struct ib_cm_req_event_param	req_rcvd;
+		struct ib_cm_rep_event_param	rep_rcvd;
+		struct ib_cm_rej_event_param	rej_rcvd;
+		struct ib_cm_mra_event_param	mra_rcvd;
+		/*
+		struct ib_cm_lap_event_param	lap_rcvd;
+		struct ib_cm_apr_event_param	apr_rcvd;
+		*/
+		enum ib_wc_status		send_status;
+	} param;
+
 	void			*private_data;
 	u8			private_data_len;
-	enum ib_cm_event_type	event;
 };
 
-struct ib_cm_id;
-
 typedef void (*ib_cm_handler)(struct ib_cm_id *cm_id,
 			      struct ib_cm_event *event);
 
@@ -95,6 +162,25 @@
 	u64			service_id;
 	u64			service_mask;
 	enum ib_cm_state	state;
+	u32			local_id;  /* local/request ID */
+	u32			remote_id; /* connections only */
+};
+
+enum ib_cm_data_size {
+	IB_CM_REQ_PRIVATE_DATA_SIZE	 = 92,
+	IB_CM_MRA_PRIVATE_DATA_SIZE	 = 222,
+	IB_CM_REJ_PRIVATE_DATA_SIZE	 = 148,
+	IB_CM_REP_PRIVATE_DATA_SIZE	 = 196,
+	IB_CM_RTU_PRIVATE_DATA_SIZE	 = 224,
+	IB_CM_DREQ_PRIVATE_DATA_SIZE	 = 220,
+	IB_CM_DREP_PRIVATE_DATA_SIZE	 = 224,
+	IB_CM_REJ_ARI_LENGTH		 = 72,
+	IB_CM_LAP_PRIVATE_DATA_SIZE	 = 168,
+	IB_CM_APR_PRIVATE_DATA_SIZE	 = 148,
+	IB_CM_APR_INFO_LENGTH		 = 72,
+	IB_CM_SIDR_REQ_PRIVATE_DATA_SIZE = 216,
+	IB_CM_SIDR_REP_PRIVATE_DATA_SIZE = 136,
+	IB_CM_SIDR_REP_INFO_LENGTH	 = 72
 };
 
 /**
@@ -135,9 +221,10 @@
 
 struct ib_cm_req_param {
 	struct ib_qp		*qp;
-	struct ib_path_record	*primary_path;
-	struct ib_path_record	*alternate_path;
+	struct ib_sa_path_rec	*primary_path;
+	struct ib_sa_path_rec	*alternate_path;
 	u64			service_id;
+	u32			starting_send_psn;
 	void			*private_data;
 	u8			private_data_len;
 	u8			peer_to_peer;
@@ -163,8 +250,9 @@
 
 struct ib_cm_rep_param {
 	struct ib_qp	*qp;
+	u32		starting_send_psn;
 	void		*private_data;
-	u8		reply_private_data_len;
+	u8		private_data_len;
 	u8		responder_resources;
 	u8		initiator_depth;
 	u8		target_ack_delay;
@@ -182,7 +270,7 @@
  *   connection.
  */
 int ib_send_cm_rep(struct ib_cm_id *cm_id,
-		   struct ib_cm_req_param *param);
+		   struct ib_cm_rep_param *param);
 
 /**
  * ib_send_cm_rtu - Sends a connection ready to use message in response
@@ -310,7 +398,7 @@
  * @private_data_len: Size of the private data buffer, in bytes.
  */
 int ib_send_cm_lap(struct ib_cm_id *cm_id,
-		   struct ib_path_record *alternate_path,
+		   struct ib_sa_path_rec *alternate_path,
 		   void *private_data,
 		   u8 private_data_len);
 
@@ -351,7 +439,7 @@
 		   u8 private_data_len);
 
 struct ib_cm_sidr_req_param {
-	struct ib_path_record	*path;
+	struct ib_sa_path_rec	*path;
 	u64			service_id;
 	int			timeout_ms;
 	void			*private_data;



More information about the general mailing list