@@ -110,8 +110,8 @@ static int dump_mlid(char *str, int strlen, unsigned mlid, unsigned nports,
uint16_t mft[16][IB_MLIDS_IN_BLOCK] = { { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0}, { 0 }, { 0 } };
-static void dump_multicast_tables(ibnd_node_t *node, unsigned startlid,
- unsigned endlid, struct ibmad_port *mad_port)
+static void dump_multicast_tables(ibnd_node_t *node, unsigned startl,
+ unsigned endl, struct ibmad_port *mad_port)
{
ib_portid_t *portid = &node->path_portid;
char nd[IB_SMP_DATA_SIZE] = { 0 };
@@ -131,33 +131,33 @@ static void dump_multicast_tables(ibnd_node_t *node, unsigned startlid,
mad_decode_field(node->switchinfo, IB_SW_MCAST_FDB_CAP_F, &cap);
mad_decode_field(node->switchinfo, IB_SW_MCAST_FDB_TOP_F, &top);
- if (!endlid || endlid > IB_MIN_MCAST_LID + cap - 1)
- endlid = IB_MIN_MCAST_LID + cap - 1;
- if (!dump_all && top && top < endlid) {
+ if (!endl || endl > IB_MIN_MCAST_LID + cap - 1)
+ endl = IB_MIN_MCAST_LID + cap - 1;
+ if (!dump_all && top && top < endl) {
if (top < IB_MIN_MCAST_LID - 1)
IBWARN("illegal top mlid %x", top);
else
- endlid = top;
+ endl = top;
}
- if (!startlid)
- startlid = IB_MIN_MCAST_LID;
- else if (startlid < IB_MIN_MCAST_LID) {
- IBWARN("illegal start mlid %x, set to %x", startlid,
+ if (!startl)
+ startl = IB_MIN_MCAST_LID;
+ else if (startl < IB_MIN_MCAST_LID) {
+ IBWARN("illegal start mlid %x, set to %x", startl,
IB_MIN_MCAST_LID);
- startlid = IB_MIN_MCAST_LID;
+ startl = IB_MIN_MCAST_LID;
}
- if (endlid > IB_MAX_MCAST_LID) {
- IBWARN("illegal end mlid %x, truncate to %x", endlid,
+ if (endl > IB_MAX_MCAST_LID) {
+ IBWARN("illegal end mlid %x, truncate to %x", endl,
IB_MAX_MCAST_LID);
- endlid = IB_MAX_MCAST_LID;
+ endl = IB_MAX_MCAST_LID;
}
mapnd = remap_node_name(node_name_map, nodeguid, nd);
printf("Multicast mlids [0x%x-0x%x] of switch %s guid 0x%016" PRIx64
- " (%s):\n", startlid, endlid, portid2str(portid), nodeguid,
+ " (%s):\n", startl, endl, portid2str(portid), nodeguid,
mapnd);
if (brief)
@@ -182,8 +182,8 @@ static void dump_multicast_tables(ibnd_node_t *node, unsigned startlid,
chunks = ALIGN(nports + 1, 16) / 16;
- startblock = startlid / IB_MLIDS_IN_BLOCK;
- lastblock = endlid / IB_MLIDS_IN_BLOCK;
+ startblock = startl / IB_MLIDS_IN_BLOCK;
+ lastblock = endl / IB_MLIDS_IN_BLOCK;
for (block = startblock; block <= lastblock; block++) {
for (j = 0; j < chunks; j++) {
int status;
@@ -207,10 +207,10 @@ static void dump_multicast_tables(ibnd_node_t *node, unsigned startlid,
i = block * IB_MLIDS_IN_BLOCK;
e = i + IB_MLIDS_IN_BLOCK;
- if (i < startlid)
- i = startlid;
- if (e > endlid + 1)
- e = endlid + 1;
+ if (i < startl)
+ i = startl;
+ if (e > endl + 1)
+ e = endl + 1;
for (; i < e; i++) {
if (dump_mlid(str, sizeof str, i, nports, mft) == 0)
@@ -301,7 +301,7 @@ static int dump_lid(char *str, int str_len, int lid, int valid,
return rc;
}
-static void dump_unicast_tables(ibnd_node_t *node, int startlid, int endlid,
+static void dump_unicast_tables(ibnd_node_t *node, int startl, int endl,
struct ibmad_port *mad_port,
ibnd_fabric_t *fabric)
{
@@ -322,27 +322,27 @@ static void dump_unicast_tables(ibnd_node_t *node, int startlid, int endlid,
nports = node->numports;
memcpy(nd, node->nodedesc, strlen(node->nodedesc));
- if (!endlid || endlid > top)
- endlid = top;
+ if (!endl || endl > top)
+ endl = top;
- if (endlid > IB_MAX_UCAST_LID) {
- IBWARN("illegal lft top %d, truncate to %d", endlid,
+ if (endl > IB_MAX_UCAST_LID) {
+ IBWARN("illegal lft top %d, truncate to %d", endl,
IB_MAX_UCAST_LID);
- endlid = IB_MAX_UCAST_LID;
+ endl = IB_MAX_UCAST_LID;
}
mapnd = remap_node_name(node_name_map, nodeguid, nd);
printf("Unicast lids [0x%x-0x%x] of switch %s guid 0x%016" PRIx64
- " (%s):\n", startlid, endlid, portid2str(portid), nodeguid,
+ " (%s):\n", startl, endl, portid2str(portid), nodeguid,
mapnd);
DEBUG("Switch top is 0x%x\n", top);
printf(" Lid Out Destination\n");
printf(" Port Info \n");
- startblock = startlid / IB_SMP_DATA_SIZE;
- endblock = ALIGN(endlid, IB_SMP_DATA_SIZE) / IB_SMP_DATA_SIZE;
+ startblock = startl / IB_SMP_DATA_SIZE;
+ endblock = ALIGN(endl, IB_SMP_DATA_SIZE) / IB_SMP_DATA_SIZE;
for (block = startblock; block < endblock; block++) {
int status;
DEBUG("reading block %d", block);
@@ -357,10 +357,10 @@ static void dump_unicast_tables(ibnd_node_t *node, int startlid, int endlid,
}
i = block * IB_SMP_DATA_SIZE;
e = i + IB_SMP_DATA_SIZE;
- if (i < startlid)
- i = startlid;
- if (e > endlid + 1)
- e = endlid + 1;
+ if (i < startl)
+ i = startl;
+ if (e > endl + 1)
+ e = endl + 1;
for (; i < e; i++) {
unsigned outport = lft[i % IB_SMP_DATA_SIZE];
@@ -328,7 +328,7 @@ static struct option *make_long_opts(const char *exclude_str,
const struct ibdiag_opt *custom_opts,
const struct ibdiag_opt *map[])
{
- struct option *long_opts, *l;
+ struct option *res, *l;
const struct ibdiag_opt *o;
unsigned n = 0;
@@ -336,12 +336,12 @@ static struct option *make_long_opts(const char *exclude_str,
for (o = custom_opts; o->name; o++)
n++;
- long_opts = malloc((sizeof(common_opts) / sizeof(common_opts[0]) + n) *
- sizeof(*long_opts));
- if (!long_opts)
+ res = malloc((sizeof(common_opts) / sizeof(common_opts[0]) + n) *
+ sizeof(*res));
+ if (!res)
return NULL;
- l = long_opts;
+ l = res;
if (custom_opts)
for (o = custom_opts; o->name; o++)
@@ -355,7 +355,7 @@ static struct option *make_long_opts(const char *exclude_str,
memset(l, 0, sizeof(*l));
- return long_opts;
+ return res;
}
static void make_str_opts(const struct option *o, char *p, unsigned size)
@@ -637,11 +637,11 @@ static int resolve_gid(char *ca_name, uint8_t ca_port, ib_portid_t *portid,
ibmad_gid_t gid, ib_portid_t *sm_id,
const struct ibmad_port *srcport)
{
- ib_portid_t sm_portid;
+ ib_portid_t tmp;
char buf[IB_SA_DATA_SIZE] = { 0 };
if (!sm_id) {
- sm_id = &sm_portid;
+ sm_id = &tmp;
if (resolve_sm_portid(ca_name, ca_port, sm_id) < 0)
return -1;
}
@@ -657,13 +657,13 @@ static int resolve_guid(char *ca_name, uint8_t ca_port, ib_portid_t *portid,
uint64_t *guid, ib_portid_t *sm_id,
const struct ibmad_port *srcport)
{
- ib_portid_t sm_portid;
+ ib_portid_t tmp;
uint8_t buf[IB_SA_DATA_SIZE] = { 0 };
uint64_t prefix;
ibmad_gid_t selfgid;
if (!sm_id) {
- sm_id = &sm_portid;
+ sm_id = &tmp;
if (resolve_sm_portid(ca_name, ca_port, sm_id) < 0)
return -1;
}
@@ -1122,14 +1122,15 @@ int main(int argc, char **argv)
mad_rpc_set_timeout(ibmad_port, ibd_timeout);
if (port_guid_str) {
- ibnd_port_t *port = ibnd_find_port_guid(fabric, port_guid);
- if (port)
- print_node(port->node, NULL);
+ ibnd_port_t *ndport = ibnd_find_port_guid(fabric, port_guid);
+ if (ndport)
+ print_node(ndport->node, NULL);
else
fprintf(stderr, "Failed to find node: %s\n",
port_guid_str);
} else if (dr_path) {
- ibnd_port_t *port;
+ ibnd_port_t *ndport;
+
uint8_t ni[IB_SMP_DATA_SIZE] = { 0 };
if (!smp_query_via(ni, &portid, IB_ATTR_NODE_INFO, 0,
ibd_timeout, ibmad_port)) {
@@ -1139,12 +1140,12 @@ int main(int argc, char **argv)
mad_decode_field(ni, IB_NODE_PORT_GUID_F, &(port_guid));
- port = ibnd_find_port_guid(fabric, port_guid);
- if (port) {
+ ndport = ibnd_find_port_guid(fabric, port_guid);
+ if (ndport) {
if(obtain_sl)
- if(path_record_query(self_gid,port->guid))
+ if(path_record_query(self_gid,ndport->guid))
goto close_port;
- print_node(port->node, NULL);
+ print_node(ndport->node, NULL);
} else
fprintf(stderr, "Failed to find node: %s\n", dr_path);
} else {