public inbox for linux-rdma@vger.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
	(linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org)"
	<linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Husam Kahalah <HKahalah-DMD6N21cJuFWk0Htik3J/w@public.gmane.org>,
	Dan Ben-Yosef <danby-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>,
	Daniel Klein <danielk-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Subject: [PATCHv3 infiniband-diags] saquery: Add SMInfoRecord support
Date: Sat, 22 Jun 2013 10:07:27 -0400	[thread overview]
Message-ID: <51C5AF9F.3010102@dev.mellanox.co.il> (raw)


This patch is the combination of 2 patches:
     infiniband_diags/src/saquery.c: Add SMInfoRecord support
     infiniband_diags/doc/rst/saquery.8.in.rst: Add support to the manual

Signed-off-by: Husam Kahalah <hkahalah-DMD6N21cJuFWk0Htik3J/w@public.gmane.org>
Signed-off-by: Hal Rosenstock <hal-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
This patch is based on Husam's previous patch for this.

diff --git a/doc/rst/saquery.8.in.rst b/doc/rst/saquery.8.in.rst
index 8d87096..0551917 100644
--- a/doc/rst/saquery.8.in.rst
+++ b/doc/rst/saquery.8.in.rst
@@ -156,6 +156,7 @@ Supported query names (and aliases):
         MFTRecord (MFTR) [[mlid]/[position]/[block]]
         GUIDInfoRecord (GIR) [[lid]/[block]]
         SwitchInfoRecord (SWIR) [lid]
+        SMInfoRecord (SMIR) [lid]
 
 
 
diff --git a/src/saquery.c b/src/saquery.c
index 26b2a9d..8f59253 100644
--- a/src/saquery.c
+++ b/src/saquery.c
@@ -489,6 +489,30 @@ static void dump_service_record(void *data)
 	       cl_ntoh64(p_sr->service_data64[1]));
 }
 
+static void dump_sm_info_record(void *data)
+{
+	ib_sminfo_record_t *p_smr = data;
+	const ib_sm_info_t *const p_smi = &p_smr->sm_info;
+	uint8_t priority, state;
+	priority = ib_sminfo_get_priority(p_smi);
+	state = ib_sminfo_get_state(p_smi);
+
+	printf("SMInfoRecord dump:\n"
+	       "\t\tRID\n"
+	       "\t\tLID...................%u\n"
+	       "\t\tSMInfo dump:\n"
+	       "\t\tGUID..................0x%016" PRIx64 "\n"
+	       "\t\tSM_Key................0x%016" PRIx64 "\n"
+	       "\t\tActCount..............%u\n"
+	       "\t\tPriority..............%u\n"
+	       "\t\tSMState...............%u\n",
+	       cl_ntoh16(p_smr->lid),
+	       cl_ntoh64(p_smr->sm_info.guid),
+	       cl_ntoh64(p_smr->sm_info.sm_key),
+	       cl_ntoh32(p_smr->sm_info.act_count),
+	       priority, state);
+}
+
 static void dump_switch_info_record(void *data)
 {
 	ib_switch_info_record_t *p_sir = data;
@@ -1194,6 +1218,25 @@ static int query_service_records(const struct query_cmd *q, struct sa_handle * h
 					dump_service_record);
 }
 
+static int query_sm_info_records(const struct query_cmd *q,
+				 struct sa_handle * h, struct query_params *p,
+				 int argc, char *argv[])
+{
+	ib_sminfo_record_t smir;
+	ib_net64_t comp_mask = 0;
+	int lid = 0;
+
+	if (argc > 0)
+		parse_lid_and_ports(h, argv[0], &lid, NULL, NULL);
+
+	memset(&smir, 0, sizeof(smir));
+	CHECK_AND_SET_VAL(lid, 16, 0, smir.lid, SMIR, LID);
+
+	return get_and_dump_any_records(h, IB_SA_ATTR_SMINFORECORD, 0,
+					comp_mask, &smir, sizeof(smir),
+					dump_sm_info_record);
+}
+
 static int query_switchinfo_records(const struct query_cmd *q,
 				struct sa_handle * h, struct query_params *p,
 				int argc, char *argv[])
@@ -1406,6 +1449,8 @@ static const struct query_cmd query_cmds[] = {
 	 "[[lid]/[block]]", query_guidinfo_records},
 	{"SwitchInfoRecord", "SWIR", IB_SA_ATTR_SWITCHINFORECORD,
 	 "[lid]", query_switchinfo_records},
+	{"SMInfoRecord", "SMIR", IB_SA_ATTR_SMINFORECORD,
+	 "[lid]", query_sm_info_records},
 	{0}
 };
 
--
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:[~2013-06-22 14:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-22 14:07 Hal Rosenstock [this message]
     [not found] ` <51C5AF9F.3010102-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2013-07-05 15:32   ` [PATCHv3 infiniband-diags] saquery: Add SMInfoRecord support Weiny, Ira

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=51C5AF9F.3010102@dev.mellanox.co.il \
    --to=hal-ldsdmyg8hgv8yrgs2mwiifqbs+8scbdb@public.gmane.org \
    --cc=HKahalah-DMD6N21cJuFWk0Htik3J/w@public.gmane.org \
    --cc=danby-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    --cc=danielk-VPRAkNaXOzVWk0Htik3J/w@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox