All of lore.kernel.org
 help / color / mirror / Atom feed
* [infiniband-diags] [UPDATED PATCH] [2/3] support --cache and --load-cache options in ibnetdiscover
@ 2010-01-15 18:23 Al Chu
       [not found] ` <1263579796.15172.167.camel-X2zTWyBD0EhliZ7u+bvwcg@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Al Chu @ 2010-01-15 18:23 UTC (permalink / raw)
  To: sashak-smomgflXvOZWk0Htik3J/w; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: Type: text/plain, Size: 223 bytes --]

Hi Sasha,

This adds the --cache and --load-cache options to ibnetdiscover.

Al

-- 
Albert Chu
chu11-i2BcT+NCU+M@public.gmane.org
Computer Scientist
High Performance Systems Division
Lawrence Livermore National Laboratory

[-- Attachment #2: 0002-support-cache-and-load-cache-options-in-ibnetdis.patch --]
[-- Type: text/plain, Size: 3958 bytes --]

From: Albert Chu <chu11-i2BcT+NCU+M@public.gmane.org>
Date: Wed, 9 Dec 2009 15:19:47 -0800
Subject: [PATCH] support --cache and --load-cache options in ibnetdiscover


Signed-off-by: Albert Chu <chu11-i2BcT+NCU+M@public.gmane.org>
---
 infiniband-diags/man/ibnetdiscover.8 |   12 +++++++++++-
 infiniband-diags/src/ibnetdiscover.c |   26 ++++++++++++++++++++++++--
 2 files changed, 35 insertions(+), 3 deletions(-)

diff --git a/infiniband-diags/man/ibnetdiscover.8 b/infiniband-diags/man/ibnetdiscover.8
index abf3588..082a8e4 100644
--- a/infiniband-diags/man/ibnetdiscover.8
+++ b/infiniband-diags/man/ibnetdiscover.8
@@ -8,7 +8,8 @@ ibnetdiscover \- discover InfiniBand topology
 [\-d(ebug)] [\-e(rr_show)] [\-v(erbose)] [\-s(how)] [\-l(ist)]
 [\-g(rouping)] [\-H(ca_list)] [\-S(witch_list)] [\-R(outer_list)]
 [\-C ca_name] [\-P ca_port] [\-t(imeout) timeout_ms] [\-V(ersion)]
-[\--node-name-map <node-name-map>] [\-p(orts)] [\-m(ax_hops)]
+[\--node-name-map <node-name-map>] [\-\-cache <filename>]
+[\-\-load\-cache <filename>] [\-p(orts)] [\-m(ax_hops)]
 [\-h(elp)] [<topology-file>]
 
 .SH DESCRIPTION
@@ -47,6 +48,15 @@ Show progress information during discovery.
 Specify a node name map.  The node name map file maps GUIDs to more user
 friendly names.  See file format below.
 .TP
+\fB\-\-cache\fR <filename>
+Cache the ibnetdiscover network data in the specified filename.  This
+cache may be used by other tools for later analysis.
+.TP
+\fB\-\-load\-cache\fR <filename>
+Load and use the cached ibnetdiscover data stored in the specified
+filename.  May be useful for outputting and learning about other
+fabrics or a previous state of a fabric.
+.TP
 \fB\-p\fR, \fB\-\-ports\fR
 Obtain a ports report which is a
 list of connected ports with relevant information (like LID, portnum,
diff --git a/infiniband-diags/src/ibnetdiscover.c b/infiniband-diags/src/ibnetdiscover.c
index e081a36..e87f42e 100644
--- a/infiniband-diags/src/ibnetdiscover.c
+++ b/infiniband-diags/src/ibnetdiscover.c
@@ -63,6 +63,8 @@ static FILE *f;
 
 static char *node_name_map_file = NULL;
 static nn_map_t *node_name_map = NULL;
+static char *cache_file = NULL;
+static char *load_cache_file = NULL;
 
 static int report_max_hops = 0;
 
@@ -616,6 +618,12 @@ static int process_opt(void *context, int ch, char *optarg)
 	case 1:
 		node_name_map_file = strdup(optarg);
 		break;
+	case 2:
+		cache_file = strdup(optarg);
+		break;
+	case 3:
+		load_cache_file = strdup(optarg);
+		break;
 	case 's':
 		ibnd_show_progress(1);
 		break;
@@ -662,6 +670,8 @@ int main(int argc, char **argv)
 		{"Switch_list", 'S', 0, NULL, "list of connected switches"},
 		{"Router_list", 'R', 0, NULL, "list of connected routers"},
 		{"node-name-map", 1, 1, "<file>", "node name map file"},
+		{"cache", 2, 1, "<file>", "filename to cache ibnetdiscover data to"},
+		{"load-cache", 3, 1, "<file>", "filename of ibnetdiscover cache to load"},
 		{"ports", 'p', 0, NULL, "obtain a ports report"},
 		{"max_hops", 'm', 0, NULL,
 		 "report max hops discovered by the library"},
@@ -692,8 +702,14 @@ int main(int argc, char **argv)
 
 	node_name_map = open_node_name_map(node_name_map_file);
 
-	if ((fabric = ibnd_discover_fabric(ibmad_port, NULL, -1)) == NULL)
-		IBERROR("discover failed\n");
+	if (load_cache_file) {
+		if ((fabric = ibnd_load_fabric(load_cache_file, 0)) == NULL)
+			IBERROR("loading cached fabric failed\n");
+	}
+	else {
+		if ((fabric = ibnd_discover_fabric(ibmad_port, NULL, -1)) == NULL)
+			IBERROR("discover failed\n");
+	}
 
 	if (ports_report)
 		ibnd_iter_nodes(fabric, dump_ports_report, NULL);
@@ -702,6 +718,12 @@ int main(int argc, char **argv)
 	else
 		dump_topology(group, fabric);
 
+	if (cache_file)
+		if (ibnd_cache_fabric(fabric,
+				      cache_file,
+				      0) < 0)
+			IBERROR("caching ibnetdiscover data failed\n");
+
 	ibnd_destroy_fabric(fabric);
 	close_node_name_map(node_name_map);
 	mad_rpc_close_port(ibmad_port);
-- 
1.5.4.5


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [infiniband-diags] [UPDATED PATCH] [2/3] support --cache and --load-cache options in ibnetdiscover
       [not found] ` <1263579796.15172.167.camel-X2zTWyBD0EhliZ7u+bvwcg@public.gmane.org>
