[ofa-general] [PATCH 3/3] opensm: Fixing broken logic in 'process world' part of LinkRecord processing
Yevgeny Kliteynik
kliteyn at dev.mellanox.co.il
Sun Dec 2 04:16:21 PST 2007
Fixing broken logic in 'process world' part of LinkRecord processing.
When both HCA's ports belong to the same subnet, OpenSM would scan
'half-world' for each port of this HCA, and then for each port it would
get the node and iterate again through all the ports of this node.
In addition to the time consumed by these unnecessary iterations, it
also caused some records to be found twice.
Signed-off-by: Yevgeny Kliteynik <kliteyn at dev.mellanox.co.il>
---
opensm/opensm/osm_sa_link_record.c | 37 ++++++++++++++++++++++-------------
1 files changed, 23 insertions(+), 14 deletions(-)
diff --git a/opensm/opensm/osm_sa_link_record.c b/opensm/opensm/osm_sa_link_record.c
index 0970ad7..6ebf3d0 100644
--- a/opensm/opensm/osm_sa_link_record.c
+++ b/opensm/opensm/osm_sa_link_record.c
@@ -300,7 +300,8 @@ __osm_lr_rcv_get_port_links(IN osm_lr_rcv_t * const p_rcv,
{
const osm_physp_t *p_src_physp;
const osm_physp_t *p_dest_physp;
- const cl_qmap_t *p_port_tbl;
+ const cl_qmap_t *p_node_tbl;
+ osm_node_t * p_node;
uint8_t port_num;
uint8_t num_ports;
uint8_t dest_num_ports;
@@ -417,19 +418,27 @@ __osm_lr_rcv_get_port_links(IN osm_lr_rcv_t * const p_rcv,
/*
Process the world (recurse once back into this function).
*/
- p_port_tbl = &p_rcv->p_subn->port_guid_tbl;
- p_src_port = (osm_port_t *) cl_qmap_head(p_port_tbl);
-
- while (p_src_port !=
- (osm_port_t *) cl_qmap_end(p_port_tbl)) {
- __osm_lr_rcv_get_port_links(p_rcv, p_lr,
- p_src_port, NULL,
- comp_mask, p_list,
- p_req_physp);
-
- p_src_port =
- (osm_port_t *) cl_qmap_next(&p_src_port->
- map_item);
+ p_node_tbl = &p_rcv->p_subn->node_guid_tbl;
+ p_node = (osm_node_t *)cl_qmap_head(p_node_tbl);
+
+ while (p_node != (osm_node_t *)cl_qmap_end(p_node_tbl)) {
+ /*
+ Get only one port for each node.
+ After the recursive call, this function will
+ scan all the ports of this node anyway.
+ */
+ p_src_physp = osm_node_get_any_physp_ptr(p_node);
+ if (osm_physp_is_valid(p_src_physp)) {
+ p_src_port = (osm_port_t *)
+ cl_qmap_get(&p_rcv->p_subn->port_guid_tbl,
+ osm_physp_get_port_guid(p_src_physp));
+ __osm_lr_rcv_get_port_links(p_rcv, p_lr,
+ p_src_port, NULL,
+ comp_mask, p_list,
+ p_req_physp);
+ }
+ p_node = (osm_node_t *) cl_qmap_next(&p_node->
+ map_item);
}
}
}
--
1.5.1.4
More information about the general
mailing list