[openib-general] [PATCH] opensm: check port capabilities to join MC group.

Sasha Khapyorsky sashak at voltaire.com
Sun Feb 26 15:14:07 PST 2006


Hello,

As recently discussed on the list OpenSM does not check port's physical
MTU and rate during MC group joining process (only requested values).
This patch adds such checking.

Sasha.


This adds verification of endport physical capability to join MC group.

Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>

diff --git a/osm/opensm/osm_sa_mcmember_record.c b/osm/opensm/osm_sa_mcmember_record.c
index 8f785ff..1003916 100644
--- a/osm/opensm/osm_sa_mcmember_record.c
+++ b/osm/opensm/osm_sa_mcmember_record.c
@@ -677,6 +677,57 @@ __validate_more_comp_fields(
   return TRUE;
 }
 
+/*********************************************************************
+In joining an existing group, we make sure the following components
+are physically realizable: MTU and RATE
+**********************************************************************/
+static boolean_t
+__validate_port_caps(
+  osm_log_t * const p_log,
+  const osm_mgrp_t *p_mgrp,
+  const osm_physp_t *p_physp)
+{
+  ib_port_info_t *p_pi;
+  uint8_t mtu_required;
+  uint8_t mtu_mgrp;
+  uint8_t rate_required;
+  uint8_t rate_mgrp;
+
+  p_pi = osm_physp_get_port_info_ptr(p_physp);
+  if (!p_pi)
+  {
+    osm_log( p_log, OSM_LOG_DEBUG,
+            "__validate_port_caps: "
+            "Cannot get Port's 0x%016" PRIx64 " PortInfo\n",
+            osm_physp_get_port_guid(p_physp));
+    return FALSE;
+  }
+
+  mtu_required = ib_port_info_get_mtu_cap(p_pi);
+  mtu_mgrp = (uint8_t)(p_mgrp->mcmember_rec.mtu & 0x3F);
+  if (mtu_required < mtu_mgrp)
+  {
+    osm_log( p_log, OSM_LOG_DEBUG,
+            "__validate_port_caps: "
+            "Port's MTU %x is less than %x\n",
+             mtu_required, mtu_mgrp);
+    return FALSE;
+  }
+
+  rate_required = ib_port_info_compute_rate(p_pi);
+  rate_mgrp = (uint8_t)(p_mgrp->mcmember_rec.rate & 0x3F);
+  if (rate_required < rate_mgrp)
+  {
+    osm_log( p_log, OSM_LOG_DEBUG,
+            "__validate_port_caps: "
+            "Port's RATE %x is less than %x\n",
+             rate_required, rate_mgrp);
+    return FALSE;
+  }
+
+  return TRUE;
+}
+
 /**********************************************************************
  * o15-0.2.1: If SA supports UD multicast, then if SA receives a SubnAdmSet()
  * or SubnAdmDelete() method that would modify an existing
@@ -1641,13 +1692,17 @@ osm_mcmr_rcv_join_mgrp(
     p_rcv->p_log,
     p_mgrp,
     p_recvd_mcmember_rec,
-    p_sa_mad->comp_mask) && (join_state != 0);
+    p_sa_mad->comp_mask) && __validate_port_caps(
+    p_rcv->p_log,
+    p_mgrp,
+    p_physp) && (join_state != 0);
  
   if(!valid)
   {
     osm_log( p_rcv->p_log, OSM_LOG_ERROR,
              "osm_mcmr_rcv_join_mgrp: ERR 1B12: "
-             "__validate_more_comp_fields or JoinState = 0 failed, "
+             "__validate_more_comp_fields, __validate_port_caps "
+	     "or JoinState = 0 failed, "
              "sending IB_SA_MAD_STATUS_REQ_INVALID\n");
 
     /* since we might have created the new group we need to cleanup */



More information about the general mailing list