All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hal Rosenstock <hal-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
To: Ira Weiny <weiny2-i2BcT+NCU+M@public.gmane.org>
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: [PATCH 3/3] infiniband-diags/saquery: Add GUIDInfoRecord support
Date: Fri, 25 Mar 2011 21:23:31 +0200	[thread overview]
Message-ID: <4D8CEBB3.805@dev.mellanox.co.il> (raw)


Signed-off-by: Hal Rosenstock <hal-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
  infiniband-diags/man/saquery.8 |    3 +-
  infiniband-diags/src/saquery.c |   48 
+++++++++++++++++++++++++++++++++++++++-
  2 files changed, 49 insertions(+), 2 deletions(-)

diff --git a/infiniband-diags/man/saquery.8 b/infiniband-diags/man/saquery.8
index b2b9d91..4a3102d 100644
--- a/infiniband-diags/man/saquery.8
+++ b/infiniband-diags/man/saquery.8
@@ -1,4 +1,4 @@
-.TH SAQUERY 8 "October 19, 2008" "OpenIB" "OpenIB Diagnostics"
+.TH SAQUERY 8 "March 28, 2010" "OpenIB" "OpenIB Diagnostics"

  .SH NAME
  saquery \- query InfiniBand subnet administration attributes
@@ -117,6 +117,7 @@ Supported query names (and aliases):
   MCMemberRecord (MCMR)
   LFTRecord (LFTR) [[lid]/[block]]
   MFTRecord (MFTR) [[mlid]/[position]/[block]]
+ GUIDInfoRecord (GIR) [[lid]/[block]]
  .TP
  \fB\-d\fR
  enable debugging
diff --git a/infiniband-diags/src/saquery.c b/infiniband-diags/src/saquery.c
index cb4fc18..490f6d2 100644
--- a/infiniband-diags/src/saquery.c
+++ b/infiniband-diags/src/saquery.c
@@ -781,6 +781,31 @@ static void dump_one_lft_record(void *data)
      printf("\n");
  }

+static void dump_one_guidinfo_record(void *data)
+{
+    ib_guidinfo_record_t *gir = data;
+    printf("GUIDInfo Record dump:\n"
+           "\t\tLID........................%u\n"
+           "\t\tBlock......................%u\n"
+           "\t\tGUID 0.....................0x%016" PRIx64 "\n"
+           "\t\tGUID 1.....................0x%016" PRIx64 "\n"
+           "\t\tGUID 2.....................0x%016" PRIx64 "\n"
+           "\t\tGUID 3.....................0x%016" PRIx64 "\n"
+           "\t\tGUID 4.....................0x%016" PRIx64 "\n"
+           "\t\tGUID 5.....................0x%016" PRIx64 "\n"
+           "\t\tGUID 6.....................0x%016" PRIx64 "\n"
+           "\t\tGUID 7.....................0x%016" PRIx64 "\n",
+           cl_ntoh16(gir->lid), gir->block_num,
+           cl_ntoh64(gir->guid_info.guid[0]),
+           cl_ntoh64(gir->guid_info.guid[1]),
+           cl_ntoh64(gir->guid_info.guid[2]),
+           cl_ntoh64(gir->guid_info.guid[3]),
+           cl_ntoh64(gir->guid_info.guid[4]),
+           cl_ntoh64(gir->guid_info.guid[5]),
+           cl_ntoh64(gir->guid_info.guid[6]),
+           cl_ntoh64(gir->guid_info.guid[7]));
+}
+
  static void dump_one_mft_record(void *data)
  {
      ib_mft_record_t *mftr = data;
@@ -1339,6 +1364,25 @@ static int query_lft_records(const struct 
query_cmd *q, bind_handle_t h,
&lftr, 0, dump_one_lft_record);
  }

+static int query_guidinfo_records(const struct query_cmd *q, 
bind_handle_t h,
+                  struct query_params *p, int argc, char *argv[])
+{
+    ib_guidinfo_record_t gir;
+    ib_net64_t comp_mask = 0;
+    int lid = 0, block = -1;
+
+    if (argc > 0)
+        parse_lid_and_ports(h, argv[0], &lid, &block, NULL);
+
+    memset(&gir, 0, sizeof(gir));
+    CHECK_AND_SET_VAL(lid, 16, 0, gir.lid, GIR, LID);
+    CHECK_AND_SET_VAL(block, 8, -1, gir.block_num, GIR, BLOCKNUM);
+
+    return get_and_dump_any_records(h, IB_SA_ATTR_GUIDINFORECORD, 0,
+                    comp_mask, &gir, 0,
+                    dump_one_guidinfo_record);
+}
+
  static int query_mft_records(const struct query_cmd *q, bind_handle_t h,
                   struct query_params *p, int argc, char *argv[])
  {
@@ -1419,6 +1463,8 @@ static const struct query_cmd query_cmds[] = {
       "[[lid]/[block]]", query_lft_records},
      {"MFTRecord", "MFTR", IB_SA_ATTR_MFTRECORD,
       "[[mlid]/[position]/[block]]", query_mft_records},
+    {"GUIDInfoRecord", "GIR", IB_SA_ATTR_GUIDINFORECORD,
+     "[[lid]/[block]]", query_guidinfo_records},
      {0}
  };

-- 
1.5.3

--
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

             reply	other threads:[~2011-03-25 19:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-25 19:23 Hal Rosenstock [this message]
     [not found] ` <4D8CEBB3.805-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2011-03-28 20:41   ` [PATCH 3/3] infiniband-diags/saquery: Add GUIDInfoRecord support Ira Weiny

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=4D8CEBB3.805@dev.mellanox.co.il \
    --to=hal-ldsdmyg8hgv8yrgs2mwiifqbs+8scbdb@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=weiny2-i2BcT+NCU+M@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 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.