[infiniband-diags] [2/4] support --diffcheck in iblinkinfo [REPOST]

2010-07-14 Thread Albert Chu
Hi Sasha,

Similar to ibnetdiscover, this patch support a --diffcheck option in
iblinkinfo.

Al

-- 
Albert Chu
ch...@llnl.gov
Computer Scientist
High Performance Systems Division
Lawrence Livermore National Laboratory
---BeginMessage---

Signed-off-by: Albert Chu ch...@llnl.gov
---
 infiniband-diags/man/iblinkinfo.8 |5 +
 infiniband-diags/src/iblinkinfo.c |   20 
 2 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/infiniband-diags/man/iblinkinfo.8 
b/infiniband-diags/man/iblinkinfo.8
index b91afbd..431ab0e 100644
--- a/infiniband-diags/man/iblinkinfo.8
+++ b/infiniband-diags/man/iblinkinfo.8
@@ -58,6 +58,11 @@ output will be displayed showing differences between the old 
and current
 fabric links.  See
 .B ibnetdiscover
 for information on caching ibnetdiscover output.
+.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:\fIport\fR = port connections, \fIstate\fR = port state.
 
 .SH AUTHOR
 .TP
diff --git a/infiniband-diags/src/iblinkinfo.c 
b/infiniband-diags/src/iblinkinfo.c
index 4b922af..b9c1c32 100644
--- a/infiniband-diags/src/iblinkinfo.c
+++ b/infiniband-diags/src/iblinkinfo.c
@@ -400,6 +400,8 @@ int diff_switch(ibnd_node_t * node, ibnd_fabric_t * 
orig_fabric,
 static int process_opt(void *context, int ch, char *optarg)
 {
struct ibnd_config *cfg = context;
+   char *p;
+
switch (ch) {
case 1:
node_name_map_file = strdup(optarg);
@@ -410,6 +412,22 @@ static int process_opt(void *context, int ch, char *optarg)
case 3:
diff_cache_file = strdup(optarg);
break;
+   case 4:
+   diffcheck_flags = 0;
+   p = strtok(optarg, ,);
+   while (p) {
+   if (!strcasecmp(p, port))
+   diffcheck_flags |= DIFF_FLAG_PORT_CONNECTION;
+   else if (!strcasecmp(p, state))
+   diffcheck_flags |= DIFF_FLAG_PORT_STATE;
+   else {
+   fprintf(stderr, invalid diff check key: %s\n,
+   p);
+   return -1;
+   }
+   p = strtok(NULL, ,);
+   }
+   break;
case 'S':
guid_str = optarg;
guid = (uint64_t) strtoull(guid_str, 0, 0);
@@ -480,6 +498,8 @@ int main(int argc, char **argv)
 filename of ibnetdiscover cache to load},
{diff, 3, 1, file,
 filename of ibnetdiscover cache to diff},
+   {diffcheck, 4, 1, key(s),
+specify checks to execute for --diff},
{outstanding_smps, 'o', 1, NULL,
 specify the number of outstanding SMP's which should be 
 issued during the scan},
-- 
1.5.4.5

---End Message---


[infiniband-diags] [2/4] support --diffcheck in iblinkinfo

2010-04-26 Thread Al Chu
Hi Sasha,

Similar to ibnetdiscover, this patch support a --diffcheck option in
iblinkinfo.

Al

-- 
Albert Chu
ch...@llnl.gov
Computer Scientist
High Performance Systems Division
Lawrence Livermore National Laboratory
---BeginMessage---

Signed-off-by: Albert Chu ch...@llnl.gov
---
 infiniband-diags/man/iblinkinfo.8 |5 +
 infiniband-diags/src/iblinkinfo.c |   20 
 2 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/infiniband-diags/man/iblinkinfo.8 
b/infiniband-diags/man/iblinkinfo.8
index b91afbd..431ab0e 100644
--- a/infiniband-diags/man/iblinkinfo.8
+++ b/infiniband-diags/man/iblinkinfo.8
@@ -58,6 +58,11 @@ output will be displayed showing differences between the old 
and current
 fabric links.  See
 .B ibnetdiscover
 for information on caching ibnetdiscover output.
+.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:\fIport\fR = port connections, \fIstate\fR = port state.
 
 .SH AUTHOR
 .TP
diff --git a/infiniband-diags/src/iblinkinfo.c 
b/infiniband-diags/src/iblinkinfo.c
index c6092f9..a4a8e49 100644
--- a/infiniband-diags/src/iblinkinfo.c
+++ b/infiniband-diags/src/iblinkinfo.c
@@ -400,6 +400,8 @@ int diff_switch(ibnd_node_t * node, ibnd_fabric_t * 
orig_fabric,
 static int process_opt(void *context, int ch, char *optarg)
 {
struct ibnd_config *cfg = context;
+   char *p;
+
switch (ch) {
case 1:
node_name_map_file = strdup(optarg);
@@ -410,6 +412,22 @@ static int process_opt(void *context, int ch, char *optarg)
case 3:
diff_cache_file = strdup(optarg);
break;
+   case 4:
+   diffcheck_flags = 0;
+   p = strtok(optarg, ,);
+   while (p) {
+   if (!strcasecmp(p, port))
+   diffcheck_flags |= DIFF_FLAG_PORT_CONNECTION;
+   else if (!strcasecmp(p, state))
+   diffcheck_flags |= DIFF_FLAG_PORT_STATE;
+   else {
+   fprintf(stderr, invalid diff check key: %s\n,
+   p);
+   return -1;
+   }
+   p = strtok(NULL, ,);
+   }
+   break;
case 'S':
guid_str = optarg;
guid = (uint64_t) strtoull(guid_str, 0, 0);
@@ -480,6 +498,8 @@ int main(int argc, char **argv)
 filename of ibnetdiscover cache to load},
{diff, 3, 1, file,
 filename of ibnetdiscover cache to diff},
+   {diffcheck, 4, 1, key(s),
+specify checks to execute for --diff},
{outstanding_smps, 'o', 1, NULL,
 specify the number of outstanding SMP's which should be 
 issued during the scan},
-- 
1.5.4.5

---End Message---