Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: Al Chu <chu11-i2BcT+NCU+M@public.gmane.org>
To: "sashak-smomgflXvOZWk0Htik3J/w@public.gmane.org"
	<sashak-smomgflXvOZWk0Htik3J/w@public.gmane.org>
Cc: "linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: [infiniband-diags] [2/3] support --diffcheck in ibnetdiscover
Date: Wed, 07 Apr 2010 10:06:32 -0700	[thread overview]
Message-ID: <1270659992.26381.40.camel@crazyclimber.llnl.gov> (raw)

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

Hi Sasha,

This patch adds basic --diffcheck support in ibnetdiscover, allowing
configuration of the diff checks done in the default --diff option.

Al

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

[-- Attachment #2: 0002-support-diffcheck-in-ibnetdiscover.patch --]
[-- Type: message/rfc822, Size: 5251 bytes --]

From: Albert Chu <chu11-i2BcT+NCU+M@public.gmane.org>
Subject: [PATCH] support --diffcheck in ibnetdiscover
Date: Wed, 31 Mar 2010 11:13:37 -0700
Message-ID: <1270659341.26381.29.camel-RLKWKRZIcZkVVsCFsIUZTRy+HRzXvqW9@public.gmane.org>


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

diff --git a/infiniband-diags/man/ibnetdiscover.8 b/infiniband-diags/man/ibnetdiscover.8
index 975b999..e122736 100644
--- a/infiniband-diags/man/ibnetdiscover.8
+++ b/infiniband-diags/man/ibnetdiscover.8
@@ -64,6 +64,14 @@ output will be displayed showing differences between the old and current
 fabric.  By default, the following are compared for differences: switches,
 channel adapters, routers, and port connections.
 .TP
+\fB\-\-diffcheck\fR <key(s)>
+Specify what diff checks should be done in the \fB\-\-diff\fR option above.
+Comma separate multiple diff check key(s).  The available diff checks
+are: \fIsw\fR = switches, \fIca\fR = channel adapters, \fIrouter\fR = routers,
+\fIport\fR = port connections descriptions.  Note that \fIport\fR is
+checked only for the node types that are specified (e.g. \fIsw\fR,
+\fIca\fR, \fIrouter\fR).
+.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 4da09ce..4435ade 100644
--- a/infiniband-diags/src/ibnetdiscover.c
+++ b/infiniband-diags/src/ibnetdiscover.c
@@ -57,10 +57,10 @@
 #define LIST_SWITCH_NODE (1 << IB_NODE_SWITCH)
 #define LIST_ROUTER_NODE (1 << IB_NODE_ROUTER)
 
-#define DIFF_FLAG_SWITCH          0x00000001
-#define DIFF_FLAG_CA              0x00000002
-#define DIFF_FLAG_ROUTER          0x00000004
-#define DIFF_FLAG_PORT_CONNECTION 0x00000008
+#define DIFF_FLAG_SWITCH           0x00000001
+#define DIFF_FLAG_CA               0x00000002
+#define DIFF_FLAG_ROUTER           0x00000004
+#define DIFF_FLAG_PORT_CONNECTION  0x00000008
 
 #define DIFF_FLAG_DEFAULT      (DIFF_FLAG_SWITCH \
 				| DIFF_FLAG_CA \
@@ -76,6 +76,7 @@ static nn_map_t *node_name_map = NULL;
 static char *cache_file = NULL;
 static char *load_cache_file = NULL;
 static char *diff_cache_file = NULL;
+static uint32_t diffcheck_flags = DIFF_FLAG_DEFAULT;
 
 static int report_max_hops = 0;
 
@@ -735,7 +736,9 @@ static int diff_common(ibnd_fabric_t * orig_fabric,
 	 * in new_fabric but not in orig_fabric.
 	 *
 	 * In this diff, we don't need to check port connections,
-	 * since it has already been done before.
+	 * lids, or node descriptions since it has already been
+         * done (i.e. checks are only done when guid exists on both
+	 * orig and new).
 	 */
 	iter_diff_data.diff_flags = diff_flags & ~DIFF_FLAG_PORT_CONNECTION;
 	iter_diff_data.fabric1 = new_fabric;
@@ -752,29 +755,27 @@ static int diff_common(ibnd_fabric_t * orig_fabric,
 
 int diff(ibnd_fabric_t * orig_fabric, ibnd_fabric_t * new_fabric)
 {
-	uint32_t diff_flags = DIFF_FLAG_DEFAULT;
-
-	if (diff_flags & DIFF_FLAG_SWITCH)
+	if (diffcheck_flags & DIFF_FLAG_SWITCH)
 		diff_common(orig_fabric,
 			    new_fabric,
 			    IB_NODE_SWITCH,
-			    diff_flags,
+			    diffcheck_flags,
 			    out_switch,
 			    out_switch_port);
 
-	if (diff_flags & DIFF_FLAG_CA)
+	if (diffcheck_flags & DIFF_FLAG_CA)
 		diff_common(orig_fabric,
 			    new_fabric,
 			    IB_NODE_CA,
-			    diff_flags,
+			    diffcheck_flags,
 			    out_ca,
 			    out_ca_port);
 
-	if (diff_flags & DIFF_FLAG_ROUTER)
+	if (diffcheck_flags & DIFF_FLAG_ROUTER)
 		diff_common(orig_fabric,
 			    new_fabric,
 			    IB_NODE_ROUTER,
-			    diff_flags,
+			    diffcheck_flags,
 			    out_ca,
 			    out_ca_port);
 
@@ -786,6 +787,8 @@ static int list, group, ports_report;
 
 static int process_opt(void *context, int ch, char *optarg)
 {
+	char *p;
+
 	switch (ch) {
 	case 1:
 		node_name_map_file = strdup(optarg);
@@ -799,6 +802,25 @@ static int process_opt(void *context, int ch, char *optarg)
 	case 4:
 		diff_cache_file = strdup(optarg);
 		break;
+	case 5:
+		diffcheck_flags = 0;
+		p = strtok(optarg, ",");
+		while (p) {
+			if (!strcasecmp(p, "sw"))
+				diffcheck_flags |= DIFF_FLAG_SWITCH;
+			else if (!strcasecmp(p, "ca"))
+				diffcheck_flags |= DIFF_FLAG_CA;
+			else if (!strcasecmp(p, "router"))
+				diffcheck_flags |= DIFF_FLAG_ROUTER;
+			else if (!strcasecmp(p, "port"))
+				diffcheck_flags |= DIFF_FLAG_PORT_CONNECTION;
+			else {
+				fprintf(stderr, "invalid diff check key: %s\n", p);
+				return -1;
+			}
+			p = strtok(NULL, ",");
+		}
+		break;
 	case 's':
 		ibnd_show_progress(1);
 		break;
@@ -852,6 +874,8 @@ int main(int argc, char **argv)
 		 "filename of ibnetdiscover cache to load"},
 		{"diff", 4, 1, "<file>",
 		 "filename of ibnetdiscover cache to diff"},
+		{"diffcheck", 5, 1, "<key(s)>",
+		 "specify checks to execute for --diff"},
 		{"ports", 'p', 0, NULL, "obtain a ports report"},
 		{"max_hops", 'm', 0, NULL,
 		 "report max hops discovered by the library"},
-- 
1.5.4.5


                 reply	other threads:[~2010-04-07 17:06 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1270659992.26381.40.camel@crazyclimber.llnl.gov \
    --to=chu11-i2bct+ncu+m@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=sashak-smomgflXvOZWk0Htik3J/w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox