[ofa-general] Re: [PATCH OpenSM 3/3] Added possible reverse hops for Ftree algorithm.

Sasha Khapyorsky sashak at voltaire.com
Sat Feb 7 10:47:25 PST 2009


On 14:44 Thu 18 Dec     , Nicolas Morey Chaisemartin wrote:
>
> Signed-off-by: Nicolas Morey-Chaisemartin 
> <nicolas.morey-chaisemartin at ext.bull.net>
> ---
>  opensm/opensm/osm_ucast_ftree.c |  102 
> ++++++++++++++++++++++++++++++++-------
>  1 files changed, 85 insertions(+), 17 deletions(-)

> diff --git a/opensm/opensm/osm_ucast_ftree.c b/opensm/opensm/osm_ucast_ftree.c
> index c24c517..d4d3e70 100644
> --- a/opensm/opensm/osm_ucast_ftree.c
> +++ b/opensm/opensm/osm_ucast_ftree.c
> @@ -2131,7 +2131,8 @@ __osm_ftree_fabric_route_downgoing_by_going_up(IN ftree_fabric_t * p_ftree,
>  					       IN ib_net16_t target_lid,
>  					       IN uint8_t target_rank,
>  					       IN boolean_t is_real_lid,
> -					       IN boolean_t is_main_path)
> +					       IN boolean_t is_main_path,
> +					       IN uint16_t reverse_hop_credit)
>  {
>  	ftree_sw_t *p_remote_sw;
>  	uint16_t ports_num;
> @@ -2155,8 +2156,36 @@ __osm_ftree_fabric_route_downgoing_by_going_up(IN ftree_fabric_t * p_ftree,
>  						       p_sw->rank);	/* the highest visited point in the tree before going down */
>  
>  	/* recursion stop condition - if it's a root switch, */
> -	if (p_sw->rank == 0)
> -		return;
> +	if (p_sw->rank == 0){
> +              if(reverse_hop_credit>0){

	if (p_sw->rank == 0 && reverse_hop_credit > 0) {
		...

> +                     /* We go up by going down as we have some reverse_hop_credit left*/
> +                     /* We use the index to scatter a bit the reverse up routes */
> +                     p_sw->down_port_groups_idx =
> +                            (p_sw->down_port_groups_idx + 1) % p_sw->down_port_groups_num;
> +                     i=p_sw->down_port_groups_idx;
> +                     for (j = 0; j < p_sw->down_port_groups_num; j++) {
> +
> +                            p_group = p_sw->down_port_groups[i];
> +                            i = (i + 1) % p_sw->down_port_groups_num;
> +
> +                            /* Skip this port group unless it points to a switch */
> +                            if (p_group->remote_node_type != IB_NODE_TYPE_SWITCH)
> +                                   continue;
> +                            p_remote_sw = p_group->remote_hca_or_sw.p_sw;
> +
> +                            __osm_ftree_fabric_route_downgoing_by_going_up(p_ftree, p_remote_sw,	/* remote switch - used as a route-downgoing alg. next step point */
> +                                                                           p_sw,	/* this switch - prev. position switch for the function */
> +                                                                           target_lid,	/* LID that we're routing to */
> +                                                                           target_rank,	/* rank of the LID that we're routing to */
> +                                                                           is_real_lid,	/* whether this target LID is real or dummy */
> +                                                                           is_main_path,reverse_hop_credit-1);	/* whether this is path to HCA that should by tracked by counters */
> +                            return;
> +                     }
> +
> +              }
> +              return;
> +	}
> +
>  
>  	/* Find the least loaded upgoing port group */
>  	p_min_group = NULL;
> @@ -2242,14 +2271,17 @@ __osm_ftree_fabric_route_downgoing_by_going_up(IN ftree_fabric_t * p_ftree,
>  		p_min_group->counter_down++;
>  		p_min_port->counter_down++;
>  		if (is_real_lid) {
> -			p_remote_sw->p_osm_sw->new_lft[cl_ntoh16(target_lid)] =
> -				p_min_port->remote_port_num;
> -			OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_DEBUG,
> -				"Switch %s: set path to CA LID %u through port %u\n",
> -				__osm_ftree_tuple_to_str(p_remote_sw->tuple),
> -				cl_ntoh16(target_lid),
> -				p_min_port->remote_port_num);
> -
> +			/* This LID may already be in the LFT in the reverse_hop feature is used */
> +			/* We update the LFT only if this LID isn't already present. */
> +			if(p_remote_sw->p_osm_sw->new_lft[cl_ntoh16(target_lid)] == OSM_NO_PATH) {
> +				p_remote_sw->p_osm_sw->new_lft[cl_ntoh16(target_lid)] =
> +					p_min_port->remote_port_num;
> +				OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_DEBUG,
> +					"Switch %s: set path to CA LID %u through port %u\n",
> +					__osm_ftree_tuple_to_str(p_remote_sw->tuple),
> +					cl_ntoh16(target_lid),
> +					p_min_port->remote_port_num);
> +			}
>  			/* On the remote switch that is pointed by the min_group,
>  			   set hops for ALL the ports in the remote group. */
>  
> @@ -2274,7 +2306,8 @@ __osm_ftree_fabric_route_downgoing_by_going_up(IN ftree_fabric_t * p_ftree,
>  							       target_lid,	/* LID that we're routing to */
>  							       target_rank,	/* rank of the LID that we're routing to */
>  							       is_real_lid,	/* whether this target LID is real or dummy */
> -							       is_main_path);	/* whether this is path to HCA that should by tracked by counters */
> +                                                               is_main_path,	/* whether this is path to HCA that should by tracked by counters */
> +							       reverse_hop_credit);
>  	}
>  
>  	/* we're done for the third case */
> @@ -2360,9 +2393,39 @@ __osm_ftree_fabric_route_downgoing_by_going_up(IN ftree_fabric_t * p_ftree,
>  							       target_lid,	/* LID that we're routing to */
>  							       target_rank,	/* rank of the LID that we're routing to */
>  							       TRUE,	/* whether the target LID is real or dummy */
> -							       FALSE);	/* whether this is path to HCA that should by tracked by counters */
> +                                                               FALSE,reverse_hop_credit);	/* whether this is path to HCA that should by tracked by counters */
>  	}
>  
> +
> +       /* If we don't have any reverse hop credits, we are done */
> +       if(reverse_hop_credit==0)
> +              return;
> +
> +       /* We explore all the down group ports */
> +       /* We try to reverse jump for each of them */
> +       /* They already have a route to us from the upgoing_by_going_down started earlier */
> +       /* This is only so it'll continue exploring up, after this step backwards*/
> +	for (i = 0; i < p_sw->down_port_groups_num; i++) {
> +		p_group = p_sw->down_port_groups[i];
> +		p_remote_sw = p_group->remote_hca_or_sw.p_sw;
> +
> +
> +              /* Skip this port group unless it points to a switch */
> +              if (p_group->remote_node_type != IB_NODE_TYPE_SWITCH)
> +                     continue;
> +
> +
> +		/* Recursion step:
> +		   Assign downgoing ports by stepping up, fter doing one step down starting on REMOTE switch. */
> +		__osm_ftree_fabric_route_downgoing_by_going_up(p_ftree, p_remote_sw,	/* remote switch - used as a route-downgoing alg. next step point */
> +							       p_sw,	/* this switch - prev. position switch for the function */
> +							       target_lid,	/* LID that we're routing to */
> +							       target_rank,	/* rank of the LID that we're routing to */
> +							       TRUE,	/* whether the target LID is real or dummy */
> +                                                               TRUE,reverse_hop_credit-1);	/* whether this is path to HCA that should by tracked by counters */
> +	}
> +
> +
>  }				/* ftree_fabric_route_downgoing_by_going_up() */
>  
>  /***************************************************/
> @@ -2448,7 +2511,7 @@ static void __osm_ftree_fabric_route_to_cns(IN ftree_fabric_t * p_ftree)
>  								       hca_lid,	/* LID that we're routing to */
>  								       p_sw->rank + 1,	/* rank of the LID that we're routing to */
>  								       TRUE,	/* whether this HCA LID is real or dummy */
> -								       TRUE);	/* whether this path to HCA should by tracked by counters */
> +                                                                       TRUE,0);	/* whether this path to HCA should by tracked by counters */
>  
>  			/* count how many real targets have been routed from this leaf switch */
>  			routed_targets_on_leaf++;
> @@ -2473,7 +2536,7 @@ static void __osm_ftree_fabric_route_to_cns(IN ftree_fabric_t * p_ftree)
>  									       0,	/* LID that we're routing to - ignored for dummy HCA */
>  									       0,	/* rank of the LID that we're routing to - ignored for dummy HCA */
>  									       FALSE,	/* whether this HCA LID is real or dummy */
> -									       TRUE);	/* whether this path to HCA should by tracked by counters */
> +                                                                               TRUE,0);	/* whether this path to HCA should by tracked by counters */
>  			}
>  		}
>  	}
> @@ -2558,7 +2621,8 @@ static void __osm_ftree_fabric_route_to_non_cns(IN ftree_fabric_t * p_ftree)
>  								       hca_lid,	/* LID that we're routing to */
>  								       p_sw->rank + 1,	/* rank of the LID that we're routing to */
>  								       TRUE,	/* whether this HCA LID is real or dummy */
> -								       TRUE);	/* whether this path to HCA should by tracked by counters */
> +                                                                       TRUE, 	/* whether this path to HCA should by tracked by counters */
> +                                                                       p_hca_port_group->is_io ? p_ftree->p_osm->subn.opt.max_reverse_hops :0  ); /* Number or reverse hops allowed*/
>  		}
>  		/* done with all the port groups of this HCA - go to next HCA */
>  	}
> @@ -2610,7 +2674,7 @@ static void __osm_ftree_fabric_route_to_switches(IN ftree_fabric_t * p_ftree)
>  							       p_sw->base_lid,	/* LID that we're routing to */
>  							       p_sw->rank,	/* rank of the LID that we're routing to */
>  							       TRUE,	/* whether the target LID is a real or dummy */
> -							       FALSE);	/* whether this path should by tracked by counters */
> +                                                        FALSE,0);	/* whether this path should by tracked by counters */
>  	}
>  
>  	OSM_LOG_EXIT(&p_ftree->p_osm->log);
> @@ -3432,6 +3496,8 @@ static int __osm_ftree_fabric_read_guid_files(IN ftree_fabric_t * p_ftree)
>  		if (parse_node_map(p_ftree->p_osm->subn.opt.cn_guid_file,
>  				   add_guid_item_to_map,
>  				   &p_ftree->cn_guid_tbl)) {
> +			OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_ERROR, "ERR AB23: "
> +				"Problem parsin CN guid file\n");
>  			status = -1;
>  			goto Exit;
>  		}
> @@ -3453,6 +3519,8 @@ static int __osm_ftree_fabric_read_guid_files(IN ftree_fabric_t * p_ftree)
>  		if (parse_node_map(p_ftree->p_osm->subn.opt.io_guid_file,
>  				   add_guid_item_to_map,
>  				   &p_ftree->io_guid_tbl)) {
> +			OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_ERROR, "ERR AB23: "
> +				"Problem parsin I/O guid file\n");

"ERR AB**" codes should be unique.

Sasha

>  			status = -1;
>  			goto Exit;
>  		}
> 




More information about the general mailing list