Eliminate redundant calls to ib_port_info_compute_rate
PATCH 2/2 Eliminate redundant calls to ib_port_info_compute_rate
From: Shlomi Nimrodi <shlomin-VPRAkNaXOzVWk0Htik3J/[email protected]>
--- opensm/osm_sa_multipath_record.c | 23 ++++++++++------------- opensm/osm_sa_path_record.c | 23 ++++++++++------------- 2 files changed, 20 insertions(+), 26 deletions(-)
opensm/osm_sa_multipath_record.c +10 -13
@@ -152,7 +152,7 @@ static ib_api_status_t mpr_rcv_get_path_parms(IN osm_sa_t * sa,ib_slvl_table_t *p_slvl_tbl;ib_api_status_t status =IB_SUCCESS ;uint8_t mtu; -uint8_t rate; +uint8_t rate, p0_extended_rate, dest_rate;uint8_t pkt_life;uint8_t required_mtu;uint8_t required_rate;
@@ -355,10 +355,9 @@ static ib_api_status_t mpr_rcv_get_path_parms(IN osm_sa_t * sa, p_physp0 =osm_node_get_physp_ptr ((osm_node_t *)p_node,0 ); p_pi0 = &p_physp0->port_info; p0_extended = p_pi0->capability_mask &IB_PORT_CAP_HAS_EXT_SPEEDS ; -if (ib_path_compare_rates (rate, -ib_port_info_compute_rate (p_pi, - p0_extended)) >0 ) - rate =ib_port_info_compute_rate (p_pi, p0_extended); + p0_extended_rate =ib_port_info_compute_rate (p_pi, p0_extended); +if (ib_path_compare_rates (rate, p0_extended_rate) >0 ) + rate = p0_extended_rate;/* Continue with the egress port on this switch.
@@ -383,10 +382,9 @@ static ib_api_status_t mpr_rcv_get_path_parms(IN osm_sa_t * sa, p_physp0 =osm_node_get_physp_ptr ((osm_node_t *)p_node,0 ); p_pi0 = &p_physp0->port_info; p0_extended = p_pi0->capability_mask &IB_PORT_CAP_HAS_EXT_SPEEDS ; -if (ib_path_compare_rates (rate, -ib_port_info_compute_rate (p_pi, - p0_extended)) >0 ) - rate =ib_port_info_compute_rate (p_pi, p0_extended); + p0_extended_rate =ib_port_info_compute_rate (p_pi, p0_extended); +if (ib_path_compare_rates (rate, p0_extended_rate) >0 ) + rate = p0_extended_rate;if (sa->p_subn->opt.qos) {/*
@@ -419,10 +417,9 @@ static ib_api_status_t mpr_rcv_get_path_parms(IN osm_sa_t * sa, mtu =ib_port_info_get_mtu_cap (p_pi); extended = p_pi->capability_mask &IB_PORT_CAP_HAS_EXT_SPEEDS ; -if (ib_path_compare_rates (rate, -ib_port_info_compute_rate (p_pi, - extended)) >0 ) - rate =ib_port_info_compute_rate (p_pi, extended); + dest_rate =ib_port_info_compute_rate (p_pi, extended); +if (ib_path_compare_rates (rate, dest_rate) >0 ) + rate = dest_rate;OSM_LOG (sa->p_log,OSM_LOG_DEBUG ,"Path min MTU = %u, min rate = %u\n" , mtu, rate);
opensm/osm_sa_path_record.c +10 -13
@@ -162,7 +162,7 @@ static ib_api_status_t pr_rcv_get_path_parms(IN osm_sa_t * sa,ib_api_status_t status =IB_SUCCESS ;ib_net16_t pkey;uint8_t mtu; -uint8_t rate; +uint8_t rate, p0_extended_rate, dest_rate;uint8_t pkt_life;uint8_t required_mtu;uint8_t required_rate;
@@ -349,10 +349,9 @@ static ib_api_status_t pr_rcv_get_path_parms(IN osm_sa_t * sa, p_physp0 =osm_node_get_physp_ptr ((osm_node_t *)p_node,0 ); p_pi0 = &p_physp0->port_info; p0_extended = p_pi0->capability_mask &IB_PORT_CAP_HAS_EXT_SPEEDS ; -if (ib_path_compare_rates (rate, -ib_port_info_compute_rate (p_pi, - p0_extended)) >0 ) - rate =ib_port_info_compute_rate (p_pi, p0_extended); + p0_extended_rate =ib_port_info_compute_rate (p_pi, p0_extended); +if (ib_path_compare_rates (rate, p0_extended_rate) >0 ) + rate = p0_extended_rate;/* Continue with the egress port on this switch.
@@ -377,10 +376,9 @@ static ib_api_status_t pr_rcv_get_path_parms(IN osm_sa_t * sa, p_physp0 =osm_node_get_physp_ptr ((osm_node_t *)p_node,0 ); p_pi0 = &p_physp0->port_info; p0_extended = p_pi0->capability_mask &IB_PORT_CAP_HAS_EXT_SPEEDS ; -if (ib_path_compare_rates (rate, -ib_port_info_compute_rate (p_pi, - p0_extended)) >0 ) - rate =ib_port_info_compute_rate (p_pi, p0_extended); + p0_extended_rate =ib_port_info_compute_rate (p_pi, p0_extended); +if (ib_path_compare_rates (rate, p0_extended_rate) >0 ) + rate = p0_extended_rate;if (sa->p_subn->opt.qos) {/*
@@ -433,10 +431,9 @@ static ib_api_status_t pr_rcv_get_path_parms(IN osm_sa_t * sa, mtu =ib_port_info_get_mtu_cap (p_pi); extended = p_pi->capability_mask &IB_PORT_CAP_HAS_EXT_SPEEDS ; -if (ib_path_compare_rates (rate, -ib_port_info_compute_rate (p_pi, - extended)) >0 ) - rate =ib_port_info_compute_rate (p_pi, extended); + dest_rate =ib_port_info_compute_rate (p_pi, extended); +if (ib_path_compare_rates (rate, dest_rate) >0 ) + rate = dest_rate;OSM_LOG (sa->p_log,OSM_LOG_DEBUG ,"Path min MTU = %u, min rate = %u\n" , mtu, rate);
Signature · 6 lines
1.7.8.2 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html