Skip to contentSkip to conversation

dump_fts: Open global file descriptor after calling ibnd_discover_fabric

PATCH Applied Hal Rosenstock 2 participants 3 messages Apr 21, 2015 – Jul 3, 2015 1 message not in the archive InfiniBand

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dump_fts: Open global file descriptor after calling ibnd_discover_fabric

From: Vladimir Koushnir <vladimirk-VPRAkNaXOzVWk0Htik3J/[email protected]>
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

---
 src/dump_fts.c |   30 +++++++++++++++++++-----------
 1 files changed, 19 insertions(+), 11 deletions(-)
src/dump_fts.c +19 -11
index 0de61da..387211f 100644
@@ -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);
 }
Signature · 6 lines
1.7.8.2

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 55363F57.3020909-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org

#2 lore raw
Quoted 5 lines · Hal Rosenstock

From: Vladimir Koushnir <vladimirk-VPRAkNaXOzVWk0Htik3J/[email protected]>
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

Is there a bug which these patches fix?

Is there some issue with the ibsim?

Ir

Quoted 67 lines
---
 src/dump_fts.c |   30 +++++++++++++++++++-----------
 1 files changed, 19 insertions(+), 11 deletions(-)
src/dump_fts.c +19 -11
index 0de61da..387211f 100644
@@ -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);
 }
Signature · 1 line
1.7.8.2

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

Applied
#3 lore raw
In reply to a message not in the archive
Quoted 8 lines · Hal Rosenstock

From: Vladimir Koushnir <vladimirk-VPRAkNaXOzVWk0Htik3J/[email protected]>
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

Thanks applied,
Ira

Quoted 64 lines
---
 src/dump_fts.c |   30 +++++++++++++++++++-----------
 1 files changed, 19 insertions(+), 11 deletions(-)
src/dump_fts.c +19 -11
index 0de61da..387211f 100644
@@ -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);
 }
Signature · 1 line
1.7.8.2

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html