@ 2010-01-16 14:49   ` Sasha Khapyorsky
  0 siblings, 0 replies; 2+ messages in thread
From: Sasha Khapyorsky @ 2010-01-16 14:49 UTC (permalink / raw)
  To: Al Chu; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA

On 10:23 Fri 15 Jan     , Al Chu wrote:
> Hi Sasha,
> 
> This adds the --cache and --load-cache options to ibnetdiscover.
> 
> Al
> 
> -- 
> Albert Chu
> chu11-i2BcT+NCU+M@public.gmane.org
> Computer Scientist
> High Performance Systems Division
> Lawrence Livermore National Laboratory

> From: Albert Chu <chu11-i2BcT+NCU+M@public.gmane.org>
> Date: Wed, 9 Dec 2009 15:19:47 -0800
> Subject: [PATCH] support --cache and --load-cache options in ibnetdiscover
> 
> 
> Signed-off-by: Albert Chu <chu11-i2BcT+NCU+M@public.gmane.org>

Applied. Thanks.

Sasha
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-01-16 14:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-15 18:23 [infiniband-diags] [UPDATED PATCH] [2/3] support --cache and --load-cache options in ibnetdiscover Al Chu
     [not found] ` <1263579796.15172.167.camel-X2zTWyBD0EhliZ7u+bvwcg@public.gmane.org>
2010-01-16 14:49   ` Sasha Khapyorsky

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.