Hey Sasha,
Here's the first patch in my set of patches to fix the incorrect routing
engine reporting problem described in the earlier thread (thread: [PATCH
2/3] OpenSM: Fix incorrect reporting of routing engine/algorithm used).
It's been redone as discussed in the thread.
This patch 1/3 just defines the enumeration of routing engine types, a
few functions for mapping between enums and strings, and sticks a value
into osm_opensm_t for tracking the routing engine. The only interesting
thing to note is due to current implementation, the function
osm_routing_engine_type() considers a NULL pointer and the string "null"
to mean that the minhop algorithm was specified.
Thanks,
Al
--
Albert Chu
[EMAIL PROTECTED]
925-422-5311
Computer Scientist
High Performance Systems Division
Lawrence Livermore National Laboratory
>From 2b8ffc06d734d3da9e5e5abba766548052aac923 Mon Sep 17 00:00:00 2001
From: Albert L. Chu <[EMAIL PROTECTED]>
Date: Tue, 18 Dec 2007 10:47:31 -0800
Subject: [PATCH] support osm_routing_engine_type_t enumeration
Signed-off-by: Albert L. Chu <[EMAIL PROTECTED]>
---
opensm/include/opensm/osm_opensm.h | 75 ++++++++++++++++++++++++++++++++++++
opensm/opensm/osm_opensm.c | 55 ++++++++++++++++++++++++++
2 files changed, 130 insertions(+), 0 deletions(-)
diff --git a/opensm/include/opensm/osm_opensm.h b/opensm/include/opensm/osm_opensm.h
index 1b5edb8..158e72b 100644
--- a/opensm/include/opensm/osm_opensm.h
+++ b/opensm/include/opensm/osm_opensm.h
@@ -90,6 +90,29 @@ BEGIN_C_DECLS
* Steve King, Intel
*
*********/
+
+/****d* OpenSM: OpenSM/osm_routing_engine_type_t
+* NAME
+* osm_routing_engine_type_t
+*
+* DESCRIPTION
+* Enumerates the possible routing engines that
+* could be used to route a subnet.
+*
+* SYNOPSIS
+*/
+typedef enum _osm_routing_engine_type {
+ OSM_ROUTING_ENGINE_TYPE_NONE = 0,
+ OSM_ROUTING_ENGINE_TYPE_MINHOP,
+ OSM_ROUTING_ENGINE_TYPE_UPDN,
+ OSM_ROUTING_ENGINE_TYPE_FILE,
+ OSM_ROUTING_ENGINE_TYPE_FTREE,
+ OSM_ROUTING_ENGINE_TYPE_LASH,
+ OSM_ROUTING_ENGINE_TYPE_DOR,
+ OSM_ROUTING_ENGINE_TYPE_UNKNOWN
+} osm_routing_engine_type_t;
+/***********/
+
/****s* OpenSM: OpenSM/osm_routing_engine
* NAME
* struct osm_routing_engine
@@ -167,6 +190,7 @@ typedef struct _osm_opensm_t {
cl_dispatcher_t disp;
cl_plock_t lock;
struct osm_routing_engine routing_engine;
+ osm_routing_engine_type_t routing_engine_used;
osm_stats_t stats;
osm_console_t console;
nn_map_t *node_name_map;
@@ -208,6 +232,9 @@ typedef struct _osm_opensm_t {
* routing_engine
* Routing engine; will be initialized then used.
*
+* routing_engine_used
+* Indicates which routing engine was used to route a subnet.
+*
* stats
* Open SM statistics block
*
@@ -435,6 +462,54 @@ osm_opensm_wait_for_subnet_up(IN osm_opensm_t * const p_osm,
* SEE ALSO
*********/
+/****f* OpenSM: OpenSM/osm_routing_engine_type_str
+* NAME
+* osm_routing_engine_type_str
+*
+* DESCRIPTION
+* Returns a string for the specified routing engine type.
+*
+* SYNOPSIS
+*/
+const char *
+osm_routing_engine_type_str(IN osm_routing_engine_type_t type);
+/*
+* PARAMETERS
+* type
+* [in] routing engine type.
+*
+* RETURN VALUES
+* Pointer to routing engine name.
+*
+* NOTES
+*
+* SEE ALSO
+*********/
+
+/****f* OpenSM: OpenSM/osm_routing_engine_type
+* NAME
+* osm_routing_engine_type
+*
+* DESCRIPTION
+* Returns a routing engine type specified routing engine name string.
+*
+* SYNOPSIS
+*/
+osm_routing_engine_type_t
+osm_routing_engine_type(IN const char *str);
+/*
+* PARAMETERS
+* str
+* [in] routing engine name string.
+*
+* RETURN VALUES
+* Routing engine type.
+*
+* NOTES
+*
+* SEE ALSO
+*********/
+
/* dump helpers */
void osm_dump_mcast_routes(osm_opensm_t * osm);
void osm_dump_all(osm_opensm_t * osm);
diff --git a/opensm/opensm/osm_opensm.c b/opensm/opensm/osm_opensm.c
index 26b9969..fd51369 100644
--- a/opensm/opensm/osm_opensm.c
+++ b/opensm/opensm/osm_opensm.c
@@ -86,6 +86,59 @@ const static struct routing_engine_module routing_modules[] = {
{NULL, NULL}
};
+/**********************************************************************
+ **********************************************************************/
+const char *
+osm_routing_engine_type_str(IN osm_routing_engine_type_t type)
+{
+ if (type == OSM_ROUTING_ENGINE_TYPE_NONE)
+ return "none";
+ else if (type == OSM_ROUTING_ENGINE_TYPE_MINHOP)
+ return "minhop";
+ else if (type == OSM_ROUTING_ENGINE_TYPE_UPDN)
+ return "updn";
+ else if (type == OSM_ROUTING_ENGINE_TYPE_FILE)
+ return "file";
+ else if (type == OSM_ROUTING_ENGINE_TYPE_FTREE)
+ return "ftree";
+ else if (type == OSM_ROUTING_ENGINE_TYPE_LASH)
+ return "lash";
+ else if (type == OSM_ROUTING_ENGINE_TYPE_DOR)
+ return "dor";
+ else
+ return "unknown";
+}
+
+/**********************************************************************
+ **********************************************************************/
+osm_routing_engine_type_t
+osm_routing_engine_type(IN const char *str)
+{
+ /* For legacy reasons, consider a NULL pointer and the string
+ * "null" as the minhop routing engine.
+ */
+ if (!str
+ || !strcasecmp(str, "null")
+ || !strcasecmp(str, "minhop"))
+ return OSM_ROUTING_ENGINE_TYPE_MINHOP;
+ else if (!strcasecmp(str, "none"))
+ return OSM_ROUTING_ENGINE_TYPE_NONE;
+ else if (!strcasecmp(str, "updn"))
+ return OSM_ROUTING_ENGINE_TYPE_UPDN;
+ else if (!strcasecmp(str, "file"))
+ return OSM_ROUTING_ENGINE_TYPE_FILE;
+ else if (!strcasecmp(str, "ftree"))
+ return OSM_ROUTING_ENGINE_TYPE_FTREE;
+ else if (!strcasecmp(str, "lash"))
+ return OSM_ROUTING_ENGINE_TYPE_LASH;
+ else if (!strcasecmp(str, "dor"))
+ return OSM_ROUTING_ENGINE_TYPE_DOR;
+ else
+ return OSM_ROUTING_ENGINE_TYPE_UNKNOWN;
+}
+
+/**********************************************************************
+ **********************************************************************/
static int setup_routing_engine(osm_opensm_t * p_osm, const char *name)
{
const struct routing_engine_module *r;
@@ -311,6 +364,8 @@ osm_opensm_init(IN osm_opensm_t * const p_osm,
" \'%s\'. Default will be used instead\n",
p_opt->routing_engine_name);
+ p_osm->routing_engine_used = OSM_ROUTING_ENGINE_TYPE_NONE;
+
p_osm->node_name_map = open_node_name_map(p_opt->node_name_map_name);
Exit:
--
1.5.1
_______________________________________________
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