[ofw] patch: [ibbus] Add A new function to IBAL that allows one to create a multicast group without attaching a QP to it.
Tzachi Dar
tzachid at mellanox.co.il
Thu Feb 10 08:29:42 PST 2011
On some occasions one might have to create a multicast group but does not want to attach a QP to it.
The following new function enables this functionality.
Any comments (including to function names) are welcomed.
Thanks
Tzachi & Irena
Index: b:/users/irena/proj1/trunk/core/bus/kernel/bus_pnp.c
===================================================================
--- b:/users/irena/proj1/trunk/core/bus/kernel/bus_pnp.c (revision 7368)
+++ b:/users/irena/proj1/trunk/core/bus/kernel/bus_pnp.c (revision 7369)
@@ -1014,6 +1014,7 @@
p_ifc->poll_cq = ib_poll_cq;
p_ifc->rearm_cq = ib_rearm_cq;
p_ifc->join_mcast = ib_join_mcast;
+ p_ifc->join_mcast_no_qp = al_join_mcast_no_qp;
p_ifc->leave_mcast = ib_leave_mcast;
p_ifc->local_mad = ib_local_mad;
p_ifc->cm_listen = ib_cm_listen;
Index: b:/users/irena/proj1/trunk/core/al/al_mcast.c
===================================================================
--- b:/users/irena/proj1/trunk/core/al/al_mcast.c (revision 7368)
+++ b:/users/irena/proj1/trunk/core/al/al_mcast.c (revision 7369)
@@ -100,10 +100,9 @@
#endif
-
ib_api_status_t
-al_join_mcast(
- IN const ib_qp_handle_t h_qp,
+al_join_mcast_common(
+ IN const ib_qp_handle_t h_qp OPTIONAL,
IN const ib_mcast_req_t* const p_mcast_req )
{
ib_mcast_handle_t h_mcast;
@@ -113,20 +112,6 @@
AL_ENTER( AL_DBG_MCAST );
- /*
- * Validate the port GUID. There is no need to validate the pkey index as
- * the user could change it later to make it invalid. There is also no
- * need to perform any QP transitions as ib_init_dgrm_svc resets the QP and
- * starts from scratch.
- */
- status = get_port_num( h_qp->obj.p_ci_ca, p_mcast_req->port_guid, NULL );
- if( status != IB_SUCCESS )
- {
- AL_PRINT( TRACE_LEVEL_ERROR, AL_DBG_ERROR,
- ("get_port_num failed, status: %s\n", ib_get_err_str(status)) );
- return status;
- }
-
/* Allocate a new multicast request. */
h_mcast = cl_zalloc( sizeof( ib_mcast_t ) );
if( !h_mcast )
@@ -183,13 +168,16 @@
h_mcast->port_guid = p_mcast_req->port_guid;
/* Track the multicast with the QP instance. */
- status = attach_al_obj( &h_qp->obj, &h_mcast->obj );
- if( status != IB_SUCCESS )
- {
- h_mcast->obj.pfn_destroy( &h_mcast->obj, NULL );
- AL_PRINT_EXIT( TRACE_LEVEL_ERROR, AL_DBG_ERROR,
- ("attach_al_obj returned %s.\n", ib_get_err_str(status)) );
- return status;
+
+ if (h_qp) {
+ status = attach_al_obj( &h_qp->obj, &h_mcast->obj );
+ if( status != IB_SUCCESS )
+ {
+ h_mcast->obj.pfn_destroy( &h_mcast->obj, NULL );
+ AL_PRINT_EXIT( TRACE_LEVEL_ERROR, AL_DBG_ERROR,
+ ("attach_al_obj returned %s.\n", ib_get_err_str(status)) );
+ return status;
+ }
}
/* Issue the MAD to the SA. */
@@ -224,6 +212,38 @@
}
+ib_api_status_t
+al_join_mcast_no_qp(
+ IN const ib_mcast_req_t* const p_mcast_req )
+{
+ return al_join_mcast_common(NULL, p_mcast_req );
+
+}
+
+ib_api_status_t
+al_join_mcast(
+ IN const ib_qp_handle_t h_qp,
+ IN const ib_mcast_req_t* const p_mcast_req )
+{
+ ib_api_status_t status;
+ /*
+ * Validate the port GUID. There is no need to validate the pkey index as
+ * the user could change it later to make it invalid. There is also no
+ * need to perform any QP transitions as ib_init_dgrm_svc resets the QP and
+ * starts from scratch.
+ */
+
+ status = get_port_num( h_qp->obj.p_ci_ca, p_mcast_req->port_guid, NULL );
+ if( status != IB_SUCCESS )
+ {
+ AL_PRINT( TRACE_LEVEL_ERROR, AL_DBG_ERROR,
+ ("get_port_num failed, status: %s\n", ib_get_err_str(status)) );
+ return status;
+ }
+
+ return al_join_mcast_common(h_qp, p_mcast_req);
+}
+
static void
__destroying_mcast(
IN al_obj_t *p_obj )
@@ -504,7 +524,8 @@
*/
h_mcast->state = SA_REG_ACTIVE;
/* Attach the QP to the multicast group. */
- if(ib_member_get_state(mcast_rec.p_member_rec->scope_state) == IB_MC_REC_STATE_FULL_MEMBER)
+ if(ib_member_get_state(mcast_rec.p_member_rec->scope_state) == IB_MC_REC_STATE_FULL_MEMBER &&
+ (((ib_qp_handle_t)h_mcast->obj.p_parent_obj) != NULL))
{
status = verbs_attach_mcast(h_mcast);
if( status != IB_SUCCESS )
Index: b:/users/irena/proj1/trunk/core/al/al_mcast.h
===================================================================
--- b:/users/irena/proj1/trunk/core/al/al_mcast.h (revision 7368)
+++ b:/users/irena/proj1/trunk/core/al/al_mcast.h (revision 7369)
@@ -96,7 +96,11 @@
IN const ib_qp_handle_t h_qp,
IN const ib_mcast_req_t* const p_mcast_req );
+ib_api_status_t
+al_join_mcast_no_qp(
+ IN const ib_mcast_req_t* const p_mcast_req );
+
#if defined( CL_KERNEL )
/*
* Called by proxy to attach a QP to a multicast group.
@@ -109,6 +113,7 @@
OUT al_attach_handle_t *ph_attach,
IN OUT ci_umv_buf_t *p_umv_buf OPTIONAL );
+
#endif /* CL_KERNEL */
Index: b:/users/irena/proj1/trunk/core/al/al_qp.c
===================================================================
--- b:/users/irena/proj1/trunk/core/al/al_qp.c (revision 7368)
+++ b:/users/irena/proj1/trunk/core/al/al_qp.c (revision 7369)
@@ -1619,7 +1619,28 @@
}
+ib_api_status_t
+ib_join_mcast_no_qp(
+ IN const ib_mcast_req_t* const p_mcast_req )
+{
+ ib_api_status_t status;
+ AL_ENTER( AL_DBG_MCAST );
+
+ if( !p_mcast_req )
+ {
+ AL_PRINT_EXIT( TRACE_LEVEL_ERROR, AL_DBG_ERROR, ("IB_INVALID_PARAMETER\n") );
+ return IB_INVALID_PARAMETER;
+ }
+
+ status = al_join_mcast_no_qp( p_mcast_req );
+
+ AL_EXIT( AL_DBG_MCAST );
+ return status;
+}
+
+
+
/*
* Post a work request to the send queue of the QP.
*/
Index: b:/users/irena/proj1/trunk/inc/kernel/iba/ib_al_ifc.h
===================================================================
--- b:/users/irena/proj1/trunk/inc/kernel/iba/ib_al_ifc.h (revision 7368)
+++ b:/users/irena/proj1/trunk/inc/kernel/iba/ib_al_ifc.h (revision 7369)
@@ -48,7 +48,7 @@
* IB resources provided by HCAs.
*********/
-#define AL_INTERFACE_VERSION (14)
+#define AL_INTERFACE_VERSION (15)
@@ -404,6 +404,10 @@
IN const ib_mcast_req_t* const p_mcast_req );
typedef ib_api_status_t
+(*ib_pfn_join_mcast_no_qp_t)(
+ IN const ib_mcast_req_t* const p_mcast_req );
+
+typedef ib_api_status_t
(*ib_pfn_leave_mcast_t)(
IN const ib_mcast_handle_t h_mcast,
IN const ib_pfn_destroy_cb_t destroy_cb );
@@ -702,6 +706,7 @@
ib_pfn_poll_cq_t poll_cq;
ib_pfn_rearm_cq_t rearm_cq;
ib_pfn_join_mcast_t join_mcast;
+ ib_pfn_join_mcast_no_qp_t join_mcast_no_qp;
ib_pfn_leave_mcast_t leave_mcast;
ib_pfn_local_mad_t local_mad;
ib_pfn_cm_listen_t cm_listen;
Index: b:/users/irena/proj1/trunk/inc/iba/ib_al.h
===================================================================
--- b:/users/irena/proj1/trunk/inc/iba/ib_al.h (revision 7368)
+++ b:/users/irena/proj1/trunk/inc/iba/ib_al.h (revision 7369)
@@ -3801,7 +3801,7 @@
* ib_join_mcast
*
* DESCRIPTION
-* Attaches a queue pair to a multicast group.
+* Creates a multicast group and Attaches a queue pair to it.
*
* SYNOPSIS
*/
@@ -3876,7 +3876,84 @@
* ib_leave_mcast, ib_mcast_req_t, ib_create_qp, ib_init_dgrm_svc
*****/
+/****f* Access Layer/ib_join_mcast
+* NAME
+* ib_join_mcast_no_qp
+*
+* DESCRIPTION
+* Creates a multicast group.
+*
+* SYNOPSIS
+*/
+AL_EXPORT ib_api_status_t AL_API
+ib_join_mcast_no_qp(
+ IN const ib_mcast_req_t* const p_mcast_req );
+/*
+* PARAMETERS
+*
+* p_mcast_req
+* [in] Specifies the multicast group to join.
+*
+* RETURN VALUES
+* IB_SUCCESS
+* The join multicast group request has been initiated.
+*
+* IB_INVALID_QP_HANDLE
+* The queue pair handle was invalid.
+*
+* IB_INVALID_PARAMETER
+* A reference to the multicast group request information was not
+* provided.
+*
+* IB_INVALID_SERVICE_TYPE
+* The queue pair configuration does not support this type of service.
+*
+* IB_INSUFFICIENT_MEMORY
+* There was insufficient memory to join the multicast group.
+*
+* IB_INVALID_GUID
+* No port was found for the port_guid specified in the request.
+*
+* IB_INSUFFICIENT_RESOURCES
+* There were insufficient resources currently available on the channel
+* adapter to perform the operation.
+*
+* IB_INVALID_PKEY
+* The pkey specified in the multicast join request does not match the
+* pkey of the queue pair.
+*
+* IB_INVALID_PORT
+* The port GUID specified in the multicast join request does not match
+* the port of the queue pair.
+*
+* IB_ERROR
+* An error occurred while performing the multicast group join operation.
+*
+* IB_INSUFFICIENT_RESOURCES
+* There were insufficient resources currently available to complete
+* the request.
+*
+* IB_INSUFFICIENT_MEMORY
+* There was insufficient memory to complete the request.
+*
+* NOTES
+* This routine results in the specified queue pair joining a multicast
+* group. If the multicast group does not already exist, it will be created
+* at the user's option. Information about the multicast group is returned
+* to the user through a callback specified through the p_mcast_req
+* parameter.
+*
+* If the specified queue pair is already a member of a multicast group when
+* this call is invoked, an error will occur if there are conflicting
+* membership requirements. The QP is restricted to being bound to a single
+* port_guid and using a single pkey.
+*
+* SEE ALSO
+* ib_leave_mcast, ib_mcast_req_t, ib_create_qp, ib_init_dgrm_svc
+*****/
+
+
/****f* Access Layer/ib_leave_mcast
* NAME
* ib_leave_mcast
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20110210/cfdd04e6/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mcast.diff
Type: application/octet-stream
Size: 9446 bytes
Desc: mcast.diff
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20110210/cfdd04e6/attachment.obj>
More information about the ofw
mailing list