[openib-general] [PATCH 12/13] osm: port to WinIB stack : opensm/osm_qos.c

Eitan Zahavi eitan at mellanox.co.il
Sun Sep 17 09:00:33 PDT 2006


Hi Hal

Port num is uint8_t (avoid casting by using correct size field).
Added some explicit casts

Thanks

Eitan

Signed-off-by:  Eitan Zahavi <eitan at mellanox.co.il>

Index: opensm/osm_qos.c
===================================================================
--- opensm/osm_qos.c	(revision 9502)
+++ opensm/osm_qos.c	(working copy)
@@ -70,7 +70,7 @@ static void qos_build_config(struct qos_
  */
 static ib_api_status_t vlarb_update_table_block(osm_req_t * p_req,
 						osm_physp_t * p,
-						unsigned port_num,
+						uint8_t port_num,
 						const ib_vl_arb_table_t *table_block,
 						unsigned block_length,
 						unsigned block_num)
@@ -80,7 +80,7 @@ static ib_api_status_t vlarb_update_tabl
 	uint32_t attr_mod;
 	ib_port_info_t *p_pi;
 	unsigned vl_mask;
-	int i;
+	unsigned int i;
 
 	if (!(p_pi = osm_physp_get_port_info_ptr(p)))
 		return IB_ERROR;
@@ -110,7 +110,7 @@ static ib_api_status_t vlarb_update_tabl
 }
 
 static ib_api_status_t vlarb_update(osm_req_t * p_req,
-				    osm_physp_t * p, unsigned port_num,
+				    osm_physp_t * p, uint8_t port_num,
 				    const struct qos_config *qcfg)
 {
 	ib_api_status_t status = IB_SUCCESS;
@@ -198,11 +198,11 @@ static ib_api_status_t sl2vl_update_tabl
 }
 
 static ib_api_status_t sl2vl_update(osm_req_t * p_req, osm_port_t * p_port,
-				    osm_physp_t * p, unsigned port_num,
+				    osm_physp_t * p, uint8_t port_num,
 				    const struct qos_config *qcfg)
 {
 	ib_api_status_t status;
-	unsigned i, num_ports;
+	uint8_t i, num_ports;
 	ib_port_info_t *p_pi = osm_physp_get_port_info_ptr(p);
 	osm_physp_t *p_physp;
 
@@ -273,7 +273,7 @@ static ib_api_status_t vl_high_limit_upd
 
 static ib_api_status_t qos_physp_setup(osm_log_t * p_log, osm_req_t * p_req,
 				       osm_port_t * p_port, osm_physp_t * p,
-				       unsigned port_num,
+				       uint8_t port_num,
 				       const struct qos_config *qcfg)
 {
 	ib_api_status_t status;
@@ -329,7 +329,7 @@ osm_signal_t osm_qos_setup(osm_opensm_t 
 	osm_physp_t *p_physp;
 	uint8_t node_type;
 	ib_api_status_t status;
-	uint32_t i;
+	uint8_t i;
 
 	if (p_osm->subn.opt.no_qos)
 		return OSM_SIGNAL_DONE;
@@ -411,7 +411,7 @@ static int parse_vlarb_entry(char *str, 
 	p += parse_one_unsigned(p, ':', &val);
 	e->vl = val % 15;
 	p += parse_one_unsigned(p, ',', &val);
-	e->weight = val;
+	e->weight = (uint8_t)val;
 	return p - str;
 }
 
@@ -434,7 +434,7 @@ static void qos_build_config(struct qos_
 	memset(cfg, 0, sizeof(*cfg));
 
 	cfg->max_vls = opt->max_vls > 0 ? opt->max_vls : dflt->max_vls;
-	cfg->vl_high_limit = opt->high_limit;
+	cfg->vl_high_limit = (uint8_t)opt->high_limit;
 
 	p = opt->vlarb_high ? opt->vlarb_high : dflt->vlarb_high;
 	for (i = 0; i < 2 * IB_NUM_VL_ARB_ELEMENTS_IN_BLOCK; i++) {





More information about the general mailing list