|
Michal Schmidt |
514221 |
From d5723a0f69577fd3022024ca17c27e273a29695b Mon Sep 17 00:00:00 2001
|
|
Michal Schmidt |
514221 |
From: Michal Schmidt <mschmidt@redhat.com>
|
|
Michal Schmidt |
514221 |
Date: Wed, 1 Feb 2023 22:41:16 +0100
|
|
Michal Schmidt |
514221 |
Subject: [PATCH 2/3] infiniband-diags: drop unnecessary nodedesc local copies
|
|
Michal Schmidt |
514221 |
|
|
Michal Schmidt |
514221 |
Now that remap_node_name() never rewrites nodedesc in-place, some
|
|
Michal Schmidt |
514221 |
copying can be avoided.
|
|
Michal Schmidt |
514221 |
|
|
Michal Schmidt |
514221 |
Signed-off-by: Michal Schmidt <mschmidt@redhat.com>
|
|
Michal Schmidt |
514221 |
---
|
|
Michal Schmidt |
514221 |
infiniband-diags/dump_fts.c | 14 +++-----------
|
|
Michal Schmidt |
514221 |
1 file changed, 3 insertions(+), 11 deletions(-)
|
|
Michal Schmidt |
514221 |
|
|
Michal Schmidt |
514221 |
diff --git a/infiniband-diags/dump_fts.c b/infiniband-diags/dump_fts.c
|
|
Michal Schmidt |
514221 |
index ce6bfb9ecc33..acef9efe692d 100644
|
|
Michal Schmidt |
514221 |
--- a/infiniband-diags/dump_fts.c
|
|
Michal Schmidt |
514221 |
+++ b/infiniband-diags/dump_fts.c
|
|
Michal Schmidt |
514221 |
@@ -109,7 +109,6 @@ static void dump_multicast_tables(ibnd_node_t *node, unsigned startl,
|
|
Michal Schmidt |
514221 |
unsigned endl, struct ibmad_port *mad_port)
|
|
Michal Schmidt |
514221 |
{
|
|
Michal Schmidt |
514221 |
ib_portid_t *portid = &node->path_portid;
|
|
Michal Schmidt |
514221 |
- char nd[IB_SMP_DATA_SIZE + 1] = { 0 };
|
|
Michal Schmidt |
514221 |
char str[512];
|
|
Michal Schmidt |
514221 |
char *s;
|
|
Michal Schmidt |
514221 |
uint64_t nodeguid;
|
|
Michal Schmidt |
514221 |
@@ -119,7 +118,6 @@ static void dump_multicast_tables(ibnd_node_t *node, unsigned startl,
|
|
Michal Schmidt |
514221 |
char *mapnd = NULL;
|
|
Michal Schmidt |
514221 |
int n = 0;
|
|
Michal Schmidt |
514221 |
|
|
Michal Schmidt |
514221 |
- memcpy(nd, node->nodedesc, strlen(node->nodedesc));
|
|
Michal Schmidt |
514221 |
nports = node->numports;
|
|
Michal Schmidt |
514221 |
nodeguid = node->guid;
|
|
Michal Schmidt |
514221 |
|
|
Michal Schmidt |
514221 |
@@ -149,7 +147,7 @@ static void dump_multicast_tables(ibnd_node_t *node, unsigned startl,
|
|
Michal Schmidt |
514221 |
endl = IB_MAX_MCAST_LID;
|
|
Michal Schmidt |
514221 |
}
|
|
Michal Schmidt |
514221 |
|
|
Michal Schmidt |
514221 |
- mapnd = remap_node_name(node_name_map, nodeguid, nd);
|
|
Michal Schmidt |
514221 |
+ mapnd = remap_node_name(node_name_map, nodeguid, node->nodedesc);
|
|
Michal Schmidt |
514221 |
|
|
Michal Schmidt |
514221 |
printf("Multicast mlids [0x%x-0x%x] of switch %s guid 0x%016" PRIx64
|
|
Michal Schmidt |
514221 |
" (%s):\n", startl, endl, portid2str(portid), nodeguid,
|
|
Michal Schmidt |
514221 |
@@ -224,8 +222,6 @@ static int dump_lid(char *str, int str_len, int lid, int valid,
|
|
Michal Schmidt |
514221 |
ibnd_fabric_t *fabric, int *last_port_lid,
|
|
Michal Schmidt |
514221 |
int *base_port_lid, uint64_t *portguid)
|
|
Michal Schmidt |
514221 |
{
|
|
Michal Schmidt |
514221 |
- char nd[IB_SMP_DATA_SIZE + 1] = { 0 };
|
|
Michal Schmidt |
514221 |
-
|
|
Michal Schmidt |
514221 |
ibnd_port_t *port = NULL;
|
|
Michal Schmidt |
514221 |
|
|
Michal Schmidt |
514221 |
char ntype[50], sguid[30];
|
|
Michal Schmidt |
514221 |
@@ -276,14 +272,12 @@ static int dump_lid(char *str, int str_len, int lid, int valid,
|
|
Michal Schmidt |
514221 |
baselid = port->base_lid;
|
|
Michal Schmidt |
514221 |
lmc = port->lmc;
|
|
Michal Schmidt |
514221 |
|
|
Michal Schmidt |
514221 |
- memcpy(nd, port->node->nodedesc, strlen(port->node->nodedesc));
|
|
Michal Schmidt |
514221 |
-
|
|
Michal Schmidt |
514221 |
if (lmc > 0) {
|
|
Michal Schmidt |
514221 |
*base_port_lid = baselid;
|
|
Michal Schmidt |
514221 |
*last_port_lid = baselid + (1 << lmc) - 1;
|
|
Michal Schmidt |
514221 |
}
|
|
Michal Schmidt |
514221 |
|
|
Michal Schmidt |
514221 |
- mapnd = remap_node_name(node_name_map, nodeguid, nd);
|
|
Michal Schmidt |
514221 |
+ mapnd = remap_node_name(node_name_map, nodeguid, port->node->nodedesc);
|
|
Michal Schmidt |
514221 |
|
|
Michal Schmidt |
514221 |
rc = snprintf(str, str_len, ": (%s portguid %s: '%s')",
|
|
Michal Schmidt |
514221 |
mad_dump_val(IB_NODE_TYPE_F, ntype, sizeof ntype,
|
|
Michal Schmidt |
514221 |
@@ -302,7 +296,6 @@ static void dump_unicast_tables(ibnd_node_t *node, int startl, int endl,
|
|
Michal Schmidt |
514221 |
{
|
|
Michal Schmidt |
514221 |
ib_portid_t * portid = &node->path_portid;
|
|
Michal Schmidt |
514221 |
char lft[IB_SMP_DATA_SIZE] = { 0 };
|
|
Michal Schmidt |
514221 |
- char nd[IB_SMP_DATA_SIZE + 1] = { 0 };
|
|
Michal Schmidt |
514221 |
char str[200];
|
|
Michal Schmidt |
514221 |
uint64_t nodeguid;
|
|
Michal Schmidt |
514221 |
int block, i, e, top;
|
|
Michal Schmidt |
514221 |
@@ -315,7 +308,6 @@ static void dump_unicast_tables(ibnd_node_t *node, int startl, int endl,
|
|
Michal Schmidt |
514221 |
mad_decode_field(node->switchinfo, IB_SW_LINEAR_FDB_TOP_F, &top);
|
|
Michal Schmidt |
514221 |
nodeguid = node->guid;
|
|
Michal Schmidt |
514221 |
nports = node->numports;
|
|
Michal Schmidt |
514221 |
- memcpy(nd, node->nodedesc, strlen(node->nodedesc));
|
|
Michal Schmidt |
514221 |
|
|
Michal Schmidt |
514221 |
if (!endl || endl > top)
|
|
Michal Schmidt |
514221 |
endl = top;
|
|
Michal Schmidt |
514221 |
@@ -326,7 +318,7 @@ static void dump_unicast_tables(ibnd_node_t *node, int startl, int endl,
|
|
Michal Schmidt |
514221 |
endl = IB_MAX_UCAST_LID;
|
|
Michal Schmidt |
514221 |
}
|
|
Michal Schmidt |
514221 |
|
|
Michal Schmidt |
514221 |
- mapnd = remap_node_name(node_name_map, nodeguid, nd);
|
|
Michal Schmidt |
514221 |
+ mapnd = remap_node_name(node_name_map, nodeguid, node->nodedesc);
|
|
Michal Schmidt |
514221 |
|
|
Michal Schmidt |
514221 |
printf("Unicast lids [0x%x-0x%x] of switch %s guid 0x%016" PRIx64
|
|
Michal Schmidt |
514221 |
" (%s):\n", startl, endl, portid2str(portid), nodeguid,
|
|
Michal Schmidt |
514221 |
--
|
|
Michal Schmidt |
514221 |
2.39.1
|
|
Michal Schmidt |
514221 |
|