[ofa-general] [PATCH 2/2] osm: QoS - reworked node types in port group
Yevgeny Kliteynik
kliteyn at dev.mellanox.co.il
Mon Sep 17 12:23:27 PDT 2007
QoS policy optimization: replaced node types with
single bitmask, and node_type_self is implemented
as an additional guid in group's port map.
Signed-off-by: Yevgeny Kliteynik <kliteyn at dev.mellanox.co.il>
---
opensm/include/opensm/osm_qos_policy.h | 9 +++++----
opensm/opensm/osm_qos_parser.y | 24 +++++++++++++++++-------
opensm/opensm/osm_qos_policy.c | 7 ++-----
3 files changed, 24 insertions(+), 16 deletions(-)
diff --git a/opensm/include/opensm/osm_qos_policy.h b/opensm/include/opensm/osm_qos_policy.h
index 680bf71..30c2e6d 100644
--- a/opensm/include/opensm/osm_qos_policy.h
+++ b/opensm/include/opensm/osm_qos_policy.h
@@ -58,6 +58,10 @@
#define OSM_QOS_POLICY_MAX_PORTS_ON_SWITCH 128
#define OSM_QOS_POLICY_DEFAULT_LEVEL_NAME "default"
+#define OSM_QOS_POLICY_NODE_TYPE_CA (((uint8_t)1)<<IB_NODE_TYPE_CA)
+#define OSM_QOS_POLICY_NODE_TYPE_SWITCH (((uint8_t)1)<<IB_NODE_TYPE_SWITCH)
+#define OSM_QOS_POLICY_NODE_TYPE_ROUTER (((uint8_t)1)<<IB_NODE_TYPE_ROUTER)
+
/***************************************************/
typedef struct _osm_qos_port_t {
@@ -69,10 +73,7 @@ typedef struct _osm_qos_port_group_t {
char *name; /* single string (this port group name) */
char *use; /* single string (description) */
cl_list_t port_name_list; /* list of port names (.../.../...) */
- boolean_t node_type_ca;
- boolean_t node_type_switch;
- boolean_t node_type_router;
- boolean_t node_type_self;
+ uint8_t node_types; /* node types bitmask */
cl_qmap_t port_map;
} osm_qos_port_group_t;
diff --git a/opensm/opensm/osm_qos_parser.y b/opensm/opensm/osm_qos_parser.y
index ca77536..13baab5 100644
--- a/opensm/opensm/osm_qos_parser.y
+++ b/opensm/opensm/osm_qos_parser.y
@@ -694,29 +694,39 @@ node_type_item: node_type_ca
;
node_type_ca: TK_NODE_TYPE_CA {
- p_current_port_group->node_type_ca = TRUE;;
+ p_current_port_group->node_types |=
+ OSM_QOS_POLICY_NODE_TYPE_CA;
}
;
node_type_switch: TK_NODE_TYPE_SWITCH {
- p_current_port_group->node_type_switch = TRUE;
+ p_current_port_group->node_types |=
+ OSM_QOS_POLICY_NODE_TYPE_SWITCH;
}
;
node_type_router: TK_NODE_TYPE_ROUTER {
- p_current_port_group->node_type_router = TRUE;
+ p_current_port_group->node_types |=
+ OSM_QOS_POLICY_NODE_TYPE_ROUTER;
}
;
node_type_all: TK_NODE_TYPE_ALL {
- p_current_port_group->node_type_ca = TRUE;
- p_current_port_group->node_type_switch = TRUE;
- p_current_port_group->node_type_router = TRUE;
+ p_current_port_group->node_types |=
+ (OSM_QOS_POLICY_NODE_TYPE_CA |
+ OSM_QOS_POLICY_NODE_TYPE_SWITCH |
+ OSM_QOS_POLICY_NODE_TYPE_ROUTER);
}
;
node_type_self: TK_NODE_TYPE_SELF {
- p_current_port_group->node_type_self = TRUE;
+ osm_port_t * p_osm_port =
+ osm_get_port_by_guid(p_qos_policy->p_subn,
+ p_qos_policy->p_subn->sm_port_guid);
+ if (p_osm_port)
+ __parser_add_port_to_port_map(
+ &p_current_port_group->port_map,
+ p_osm_port->p_physp);
}
;
diff --git a/opensm/opensm/osm_qos_policy.c b/opensm/opensm/osm_qos_policy.c
index d1b227f..c84fb8b 100644
--- a/opensm/opensm/osm_qos_policy.c
+++ b/opensm/opensm/osm_qos_policy.c
@@ -506,14 +506,11 @@ __qos_policy_is_port_in_group(osm_subn_t * p_subn,
osm_node_t *p_node = osm_physp_get_node_ptr(p_physp);
ib_net64_t port_guid = osm_physp_get_port_guid(p_physp);
uint64_t port_guid_ho = cl_ntoh64(port_guid);
- uint8_t node_type = osm_node_get_type(p_node);
/* check whether this port's type matches any of group's types */
- if ((node_type == IB_NODE_TYPE_CA && p_port_group->node_type_ca) ||
- (node_type == IB_NODE_TYPE_SWITCH && p_port_group->node_type_switch)
- || (node_type == IB_NODE_TYPE_ROUTER
- && p_port_group->node_type_router))
+ if ( p_port_group->node_types &
+ (((uint8_t)1)<<osm_node_get_type(p_node)) )
return TRUE;
/* check whether this port's guid is in group's port map */
--
1.5.1.4
More information about the general
mailing list