[openib-general] [PATCH] opensm: MTU/rate setup fixes in MCG creation
Sasha Khapyorsky
sashak at voltaire.com
Wed Mar 29 11:47:19 PST 2006
Hello,
There are fixes in MTU/rate verification/setup when MC Group is created.
Most of them were discussed in this thread:
http://openib.org/pipermail/openib-general/2006-March/018888.html
Sasha.
Fixes in MTU/rate verification/setup when MC Group is created.
Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
---
osm/opensm/osm_sa_mcmember_record.c | 176 +++++++++++++----------------------
1 files changed, 65 insertions(+), 111 deletions(-)
diff --git a/osm/opensm/osm_sa_mcmember_record.c b/osm/opensm/osm_sa_mcmember_record.c
index 78d8065..7ac60ef 100644
--- a/osm/opensm/osm_sa_mcmember_record.c
+++ b/osm/opensm/osm_sa_mcmember_record.c
@@ -1039,9 +1039,9 @@ __mgrp_request_is_realizable(
IN const osm_physp_t* const p_physp)
{
uint8_t mtu_sel;
- uint8_t mtu_required;
+ uint8_t mtu_required, mtu, port_mtu;
uint8_t rate_sel;
- uint8_t rate_required;
+ uint8_t rate_required, rate, port_rate;
osm_log_t *p_log = p_rcv->p_log;
ib_port_info_t *p_pi = NULL;
@@ -1060,158 +1060,112 @@ __mgrp_request_is_realizable(
*
* so we might also need to assign RATE/MTU if they are not comp masked in.
*/
- if (! (comp_mask & IB_MCR_COMPMASK_MTU))
- {
- p_mcm_rec->mtu = p_rcv->p_subn->min_ca_mtu;
- }
+
+ port_mtu = p_pi ? ib_port_info_get_mtu_cap(p_pi) : 0;
+ if (!(comp_mask & IB_MCR_COMPMASK_MTU) ||
+ !(comp_mask & IB_MCR_COMPMASK_MTU_SEL) ||
+ (mtu_sel = (p_mcm_rec->mtu >> 6)) == 3)
+ mtu = port_mtu ? port_mtu : p_rcv->p_subn->min_ca_mtu;
else
{
- /* we need to select an MTU based on the requested MTU and selector */
- if ( comp_mask & IB_MCR_COMPMASK_MTU_SEL)
- {
- mtu_sel = (uint8_t)(p_mcm_rec->mtu >> 6);
- }
- else
- {
- /* by default we assume an exact mtu is requested */
- mtu_sel = 2;
- }
-
- /* Clearing last 2 bits */
mtu_required = (uint8_t)(p_mcm_rec->mtu & 0x3F);
-
+ mtu = mtu_required;
switch (mtu_sel)
{
case 0: /* Greater than MTU specified */
- /* we provide the largest MTU possible if we can */
- if (mtu_required < p_rcv->p_subn->min_ca_mtu)
- {
- p_mcm_rec->mtu = p_rcv->p_subn->min_ca_mtu;
- }
- else
+ if (port_mtu && mtu_required >= port_mtu)
{
osm_log( p_log, OSM_LOG_DEBUG,
"__mgrp_request_is_realizable: "
- "Requested MTU %x >= the maximal possible:%x\n",
- mtu_required, p_rcv->p_subn->min_ca_mtu);
+ "Requested MTU %x >= the port\'s mtu:%x\n",
+ mtu_required, port_mtu);
return FALSE;
}
+ /* we provide the largest MTU possible if we can */
+ if (port_mtu)
+ mtu = port_mtu;
+ else if (mtu_required < p_rcv->p_subn->min_ca_mtu)
+ mtu = p_rcv->p_subn->min_ca_mtu;
+ else
+ mtu++;
break;
case 1: /* Less than MTU specified */
- /* if the requested MTU is not already the minimal, then we will
- use the smaller of the two:
+ /* 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 requester port and
- just use mtu one lower than 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--;
- }
+ b. the mtu of the requesting port (if exists) */
+ if (port_mtu && mtu_required > port_mtu)
+ mtu = port_mtu;
else
- {
- osm_log( p_log, OSM_LOG_DEBUG,
- "__mgrp_request_is_realizable: "
- "Can not obtain a lower MTU then the given one:%x\n",
- mtu_required);
- return FALSE;
- }
+ mtu--;
break;
case 2: /* Exactly MTU specified */
- /* make sure it is in the range */
- if (mtu_required < IB_MIN_MTU || mtu_required > IB_MAX_MTU)
- {
- osm_log( p_log, OSM_LOG_DEBUG,
- "__mgrp_request_is_realizable: "
- "Requested MTU %x is out of range\n",
- mtu_required);
- return FALSE;
- }
- break;
default:
break;
}
+ /* make sure it still be in the range */
+ if (mtu < IB_MIN_MTU || mtu > IB_MAX_MTU)
+ {
+ osm_log( p_log, OSM_LOG_DEBUG,
+ "__mgrp_request_is_realizable: "
+ "Calculated MTU %x is out of range\n",
+ mtu);
+ return FALSE;
+ }
}
+ p_mcm_rec->mtu = (mtu_sel<<6) | mtu;
- if (! (comp_mask & IB_MCR_COMPMASK_RATE))
- {
- p_mcm_rec->rate = p_rcv->p_subn->min_ca_rate;
- }
+ port_rate = p_pi ? ib_port_info_compute_rate(p_pi) : 0;
+ if (!(comp_mask & IB_MCR_COMPMASK_RATE) ||
+ !(comp_mask & IB_MCR_COMPMASK_RATE_SEL) ||
+ (rate_sel = (p_mcm_rec->rate >> 6)) == 3)
+ rate = port_rate ? port_rate : p_rcv->p_subn->min_ca_rate;
else
{
- /* we need to select an RATE based on the requested RATE and selector */
- if ( comp_mask & IB_MCR_COMPMASK_RATE_SEL)
- {
- rate_sel = (uint8_t)(p_mcm_rec->rate >> 6);
- }
- else
- {
- /* by default we assume an exact rate is requested */
- rate_sel = 2;
- }
-
- /* Clearing last 2 bits */
rate_required = (uint8_t)(p_mcm_rec->rate & 0x3F);
-
+ rate = rate_required;
switch (rate_sel)
{
case 0: /* Greater than RATE specified */
- /* we provide the largest RATE possible if we can */
- if (rate_required < p_rcv->p_subn->min_ca_rate)
- {
- p_mcm_rec->rate = p_rcv->p_subn->min_ca_rate;
- }
- else
+ if (port_rate && rate_required >= port_rate)
{
osm_log( p_log, OSM_LOG_DEBUG,
"__mgrp_request_is_realizable: "
- "Requested RATE %x >= the maximal possible:%x\n",
- rate_required, p_rcv->p_subn->min_ca_rate);
+ "Requested RATE %x >= the port\'s rate:%x\n",
+ rate_required, port_rate);
return FALSE;
}
+ /* we provide the largest RATE possible if we can */
+ if (port_rate)
+ rate = port_rate;
+ else if (rate_required < p_rcv->p_subn->min_ca_rate)
+ rate = p_rcv->p_subn->min_ca_rate;
+ else
+ rate++;
break;
case 1: /* Less than RATE specified */
- /* if the requested RATE is not already the minimal, then we will
- use the smaller of the two:
+ /* 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 requester port and
- just use rate one lower than 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--;
- }
+ b. the rate of the requesting port (if exists) */
+ if (port_rate && rate_required > port_rate)
+ rate = port_rate;
else
- {
- osm_log( p_log, OSM_LOG_DEBUG,
- "__mgrp_request_is_realizable: "
- "Can not obtain a lower RATE then the given one:%x\n",
- rate_required);
- return FALSE;
- }
+ rate--;
break;
case 2: /* Exactly RATE specified */
- /* make sure it is in the range */
- if (rate_required < IB_MIN_RATE || rate_required > IB_MAX_RATE)
- {
- osm_log( p_log, OSM_LOG_DEBUG,
- "__mgrp_request_is_realizable: "
- "Requested RATE %x is out of range\n",
- rate_required);
- return FALSE;
- }
- break;
default:
break;
}
+ /* make sure it still be in the range */
+ if (rate < IB_MIN_RATE || rate > IB_MAX_RATE)
+ {
+ osm_log( p_log, OSM_LOG_DEBUG,
+ "__mgrp_request_is_realizable: "
+ "Calculated RATE %x is out of range\n",
+ rate);
+ return FALSE;
+ }
}
+ p_mcm_rec->rate = (rate_sel<<6) | rate;
OSM_LOG_EXIT( p_rcv->p_log );
return TRUE;
More information about the general
mailing list