Hi Sasha,

This patch adds osm_qos_policy_get_qos_level_by_mpr() wrapper function that
basically does the same thing as the osm_qos_policy_get_qos_level_by_pr(),
by converting MultiPathRecord comp_mask into PathRecord comp_mask.

-- Yevgeny

Signed-off-by: Yevgeny Kliteynik <[EMAIL PROTECTED]>
---
 opensm/include/opensm/osm_qos_policy.h |    8 +++++++
 opensm/opensm/osm_qos_policy.c         |   36 ++++++++++++++++++++++++++++++++
 2 files changed, 44 insertions(+), 0 deletions(-)

diff --git a/opensm/include/opensm/osm_qos_policy.h 
b/opensm/include/opensm/osm_qos_policy.h
index 11598be..0c220ee 100644
--- a/opensm/include/opensm/osm_qos_policy.h
+++ b/opensm/include/opensm/osm_qos_policy.h
@@ -51,6 +51,7 @@
 #include <complib/cl_list.h>
 #include <opensm/osm_port.h>
 #include <opensm/osm_sa_path_record.h>
+#include <opensm/osm_sa_multipath_record.h>

 #define YYSTYPE char *
 #define OSM_QOS_POLICY_MAX_PORTS_ON_SWITCH  128
@@ -179,6 +180,13 @@ osm_qos_level_t * osm_qos_policy_get_qos_level_by_pr(
        IN const osm_physp_t * p_dest_physp,
        IN ib_net64_t comp_mask);

+osm_qos_level_t * osm_qos_policy_get_qos_level_by_mpr(
+       IN const osm_qos_policy_t * p_qos_policy,
+       IN const ib_multipath_rec_t * p_mpr,
+       IN const osm_physp_t * p_src_physp,
+       IN const osm_physp_t * p_dest_physp,
+       IN ib_net64_t comp_mask);
+
 /***************************************************/

 int osm_qos_parse_policy_file(IN osm_subn_t * const p_subn);
diff --git a/opensm/opensm/osm_qos_policy.c b/opensm/opensm/osm_qos_policy.c
index 4ac0e35..40ce35c 100644
--- a/opensm/opensm/osm_qos_policy.c
+++ b/opensm/opensm/osm_qos_policy.c
@@ -937,3 +937,39 @@ osm_qos_level_t * osm_qos_policy_get_qos_level_by_pr(

 /***************************************************
  ***************************************************/
+
+osm_qos_level_t * osm_qos_policy_get_qos_level_by_mpr(
+       IN const osm_qos_policy_t * p_qos_policy,
+       IN const ib_multipath_rec_t * p_mpr,
+       IN const osm_physp_t * p_src_physp,
+       IN const osm_physp_t * p_dest_physp,
+       IN ib_net64_t comp_mask)
+{
+       ib_net64_t pr_comp_mask = 0;
+
+       if (!p_qos_policy)
+               return NULL;
+
+       /*
+        * Converting MultiPathRecord compmask to the PathRecord
+        * compmask. Note that only relevant bits are set.
+        */
+       pr_comp_mask =
+               ((comp_mask & IB_MPR_COMPMASK_QOS_CLASS) ?
+                IB_PR_COMPMASK_QOS_CLASS : 0) |
+               ((comp_mask & IB_MPR_COMPMASK_PKEY) ?
+                IB_PR_COMPMASK_PKEY : 0) |
+               ((comp_mask & IB_MPR_COMPMASK_SERVICEID_MSB) ?
+                IB_PR_COMPMASK_SERVICEID_MSB : 0) |
+               ((comp_mask & IB_MPR_COMPMASK_SERVICEID_LSB) ?
+                IB_PR_COMPMASK_SERVICEID_LSB : 0);
+
+       return __qos_policy_get_qos_level_by_params(
+               p_qos_policy, p_src_physp, p_dest_physp,
+               cl_ntoh64(ib_multipath_rec_service_id(p_mpr)),
+               ib_multipath_rec_qos_class(p_mpr),
+               cl_ntoh16(p_mpr->pkey), pr_comp_mask);
+}
+
+/***************************************************
+ ***************************************************/
-- 
1.5.1.4


_______________________________________________
general mailing list
[email protected]
http://lists.openfabrics.org/cgi-bin/mailman/listinfo/general

To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general

Reply via email to