From: "Eli Dorfman (Voltaire)" <dorfman.eli-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Sasha Khapyorsky <sashak-smomgflXvOZWk0Htik3J/w@public.gmane.org>
Cc: linux-rdma <linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH v2] infiniband-diags/saquery: Report SA MAD Class specific status.
Date: Mon, 02 Nov 2009 11:40:19 +0200 [thread overview]
Message-ID: <4AEEA903.4030406@gmail.com> (raw)
In-Reply-To: <20091101165223.GJ29434@me>
Report SA MAD Class specific status.
In addition to SM status.
Signed-off-by: Eli Dorfman <elid-smomgflXvOZWk0Htik3J/w@public.gmane.org>
---
infiniband-diags/src/saquery.c | 45 ++++++++++++++++++++++++++++++++++++---
1 files changed, 41 insertions(+), 4 deletions(-)
diff --git a/infiniband-diags/src/saquery.c b/infiniband-diags/src/saquery.c
index 6c44b63..9495cd9 100644
--- a/infiniband-diags/src/saquery.c
+++ b/infiniband-diags/src/saquery.c
@@ -124,6 +124,45 @@ int requested_lid_flag = 0;
uint64_t requested_guid = 0;
int requested_guid_flag = 0;
+#define SA_ERR_UNKNOWN IB_SA_MAD_STATUS_PRIO_SUGGESTED
+
+const char *ib_sa_error_str[] = {
+ "SA_NO_ERROR",
+ "SA_ERR_NO_RESOURCES",
+ "SA_ERR_REQ_INVALID",
+ "SA_ERR_NO_RECORDS",
+ "SA_ERR_TOO_MANY_RECORDS",
+ "SA_ERR_REQ_INVALID_GID",
+ "SA_ERR_REQ_INSUFFICIENT_COMPONENTS",
+ "SA_ERR_REQ_DENIED",
+ "SA_ERR_STATUS_PRIO_SUGGESTED",
+ "SA_ERR_UNKNOWN"
+};
+
+static inline const char *ib_sa_err_str(IN uint8_t status)
+{
+ if (status > SA_ERR_UNKNOWN)
+ status = SA_ERR_UNKNOWN;
+ return (ib_sa_error_str[status]);
+}
+
+static inline void report_err(int status)
+{
+ int st = status & 0xff;
+ char sm_err_str[64] = { 0 };
+ char sa_err_str[64] = { 0 };
+
+ if (st)
+ sprintf(sm_err_str, " SM(%s)", ib_get_err_str(st));
+
+ st = status >> 8;
+ if (st)
+ sprintf(sa_err_str, " SA(%s)", ib_sa_err_str(st));
+
+ fprintf(stderr, "ERROR: Query result returned 0x%04x, %s%s\n",
+ status, sm_err_str, sa_err_str);
+}
+
static int sa_query(struct bind_handle *h, uint8_t method,
uint16_t attr, uint32_t mod, uint64_t comp_mask,
uint64_t sm_key, void *data)
@@ -794,8 +833,7 @@ static int get_any_records(bind_handle_t h,
}
if (result.status != IB_SUCCESS) {
- fprintf(stderr, "Query result returned: %s\n",
- ib_get_err_str(result.status));
+ report_err(result.status);
return result.status;
}
@@ -1009,8 +1047,7 @@ static int get_print_class_port_info(bind_handle_t h)
return ret;
}
if (result.status != IB_SUCCESS) {
- fprintf(stderr, "ERROR: Query result returned: %s\n",
- ib_get_err_str(result.status));
+ report_err(result.status);
return (result.status);
}
dump_results(&result, dump_class_port_info);
--
1.5.5
--
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
next prev parent reply other threads:[~2009-11-02 9:40 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-01 8:09 [PATCH] infiniband-diags/saquery: Report SA MAD Class specific status Eli Dorfman (Voltaire)
[not found] ` <4AED4241.4000808-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2009-11-01 16:52 ` Sasha Khapyorsky
2009-11-02 9:22 ` Eli Dorfman (Voltaire)
[not found] ` <4AEEA4D6.8070109-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2009-11-02 12:20 ` Sasha Khapyorsky
2009-11-02 9:40 ` Eli Dorfman (Voltaire) [this message]
[not found] ` <4AEEA903.4030406-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2009-11-02 12:25 ` [PATCH v2] " Sasha Khapyorsky
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=4AEEA903.4030406@gmail.com \
--to=dorfman.eli-re5jqeeqqe8avxtiumwx3w@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