[openib-general] [PATCH] OpenSM - check port capabilities to create MC group-#2

Yael Kalka yael at mellanox.co.il
Sun Mar 5 05:21:06 PST 2006


Hi Hal,

This is the fixed patch (Sasha's comment).

After checking in Sasha's patch regarding the port capabilities for
joining MC group, and doing some testing here, we've noticed the
following problem:
Currently, when requesting to create MC group with MTU(rate) selector
1 (meaning less than rate specified), the MC group is created with
MTU(rate) requested - 1. This is without checking the MTU(rate) of the
port requesting the creation of the multicast group. 
This means that if, for example, port with MTU=2 sends a request for
MC group creation with MTU selector=1 and MTU=5, Opensm will try to
create a MC group with MTU=4, and fail, since the port capabilities
are not realizable.
The following patch adds creation of the MC group with MTU(rate) that
also takes into account the MTU(rate) of the port requesting the creation.

Thanks,
Yael

Signed-off-by:  Yael Kalka <yael at mellanox.co.il>

Index: include/opensm/osm_sa_mcmember_record.h
===================================================================
--- include/opensm/osm_sa_mcmember_record.h	(revision 5608)
+++ include/opensm/osm_sa_mcmember_record.h	(working copy)
@@ -294,6 +294,7 @@ osm_mcmr_rcv_create_new_mgrp(
 									  IN osm_mcmr_recv_t* const p_mcmr,
 									  IN uint64_t comp_mask,
 									  IN const ib_member_rec_t* const p_recvd_mcmember_rec, 
+                             IN const osm_physp_t* const p_req_physp,
 									  OUT osm_mgrp_t **pp_mgrp);
 /*
 * PARAMETERS
@@ -302,6 +303,10 @@ osm_mcmr_rcv_create_new_mgrp(
 *	p_recvd_mcmember_rec
 *		[in] Received Multicast member record
 *
+*  p_req_physp
+*     [in] The requesting osm_physp_t object. 
+*     NULL if the creation is without a requesting port (e.g - ipoib known mcgroups)
+*
 *	pp_mgrp
 *		[out] pointer the osm_mgrp_t object
 *		
Index: opensm/osm_sa.c
===================================================================
--- opensm/osm_sa.c	(revision 5608)
+++ opensm/osm_sa.c	(working copy)
@@ -591,6 +591,7 @@ osm_sa_add_well_known_mc_record(
     p_mcmr,
     comp_mask,
     p_well_know_mc_rec,
+    NULL,
     &p_mgrp);
   if(p_mgrp)
   {
Index: opensm/osm_sa_mcmember_record.c
===================================================================
--- opensm/osm_sa_mcmember_record.c	(revision 5608)
+++ opensm/osm_sa_mcmember_record.c	(working copy)
@@ -1034,15 +1034,20 @@ boolean_t
 __mgrp_request_is_realizable(
   IN osm_mcmr_recv_t* const p_rcv,
   IN ib_net64_t comp_mask,
-  IN ib_member_rec_t * p_mcm_rec)
+  IN ib_member_rec_t * p_mcm_rec,
+  IN const osm_physp_t* const p_physp)
 {
   uint8_t mtu_sel;
   uint8_t mtu_required;
   uint8_t rate_sel;
   uint8_t rate_required;
   osm_log_t *p_log = p_rcv->p_log;
+  ib_port_info_t *p_pi = NULL;
 
-  OSM_LOG_ENTER( p_rcv->p_log,  __mgrp_request_is_realizable);
+  OSM_LOG_ENTER( p_rcv->p_log,  __mgrp_request_is_realizable;)
+
+   if (p_physp != NULL)
+      p_pi = osm_physp_get_port_info_ptr(p_physp);
 
   /*
    * End of o15-0.1.6 specifies:
@@ -1092,10 +1097,17 @@ __mgrp_request_is_realizable(
       }
       break;
     case 1: /* Less than MTU specified */
-      /* if the requested MTU is not already the minimal we just
-         use one lower */
+      /* if the requested MTU is not already the minimal, then we will
+         use the smaller of the two:
+         a. one lower then the required
+         b. the mtu of the requesting port
+         If the p_pi is NULL - this means there is no requestor port, then
+         just use mtu one lower then the required. */
       if ( mtu_required > 1 )
       {
+        if (p_pi && ib_port_info_get_mtu_cap(p_pi) < (mtu_required - 1))
+          p_mcm_rec->mtu = (mtu_sel<<6) | ib_port_info_get_mtu_cap(p_pi);
+        else
         p_mcm_rec->mtu--;
       }
       else
@@ -1161,10 +1173,18 @@ __mgrp_request_is_realizable(
       }
       break;
     case 1: /* Less than RATE specified */
-      /* if the requested RATE is not already the minimal we just
-         use one lower */
+      /* if the requested RATE is not already the minimal, then we will
+         use the smaller of the two:
+         a. one lower then the required
+         b. the rate of the requesting port
+         If the p_pi is NULL - this means there is no requestor port, then
+         just use rate one lower then the required. */
+      
       if ( rate_required > 2 )
       {
+        if (p_pi && ib_port_info_compute_rate(p_pi) < (rate_required - 1))
+          p_mcm_rec->rate = (rate_sel<<6) | ib_port_info_compute_rate(p_pi);
+        else
         p_mcm_rec->rate--;
       }
       else
@@ -1204,6 +1224,7 @@ osm_mcmr_rcv_create_new_mgrp(
   IN osm_mcmr_recv_t* const p_rcv,
   IN ib_net64_t comp_mask,
   IN const ib_member_rec_t* const p_recvd_mcmember_rec,
+  IN const osm_physp_t* const p_physp,
   OUT osm_mgrp_t **pp_mgrp)
 {
   ib_net16_t mlid;
@@ -1301,7 +1322,7 @@ osm_mcmr_rcv_create_new_mgrp(
   }
 
   /* check the requested parameters are realizable */
-  if (__mgrp_request_is_realizable(p_rcv, comp_mask, &mcm_rec) == FALSE)
+  if (__mgrp_request_is_realizable(p_rcv, comp_mask, &mcm_rec, p_physp) == FALSE)
   {
     osm_log( p_rcv->p_log, OSM_LOG_ERROR,
              "osm_mcmr_rcv_create_new_mgrp: ERR 1B26: "
@@ -1623,6 +1644,7 @@ osm_mcmr_rcv_join_mgrp(
       status = osm_mcmr_rcv_create_new_mgrp(p_rcv,
                                             p_sa_mad->comp_mask,
                                             p_recvd_mcmember_rec,
+                                            p_physp,
                                             &p_mgrp);
       if (status != IB_SUCCESS)
       {




More information about the general mailing list