opensm/osm_helper: Add rate related routines
PATCH v2 1/3 opensm/osm_helper: Add rate related routines
for proper comparison and selector operation
Rate enum was never is ascending order of actual underlying rates but even worse with newly added extended link speeds.
---
Changes since v1:
In find_ordered_rate, changed hard coded constant (2) into define (IB_MIN_RATE) Added asserts to ib_path_compare_rates, ib_path_rate_get_prev, and ib_path_rate_get_next
include/opensm/osm_helper.h +81 -1
@@ -1,6 +1,6 @@/* * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved. -* Copyright (c) 2002-2010 Mellanox Technologies LTD. All rights reserved. +* Copyright (c) 2002-2011 Mellanox Technologies LTD. All rights reserved. * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. * Copyright (c) 2009 HNR Consulting. All rights reserved. *
@@ -582,5 +582,85 @@ const char *osm_get_sm_mgr_state_str(IN uint16_t state);* SEE ALSO *********/ +/****f* IBA Base: Types/ib_path_compare_rates +* NAME +* ib_path_compare_rates +* +* DESCRIPTION +* Compares the encoded values for two path rates and +* return value is based on the ordered comparison of +* the path rates (or path rate equivalents). +* +* SYNOPSIS +*/ +int ib_path_compare_rates(IN const int rate1, IN const int rate2); + +/* +* PARAMETERS +* rate1 +* [in] Encoded path rate 1. +* +* rate2 +* [in] Encoded path rate 2. +* +* RETURN VALUES +* Returns an int indicating less than (-1), equal to (0), or +* greater than (1) rate1 as compared with rate2. +* +* NOTES +* +* SEE ALSO +*********/ + +/****f* IBA Base: Types/ib_path_rate_get_prev +* NAME +* ib_path_rate_get_prev +* +* DESCRIPTION +* Obtains encoded rate for the rate previous to the one requested. +* +* SYNOPSIS +*/ +int ib_path_rate_get_prev(IN const int rate); + +/* +* PARAMETERS +* rate +* [in] Encoded path rate. +* +* RETURN VALUES +* Returns an int indicating encoded rate or +* 0 if none can be found. +* +* NOTES +* +* SEE ALSO +*********/ + +/****f* IBA Base: Types/ib_path_rate_get_next +* NAME +* ib_path_rate_get_next +* +* DESCRIPTION +* Obtains encoded rate for the rate subsequent to the one requested. +* +* SYNOPSIS +*/ +int ib_path_rate_get_next(IN const int rate); + +/* +* PARAMETERS +* rate +* [in] Encoded path rate. +* +* RETURN VALUES +* Returns an int indicating encoded rate or +* 0 if none can be found. +* +* NOTES +* +* SEE ALSO +*********/ + END_C_DECLS#endif /* _OSM_HELPER_H_ */
opensm/libopensm.map +3 -0
@@ -57,5 +57,8 @@ OPENSM_1.5 { osm_get_lsa_str; osm_get_sm_mgr_signal_str; osm_get_sm_mgr_state_str; + ib_path_compare_rates; + ib_path_rate_get_prev; + ib_path_rate_get_next; local: *; };
opensm/osm_helper.c +80 -0
89 lines not on this page · raw message
--
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
Alex Netes
AppliedQuoted 6 lines · Hal Rosenstock
for proper comparison and selector operation
Rate enum was never is ascending order of actual underlying rates but even worse with newly added extended link speeds.
Quoted 7 lines
---
Changes since v1:
Infind_ordered_rate, changed hard coded constant (2) into define (IB_MIN_RATE) Added asserts toib_path_compare_rates,ib_path_rate_get_prev, andib_path_rate_get_next
Applied all 4 patches. Thanks.
-- Alex
--
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