From: Hal Rosenstock <hal-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
To: Ira Weiny <ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc: Vladimir Koushnir
<vladimirk-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>,
"linux-rdma
(linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org)"
<linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: [PATCH infiniband-diags] dump_fts: Open global file descriptor after calling ibnd_discover_fabric
Date: Tue, 21 Apr 2015 08:15:19 -0400 [thread overview]
Message-ID: <55363F57.3020909@dev.mellanox.co.il> (raw)
From: Vladimir Koushnir <vladimirk-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Date: Thu, 16 Apr 2015 16:56:40 +0300
Global file descriptor for SMPs should be opened only after running
ibnd_discover_fabric() to avoid parallel usage of two SMP file descriptors
Signed-off-by: Vladimir Koushnir <vladimirk-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Signed-off-by: Hal Rosenstock <hal-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
src/dump_fts.c | 30 +++++++++++++++++++-----------
1 files changed, 19 insertions(+), 11 deletions(-)
diff --git a/src/dump_fts.c b/src/dump_fts.c
index 0de61da..387211f 100644
--- a/src/dump_fts.c
+++ b/src/dump_fts.c
@@ -457,33 +457,41 @@ int main(int argc, char **argv)
if (argc > 1)
endlid = strtoul(argv[1], 0, 0);
- srcport = mad_rpc_open_port(ibd_ca, ibd_ca_port, mgmt_classes, 3);
- if (!srcport)
- IBEXIT("Failed to open '%s' port '%d'", ibd_ca, ibd_ca_port);
-
node_name_map = open_node_name_map(node_name_map_file);
- smp_mkey_set(srcport, ibd_mkey);
-
- if (ibd_timeout) {
- mad_rpc_set_timeout(srcport, ibd_timeout);
+ if (ibd_timeout)
config.timeout_ms = ibd_timeout;
- }
config.flags = ibd_ibnetdisc_flags;
config.mkey = ibd_mkey;
if ((fabric = ibnd_discover_fabric(ibd_ca, ibd_ca_port, NULL,
&config)) != NULL) {
+
+ srcport = mad_rpc_open_port(ibd_ca, ibd_ca_port, mgmt_classes, 3);
+ if (!srcport) {
+ fprintf(stderr,
+ "Failed to open '%s' port '%d'\n", ibd_ca, ibd_ca_port);
+ rc = -1;
+ goto Exit;
+ }
+ smp_mkey_set(srcport, ibd_mkey);
+
+ if (ibd_timeout) {
+ mad_rpc_set_timeout(srcport, ibd_timeout);
+ }
+
ibnd_iter_nodes_type(fabric, process_switch, IB_NODE_SWITCH, fabric);
+
+ mad_rpc_close_port(srcport);
+
} else {
fprintf(stderr, "Failed to discover fabric\n");
rc = -1;
}
-
+Exit:
ibnd_destroy_fabric(fabric);
- mad_rpc_close_port(srcport);
close_node_name_map(node_name_map);
exit(rc);
}
--
1.7.8.2
--
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 reply other threads:[~2015-04-21 12:15 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-21 12:15 Hal Rosenstock [this message]
[not found] ` <55363F57.3020909-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2015-04-22 15:27 ` [PATCH infiniband-diags] dump_fts: Open global file descriptor after calling ibnd_discover_fabric ira.weiny
2015-07-03 15:21 ` 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=55363F57.3020909@dev.mellanox.co.il \
--to=hal-ldsdmyg8hgv8yrgs2mwiifqbs+8scbdb@public.gmane.org \
--cc=ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=vladimirk-VPRAkNaXOzVWk0Htik3J/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