[ofa-general] [PATCH] opensm/osm_sa_(multi)path_record: various fixes
Sasha Khapyorsky
sashak at voltaire.com
Wed Sep 19 12:31:00 PDT 2007
Couple of similar fixes for osm_sa_path_record.c and
osm_sa_multipath_record.c - mostly related to using yet not initialized
variables.
Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
---
opensm/opensm/osm_sa_multipath_record.c | 27 ++++++++++++---------------
opensm/opensm/osm_sa_path_record.c | 25 ++++++++++---------------
2 files changed, 22 insertions(+), 30 deletions(-)
diff --git a/opensm/opensm/osm_sa_multipath_record.c b/opensm/opensm/osm_sa_multipath_record.c
index a94a943..efc6a07 100644
--- a/opensm/opensm/osm_sa_multipath_record.c
+++ b/opensm/opensm/osm_sa_multipath_record.c
@@ -226,7 +226,7 @@ __osm_mpr_rcv_get_path_parms(IN osm_mpr_rcv_t * const p_rcv,
const osm_physp_t *p_physp;
const osm_physp_t *p_src_physp;
const osm_physp_t *p_dest_physp;
- const osm_prtn_t *p_prtn;
+ const osm_prtn_t *p_prtn = NULL;
const ib_port_info_t *p_pi;
ib_slvl_table_t *p_slvl_tbl;
ib_api_status_t status = IB_SUCCESS;
@@ -494,10 +494,6 @@ __osm_mpr_rcv_get_path_parms(IN osm_mpr_rcv_t * const p_rcv,
&& (rate > p_qos_level->rate_limit))
rate = p_qos_level->rate_limit;
- if (p_qos_level->pkt_life_set
- && (pkt_life > p_qos_level->pkt_life))
- pkt_life = p_qos_level->pkt_life;
-
if (p_qos_level->sl_set) {
required_sl = p_qos_level->sl;
if (!(valid_sl_mask & (1 << required_sl))) {
@@ -505,14 +501,6 @@ __osm_mpr_rcv_get_path_parms(IN osm_mpr_rcv_t * const p_rcv,
goto Exit;
}
}
-
- if (osm_log_is_active(p_rcv->p_log, OSM_LOG_DEBUG))
- osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
- "__osm_mpr_rcv_get_path_parms: "
- "MultiPath params with QoS constaraints: "
- "min MTU = %u, min rate = %u, "
- "packet lifetime = %u, sl = %u\n",
- mtu, rate, pkt_life, required_sl);
}
/*
@@ -608,7 +596,9 @@ __osm_mpr_rcv_get_path_parms(IN osm_mpr_rcv_t * const p_rcv,
for loopback paths, packetLifeTime shall be zero. */
if (p_src_port == p_dest_port)
pkt_life = 0; /* loopback */
- else if (!(p_qos_level && p_qos_level->pkt_life_set))
+ else if (p_qos_level && p_qos_level->pkt_life_set)
+ pkt_life = p_qos_level->pkt_life;
+ else
pkt_life = OSM_DEFAULT_SUBNET_TIMEOUT;
/* we silently ignore cases where only the PktLife selector is defined */
@@ -783,13 +773,13 @@ __osm_mpr_rcv_get_path_parms(IN osm_mpr_rcv_t * const p_rcv,
required_pkey &
cl_ntoh16((uint16_t) ~ 0x8000));
if (!p_prtn) {
+ required_sl = OSM_DEFAULT_SL;
/* this may be possible when pkey tables are created somehow in
previous runs or things are going wrong here */
osm_log(p_rcv->p_log, OSM_LOG_ERROR,
"__osm_mpr_rcv_get_path_parms: ERR 451A: "
"No partition found for PKey 0x%04x - using default SL %d\n",
cl_ntoh16(required_pkey), required_sl);
- required_sl = OSM_DEFAULT_SL;
} else
required_sl = p_prtn->sl;
@@ -825,6 +815,13 @@ __osm_mpr_rcv_get_path_parms(IN osm_mpr_rcv_t * const p_rcv,
p_parms->sl = required_sl;
p_parms->hops = hops;
+ if (osm_log_is_active(p_rcv->p_log, OSM_LOG_DEBUG))
+ osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+ "__osm_mpr_rcv_get_path_parms: MultiPath params:"
+ " mtu = %u, rate = %u, packet lifetime = %u,"
+ " pkey = %u, sl = %u, hops = %u\n", mtu, rate,
+ pkt_life, cl_ntoh16(required_pkey), required_sl, hops);
+
Exit:
OSM_LOG_EXIT(p_rcv->p_log);
return (status);
diff --git a/opensm/opensm/osm_sa_path_record.c b/opensm/opensm/osm_sa_path_record.c
index 5e06f75..3b183d9 100644
--- a/opensm/opensm/osm_sa_path_record.c
+++ b/opensm/opensm/osm_sa_path_record.c
@@ -487,7 +487,6 @@ __osm_pr_rcv_get_path_parms(IN osm_pr_rcv_t * const p_rcv,
osm_qos_policy_get_qos_level_by_pr(p_rcv->p_subn->p_qos_policy,
p_pr, p_src_physp, p_dest_physp,
comp_mask))) {
-
if (osm_log_is_active(p_rcv->p_log, OSM_LOG_DEBUG))
osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
"__osm_pr_rcv_get_path_parms: "
@@ -504,10 +503,6 @@ __osm_pr_rcv_get_path_parms(IN osm_pr_rcv_t * const p_rcv,
&& (rate > p_qos_level->rate_limit))
rate = p_qos_level->rate_limit;
- if (p_qos_level->pkt_life_set
- && (pkt_life > p_qos_level->pkt_life))
- pkt_life = p_qos_level->pkt_life;
-
if (p_qos_level->sl_set) {
sl = p_qos_level->sl;
if (!(valid_sl_mask & (1 << sl))) {
@@ -515,14 +510,6 @@ __osm_pr_rcv_get_path_parms(IN osm_pr_rcv_t * const p_rcv,
goto Exit;
}
}
-
- if (osm_log_is_active(p_rcv->p_log, OSM_LOG_DEBUG))
- osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
- "__osm_pr_rcv_get_path_parms: "
- "Path params with QoS constaraints: "
- "min MTU = %u, min rate = %u, "
- "packet lifetime = %u, sl = %u\n",
- mtu, rate, pkt_life, sl);
}
/*
@@ -533,7 +520,9 @@ __osm_pr_rcv_get_path_parms(IN osm_pr_rcv_t * const p_rcv,
*/
if (p_src_port == p_dest_port)
pkt_life = 0;
- else if (!(p_qos_level && p_qos_level->pkt_life_set))
+ else if (p_qos_level && p_qos_level->pkt_life_set)
+ pkt_life = p_qos_level->pkt_life;
+ else
pkt_life = OSM_DEFAULT_SUBNET_TIMEOUT;
/*
@@ -803,13 +792,13 @@ __osm_pr_rcv_get_path_parms(IN osm_pr_rcv_t * const p_rcv,
* No specific SL in request or in QoS level - use partition SL
*/
if (!p_prtn) {
+ sl = OSM_DEFAULT_SL;
/* this may be possible when pkey tables are created somehow in
previous runs or things are going wrong here */
osm_log(p_rcv->p_log, OSM_LOG_ERROR,
"__osm_pr_rcv_get_path_parms: ERR 1F1C: "
"No partition found for PKey 0x%04x - using default SL %d\n",
cl_ntoh16(pkey), sl);
- sl = OSM_DEFAULT_SL;
} else
sl = p_prtn->sl;
} else if (p_rcv->p_subn->opt.qos) {
@@ -843,6 +832,12 @@ __osm_pr_rcv_get_path_parms(IN osm_pr_rcv_t * const p_rcv,
p_parms->pkey = pkey;
p_parms->sl = sl;
+ if (osm_log_is_active(p_rcv->p_log, OSM_LOG_DEBUG))
+ osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+ "__osm_pr_rcv_get_path_parms: Path params:"
+ " mtu = %u, rate = %u, packet lifetime = %u,"
+ " pkey = %u, sl = %u\n",
+ mtu, rate, pkt_life, cl_ntoh16(pkey), sl);
Exit:
OSM_LOG_EXIT(p_rcv->p_log);
return (status);
--
1.5.3.rc2.29.gc4640f
More information about the general
mailing list