Hi Sasha,

Adding log message for matched criteria of
the QoS policy rule.

This patch addresses all the issues that were brought
up during the previous versions, mainly the fact that
the prev. version was printing one log message per
matched criterion (this one prints single message at
the end of matching rule search).

Signed-off-by: Yevgeny Kliteynik <[EMAIL PROTECTED]>
---
 opensm/opensm/osm_qos_policy.c |   52 ++++++++++++++++++++++++++++++++++++++-
 1 files changed, 50 insertions(+), 2 deletions(-)

diff --git a/opensm/opensm/osm_qos_policy.c b/opensm/opensm/osm_qos_policy.c
index f1d4e54..106a2cb 100644
--- a/opensm/opensm/osm_qos_policy.c
+++ b/opensm/opensm/osm_qos_policy.c
@@ -595,10 +595,15 @@ static osm_qos_match_rule_t 
*__qos_policy_get_match_rule_by_params(
 {
        osm_qos_match_rule_t *p_qos_match_rule = NULL;
        cl_list_iterator_t list_iterator;
+       osm_log_t * p_log = &p_qos_policy->p_subn->p_osm->log;
+       char buff[999];
+       int n;

        if (!cl_list_count(&p_qos_policy->qos_match_rules))
                return NULL;

+       OSM_LOG_ENTER(p_log);
+
        /* Go over all QoS match rules and find the one that matches the 
request */

        list_iterator = cl_list_head(&p_qos_policy->qos_match_rules);
@@ -609,6 +614,7 @@ static osm_qos_match_rule_t 
*__qos_policy_get_match_rule_by_params(
                        list_iterator = cl_list_next(list_iterator);
                        continue;
                }
+               n = 0;

                /* If a match rule has Source groups, PR request source has to 
be in this list */

@@ -621,6 +627,14 @@ static osm_qos_match_rule_t 
*__qos_policy_get_match_rule_by_params(
                                list_iterator = cl_list_next(list_iterator);
                                continue;
                        }
+
+                       if (n)
+                               n += snprintf(buff + n, sizeof(buff) - n,
+                                             ", ");
+                       n += snprintf(buff + n, sizeof(buff) - n,
+                                     "S_Port (0x%016" PRIx64 ")",
+                                     cl_ntoh64(osm_physp_get_port_guid(
+                                             p_src_physp)));
                }

                /* If a match rule has Destination groups, PR request dest. has 
to be in this list */
@@ -634,6 +648,14 @@ static osm_qos_match_rule_t 
*__qos_policy_get_match_rule_by_params(
                                list_iterator = cl_list_next(list_iterator);
                                continue;
                        }
+
+                       if (n)
+                               n += snprintf(buff + n, sizeof(buff) - n,
+                                             ", ");
+                       n += snprintf(buff + n, sizeof(buff) - n,
+                                     "D_Port (0x%016" PRIx64 ")",
+                                     cl_ntoh64(osm_physp_get_port_guid(
+                                             p_dest_physp)));
                }

                /* If a match rule has QoS classes, PR request HAS
@@ -653,6 +675,11 @@ static osm_qos_match_rule_t 
*__qos_policy_get_match_rule_by_params(
                                continue;
                        }

+                       if (n)
+                               n += snprintf(buff + n, sizeof(buff) - n,
+                                             ", ");
+                       n += snprintf(buff + n, sizeof(buff) - n,
+                                     "QoS_Class (0x%04x)", qos_class);
                }

                /* If a match rule has Service IDs, PR request HAS
@@ -673,6 +700,12 @@ static osm_qos_match_rule_t 
*__qos_policy_get_match_rule_by_params(
                                continue;
                        }

+                       if (n)
+                               n += snprintf(buff + n, sizeof(buff) - n,
+                                             ", ");
+                       n += snprintf(buff + n, sizeof(buff) - n,
+                                     "ServiceID (0x%016" PRIx64 ")",
+                                     service_id);
                }

                /* If a match rule has PKeys, PR request HAS
@@ -692,6 +725,11 @@ static osm_qos_match_rule_t 
*__qos_policy_get_match_rule_by_params(
                                continue;
                        }

+                       if (n)
+                               n += snprintf(buff + n, sizeof(buff) - n,
+                                             ", ");
+                       n += snprintf(buff + n, sizeof(buff) - n,
+                                     "PKey (0x%04x)", pkey);
                }

                /* if we got here, then this match-rule matched this PR request 
*/
@@ -699,10 +737,20 @@ static osm_qos_match_rule_t 
*__qos_policy_get_match_rule_by_params(
        }

        if (list_iterator == cl_list_end(&p_qos_policy->qos_match_rules))
-               return NULL;
+               p_qos_match_rule = NULL;

+       if (p_qos_match_rule)
+               OSM_LOG(p_log, OSM_LOG_DEBUG,
+                       "request matched by: %s\n",
+                       (n == 0) ? "(empty)" : buff);
+       else
+               OSM_LOG(p_log, OSM_LOG_DEBUG,
+                       "request not matched to any rule\n");
+
+
+       OSM_LOG_EXIT(p_log);
        return p_qos_match_rule;
-}                              /* __qos_policy_get_match_rule_by_pr() */
+}                              /* __qos_policy_get_match_rule_by_params() */

 /***************************************************
  ***************************************************/
-- 
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