|
|
cd5d9a5 |
diff -up infiniband-diags-1.5.12/src/perfquery.c.hcas infiniband-diags-1.5.12/src/perfquery.c
|
|
|
cd5d9a5 |
--- infiniband-diags-1.5.12/src/perfquery.c.hcas 2011-11-02 01:31:40.000000000 -0400
|
|
|
3841758 |
+++ infiniband-diags-1.5.12/src/perfquery.c 2012-08-22 15:29:50.838358011 -0400
|
|
|
cd5d9a5 |
@@ -368,9 +368,10 @@ static void reset_counters(int extended,
|
|
|
cd5d9a5 |
}
|
|
|
cd5d9a5 |
|
|
|
cd5d9a5 |
static int reset, reset_only, all_ports, loop_ports, port, extended, xmt_sl,
|
|
|
cd5d9a5 |
- rcv_sl, xmt_disc, rcv_err, extended_speeds, smpl_ctl, oprcvcounters, flowctlcounters,
|
|
|
cd5d9a5 |
- vloppackets, vlopdata, vlxmitflowctlerrors, vlxmitcounters, swportvlcong,
|
|
|
cd5d9a5 |
- rcvcc, slrcvfecn, slrcvbecn, xmitcc, vlxmittimecc;
|
|
|
cd5d9a5 |
+ rcv_sl, xmt_disc, rcv_err, extended_speeds, smpl_ctl, oprcvcounters,
|
|
|
cd5d9a5 |
+ flowctlcounters, vloppackets, vlopdata, vlxmitflowctlerrors,
|
|
|
cd5d9a5 |
+ vlxmitcounters, swportvlcong, rcvcc, slrcvfecn, slrcvbecn, xmitcc,
|
|
|
cd5d9a5 |
+ vlxmittimecc, all_hcas;
|
|
|
cd5d9a5 |
|
|
|
cd5d9a5 |
static void common_func(ib_portid_t * portid, int port_num, int mask,
|
|
|
cd5d9a5 |
unsigned query, unsigned reset,
|
|
|
cd5d9a5 |
@@ -604,12 +605,16 @@ static int process_opt(void *context, in
|
|
|
cd5d9a5 |
case 'R':
|
|
|
cd5d9a5 |
reset_only++;
|
|
|
cd5d9a5 |
break;
|
|
|
cd5d9a5 |
+ case 'H':
|
|
|
cd5d9a5 |
+ all_hcas++;
|
|
|
cd5d9a5 |
+ break;
|
|
|
cd5d9a5 |
default:
|
|
|
cd5d9a5 |
return -1;
|
|
|
cd5d9a5 |
}
|
|
|
cd5d9a5 |
return 0;
|
|
|
cd5d9a5 |
}
|
|
|
cd5d9a5 |
|
|
|
cd5d9a5 |
+#define MAX_NAMES 10
|
|
|
cd5d9a5 |
int main(int argc, char **argv)
|
|
|
cd5d9a5 |
{
|
|
|
cd5d9a5 |
int mgmt_classes[4] = { IB_SMI_CLASS, IB_SMI_DIRECT_CLASS, IB_SA_CLASS,
|
|
|
cd5d9a5 |
@@ -624,6 +629,10 @@ int main(int argc, char **argv)
|
|
|
cd5d9a5 |
int start_port = 1;
|
|
|
cd5d9a5 |
int enhancedport0;
|
|
|
cd5d9a5 |
int i;
|
|
|
cd5d9a5 |
+ int names;
|
|
|
cd5d9a5 |
+ int cur_name = 0;
|
|
|
cd5d9a5 |
+ char name_list[MAX_NAMES][UMAD_CA_NAME_LEN];
|
|
|
cd5d9a5 |
+ umad_ca_t ca;
|
|
|
cd5d9a5 |
|
|
|
cd5d9a5 |
const struct ibdiag_opt opts[] = {
|
|
|
cd5d9a5 |
{"extended", 'x', 0, NULL, "show extended port counters"},
|
|
|
cd5d9a5 |
@@ -646,6 +655,7 @@ int main(int argc, char **argv)
|
|
|
cd5d9a5 |
{"vlxmittimecc", 12, 0, NULL, "show VL Xmit Time congestion control counters"},
|
|
|
cd5d9a5 |
{"smplctl", 'c', 0, NULL, "show samples control"},
|
|
|
cd5d9a5 |
{"all_ports", 'a', 0, NULL, "show aggregated counters"},
|
|
|
cd5d9a5 |
+ {"all_hcas", 'H', 0, NULL, "iterate through all local HCAs and ports"},
|
|
|
cd5d9a5 |
{"loop_ports", 'l', 0, NULL, "iterate through each port"},
|
|
|
cd5d9a5 |
{"reset_after_read", 'r', 0, NULL, "reset counters after read"},
|
|
|
cd5d9a5 |
{"Reset_only", 'R', 0, NULL, "only reset counters"},
|
|
|
cd5d9a5 |
@@ -654,10 +664,12 @@ int main(int argc, char **argv)
|
|
|
cd5d9a5 |
char usage_args[] = " [<lid|guid> [[port] [reset_mask]]]";
|
|
|
cd5d9a5 |
const char *usage_examples[] = {
|
|
|
cd5d9a5 |
"\t\t# read local port's performance counters",
|
|
|
cd5d9a5 |
+ "-H\t\t# read performance counters on all local HCAs/ports",
|
|
|
cd5d9a5 |
"32 1\t\t# read performance counters from lid 32, port 1",
|
|
|
cd5d9a5 |
"-x 32 1\t# read extended performance counters from lid 32, port 1",
|
|
|
cd5d9a5 |
"-a 32\t\t# read performance counters from lid 32, all ports",
|
|
|
cd5d9a5 |
"-r 32 1\t# read performance counters and reset",
|
|
|
cd5d9a5 |
+ "-r -H\t\t# read and reset counters on all local HCAs/ports",
|
|
|
cd5d9a5 |
"-x -r 32 1\t# read extended performance counters and reset",
|
|
|
cd5d9a5 |
"-R 0x20 1\t# reset performance counters of port 1 only",
|
|
|
cd5d9a5 |
"-x -R 0x20 1\t# reset extended performance counters of port 1 only",
|
|
|
3841758 |
@@ -673,186 +685,244 @@ int main(int argc, char **argv)
|
|
|
cd5d9a5 |
argc -= optind;
|
|
|
cd5d9a5 |
argv += optind;
|
|
|
cd5d9a5 |
|
|
|
cd5d9a5 |
+ if (all_hcas && argc > 0)
|
|
|
cd5d9a5 |
+ IBERROR("Invalid input: all_hcas and any port/lid/guid are "
|
|
|
cd5d9a5 |
+ "not allowed together.");
|
|
|
cd5d9a5 |
+ if (all_hcas && (loop_ports || all_ports || (port==ALL_PORTS)))
|
|
|
cd5d9a5 |
+ IBERROR("Invalid input: all_hcas can not be combined with "
|
|
|
cd5d9a5 |
+ "loop_ports or all_ports or port == ALL_PORTS");
|
|
|
cd5d9a5 |
+
|
|
|
cd5d9a5 |
if (argc > 1)
|
|
|
cd5d9a5 |
port = strtoul(argv[1], 0, 0);
|
|
|
cd5d9a5 |
if (argc > 2)
|
|
|
cd5d9a5 |
mask = strtoul(argv[2], 0, 0);
|
|
|
cd5d9a5 |
|
|
|
cd5d9a5 |
- srcport = mad_rpc_open_port(ibd_ca, ibd_ca_port, mgmt_classes, 4);
|
|
|
cd5d9a5 |
- if (!srcport)
|
|
|
cd5d9a5 |
- IBERROR("Failed to open '%s' port '%d'", ibd_ca, ibd_ca_port);
|
|
|
cd5d9a5 |
-
|
|
|
cd5d9a5 |
- if (argc) {
|
|
|
cd5d9a5 |
- if (ib_resolve_portid_str_via(&portid, argv[0], ibd_dest_type,
|
|
|
cd5d9a5 |
- ibd_sm_id, srcport) < 0)
|
|
|
cd5d9a5 |
- IBERROR("can't resolve destination port %s", argv[0]);
|
|
|
cd5d9a5 |
- } else {
|
|
|
cd5d9a5 |
- if (ib_resolve_self_via(&portid, &port, 0, srcport) < 0)
|
|
|
cd5d9a5 |
- IBERROR("can't resolve self port %s", argv[0]);
|
|
|
cd5d9a5 |
- }
|
|
|
cd5d9a5 |
+ if (all_hcas) {
|
|
|
cd5d9a5 |
+ if (umad_init() < 0)
|
|
|
cd5d9a5 |
+ IBERROR("Failed to initialize libibumad");
|
|
|
cd5d9a5 |
+ if ((names = umad_get_cas_names(name_list, MAX_NAMES)) < 0)
|
|
|
cd5d9a5 |
+ IBERROR("Unable to get list of HCAs");
|
|
|
cd5d9a5 |
+ cur_name = 0;
|
|
|
cd5d9a5 |
+ if (umad_get_ca(name_list[cur_name], &ca))
|
|
|
cd5d9a5 |
+ IBERROR("Unable to get umad ca");
|
|
|
cd5d9a5 |
+ ibd_ca = name_list[cur_name++];
|
|
|
cd5d9a5 |
+ ibd_ca_port = start_port;
|
|
|
cd5d9a5 |
+ }
|
|
|
cd5d9a5 |
+
|
|
|
cd5d9a5 |
+ do {
|
|
|
3841758 |
+ if (all_hcas && strncmp(ca.ports[ibd_ca_port]->link_layer,
|
|
|
3841758 |
+ "InfiniBand", 10))
|
|
|
3841758 |
+ goto skip_port;
|
|
|
3841758 |
+
|
|
|
cd5d9a5 |
+ srcport = mad_rpc_open_port(ibd_ca, ibd_ca_port,
|
|
|
cd5d9a5 |
+ mgmt_classes, 4);
|
|
|
cd5d9a5 |
+ if (!srcport) {
|
|
|
cd5d9a5 |
+ if (cur_name == 0)
|
|
|
cd5d9a5 |
+ IBERROR("Failed to open '%s' port '%d'",
|
|
|
cd5d9a5 |
+ ibd_ca, ibd_ca_port);
|
|
|
cd5d9a5 |
+ exit(0);
|
|
|
cd5d9a5 |
+ }
|
|
|
cd5d9a5 |
|
|
|
cd5d9a5 |
- /* PerfMgt ClassPortInfo is a required attribute */
|
|
|
cd5d9a5 |
- memset(pc, 0, sizeof(pc));
|
|
|
cd5d9a5 |
- if (!pma_query_via(pc, &portid, port, ibd_timeout, CLASS_PORT_INFO,
|
|
|
cd5d9a5 |
- srcport))
|
|
|
cd5d9a5 |
- IBERROR("classportinfo query");
|
|
|
cd5d9a5 |
- /* ClassPortInfo should be supported as part of libibmad */
|
|
|
cd5d9a5 |
- memcpy(&cap_mask, pc + 2, sizeof(cap_mask)); /* CapabilityMask */
|
|
|
cd5d9a5 |
- if (!(cap_mask & IB_PM_ALL_PORT_SELECT)) { /* bit 8 is AllPortSelect */
|
|
|
cd5d9a5 |
- if (!all_ports && port == ALL_PORTS)
|
|
|
cd5d9a5 |
- IBERROR("AllPortSelect not supported");
|
|
|
cd5d9a5 |
- if (all_ports)
|
|
|
cd5d9a5 |
- all_ports_loop = 1;
|
|
|
cd5d9a5 |
- }
|
|
|
cd5d9a5 |
+ if (argc) {
|
|
|
cd5d9a5 |
+ if (ib_resolve_portid_str_via(&portid, argv[0],
|
|
|
cd5d9a5 |
+ ibd_dest_type,
|
|
|
cd5d9a5 |
+ ibd_sm_id, srcport) < 0)
|
|
|
cd5d9a5 |
+ IBERROR("can't resolve destination port %s",
|
|
|
cd5d9a5 |
+ argv[0]);
|
|
|
cd5d9a5 |
+ } else {
|
|
|
cd5d9a5 |
+ if (ib_resolve_self_via(&portid, &port, 0, srcport) < 0)
|
|
|
cd5d9a5 |
+ IBERROR("can't resolve self port %s", argv[0]);
|
|
|
cd5d9a5 |
+ }
|
|
|
cd5d9a5 |
|
|
|
cd5d9a5 |
- if (xmt_sl) {
|
|
|
cd5d9a5 |
- xmt_sl_query(&portid, port, mask);
|
|
|
cd5d9a5 |
- goto done;
|
|
|
cd5d9a5 |
- }
|
|
|
cd5d9a5 |
+ /* PerfMgt ClassPortInfo is a required attribute */
|
|
|
cd5d9a5 |
+ memset(pc, 0, sizeof(pc));
|
|
|
cd5d9a5 |
+ if (!pma_query_via(pc, &portid, port, ibd_timeout,
|
|
|
cd5d9a5 |
+ CLASS_PORT_INFO, srcport))
|
|
|
cd5d9a5 |
+ IBERROR("classportinfo query");
|
|
|
cd5d9a5 |
+ /* ClassPortInfo should be supported as part of libibmad */
|
|
|
cd5d9a5 |
+ memcpy(&cap_mask, pc + 2, sizeof(cap_mask));/* CapabilityMask */
|
|
|
cd5d9a5 |
+ if (!(cap_mask & IB_PM_ALL_PORT_SELECT)) { /* bit 8 is AllPortSelect */
|
|
|
cd5d9a5 |
+ if (!all_ports && port == ALL_PORTS)
|
|
|
cd5d9a5 |
+ IBERROR("AllPortSelect not supported");
|
|
|
cd5d9a5 |
+ if (all_ports)
|
|
|
cd5d9a5 |
+ all_ports_loop = 1;
|
|
|
cd5d9a5 |
+ }
|
|
|
cd5d9a5 |
|
|
|
cd5d9a5 |
- if (rcv_sl) {
|
|
|
cd5d9a5 |
- rcv_sl_query(&portid, port, mask);
|
|
|
cd5d9a5 |
- goto done;
|
|
|
cd5d9a5 |
- }
|
|
|
cd5d9a5 |
+ if (xmt_sl) {
|
|
|
cd5d9a5 |
+ xmt_sl_query(&portid, port, mask);
|
|
|
cd5d9a5 |
+ goto done;
|
|
|
cd5d9a5 |
+ }
|
|
|
cd5d9a5 |
|
|
|
cd5d9a5 |
- if (xmt_disc) {
|
|
|
cd5d9a5 |
- xmt_disc_query(&portid, port, mask);
|
|
|
cd5d9a5 |
- goto done;
|
|
|
cd5d9a5 |
- }
|
|
|
cd5d9a5 |
+ if (rcv_sl) {
|
|
|
cd5d9a5 |
+ rcv_sl_query(&portid, port, mask);
|
|
|
cd5d9a5 |
+ goto done;
|
|
|
cd5d9a5 |
+ }
|
|
|
cd5d9a5 |
|
|
|
cd5d9a5 |
- if (rcv_err) {
|
|
|
cd5d9a5 |
- rcv_err_query(&portid, port, mask);
|
|
|
cd5d9a5 |
- goto done;
|
|
|
cd5d9a5 |
- }
|
|
|
cd5d9a5 |
+ if (xmt_disc) {
|
|
|
cd5d9a5 |
+ xmt_disc_query(&portid, port, mask);
|
|
|
cd5d9a5 |
+ goto done;
|
|
|
cd5d9a5 |
+ }
|
|
|
cd5d9a5 |
|
|
|
cd5d9a5 |
- if (extended_speeds) {
|
|
|
cd5d9a5 |
- extended_speeds_query(&portid, port, mask);
|
|
|
cd5d9a5 |
- goto done;
|
|
|
cd5d9a5 |
- }
|
|
|
cd5d9a5 |
+ if (rcv_err) {
|
|
|
cd5d9a5 |
+ rcv_err_query(&portid, port, mask);
|
|
|
cd5d9a5 |
+ goto done;
|
|
|
cd5d9a5 |
+ }
|
|
|
cd5d9a5 |
|
|
|
cd5d9a5 |
- if (oprcvcounters) {
|
|
|
cd5d9a5 |
- oprcvcounters_query(&portid, port, mask);
|
|
|
cd5d9a5 |
- goto done;
|
|
|
cd5d9a5 |
- }
|
|
|
cd5d9a5 |
+ if (extended_speeds) {
|
|
|
cd5d9a5 |
+ extended_speeds_query(&portid, port, mask);
|
|
|
cd5d9a5 |
+ goto done;
|
|
|
cd5d9a5 |
+ }
|
|
|
cd5d9a5 |
|
|
|
cd5d9a5 |
- if (flowctlcounters) {
|
|
|
cd5d9a5 |
- flowctlcounters_query(&portid, port, mask);
|
|
|
cd5d9a5 |
- goto done;
|
|
|
cd5d9a5 |
- }
|
|
|
cd5d9a5 |
+ if (oprcvcounters) {
|
|
|
cd5d9a5 |
+ oprcvcounters_query(&portid, port, mask);
|
|
|
cd5d9a5 |
+ goto done;
|
|
|
cd5d9a5 |
+ }
|
|
|
cd5d9a5 |
|
|
|
cd5d9a5 |
- if (vloppackets) {
|
|
|
cd5d9a5 |
- vloppackets_query(&portid, port, mask);
|
|
|
cd5d9a5 |
- goto done;
|
|
|
cd5d9a5 |
- }
|
|
|
cd5d9a5 |
+ if (flowctlcounters) {
|
|
|
cd5d9a5 |
+ flowctlcounters_query(&portid, port, mask);
|
|
|
cd5d9a5 |
+ goto done;
|
|
|
cd5d9a5 |
+ }
|
|
|
cd5d9a5 |
|
|
|
cd5d9a5 |
- if (vlopdata) {
|
|
|
cd5d9a5 |
- vlopdata_query(&portid, port, mask);
|
|
|
cd5d9a5 |
- goto done;
|
|
|
cd5d9a5 |
- }
|
|
|
cd5d9a5 |
+ if (vloppackets) {
|
|
|
cd5d9a5 |
+ vloppackets_query(&portid, port, mask);
|
|
|
cd5d9a5 |
+ goto done;
|
|
|
cd5d9a5 |
+ }
|
|
|
cd5d9a5 |
|
|
|
cd5d9a5 |
- if (vlxmitflowctlerrors) {
|
|
|
cd5d9a5 |
- vlxmitflowctlerrors_query(&portid, port, mask);
|
|
|
cd5d9a5 |
- goto done;
|
|
|
cd5d9a5 |
- }
|
|
|
cd5d9a5 |
+ if (vlopdata) {
|
|
|
cd5d9a5 |
+ vlopdata_query(&portid, port, mask);
|
|
|
cd5d9a5 |
+ goto done;
|
|
|
cd5d9a5 |
+ }
|
|
|
cd5d9a5 |
|
|
|
cd5d9a5 |
- if (vlxmitcounters) {
|
|
|
cd5d9a5 |
- vlxmitcounters_query(&portid, port, mask);
|
|
|
cd5d9a5 |
- goto done;
|
|
|
cd5d9a5 |
- }
|
|
|
cd5d9a5 |
+ if (vlxmitflowctlerrors) {
|
|
|
cd5d9a5 |
+ vlxmitflowctlerrors_query(&portid, port, mask);
|
|
|
cd5d9a5 |
+ goto done;
|
|
|
cd5d9a5 |
+ }
|
|
|
cd5d9a5 |
|
|
|
cd5d9a5 |
- if (swportvlcong) {
|
|
|
cd5d9a5 |
- swportvlcong_query(&portid, port, mask);
|
|
|
cd5d9a5 |
- goto done;
|
|
|
cd5d9a5 |
- }
|
|
|
cd5d9a5 |
+ if (vlxmitcounters) {
|
|
|
cd5d9a5 |
+ vlxmitcounters_query(&portid, port, mask);
|
|
|
cd5d9a5 |
+ goto done;
|
|
|
cd5d9a5 |
+ }
|
|
|
cd5d9a5 |
|
|
|
cd5d9a5 |
- if (rcvcc) {
|
|
|
cd5d9a5 |
- rcvcc_query(&portid, port, mask);
|
|
|
cd5d9a5 |
- goto done;
|
|
|
cd5d9a5 |
- }
|
|
|
cd5d9a5 |
+ if (swportvlcong) {
|
|
|
cd5d9a5 |
+ swportvlcong_query(&portid, port, mask);
|
|
|
cd5d9a5 |
+ goto done;
|
|
|
cd5d9a5 |
+ }
|
|
|
cd5d9a5 |
|
|
|
cd5d9a5 |
- if (slrcvfecn) {
|
|
|
cd5d9a5 |
- slrcvfecn_query(&portid, port, mask);
|
|
|
cd5d9a5 |
- goto done;
|
|
|
cd5d9a5 |
- }
|
|
|
cd5d9a5 |
+ if (rcvcc) {
|
|
|
cd5d9a5 |
+ rcvcc_query(&portid, port, mask);
|
|
|
cd5d9a5 |
+ goto done;
|
|
|
cd5d9a5 |
+ }
|
|
|
cd5d9a5 |
|
|
|
cd5d9a5 |
- if (slrcvbecn) {
|
|
|
cd5d9a5 |
- slrcvbecn_query(&portid, port, mask);
|
|
|
cd5d9a5 |
- goto done;
|
|
|
cd5d9a5 |
- }
|
|
|
cd5d9a5 |
+ if (slrcvfecn) {
|
|
|
cd5d9a5 |
+ slrcvfecn_query(&portid, port, mask);
|
|
|
cd5d9a5 |
+ goto done;
|
|
|
cd5d9a5 |
+ }
|
|
|
cd5d9a5 |
|
|
|
cd5d9a5 |
- if (xmitcc) {
|
|
|
cd5d9a5 |
- xmitcc_query(&portid, port, mask);
|
|
|
cd5d9a5 |
- goto done;
|
|
|
cd5d9a5 |
- }
|
|
|
cd5d9a5 |
+ if (slrcvbecn) {
|
|
|
cd5d9a5 |
+ slrcvbecn_query(&portid, port, mask);
|
|
|
cd5d9a5 |
+ goto done;
|
|
|
cd5d9a5 |
+ }
|
|
|
cd5d9a5 |
|
|
|
cd5d9a5 |
- if (vlxmittimecc) {
|
|
|
cd5d9a5 |
- vlxmittimecc_query(&portid, port, mask);
|
|
|
cd5d9a5 |
- goto done;
|
|
|
cd5d9a5 |
- }
|
|
|
cd5d9a5 |
+ if (xmitcc) {
|
|
|
cd5d9a5 |
+ xmitcc_query(&portid, port, mask);
|
|
|
cd5d9a5 |
+ goto done;
|
|
|
cd5d9a5 |
+ }
|
|
|
cd5d9a5 |
|
|
|
cd5d9a5 |
- if (smpl_ctl) {
|
|
|
cd5d9a5 |
- dump_portsamples_control(&portid, port);
|
|
|
cd5d9a5 |
- goto done;
|
|
|
cd5d9a5 |
- }
|
|
|
cd5d9a5 |
+ if (vlxmittimecc) {
|
|
|
cd5d9a5 |
+ vlxmittimecc_query(&portid, port, mask);
|
|
|
cd5d9a5 |
+ goto done;
|
|
|
cd5d9a5 |
+ }
|
|
|
cd5d9a5 |
|
|
|
cd5d9a5 |
+ if (smpl_ctl) {
|
|
|
cd5d9a5 |
+ dump_portsamples_control(&portid, port);
|
|
|
cd5d9a5 |
+ goto done;
|
|
|
cd5d9a5 |
+ }
|
|
|
cd5d9a5 |
|
|
|
cd5d9a5 |
- if (all_ports_loop || (loop_ports && (all_ports || port == ALL_PORTS))) {
|
|
|
cd5d9a5 |
- if (smp_query_via(data, &portid, IB_ATTR_NODE_INFO, 0, 0,
|
|
|
cd5d9a5 |
- srcport) < 0)
|
|
|
cd5d9a5 |
- IBERROR("smp query nodeinfo failed");
|
|
|
cd5d9a5 |
- node_type = mad_get_field(data, 0, IB_NODE_TYPE_F);
|
|
|
cd5d9a5 |
- mad_decode_field(data, IB_NODE_NPORTS_F, &num_ports);
|
|
|
cd5d9a5 |
- if (!num_ports)
|
|
|
cd5d9a5 |
- IBERROR("smp query nodeinfo: num ports invalid");
|
|
|
cd5d9a5 |
|
|
|
cd5d9a5 |
- if (node_type == IB_NODE_SWITCH) {
|
|
|
cd5d9a5 |
- if (smp_query_via(data, &portid, IB_ATTR_SWITCH_INFO,
|
|
|
cd5d9a5 |
+ if (all_ports_loop ||
|
|
|
cd5d9a5 |
+ (loop_ports && (all_ports || port == ALL_PORTS))) {
|
|
|
cd5d9a5 |
+ if (smp_query_via(data, &portid, IB_ATTR_NODE_INFO,
|
|
|
cd5d9a5 |
0, 0, srcport) < 0)
|
|
|
cd5d9a5 |
IBERROR("smp query nodeinfo failed");
|
|
|
cd5d9a5 |
- enhancedport0 =
|
|
|
cd5d9a5 |
- mad_get_field(data, 0, IB_SW_ENHANCED_PORT0_F);
|
|
|
cd5d9a5 |
- if (enhancedport0)
|
|
|
cd5d9a5 |
- start_port = 0;
|
|
|
cd5d9a5 |
- }
|
|
|
cd5d9a5 |
- if (all_ports_loop && !loop_ports)
|
|
|
cd5d9a5 |
- IBWARN
|
|
|
cd5d9a5 |
- ("Emulating AllPortSelect by iterating through all ports");
|
|
|
cd5d9a5 |
- }
|
|
|
cd5d9a5 |
+ node_type = mad_get_field(data, 0, IB_NODE_TYPE_F);
|
|
|
cd5d9a5 |
+ mad_decode_field(data, IB_NODE_NPORTS_F, &num_ports);
|
|
|
cd5d9a5 |
+ if (!num_ports)
|
|
|
cd5d9a5 |
+ IBERROR("smp query nodeinfo: num ports invalid");
|
|
|
cd5d9a5 |
+
|
|
|
cd5d9a5 |
+ if (node_type == IB_NODE_SWITCH) {
|
|
|
cd5d9a5 |
+ if (smp_query_via(data, &portid,
|
|
|
cd5d9a5 |
+ IB_ATTR_SWITCH_INFO,
|
|
|
cd5d9a5 |
+ 0, 0, srcport) < 0)
|
|
|
cd5d9a5 |
+ IBERROR("smp query nodeinfo failed");
|
|
|
cd5d9a5 |
+ enhancedport0 =
|
|
|
cd5d9a5 |
+ mad_get_field(data, 0,
|
|
|
cd5d9a5 |
+ IB_SW_ENHANCED_PORT0_F);
|
|
|
cd5d9a5 |
+ if (enhancedport0)
|
|
|
cd5d9a5 |
+ start_port = 0;
|
|
|
cd5d9a5 |
+ }
|
|
|
cd5d9a5 |
+ if (all_ports_loop && !loop_ports)
|
|
|
cd5d9a5 |
+ IBWARN ("Emulating AllPortSelect by iterating "
|
|
|
cd5d9a5 |
+ "through all ports");
|
|
|
cd5d9a5 |
+ }
|
|
|
cd5d9a5 |
|
|
|
cd5d9a5 |
- if (reset_only)
|
|
|
cd5d9a5 |
- goto do_reset;
|
|
|
cd5d9a5 |
+ if (reset_only)
|
|
|
cd5d9a5 |
+ goto do_reset;
|
|
|
cd5d9a5 |
|
|
|
cd5d9a5 |
- if (all_ports_loop || (loop_ports && (all_ports || port == ALL_PORTS))) {
|
|
|
cd5d9a5 |
- for (i = start_port; i <= num_ports; i++)
|
|
|
cd5d9a5 |
+ if (all_ports_loop ||
|
|
|
cd5d9a5 |
+ (loop_ports && (all_ports || port == ALL_PORTS))) {
|
|
|
cd5d9a5 |
+ for (i = start_port; i <= num_ports; i++)
|
|
|
cd5d9a5 |
+ dump_perfcounters(extended, ibd_timeout,
|
|
|
cd5d9a5 |
+ cap_mask, &portid, i,
|
|
|
cd5d9a5 |
+ (all_ports_loop &&
|
|
|
cd5d9a5 |
+ !loop_ports));
|
|
|
cd5d9a5 |
+ if (all_ports_loop && !loop_ports) {
|
|
|
cd5d9a5 |
+ if (extended != 1)
|
|
|
cd5d9a5 |
+ output_aggregate_perfcounters(&portid,
|
|
|
cd5d9a5 |
+ cap_mask);
|
|
|
cd5d9a5 |
+ else
|
|
|
cd5d9a5 |
+ output_aggregate_perfcounters_ext(&portid,
|
|
|
cd5d9a5 |
+ cap_mask);
|
|
|
cd5d9a5 |
+ }
|
|
|
cd5d9a5 |
+ } else
|
|
|
cd5d9a5 |
dump_perfcounters(extended, ibd_timeout, cap_mask,
|
|
|
cd5d9a5 |
- &portid, i, (all_ports_loop
|
|
|
cd5d9a5 |
- && !loop_ports));
|
|
|
cd5d9a5 |
- if (all_ports_loop && !loop_ports) {
|
|
|
cd5d9a5 |
- if (extended != 1)
|
|
|
cd5d9a5 |
- output_aggregate_perfcounters(&portid,
|
|
|
cd5d9a5 |
- cap_mask);
|
|
|
cd5d9a5 |
- else
|
|
|
cd5d9a5 |
- output_aggregate_perfcounters_ext(&portid,
|
|
|
cd5d9a5 |
- cap_mask);
|
|
|
cd5d9a5 |
- }
|
|
|
cd5d9a5 |
- } else
|
|
|
cd5d9a5 |
- dump_perfcounters(extended, ibd_timeout, cap_mask, &portid,
|
|
|
cd5d9a5 |
- port, 0);
|
|
|
cd5d9a5 |
+ &portid, port, 0);
|
|
|
cd5d9a5 |
|
|
|
cd5d9a5 |
- if (!reset)
|
|
|
cd5d9a5 |
- goto done;
|
|
|
cd5d9a5 |
+ if (!reset)
|
|
|
cd5d9a5 |
+ goto done;
|
|
|
cd5d9a5 |
|
|
|
cd5d9a5 |
do_reset:
|
|
|
cd5d9a5 |
- if (argc <= 2 && !extended && (cap_mask & IB_PM_PC_XMIT_WAIT_SUP))
|
|
|
cd5d9a5 |
- mask |= (1 << 16); /* reset portxmitwait */
|
|
|
cd5d9a5 |
-
|
|
|
cd5d9a5 |
- if (all_ports_loop || (loop_ports && (all_ports || port == ALL_PORTS))) {
|
|
|
cd5d9a5 |
- for (i = start_port; i <= num_ports; i++)
|
|
|
cd5d9a5 |
- reset_counters(extended, ibd_timeout, mask, &portid, i);
|
|
|
cd5d9a5 |
- } else
|
|
|
cd5d9a5 |
- reset_counters(extended, ibd_timeout, mask, &portid, port);
|
|
|
cd5d9a5 |
+ if (argc <= 2 && !extended &&
|
|
|
cd5d9a5 |
+ (cap_mask & IB_PM_PC_XMIT_WAIT_SUP))
|
|
|
cd5d9a5 |
+ mask |= (1 << 16); /* reset portxmitwait */
|
|
|
cd5d9a5 |
+
|
|
|
cd5d9a5 |
+ if (all_ports_loop ||
|
|
|
cd5d9a5 |
+ (loop_ports && (all_ports || port == ALL_PORTS)))
|
|
|
cd5d9a5 |
+ for (i = start_port; i <= num_ports; i++)
|
|
|
cd5d9a5 |
+ reset_counters(extended, ibd_timeout, mask,
|
|
|
cd5d9a5 |
+ &portid, i);
|
|
|
cd5d9a5 |
+ else
|
|
|
cd5d9a5 |
+ reset_counters(extended, ibd_timeout, mask,
|
|
|
cd5d9a5 |
+ &portid, port);
|
|
|
cd5d9a5 |
|
|
|
cd5d9a5 |
done:
|
|
|
cd5d9a5 |
- mad_rpc_close_port(srcport);
|
|
|
cd5d9a5 |
+ mad_rpc_close_port(srcport);
|
|
|
3841758 |
+skip_port:
|
|
|
cd5d9a5 |
+ if (all_hcas) {
|
|
|
cd5d9a5 |
+ if (ibd_ca_port < ca.numports)
|
|
|
cd5d9a5 |
+ ibd_ca_port++;
|
|
|
cd5d9a5 |
+ else {
|
|
|
3841758 |
+ umad_release_ca(&ca);
|
|
|
cd5d9a5 |
+ if (umad_get_ca(name_list[cur_name], &ca))
|
|
|
cd5d9a5 |
+ /*
|
|
|
cd5d9a5 |
+ * We're done, the next name in the
|
|
|
cd5d9a5 |
+ * list was empty, exit gracefully
|
|
|
cd5d9a5 |
+ */
|
|
|
cd5d9a5 |
+ exit(0);
|
|
|
cd5d9a5 |
+ ibd_ca = name_list[cur_name++];
|
|
|
cd5d9a5 |
+ ibd_ca_port = start_port;
|
|
|
cd5d9a5 |
+ }
|
|
|
3841758 |
+ } else
|
|
|
3841758 |
+ ibd_ca = NULL;
|
|
|
cd5d9a5 |
+ } while (ibd_ca);
|
|
|
cd5d9a5 |
exit(0);
|
|
|
cd5d9a5 |
}
|