[ofw] [Patch 19/62] Reference implementation of NDv2

Fab Tillier ftillier at microsoft.com
Wed Feb 20 17:44:06 PST 2013


This patch adds new functions to support the ND filter driver:
1. Allow splitting formatting and sending the REP, such that the existing logic in the CEP manager for returning QP modify parameters can be used.
2. Allow specifying the callback and context for new iba_cm_id's returned by cm_get_request.  Winverbs modifies the CM's iba_cm_id structure after calling cm_get_request, but this violates the encapsulation that should be there (iba_cm_id is a structure owned by the CM, the user only really has a handle and shouldn't modify its contents).

Note that this patch does not fix Winverbs, it only adds the new functions for the ND filter driver.

Signed-off-by: Fab Tillier <ftillier at microsoft.com>

diff -dwup3 -x *svn* -x *makefile.inc -x *sources -r c:\dev\openib\ofw\gen1\branches\mlx4_30\trunk\core\al\kernel\al_cm.c .\core\al\kernel\al_cm.c
--- c:\dev\openib\ofw\gen1\branches\mlx4_30\trunk\core\al\kernel\al_cm.c	Fri Aug 03 15:22:45 2012
+++ .\core\al\kernel\al_cm.c	Thu Jul 26 15:31:13 2012
@@ -111,20 +111,22 @@ cm_listen_handler(const ib_al_handle_t h
 }
 
 static NTSTATUS
-cm_get_request(iba_cm_id *p_listen_id, iba_cm_id **pp_id, iba_cm_event *p_event)
+cm_get_request_ex(iba_cm_id *p_listen_id,
+				  NTSTATUS (*callback)(iba_cm_id *p_id, iba_cm_event *p_event),
+				  void *context, iba_cm_id **pp_id, iba_cm_event *p_event)
 {
-	void				*context;
+	void				*dummy;
 	net32_t				new_cid;
 	ib_mad_element_t	*mad;
 	ib_api_status_t		ib_status;
 	NTSTATUS			status;
 
-	ib_status = al_cep_poll(gh_al, p_listen_id->cid, &context, &new_cid, &mad);
+	ib_status = al_cep_poll(gh_al, p_listen_id->cid, &dummy, &new_cid, &mad);
 	if (ib_status != IB_SUCCESS) {
 		return STATUS_NO_MORE_ENTRIES;
 	}
 
-	*pp_id = cm_alloc_id(p_listen_id->callback, p_listen_id);
+	*pp_id = cm_alloc_id(callback, context);
 	if (*pp_id == NULL) {
 		kal_cep_destroy(gh_al, new_cid, STATUS_NO_MORE_ENTRIES);
 		status = STATUS_NO_MEMORY;
@@ -142,6 +144,12 @@ out:
 }
 
 static NTSTATUS
+cm_get_request(iba_cm_id *p_listen_id, iba_cm_id **pp_id, iba_cm_event *p_event)
+{
+	return cm_get_request_ex(p_listen_id, p_listen_id->callback, p_listen_id, pp_id, p_event);
+}
+
+static NTSTATUS
 cm_create_id(NTSTATUS (*callback)(iba_cm_id *p_id, iba_cm_event *p_event),
 			 void *context, iba_cm_id **pp_id)
 {
@@ -379,6 +387,24 @@ cm_establish(iba_cm_id *p_id)
 	return ib_to_ntstatus(ib_status);
 }
 
+static NTSTATUS
+cm_format_rep(iba_cm_id *p_id, iba_cm_rep *p_rep, ib_qp_mod_t *p_init)
+{
+	ib_api_status_t ib_status;
+
+	ib_status = kal_cep_pre_rep(gh_al, p_id->cid, p_rep, 0, p_init);
+	return ib_to_ntstatus(ib_status);
+}
+
+static NTSTATUS
+cm_send_formatted_rep(iba_cm_id *p_id)
+{
+	ib_api_status_t ib_status;
+
+	ib_status = al_cep_send_rep(gh_al, p_id->cid);
+	return ib_to_ntstatus(ib_status);
+}
+
 void cm_get_interface(iba_cm_interface *p_ifc)
 {
 	p_ifc->create_id = cm_create_id;
@@ -399,5 +425,8 @@ void cm_get_interface(iba_cm_interface *
 	p_ifc->get_qp_attr = cm_get_qp_attr;
 	p_ifc->migrate = cm_migrate;
 	p_ifc->established = cm_establish;
+	p_ifc->format_rep = cm_format_rep;
+	p_ifc->send_formatted_rep = cm_send_formatted_rep;
+	p_ifc->get_request_ex = cm_get_request_ex;
 	p_ifc->cancel_listen = cm_cancel_listen;
 }
diff -dwup3 -x *svn* -x *makefile.inc -x *sources -r c:\dev\openib\ofw\gen1\branches\mlx4_30\trunk\inc\kernel\iba\ib_cm_ifc.h .\inc\kernel\iba\ib_cm_ifc.h
--- c:\dev\openib\ofw\gen1\branches\mlx4_30\trunk\inc\kernel\iba\ib_cm_ifc.h	Fri Aug 03 15:22:45 2012
+++ .\inc\kernel\iba\ib_cm_ifc.h	Thu Jul 26 15:31:14 2012
@@ -286,6 +286,14 @@ typedef struct _iba_cm_interface
 	NTSTATUS		(*migrate)(iba_cm_id *p_id);
 	NTSTATUS		(*established)(iba_cm_id *p_id);
 	NTSTATUS		(*cancel_listen)(iba_cm_id *p_id);
+
+	NTSTATUS		(*format_rep)(iba_cm_id *p_id, iba_cm_rep *p_rep, ib_qp_mod_t *p_init);
+	NTSTATUS		(*send_formatted_rep)(iba_cm_id *p_id);
+	NTSTATUS		(*get_request_ex)(iba_cm_id *p_listen_id,
+									  NTSTATUS (*callback)(iba_cm_id *p_id,
+														   iba_cm_event *p_event),
+									  void *context, iba_cm_id **pp_id, iba_cm_event *p_event);
+
 }	iba_cm_interface;
 
 static inline USHORT IbaCmVersion(UINT8 Major, UINT8 Minor)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ndv2.19.patch
Type: application/octet-stream
Size: 3569 bytes
Desc: ndv2.19.patch
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20130221/3725ac71/attachment.obj>


More information about the ofw mailing list