Skip to content

Commit

Permalink
iblinkinfo: Use API supporting SMI/GSI seperation
Browse files Browse the repository at this point in the history
Migration to the SMI/GSI separated API to support planarized networks.

Signed-off-by: Asaf Mazor <[email protected]>
  • Loading branch information
mazorasaf committed Jan 14, 2025
1 parent aaf9f69 commit 789b993
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions infiniband-diags/iblinkinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,7 @@ int main(int argc, char **argv)
ibnd_fabric_t *fabric = NULL;
ibnd_fabric_t *diff_fabric = NULL;
struct ibmad_port *ibmad_port;
struct ibmad_ports_pair *ibmad_ports;
ib_portid_t port_id = { 0 };
uint8_t ni[IB_SMP_DATA_SIZE] = { 0 };
int mgmt_classes[3] =
Expand Down Expand Up @@ -640,7 +641,14 @@ int main(int argc, char **argv)
argc -= optind;
argv += optind;

ibmad_port = mad_rpc_open_port(ibd_ca, ibd_ca_port, mgmt_classes, 3);
ibmad_ports = mad_rpc_open_port2(ibd_ca, ibd_ca_port, mgmt_classes, 3, 1);
if (!ibmad_ports) {
fprintf(stderr, "Failed to open %s port %d\n", ibd_ca,
ibd_ca_port);
exit(1);
}

ibmad_port = ibmad_ports->smi.port;
if (!ibmad_port) {
fprintf(stderr, "Failed to open %s port %d\n", ibd_ca,
ibd_ca_port);
Expand All @@ -660,35 +668,35 @@ int main(int argc, char **argv)
node_name_map = open_node_name_map(node_name_map_file);

if (dr_path && load_cache_file) {
mad_rpc_close_port(ibmad_port);
mad_rpc_close_port2(ibmad_ports);
fprintf(stderr, "Cannot specify cache and direct route path\n");
exit(1);
}

if (dr_path) {
/* only scan part of the fabric */
if ((resolved =
resolve_portid_str(ibd_ca, ibd_ca_port, &port_id, dr_path,
IB_DEST_DRPATH, NULL, ibmad_port)) < 0)
resolve_portid_str(ibmad_ports->gsi.ca_name, ibd_ca_port, &port_id, dr_path,
IB_DEST_DRPATH, NULL, ibmad_ports->gsi.port)) < 0)
IBWARN("Failed to resolve %s; attempting full scan",
dr_path);
} else if (node_label.guid_str) {
if ((resolved = resolve_portid_str(
ibd_ca, ibd_ca_port, &port_id, node_label.guid_str,
IB_DEST_GUID, NULL, ibmad_port)) < 0)
ibmad_ports->gsi.ca_name, ibd_ca_port, &port_id, node_label.guid_str,
IB_DEST_GUID, NULL, ibmad_ports->gsi.port)) < 0)
IBWARN("Failed to resolve %s; attempting full scan\n",
node_label.guid_str);
}

if (!all && dr_path) {
if (!smp_query_via(ni, &port_id, IB_ATTR_NODE_INFO, 0,
ibd_timeout, ibmad_port)){
mad_rpc_close_port(ibmad_port);
mad_rpc_close_port2(ibmad_ports);
fprintf(stderr, "Failed to get local Node Info\n");
exit(1);
}
}
mad_rpc_close_port(ibmad_port);
mad_rpc_close_port2(ibmad_ports);

if (diff_cache_file &&
!(diff_fabric = ibnd_load_fabric(diff_cache_file, 0)))
Expand Down

0 comments on commit 789b993

Please sign in to comment.