Date: Mon, 3 Jan 2011 05:21:53 +0000 (UTC) From: Jeff Roberson <jeff@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r216907 - in projects/ofed/base/contrib/ofed/management: infiniband-diags infiniband-diags/man infiniband-diags/src libibcommon libibmad libibumad opensm opensm/include/opensm opensm/op... Message-ID: <201101030521.p035Lr7T075618@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jeff Date: Mon Jan 3 05:21:53 2011 New Revision: 216907 URL: http://svn.freebsd.org/changeset/base/216907 Log: - Upgrade opensm to 3.3.0 Sponsored by: Isilon Systems, iX Systems, and Panasas. Modified: projects/ofed/base/contrib/ofed/management/infiniband-diags/configure.in projects/ofed/base/contrib/ofed/management/infiniband-diags/man/saquery.8 projects/ofed/base/contrib/ofed/management/infiniband-diags/src/ibping.c projects/ofed/base/contrib/ofed/management/infiniband-diags/src/saquery.c projects/ofed/base/contrib/ofed/management/infiniband-diags/src/sminfo.c projects/ofed/base/contrib/ofed/management/infiniband-diags/src/smpquery.c projects/ofed/base/contrib/ofed/management/libibcommon/configure.in projects/ofed/base/contrib/ofed/management/libibmad/configure.in projects/ofed/base/contrib/ofed/management/libibumad/configure.in projects/ofed/base/contrib/ofed/management/opensm/configure.in projects/ofed/base/contrib/ofed/management/opensm/include/opensm/osm_pkey.h projects/ofed/base/contrib/ofed/management/opensm/opensm/Makefile.am projects/ofed/base/contrib/ofed/management/opensm/opensm/osm_console.c projects/ofed/base/contrib/ofed/management/opensm/opensm/osm_node_info_rcv.c projects/ofed/base/contrib/ofed/management/opensm/opensm/osm_pkey.c projects/ofed/base/contrib/ofed/management/opensm/opensm/osm_pkey_mgr.c projects/ofed/base/contrib/ofed/management/opensm/opensm/osm_port_info_rcv.c projects/ofed/base/contrib/ofed/management/opensm/opensm/osm_sa_mcmember_record.c projects/ofed/base/contrib/ofed/management/opensm/opensm/osm_sa_pkey_record.c projects/ofed/base/contrib/ofed/management/opensm/opensm/osm_sa_slvl_record.c projects/ofed/base/contrib/ofed/management/opensm/opensm/osm_sa_vlarb_record.c projects/ofed/base/contrib/ofed/management/opensm/opensm/osm_sm.c projects/ofed/base/contrib/ofed/management/opensm/opensm/osm_state_mgr.c projects/ofed/base/contrib/ofed/management/opensm/opensm/osm_ucast_mgr.c Modified: projects/ofed/base/contrib/ofed/management/infiniband-diags/configure.in ============================================================================== --- projects/ofed/base/contrib/ofed/management/infiniband-diags/configure.in Mon Jan 3 05:14:39 2011 (r216906) +++ projects/ofed/base/contrib/ofed/management/infiniband-diags/configure.in Mon Jan 3 05:21:53 2011 (r216907) @@ -1,7 +1,7 @@ dnl Process this file with autoconf to produce a configure script. AC_PREREQ(2.57) -AC_INIT(infiniband-diags, 1.4.4, general@lists.openfabrics.org) +AC_INIT(infiniband-diags, 1.5.0, general@lists.openfabrics.org) AC_CONFIG_AUX_DIR(config) AM_CONFIG_HEADER(config.h) AM_INIT_AUTOMAKE Modified: projects/ofed/base/contrib/ofed/management/infiniband-diags/man/saquery.8 ============================================================================== --- projects/ofed/base/contrib/ofed/management/infiniband-diags/man/saquery.8 Mon Jan 3 05:14:39 2011 (r216906) +++ projects/ofed/base/contrib/ofed/management/infiniband-diags/man/saquery.8 Mon Jan 3 05:21:53 2011 (r216907) @@ -105,7 +105,7 @@ for node name map file format. Only use Supported query names (and aliases): ClassPortInfo (CPI) NodeRecord (NR) - PortInfoRecord (PIR) + PortInfoRecord (PIR) [[lid]/[port]] SL2VLTableRecord (SL2VL) [[lid]/[in_port]/[out_port]] PKeyTableRecord (PKTR) [[lid]/[port]/[block]] VLArbitrationTableRecord (VLAR) [[lid]/[port]/[block]] Modified: projects/ofed/base/contrib/ofed/management/infiniband-diags/src/ibping.c ============================================================================== --- projects/ofed/base/contrib/ofed/management/infiniband-diags/src/ibping.c Mon Jan 3 05:14:39 2011 (r216906) +++ projects/ofed/base/contrib/ofed/management/infiniband-diags/src/ibping.c Mon Jan 3 05:21:53 2011 (r216907) @@ -194,7 +194,7 @@ main(int argc, char **argv) int timeout = 0, udebug = 0, server = 0, flood = 0; int oui = IB_OPENIB_OUI; uint64_t rtt; - uint count = ~0; + unsigned count = ~0; extern int ibdebug; char *err; char *ca = 0; Modified: projects/ofed/base/contrib/ofed/management/infiniband-diags/src/saquery.c ============================================================================== --- projects/ofed/base/contrib/ofed/management/infiniband-diags/src/saquery.c Mon Jan 3 05:14:39 2011 (r216906) +++ projects/ofed/base/contrib/ofed/management/infiniband-diags/src/saquery.c Mon Jan 3 05:21:53 2011 (r216907) @@ -49,6 +49,7 @@ #define _GNU_SOURCE #include <getopt.h> +#include <infiniband/mad.h> #include <infiniband/opensm/osm_log.h> #include <infiniband/vendor/osm_vendor_api.h> #include <infiniband/vendor/osm_vendor_sa_api.h> @@ -62,8 +63,8 @@ struct query_cmd { const char *name, *alias; ib_net16_t query_type; const char *usage; - int (*handler)(const struct query_cmd *q, osm_bind_handle_t bind_handle, - int argc, char *argv[]); + int (*handler) (const struct query_cmd * q, osm_bind_handle_t h, + int argc, char *argv[]); }; char *argv0 = "saquery"; @@ -77,14 +78,14 @@ static ib_net64_t smkey = OSM_DEFAULT_SA */ #define MAX_PORTS (8) #define DEFAULT_SA_TIMEOUT_MS (1000) -osmv_query_res_t result; -osm_log_t log_osm; -osm_mad_pool_t mad_pool; -osm_vendor_t *vendor = NULL; -int osm_debug = 0; -uint32_t sa_timeout_ms = DEFAULT_SA_TIMEOUT_MS; -char *sa_hca_name = NULL; -uint32_t sa_port_num = 0; +osmv_query_res_t result; +osm_log_t log_osm; +osm_mad_pool_t mad_pool; +osm_vendor_t *vendor = NULL; +int osm_debug = 0; +uint32_t sa_timeout_ms = DEFAULT_SA_TIMEOUT_MS; +char *sa_hca_name = NULL; +uint32_t sa_port_num = 0; enum { ALL, @@ -96,44 +97,54 @@ enum { NAME_OF_GUID, } node_print_desc = ALL; -char *requested_name = NULL; -ib_net16_t requested_lid = 0; -int requested_lid_flag = 0; -ib_net64_t requested_guid = 0; -int requested_guid_flag = 0; +char *requested_name = NULL; +ib_net16_t requested_lid = 0; +int requested_lid_flag = 0; +ib_net64_t requested_guid = 0; +int requested_guid_flag = 0; + +static void format_buf(char *in, char *out, unsigned size) +{ + unsigned i; + + for (i = 0; i < size - 3 && *in; i++) { + *out++ = *in; + if (*in++ == '\n' && *in) { + *out++ = '\t'; + *out++ = '\t'; + } + } + *out = '\0'; +} /** * Call back for the various record requests. */ -static void -query_res_cb(osmv_query_res_t *res) +static void query_res_cb(osmv_query_res_t * res) { result = *res; } -static void -print_node_desc(ib_node_record_t *node_record) +static void print_node_desc(ib_node_record_t * node_record) { ib_node_info_t *p_ni = &(node_record->node_info); ib_node_desc_t *p_nd = &(node_record->node_desc); - if (p_ni->node_type == IB_NODE_TYPE_CA) - { + if (p_ni->node_type == IB_NODE_TYPE_CA) { printf("%6d \"%s\"\n", cl_ntoh16(node_record->lid), clean_nodedesc((char *)p_nd->description)); } } -static void -print_node_record(ib_node_record_t *node_record) +static void print_node_record(ib_node_record_t * node_record) { ib_node_info_t *p_ni = NULL; ib_node_desc_t *p_nd = NULL; char *name; p_ni = &(node_record->node_info); - p_nd = &(node_record->node_desc); + p_nd = &(node_record->node_desc); switch (node_print_desc) { case LID_ONLY: @@ -146,15 +157,15 @@ print_node_record(ib_node_record_t *node case NAME_OF_LID: case NAME_OF_GUID: name = remap_node_name(node_name_map, - cl_ntoh64(p_ni->node_guid), - (char *)p_nd->description); + cl_ntoh64(p_ni->node_guid), + (char *)p_nd->description); printf("%s\n", name); free(name); return; case ALL: default: break; - } + } printf("NodeRecord dump:\n" "\t\tlid.....................0x%X\n" @@ -177,18 +188,18 @@ print_node_record(ib_node_record_t *node cl_ntoh16(node_record->resv), p_ni->base_version, p_ni->class_version, - ib_get_node_type_str( p_ni->node_type ), + ib_get_node_type_str(p_ni->node_type), p_ni->num_ports, - cl_ntoh64( p_ni->sys_guid ), - cl_ntoh64( p_ni->node_guid ), - cl_ntoh64( p_ni->port_guid ), - cl_ntoh16( p_ni->partition_cap ), - cl_ntoh16( p_ni->device_id ), - cl_ntoh32( p_ni->revision ), - ib_node_info_get_local_port_num( p_ni ), - cl_ntoh32( ib_node_info_get_vendor_id( p_ni )), + cl_ntoh64(p_ni->sys_guid), + cl_ntoh64(p_ni->node_guid), + cl_ntoh64(p_ni->port_guid), + cl_ntoh16(p_ni->partition_cap), + cl_ntoh16(p_ni->device_id), + cl_ntoh32(p_ni->revision), + ib_node_info_get_local_port_num(p_ni), + cl_ntoh32(ib_node_info_get_vendor_id(p_ni)), clean_nodedesc((char *)node_record->node_desc.description) - ); + ); } static void dump_path_record(void *data) @@ -215,30 +226,29 @@ static void dump_path_record(void *data) "\t\tresv2...................0x%X\n" "\t\tresv3...................0x%X\n" "", - cl_ntoh64( p_pr->service_id ), + cl_ntoh64(p_pr->service_id), inet_ntop(AF_INET6, p_pr->dgid.raw, gid_str, sizeof gid_str), inet_ntop(AF_INET6, p_pr->sgid.raw, gid_str2, sizeof gid_str2), - cl_ntoh16( p_pr->dlid ), - cl_ntoh16( p_pr->slid ), - cl_ntoh32( p_pr->hop_flow_raw ), + cl_ntoh16(p_pr->dlid), + cl_ntoh16(p_pr->slid), + cl_ntoh32(p_pr->hop_flow_raw), p_pr->tclass, p_pr->num_path, - cl_ntoh16( p_pr->pkey ), - ib_path_rec_qos_class( p_pr ), - ib_path_rec_sl( p_pr ), + cl_ntoh16(p_pr->pkey), + ib_path_rec_qos_class(p_pr), + ib_path_rec_sl(p_pr), p_pr->mtu, p_pr->rate, p_pr->pkt_life, p_pr->preference, - *(uint32_t*)&p_pr->resv2, - *((uint16_t*)&p_pr->resv2 + 2) - ); + *(uint32_t *) & p_pr->resv2, *((uint16_t *) & p_pr->resv2 + 2) + ); } static void dump_class_port_info(void *data) { - char gid_str[INET6_ADDRSTRLEN]; - char gid_str2[INET6_ADDRSTRLEN]; + char gid_str[INET6_ADDRSTRLEN]; + char gid_str2[INET6_ADDRSTRLEN]; ib_class_port_info_t *class_port_info = data; printf("SA ClassPortInfo:\n" @@ -266,28 +276,28 @@ static void dump_class_port_info(void *d ib_class_cap_mask2(class_port_info), ib_class_resp_time_val(class_port_info), inet_ntop(AF_INET6, &(class_port_info->redir_gid), gid_str, - sizeof gid_str), + sizeof gid_str), cl_ntoh32(class_port_info->redir_tc_sl_fl), cl_ntoh16(class_port_info->redir_lid), cl_ntoh16(class_port_info->redir_pkey), cl_ntoh32(class_port_info->redir_qp), cl_ntoh32(class_port_info->redir_qkey), inet_ntop(AF_INET6, &(class_port_info->trap_gid), gid_str2, - sizeof gid_str2), + sizeof gid_str2), cl_ntoh32(class_port_info->trap_tc_sl_fl), cl_ntoh16(class_port_info->trap_lid), cl_ntoh16(class_port_info->trap_pkey), cl_ntoh32(class_port_info->trap_hop_qp), cl_ntoh32(class_port_info->trap_qkey) - ); + ); } static void dump_portinfo_record(void *data) { ib_portinfo_record_t *p_pir = data; - const ib_port_info_t * const p_pi = &p_pir->port_info; + const ib_port_info_t *const p_pi = &p_pir->port_info; - printf("PortInfoRecord dump:\n" + printf("PortInfoRecord dump:\n" "\t\tEndPortLid..............0x%X\n" "\t\tPortNum.................0x%X\n" "\t\tbase_lid................0x%X\n" @@ -296,15 +306,34 @@ static void dump_portinfo_record(void *d "", cl_ntoh16(p_pir->lid), p_pir->port_num, - cl_ntoh16( p_pi->base_lid ), - cl_ntoh16( p_pi->master_sm_base_lid ), - cl_ntoh32( p_pi->capability_mask ) - ); + cl_ntoh16(p_pi->base_lid), + cl_ntoh16(p_pi->master_sm_base_lid), + cl_ntoh32(p_pi->capability_mask) + ); +} + +static void dump_one_portinfo_record(void *data) +{ + char buf[2048], buf2[4096]; + ib_portinfo_record_t *pir = data; + ib_port_info_t *pi = &pir->port_info; + + mad_dump_portinfo(buf, sizeof(buf), pi, sizeof(*pi)); + + format_buf(buf, buf2, sizeof(buf2)); + + printf("PortInfoRecord dump:\n" + "\tRID:\n" + "\t\tEndPortLid..............%u\n" + "\t\tPortNum.................0x%x\n" + "\t\tReserved................0x%x\n" + "\tPortInfo dump:\n\t\t%s", + cl_ntoh16(pir->lid), pir->port_num, pir->resv, buf2); } static void dump_multicast_group_record(void *data) { - char gid_str[INET6_ADDRSTRLEN]; + char gid_str[INET6_ADDRSTRLEN]; ib_member_rec_t *p_mcmr = data; uint8_t sl; ib_member_get_sl_flow_hop(p_mcmr->sl_flow_hop, &sl, NULL, NULL); @@ -317,21 +346,17 @@ static void dump_multicast_group_record( "\t\tSL......................0x%X\n" "", inet_ntop(AF_INET6, p_mcmr->mgid.raw, gid_str, sizeof gid_str), - cl_ntoh16( p_mcmr->mlid ), - p_mcmr->mtu, - cl_ntoh16( p_mcmr->pkey ), - p_mcmr->rate, - sl - ); + cl_ntoh16(p_mcmr->mlid), + p_mcmr->mtu, cl_ntoh16(p_mcmr->pkey), p_mcmr->rate, sl); } static void dump_multicast_member_record(void *data) { - char gid_str[INET6_ADDRSTRLEN]; - char gid_str2[INET6_ADDRSTRLEN]; + char gid_str[INET6_ADDRSTRLEN]; + char gid_str2[INET6_ADDRSTRLEN]; ib_member_rec_t *p_mcmr = data; - uint16_t mlid = cl_ntoh16( p_mcmr->mlid ); - int i = 0; + uint16_t mlid = cl_ntoh16(p_mcmr->mlid); + int i = 0; char *node_name = "<unknown>"; /* go through the node records searching for a port guid which matches @@ -339,9 +364,12 @@ static void dump_multicast_member_record * This gives us a node name to print, if available. */ for (i = 0; i < result.result_cnt; i++) { - ib_node_record_t *nr = osmv_get_query_node_rec(result.p_result_madw, i); - if (nr->node_info.port_guid == p_mcmr->port_gid.unicast.interface_id) { - node_name = clean_nodedesc((char *)nr->node_desc.description); + ib_node_record_t *nr = + osmv_get_query_node_rec(result.p_result_madw, i); + if (nr->node_info.port_guid == + p_mcmr->port_gid.unicast.interface_id) { + node_name = + clean_nodedesc((char *)nr->node_desc.description); break; } } @@ -349,10 +377,8 @@ static void dump_multicast_member_record if (requested_name) { if (strtol(requested_name, NULL, 0) == mlid) { printf("\t\tPortGid.................%s (%s)\n", - inet_ntop(AF_INET6, p_mcmr->port_gid.raw, - gid_str, sizeof gid_str), - node_name - ); + inet_ntop(AF_INET6, p_mcmr->port_gid.raw, + gid_str, sizeof gid_str), node_name); } } else { printf("MCMemberRecord member dump:\n" @@ -364,42 +390,31 @@ static void dump_multicast_member_record "\t\tNodeDescription.........%s\n" "", inet_ntop(AF_INET6, p_mcmr->mgid.raw, gid_str, - sizeof gid_str), - cl_ntoh16( p_mcmr->mlid ), + sizeof gid_str), + cl_ntoh16(p_mcmr->mlid), inet_ntop(AF_INET6, p_mcmr->port_gid.raw, - gid_str2, sizeof gid_str2), - p_mcmr->scope_state, - p_mcmr->proxy_join, - node_name - ); + gid_str2, sizeof gid_str2), + p_mcmr->scope_state, p_mcmr->proxy_join, node_name); } } static void dump_service_record(void *data) { - char gid_str[INET6_ADDRSTRLEN]; + char gid_str[INET6_ADDRSTRLEN]; char buf_service_key[35]; char buf_service_name[65]; ib_service_record_t *p_sr = data; sprintf(buf_service_key, "0x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", - p_sr->service_key[0], - p_sr->service_key[1], - p_sr->service_key[2], - p_sr->service_key[3], - p_sr->service_key[4], - p_sr->service_key[5], - p_sr->service_key[6], - p_sr->service_key[7], - p_sr->service_key[8], - p_sr->service_key[9], - p_sr->service_key[10], - p_sr->service_key[11], - p_sr->service_key[12], - p_sr->service_key[13], - p_sr->service_key[14], - p_sr->service_key[15]); + p_sr->service_key[0], p_sr->service_key[1], + p_sr->service_key[2], p_sr->service_key[3], + p_sr->service_key[4], p_sr->service_key[5], + p_sr->service_key[6], p_sr->service_key[7], + p_sr->service_key[8], p_sr->service_key[9], + p_sr->service_key[10], p_sr->service_key[11], + p_sr->service_key[12], p_sr->service_key[13], + p_sr->service_key[14], p_sr->service_key[15]); strncpy(buf_service_name, (char *)p_sr->service_name, 64); buf_service_name[64] = '\0'; @@ -441,11 +456,11 @@ static void dump_service_record(void *da "\t\tServiceData64.1.........0x%016" PRIx64 "\n" "\t\tServiceData64.2.........0x%016" PRIx64 "\n" "", - cl_ntoh64( p_sr->service_id ), + cl_ntoh64(p_sr->service_id), inet_ntop(AF_INET6, p_sr->service_gid.raw, gid_str, - sizeof gid_str), - cl_ntoh16( p_sr->service_pkey ), - cl_ntoh32( p_sr->service_lease ), + sizeof gid_str), + cl_ntoh16(p_sr->service_pkey), + cl_ntoh32(p_sr->service_lease), buf_service_key, buf_service_name, p_sr->service_data8[0], p_sr->service_data8[1], @@ -456,32 +471,34 @@ static void dump_service_record(void *da p_sr->service_data8[10], p_sr->service_data8[11], p_sr->service_data8[12], p_sr->service_data8[13], p_sr->service_data8[14], p_sr->service_data8[15], - cl_ntoh16( p_sr->service_data16[0] ), - cl_ntoh16( p_sr->service_data16[1] ), - cl_ntoh16( p_sr->service_data16[2] ), - cl_ntoh16( p_sr->service_data16[3] ), - cl_ntoh16( p_sr->service_data16[4] ), - cl_ntoh16( p_sr->service_data16[5] ), - cl_ntoh16( p_sr->service_data16[6] ), - cl_ntoh16( p_sr->service_data16[7] ), - cl_ntoh32( p_sr->service_data32[0] ), - cl_ntoh32( p_sr->service_data32[1] ), - cl_ntoh32( p_sr->service_data32[2] ), - cl_ntoh32( p_sr->service_data32[3] ), - cl_ntoh64( p_sr->service_data64[0] ), - cl_ntoh64( p_sr->service_data64[1] ) - ); + cl_ntoh16(p_sr->service_data16[0]), + cl_ntoh16(p_sr->service_data16[1]), + cl_ntoh16(p_sr->service_data16[2]), + cl_ntoh16(p_sr->service_data16[3]), + cl_ntoh16(p_sr->service_data16[4]), + cl_ntoh16(p_sr->service_data16[5]), + cl_ntoh16(p_sr->service_data16[6]), + cl_ntoh16(p_sr->service_data16[7]), + cl_ntoh32(p_sr->service_data32[0]), + cl_ntoh32(p_sr->service_data32[1]), + cl_ntoh32(p_sr->service_data32[2]), + cl_ntoh32(p_sr->service_data32[3]), + cl_ntoh64(p_sr->service_data64[0]), + cl_ntoh64(p_sr->service_data64[1]) + ); } static void dump_inform_info_record(void *data) { - char gid_str[INET6_ADDRSTRLEN]; - char gid_str2[INET6_ADDRSTRLEN]; + char gid_str[INET6_ADDRSTRLEN]; + char gid_str2[INET6_ADDRSTRLEN]; ib_inform_info_record_t *p_iir = data; uint32_t qpn; - uint8_t resp_time_val; + uint8_t resp_time_val; - ib_inform_info_get_qpn_resp_time(p_iir->inform_info.g_or_v.generic.qpn_resp_time_val, &qpn, &resp_time_val); + ib_inform_info_get_qpn_resp_time(p_iir->inform_info.g_or_v.generic. + qpn_resp_time_val, &qpn, + &resp_time_val); if (p_iir->inform_info.is_generic) { printf("InformInfoRecord dump:\n" @@ -501,20 +518,21 @@ static void dump_inform_info_record(void "\t\tnode_type...............0x%06X\n" "", inet_ntop(AF_INET6, p_iir->subscriber_gid.raw, gid_str, - sizeof gid_str), - cl_ntoh16( p_iir->subscriber_enum ), + sizeof gid_str), + cl_ntoh16(p_iir->subscriber_enum), inet_ntop(AF_INET6, p_iir->inform_info.gid.raw, gid_str2, - sizeof gid_str2), - cl_ntoh16( p_iir->inform_info.lid_range_begin ), - cl_ntoh16( p_iir->inform_info.lid_range_end ), + sizeof gid_str2), + cl_ntoh16(p_iir->inform_info.lid_range_begin), + cl_ntoh16(p_iir->inform_info.lid_range_end), p_iir->inform_info.is_generic, p_iir->inform_info.subscribe, - cl_ntoh16( p_iir->inform_info.trap_type ), - cl_ntoh16( p_iir->inform_info.g_or_v.generic.trap_num ), - cl_ntoh32( qpn ), + cl_ntoh16(p_iir->inform_info.trap_type), + cl_ntoh16(p_iir->inform_info.g_or_v.generic.trap_num), + cl_ntoh32(qpn), resp_time_val, - cl_ntoh32(ib_inform_info_get_prod_type( &p_iir->inform_info )) - ); + cl_ntoh32(ib_inform_info_get_prod_type + (&p_iir->inform_info)) + ); } else { printf("InformInfoRecord dump:\n" "\t\tRID\n" @@ -533,20 +551,21 @@ static void dump_inform_info_record(void "\t\tvendor_id...............0x%06X\n" "", inet_ntop(AF_INET6, p_iir->subscriber_gid.raw, gid_str, - sizeof gid_str), - cl_ntoh16( p_iir->subscriber_enum ), + sizeof gid_str), + cl_ntoh16(p_iir->subscriber_enum), inet_ntop(AF_INET6, p_iir->inform_info.gid.raw, - gid_str2, sizeof gid_str2), - cl_ntoh16( p_iir->inform_info.lid_range_begin ), - cl_ntoh16( p_iir->inform_info.lid_range_end ), + gid_str2, sizeof gid_str2), + cl_ntoh16(p_iir->inform_info.lid_range_begin), + cl_ntoh16(p_iir->inform_info.lid_range_end), p_iir->inform_info.is_generic, p_iir->inform_info.subscribe, - cl_ntoh16( p_iir->inform_info.trap_type ), - cl_ntoh16( p_iir->inform_info.g_or_v.vend.dev_id ), - cl_ntoh32( qpn ), + cl_ntoh16(p_iir->inform_info.trap_type), + cl_ntoh16(p_iir->inform_info.g_or_v.vend.dev_id), + cl_ntoh32(qpn), resp_time_val, - cl_ntoh32(ib_inform_info_get_prod_type( &p_iir->inform_info )) - ); + cl_ntoh32(ib_inform_info_get_prod_type + (&p_iir->inform_info)) + ); } } @@ -594,7 +613,7 @@ static void dump_one_vlarb_record(void * "\t\tPort.......................%u\n" "\t\tBlock......................%u\n", cl_ntoh16(vlarb->lid), vlarb->port_num, vlarb->block_num); - for (i = 0; i < 32 ; i += 16) { + for (i = 0; i < 32; i += 16) { printf("\t\tVL :%2u|%2u|%2u|%2u|%2u|%2u|%2u|%2u|" "%2u|%2u|%2u|%2u|%2u|%2u|%2u|%2u|", e[i + 0].vl, e[i + 1].vl, e[i + 2].vl, e[i + 3].vl, @@ -624,7 +643,7 @@ static void dump_one_pkey_tbl_record(voi "\t\tBlock......................%u\n" "\t\tPKey Table:\n", cl_ntoh16(pktr->lid), pktr->port_num, pktr->block_num); - for (i = 0; i < 32 ; i += 8) + for (i = 0; i < 32; i += 8) printf("\t\t0x%04x 0x%04x 0x%04x 0x%04x" " 0x%04x 0x%04x 0x%04x 0x%04x\n", cl_ntoh16(p[i + 0]), cl_ntoh16(p[i + 1]), @@ -642,10 +661,9 @@ static void dump_one_lft_record(void *da printf("LFT Record dump:\n" "\t\tLID........................%u\n" "\t\tBlock......................%u\n" - "\t\tLFT:\n\t\tLID\tPort Number\n", - cl_ntoh16(lftr->lid), block); - for (i = 0; i < 64 ; i++) - printf("\t\t%u\t%u\n", block*64 + i, lftr->lft[i]); + "\t\tLFT:\n\t\tLID\tPort Number\n", cl_ntoh16(lftr->lid), block); + for (i = 0; i < 64; i++) + printf("\t\t%u\t%u\n", block * 64 + i, lftr->lft[i]); printf("\n"); } @@ -654,20 +672,21 @@ static void dump_one_mft_record(void *da ib_mft_record_t *mftr = data; unsigned position = cl_ntoh16(mftr->position_block_num) >> 12; unsigned block = cl_ntoh16(mftr->position_block_num) & - IB_MCAST_BLOCK_ID_MASK_HO; + IB_MCAST_BLOCK_ID_MASK_HO; int i; printf("MFT Record dump:\n" "\t\tLID........................%u\n" "\t\tPosition...................%u\n" "\t\tBlock......................%u\n" - "\t\tMFT:\n\t\tMLID\tPort Mask\n", + "\t\tMFT:\n\t\tMLID\tPort Mask\n", cl_ntoh16(mftr->lid), position, block); for (i = 0; i < IB_MCAST_BLOCK_SIZE; i++) - printf("\t\t0x%x\t0x%x\n", IB_LID_MCAST_START_HO + block*64 + i, + printf("\t\t0x%x\t0x%x\n", + IB_LID_MCAST_START_HO + block * 64 + i, cl_ntoh16(mftr->mft[i])); printf("\n"); } -static void dump_results(osmv_query_res_t *r, void (*dump_func)(void *)) +static void dump_results(osmv_query_res_t * r, void (*dump_func) (void *)) { int i; for (i = 0; i < r->result_cnt; i++) { @@ -676,8 +695,7 @@ static void dump_results(osmv_query_res_ } } -static void -return_mad(void) +static void return_mad(void) { /* * Return the IB query MAD to the pool as necessary. @@ -692,13 +710,12 @@ return_mad(void) * Get any record(s) */ static ib_api_status_t -get_any_records(osm_bind_handle_t bind_handle, +get_any_records(osm_bind_handle_t h, ib_net16_t attr_id, ib_net32_t attr_mod, ib_net64_t comp_mask, - void *attr, ib_net16_t attr_offset, - ib_net64_t sm_key) + void *attr, ib_net16_t attr_offset, ib_net64_t sm_key) { - ib_api_status_t status; - osmv_query_req_t req; + ib_api_status_t status; + osmv_query_req_t req; osmv_user_query_t user; memset(&req, 0, sizeof(req)); @@ -719,7 +736,7 @@ get_any_records(osm_bind_handle_t bind_h req.p_query_input = &user; req.sm_key = sm_key; - if ((status = osmv_query_sa(bind_handle, &req)) != IB_SUCCESS) { + if ((status = osmv_query_sa(h, &req)) != IB_SUCCESS) { fprintf(stderr, "Query SA failed: %s\n", ib_get_err_str(status)); return status; @@ -738,12 +755,10 @@ get_any_records(osm_bind_handle_t bind_h * Get all the records available for requested query type. */ static ib_api_status_t -get_all_records(osm_bind_handle_t bind_handle, - ib_net16_t query_id, - ib_net16_t attr_offset, - int trusted) +get_all_records(osm_bind_handle_t h, + ib_net16_t query_id, ib_net16_t attr_offset, int trusted) { - return get_any_records(bind_handle, query_id, 0, 0, NULL, attr_offset, + return get_any_records(h, query_id, 0, 0, NULL, attr_offset, trusted ? smkey : 0); } @@ -751,23 +766,25 @@ get_all_records(osm_bind_handle_t bind_h * return the lid from the node descriptor (name) supplied */ static ib_api_status_t -get_lid_from_name(osm_bind_handle_t bind_handle, const char *name, ib_net16_t *lid) +get_lid_from_name(osm_bind_handle_t h, const char *name, ib_net16_t * lid) { - int i = 0; + int i = 0; ib_node_record_t *node_record = NULL; - ib_node_info_t *p_ni = NULL; - ib_net16_t attr_offset = ib_get_attr_offset(sizeof(*node_record)); - ib_api_status_t status; + ib_node_info_t *p_ni = NULL; + ib_net16_t attr_offset = ib_get_attr_offset(sizeof(*node_record)); + ib_api_status_t status; - status = get_all_records(bind_handle, IB_MAD_ATTR_NODE_RECORD, attr_offset, 0); + status = get_all_records(h, IB_MAD_ATTR_NODE_RECORD, attr_offset, 0); if (status != IB_SUCCESS) return (status); for (i = 0; i < result.result_cnt; i++) { node_record = osmv_get_query_node_rec(result.p_result_madw, i); p_ni = &(node_record->node_info); - if (name && strncmp(name, (char *)node_record->node_desc.description, - sizeof(node_record->node_desc.description)) == 0) { + if (name + && strncmp(name, (char *)node_record->node_desc.description, + sizeof(node_record->node_desc.description)) == + 0) { *lid = cl_ntoh16(node_record->lid); break; } @@ -776,40 +793,43 @@ get_lid_from_name(osm_bind_handle_t bind return (status); } -static ib_net16_t -get_lid(osm_bind_handle_t bind_handle, const char * name) +static ib_net16_t get_lid(osm_bind_handle_t h, const char *name) { ib_net16_t rc_lid = 0; if (!name) - return(0); + return (0); if (isalpha(name[0])) - assert(get_lid_from_name(bind_handle, name, &rc_lid) == IB_SUCCESS); + assert(get_lid_from_name(h, name, &rc_lid) == IB_SUCCESS); else rc_lid = atoi(name); if (rc_lid == 0) fprintf(stderr, "Failed to find lid for \"%s\"\n", name); - return (rc_lid); + return (rc_lid); } -static int parse_lid_and_ports(osm_bind_handle_t bind_handle, +static int parse_lid_and_ports(osm_bind_handle_t h, char *str, int *lid, int *port1, int *port2) { char *p, *e; - if (port1) *port1 = -1; - if (port2) *port2 = -1; + if (port1) + *port1 = -1; + if (port2) + *port2 = -1; p = strchr(str, '/'); - if (p) *p = '\0'; + if (p) + *p = '\0'; if (lid) - *lid = get_lid(bind_handle, str); + *lid = get_lid(h, str); if (!p) return 0; str = p + 1; p = strchr(str, '/'); - if (p) *p = '\0'; + if (p) + *p = '\0'; if (port1) { *port1 = strtoul(str, &e, 0); if (e == str) @@ -832,29 +852,28 @@ static int parse_lid_and_ports(osm_bind_ * Get the portinfo records available with IsSM or IsSMdisabled CapabilityMask bit on. */ static ib_api_status_t -get_issm_records(osm_bind_handle_t bind_handle, ib_net32_t capability_mask) +get_issm_records(osm_bind_handle_t h, ib_net32_t capability_mask) { ib_portinfo_record_t attr; - memset( &attr, 0, sizeof ( attr ) ); + memset(&attr, 0, sizeof(attr)); attr.port_info.capability_mask = capability_mask; - return get_any_records(bind_handle, IB_MAD_ATTR_PORTINFO_RECORD, + return get_any_records(h, IB_MAD_ATTR_PORTINFO_RECORD, cl_hton32(1 << 31), IB_PIR_COMPMASK_CAPMASK, &attr, ib_get_attr_offset(sizeof(ib_portinfo_record_t)), 0); } -static ib_api_status_t -print_node_records(osm_bind_handle_t bind_handle) +static ib_api_status_t print_node_records(osm_bind_handle_t h) { - int i = 0; + int i = 0; ib_node_record_t *node_record = NULL; - ib_net16_t attr_offset = ib_get_attr_offset(sizeof(*node_record)); - ib_api_status_t status; + ib_net16_t attr_offset = ib_get_attr_offset(sizeof(*node_record)); + ib_api_status_t status; - status = get_all_records(bind_handle, IB_MAD_ATTR_NODE_RECORD, attr_offset, 0); + status = get_all_records(h, IB_MAD_ATTR_NODE_RECORD, attr_offset, 0); if (status != IB_SUCCESS) return (status); @@ -880,7 +899,8 @@ print_node_records(osm_bind_handle_t bin if (!requested_name || (strncmp(requested_name, (char *)node_record->node_desc.description, - sizeof(node_record->node_desc.description)) == 0)) { + sizeof(node_record->node_desc. + description)) == 0)) { print_node_record(node_record); if (node_print_desc == UNIQUE_LID_ONLY) { return_mad(); @@ -894,18 +914,17 @@ print_node_records(osm_bind_handle_t bin } static ib_api_status_t -get_print_path_rec_lid(osm_bind_handle_t bind_handle, - ib_net16_t src_lid, - ib_net16_t dst_lid) -{ - osmv_query_req_t req; - osmv_lid_pair_t lid_pair; - ib_api_status_t status; +get_print_path_rec_lid(osm_bind_handle_t h, + ib_net16_t src_lid, ib_net16_t dst_lid) +{ + osmv_query_req_t req; + osmv_lid_pair_t lid_pair; + ib_api_status_t status; lid_pair.src_lid = cl_hton16(src_lid); lid_pair.dest_lid = cl_hton16(dst_lid); - memset( &req, 0, sizeof( req ) ); + memset(&req, 0, sizeof(req)); req.query_type = OSMV_QUERY_PATH_REC_BY_LIDS; req.timeout_ms = sa_timeout_ms; @@ -916,7 +935,7 @@ get_print_path_rec_lid(osm_bind_handle_t req.p_query_input = (void *)&lid_pair; req.sm_key = 0; - if ((status = osmv_query_sa(bind_handle, &req)) != IB_SUCCESS) { + if ((status = osmv_query_sa(h, &req)) != IB_SUCCESS) { fprintf(stderr, "ERROR: Query SA failed: %s\n", ib_get_err_str(status)); return (status); @@ -933,18 +952,17 @@ get_print_path_rec_lid(osm_bind_handle_t } static ib_api_status_t -get_print_path_rec_gid(osm_bind_handle_t bind_handle, - const ib_gid_t *src_gid, - const ib_gid_t *dst_gid) -{ - osmv_query_req_t req; - osmv_gid_pair_t gid_pair; - ib_api_status_t status; +get_print_path_rec_gid(osm_bind_handle_t h, + const ib_gid_t * src_gid, const ib_gid_t * dst_gid) +{ + osmv_query_req_t req; + osmv_gid_pair_t gid_pair; + ib_api_status_t status; gid_pair.src_gid = *src_gid; gid_pair.dest_gid = *dst_gid; - memset( &req, 0, sizeof( req ) ); + memset(&req, 0, sizeof(req)); req.query_type = OSMV_QUERY_PATH_REC_BY_GIDS; req.timeout_ms = sa_timeout_ms; @@ -955,7 +973,7 @@ get_print_path_rec_gid(osm_bind_handle_t req.p_query_input = (void *)&gid_pair; req.sm_key = 0; - if ((status = osmv_query_sa(bind_handle, &req)) != IB_SUCCESS) { + if ((status = osmv_query_sa(h, &req)) != IB_SUCCESS) { fprintf(stderr, "ERROR: Query SA failed: %s\n", ib_get_err_str(status)); return (status); @@ -971,13 +989,12 @@ get_print_path_rec_gid(osm_bind_handle_t return (status); } -static ib_api_status_t -get_print_class_port_info(osm_bind_handle_t bind_handle) +static ib_api_status_t get_print_class_port_info(osm_bind_handle_t h) { - osmv_query_req_t req; - ib_api_status_t status; + osmv_query_req_t req; + ib_api_status_t status; - memset( &req, 0, sizeof( req ) ); + memset(&req, 0, sizeof(req)); req.query_type = OSMV_QUERY_CLASS_PORT_INFO; req.timeout_ms = sa_timeout_ms; @@ -988,7 +1005,7 @@ get_print_class_port_info(osm_bind_handl req.p_query_input = NULL; req.sm_key = 0; - if ((status = osmv_query_sa(bind_handle, &req)) != IB_SUCCESS) { + if ((status = osmv_query_sa(h, &req)) != IB_SUCCESS) { fprintf(stderr, "ERROR: Query SA failed: %s\n", ib_get_err_str(status)); return (status); @@ -1004,13 +1021,13 @@ get_print_class_port_info(osm_bind_handl return (status); } -static ib_api_status_t -print_path_records(osm_bind_handle_t bind_handle) +static int query_path_records(const struct query_cmd *q, + osm_bind_handle_t h, int argc, char *argv[]) { ib_net16_t attr_offset = ib_get_attr_offset(sizeof(ib_path_rec_t)); ib_api_status_t status; - status = get_all_records(bind_handle, IB_MAD_ATTR_PATH_RECORD, attr_offset, 0); + status = get_all_records(h, IB_MAD_ATTR_PATH_RECORD, attr_offset, 0); if (status != IB_SUCCESS) return (status); @@ -1019,13 +1036,12 @@ print_path_records(osm_bind_handle_t bin return (status); } -static ib_api_status_t -print_portinfo_records(osm_bind_handle_t bind_handle) +static ib_api_status_t print_issm_records(osm_bind_handle_t h) { - ib_api_status_t status; + ib_api_status_t status; /* First, get IsSM records */ - status = get_issm_records(bind_handle, IB_PORT_CAP_IS_SM); + status = get_issm_records(h, IB_PORT_CAP_IS_SM); if (status != IB_SUCCESS) return (status); @@ -1034,7 +1050,7 @@ print_portinfo_records(osm_bind_handle_t return_mad(); /* Now, get IsSMdisabled records */ - status = get_issm_records(bind_handle, IB_PORT_CAP_SM_DISAB); + status = get_issm_records(h, IB_PORT_CAP_SM_DISAB); if (status != IB_SUCCESS) return (status); @@ -1045,21 +1061,22 @@ print_portinfo_records(osm_bind_handle_t return (status); } -static ib_api_status_t -print_multicast_member_records(osm_bind_handle_t bind_handle) +static ib_api_status_t print_multicast_member_records(osm_bind_handle_t h) { - osmv_query_res_t mc_group_result; - ib_api_status_t status; + osmv_query_res_t mc_group_result; + ib_api_status_t status; - status = get_all_records(bind_handle, IB_MAD_ATTR_MCMEMBER_RECORD, - ib_get_attr_offset(sizeof(ib_member_rec_t)), 1); + status = get_all_records(h, IB_MAD_ATTR_MCMEMBER_RECORD, + ib_get_attr_offset(sizeof(ib_member_rec_t)), + 1); if (status != IB_SUCCESS) return (status); mc_group_result = result; - status = get_all_records(bind_handle, IB_MAD_ATTR_NODE_RECORD, - ib_get_attr_offset(sizeof(ib_node_record_t)), 0); + status = get_all_records(h, IB_MAD_ATTR_NODE_RECORD, + ib_get_attr_offset(sizeof(ib_node_record_t)), + 0); if (status != IB_SUCCESS) goto return_mc; @@ -1076,13 +1093,13 @@ return_mc: return (status); } -static ib_api_status_t -print_multicast_group_records(osm_bind_handle_t bind_handle) +static ib_api_status_t print_multicast_group_records(osm_bind_handle_t h) { - ib_api_status_t status; + ib_api_status_t status; - status = get_all_records(bind_handle, IB_MAD_ATTR_MCMEMBER_RECORD, - ib_get_attr_offset(sizeof(ib_member_rec_t)), 0); + status = get_all_records(h, IB_MAD_ATTR_MCMEMBER_RECORD, + ib_get_attr_offset(sizeof(ib_member_rec_t)), + 0); if (status != IB_SUCCESS) return (status); @@ -1091,13 +1108,67 @@ print_multicast_group_records(osm_bind_h return (status); } -static ib_api_status_t *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201101030521.p035Lr7T075618>