1219820Sjeff/* 2219820Sjeff * Copyright (c) 2006-2008 Voltaire, Inc. All rights reserved. 3219820Sjeff * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. 4219820Sjeff * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. 5219820Sjeff * 6219820Sjeff * This software is available to you under a choice of one of two 7219820Sjeff * licenses. You may choose to be licensed under the terms of the GNU 8219820Sjeff * General Public License (GPL) Version 2, available from the file 9219820Sjeff * COPYING in the main directory of this source tree, or the 10219820Sjeff * OpenIB.org BSD license below: 11219820Sjeff * 12219820Sjeff * Redistribution and use in source and binary forms, with or 13219820Sjeff * without modification, are permitted provided that the following 14219820Sjeff * conditions are met: 15219820Sjeff * 16219820Sjeff * - Redistributions of source code must retain the above 17219820Sjeff * copyright notice, this list of conditions and the following 18219820Sjeff * disclaimer. 19219820Sjeff * 20219820Sjeff * - Redistributions in binary form must reproduce the above 21219820Sjeff * copyright notice, this list of conditions and the following 22219820Sjeff * disclaimer in the documentation and/or other materials 23219820Sjeff * provided with the distribution. 24219820Sjeff * 25219820Sjeff * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 26219820Sjeff * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 27219820Sjeff * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 28219820Sjeff * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 29219820Sjeff * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 30219820Sjeff * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 31219820Sjeff * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32219820Sjeff * SOFTWARE. 33219820Sjeff * 34219820Sjeff */ 35219820Sjeff 36219820Sjeff/* TODO : Check why we dont free the cl_qmap_items we store when reading DB */ 37219820Sjeff 38219820Sjeff/* 39219820Sjeff * Abstract: 40219820Sjeff * Implementation of osmtest_t. 41219820Sjeff * This object represents the OSMTest Test object. 42219820Sjeff * 43219820Sjeff */ 44219820Sjeff 45219820Sjeff#ifdef __WIN__ 46219820Sjeff#pragma warning(disable : 4996) 47219820Sjeff#endif 48219820Sjeff 49219820Sjeff#include <stdio.h> 50219820Sjeff#include <stdlib.h> 51219820Sjeff#include <string.h> 52219820Sjeff#ifdef __WIN__ 53219820Sjeff#include <complib/cl_timer.h> 54219820Sjeff#else 55219820Sjeff#include <strings.h> 56219820Sjeff#include <sys/time.h> 57219820Sjeff#endif 58219820Sjeff#include <complib/cl_debug.h> 59219820Sjeff#include "osmtest.h" 60219820Sjeff 61219820Sjeff#ifndef __WIN__ 62219820Sjeff#define strnicmp strncasecmp 63219820Sjeff#endif 64219820Sjeff 65219820Sjeff#define POOL_MIN_ITEMS 64 66219820Sjeff#define GUID_ARRAY_SIZE 64 67219820Sjeff 68219820Sjefftypedef struct _osmtest_sm_info_rec { 69219820Sjeff ib_net64_t sm_guid; 70219820Sjeff ib_net16_t lid; 71219820Sjeff uint8_t priority; 72219820Sjeff uint8_t sm_state; 73219820Sjeff} osmtest_sm_info_rec_t; 74219820Sjeff 75219820Sjefftypedef struct _osmtest_inform_info { 76219820Sjeff boolean_t subscribe; 77219820Sjeff ib_net32_t qpn; 78219820Sjeff ib_net16_t trap; 79219820Sjeff} osmtest_inform_info_t; 80219820Sjeff 81219820Sjefftypedef struct _osmtest_inform_info_rec { 82219820Sjeff ib_gid_t subscriber_gid; 83219820Sjeff ib_net16_t subscriber_enum; 84219820Sjeff} osmtest_inform_info_rec_t; 85219820Sjeff 86219820Sjefftypedef enum _osmtest_token_val { 87219820Sjeff OSMTEST_TOKEN_COMMENT = 0, 88219820Sjeff OSMTEST_TOKEN_END, 89219820Sjeff OSMTEST_TOKEN_DEFINE_NODE, 90219820Sjeff OSMTEST_TOKEN_DEFINE_PORT, 91219820Sjeff OSMTEST_TOKEN_DEFINE_PATH, 92219820Sjeff OSMTEST_TOKEN_DEFINE_LINK, 93219820Sjeff OSMTEST_TOKEN_LID, 94219820Sjeff OSMTEST_TOKEN_BASE_VERSION, 95219820Sjeff OSMTEST_TOKEN_CLASS_VERSION, 96219820Sjeff OSMTEST_TOKEN_NODE_TYPE, 97219820Sjeff OSMTEST_TOKEN_NUM_PORTS, 98219820Sjeff OSMTEST_TOKEN_SYS_GUID, 99219820Sjeff OSMTEST_TOKEN_NODE_GUID, 100219820Sjeff OSMTEST_TOKEN_PORT_GUID, 101219820Sjeff OSMTEST_TOKEN_PARTITION_CAP, 102219820Sjeff OSMTEST_TOKEN_DEVICE_ID, 103219820Sjeff OSMTEST_TOKEN_REVISION, 104219820Sjeff OSMTEST_TOKEN_PORT_NUM, 105219820Sjeff OSMTEST_TOKEN_VENDOR_ID, 106219820Sjeff OSMTEST_TOKEN_DGID, 107219820Sjeff OSMTEST_TOKEN_SGID, 108219820Sjeff OSMTEST_TOKEN_DLID, 109219820Sjeff OSMTEST_TOKEN_SLID, 110219820Sjeff OSMTEST_TOKEN_HOP_FLOW_RAW, 111219820Sjeff OSMTEST_TOKEN_TCLASS, 112219820Sjeff OSMTEST_TOKEN_NUM_PATH, 113219820Sjeff OSMTEST_TOKEN_PKEY, 114219820Sjeff OSMTEST_TOKEN_SL, 115219820Sjeff OSMTEST_TOKEN_RATE, 116219820Sjeff OSMTEST_TOKEN_PKT_LIFE, 117219820Sjeff OSMTEST_TOKEN_PREFERENCE, 118219820Sjeff OSMTEST_TOKEN_MKEY, 119219820Sjeff OSMTEST_TOKEN_SUBN_PREF, 120219820Sjeff OSMTEST_TOKEN_BASE_LID, 121219820Sjeff OSMTEST_TOKEN_SM_BASE_LID, 122219820Sjeff OSMTEST_TOKEN_CAP_MASK, 123219820Sjeff OSMTEST_TOKEN_DIAG_CODE, 124219820Sjeff OSMTEST_TOKEN_MKEY_LEASE_PER, 125219820Sjeff OSMTEST_TOKEN_LOC_PORT_NUM, 126219820Sjeff OSMTEST_TOKEN_LINK_WID_EN, 127219820Sjeff OSMTEST_TOKEN_LINK_WID_SUP, 128219820Sjeff OSMTEST_TOKEN_LINK_WID_ACT, 129219820Sjeff OSMTEST_TOKEN_LINK_SPEED_SUP, 130219820Sjeff OSMTEST_TOKEN_PORT_STATE, 131219820Sjeff OSMTEST_TOKEN_STATE_INFO2, 132219820Sjeff OSMTEST_TOKEN_MKEY_PROT_BITS, 133219820Sjeff OSMTEST_TOKEN_LMC, 134219820Sjeff OSMTEST_TOKEN_LINK_SPEED, 135219820Sjeff OSMTEST_TOKEN_MTU_SMSL, 136219820Sjeff OSMTEST_TOKEN_VL_CAP, 137219820Sjeff OSMTEST_TOKEN_VL_HIGH_LIMIT, 138219820Sjeff OSMTEST_TOKEN_VL_ARB_HIGH_CAP, 139219820Sjeff OSMTEST_TOKEN_VL_ARB_LOW_CAP, 140219820Sjeff OSMTEST_TOKEN_MTU_CAP, 141219820Sjeff OSMTEST_TOKEN_VL_STALL_LIFE, 142219820Sjeff OSMTEST_TOKEN_VL_ENFORCE, 143219820Sjeff OSMTEST_TOKEN_MKEY_VIOL, 144219820Sjeff OSMTEST_TOKEN_PKEY_VIOL, 145219820Sjeff OSMTEST_TOKEN_QKEY_VIOL, 146219820Sjeff OSMTEST_TOKEN_GUID_CAP, 147219820Sjeff OSMTEST_TOKEN_SUBN_TIMEOUT, 148219820Sjeff OSMTEST_TOKEN_RESP_TIME_VAL, 149219820Sjeff OSMTEST_TOKEN_ERR_THRESHOLD, 150219820Sjeff OSMTEST_TOKEN_MTU, 151219820Sjeff OSMTEST_TOKEN_FROMLID, 152219820Sjeff OSMTEST_TOKEN_FROMPORTNUM, 153219820Sjeff OSMTEST_TOKEN_TOPORTNUM, 154219820Sjeff OSMTEST_TOKEN_TOLID, 155219820Sjeff OSMTEST_TOKEN_UNKNOWN 156219820Sjeff} osmtest_token_val_t; 157219820Sjeff 158219820Sjefftypedef struct _osmtest_token { 159219820Sjeff osmtest_token_val_t val; 160219820Sjeff size_t str_size; 161219820Sjeff const char *str; 162219820Sjeff} osmtest_token_t; 163219820Sjeff 164219820Sjeffconst osmtest_token_t token_array[] = { 165219820Sjeff {OSMTEST_TOKEN_COMMENT, 1, "#"}, 166219820Sjeff {OSMTEST_TOKEN_END, 3, "END"}, 167219820Sjeff {OSMTEST_TOKEN_DEFINE_NODE, 11, "DEFINE_NODE"}, 168219820Sjeff {OSMTEST_TOKEN_DEFINE_PORT, 11, "DEFINE_PORT"}, 169219820Sjeff {OSMTEST_TOKEN_DEFINE_PATH, 11, "DEFINE_PATH"}, 170219820Sjeff {OSMTEST_TOKEN_DEFINE_LINK, 11, "DEFINE_LINK"}, 171219820Sjeff {OSMTEST_TOKEN_LID, 3, "LID"}, 172219820Sjeff {OSMTEST_TOKEN_BASE_VERSION, 12, "BASE_VERSION"}, 173219820Sjeff {OSMTEST_TOKEN_CLASS_VERSION, 13, "CLASS_VERSION"}, 174219820Sjeff {OSMTEST_TOKEN_NODE_TYPE, 9, "NODE_TYPE"}, 175219820Sjeff {OSMTEST_TOKEN_NUM_PORTS, 9, "NUM_PORTS"}, 176219820Sjeff {OSMTEST_TOKEN_SYS_GUID, 8, "SYS_GUID"}, 177219820Sjeff {OSMTEST_TOKEN_NODE_GUID, 9, "NODE_GUID"}, 178219820Sjeff {OSMTEST_TOKEN_PORT_GUID, 9, "PORT_GUID"}, 179219820Sjeff {OSMTEST_TOKEN_PARTITION_CAP, 13, "PARTITION_CAP"}, 180219820Sjeff {OSMTEST_TOKEN_DEVICE_ID, 9, "DEVICE_ID"}, 181219820Sjeff {OSMTEST_TOKEN_REVISION, 8, "REVISION"}, 182219820Sjeff {OSMTEST_TOKEN_PORT_NUM, 8, "PORT_NUM"}, 183219820Sjeff {OSMTEST_TOKEN_VENDOR_ID, 9, "VENDOR_ID"}, 184219820Sjeff {OSMTEST_TOKEN_DGID, 4, "DGID"}, 185219820Sjeff {OSMTEST_TOKEN_SGID, 4, "SGID"}, 186219820Sjeff {OSMTEST_TOKEN_DLID, 4, "DLID"}, 187219820Sjeff {OSMTEST_TOKEN_SLID, 4, "SLID"}, 188219820Sjeff {OSMTEST_TOKEN_HOP_FLOW_RAW, 12, "HOP_FLOW_RAW"}, 189219820Sjeff {OSMTEST_TOKEN_TCLASS, 6, "TCLASS"}, 190219820Sjeff {OSMTEST_TOKEN_NUM_PATH, 8, "NUM_PATH"}, 191219820Sjeff {OSMTEST_TOKEN_PKEY, 4, "PKEY"}, 192219820Sjeff {OSMTEST_TOKEN_SL, 2, "SL"}, 193219820Sjeff {OSMTEST_TOKEN_RATE, 4, "RATE"}, 194219820Sjeff {OSMTEST_TOKEN_PKT_LIFE, 8, "PKT_LIFE"}, 195219820Sjeff {OSMTEST_TOKEN_PREFERENCE, 10, "PREFERENCE"}, 196219820Sjeff {OSMTEST_TOKEN_MKEY, 4, "M_KEY"}, 197219820Sjeff {OSMTEST_TOKEN_SUBN_PREF, 13, "SUBNET_PREFIX"}, 198219820Sjeff {OSMTEST_TOKEN_BASE_LID, 8, "BASE_LID"}, 199219820Sjeff {OSMTEST_TOKEN_SM_BASE_LID, 18, "MASTER_SM_BASE_LID"}, 200219820Sjeff {OSMTEST_TOKEN_CAP_MASK, 15, "CAPABILITY_MASK"}, 201219820Sjeff {OSMTEST_TOKEN_DIAG_CODE, 9, "DIAG_CODE"}, 202219820Sjeff {OSMTEST_TOKEN_MKEY_LEASE_PER, 18, "m_key_lease_period"}, 203219820Sjeff {OSMTEST_TOKEN_LOC_PORT_NUM, 14, "local_port_num"}, 204219820Sjeff {OSMTEST_TOKEN_LINK_WID_EN, 18, "link_width_enabled"}, 205219820Sjeff {OSMTEST_TOKEN_LINK_WID_SUP, 20, "link_width_supported"}, 206219820Sjeff {OSMTEST_TOKEN_LINK_WID_ACT, 17, "link_width_active"}, 207219820Sjeff {OSMTEST_TOKEN_LINK_SPEED_SUP, 20, "link_speed_supported"}, 208219820Sjeff {OSMTEST_TOKEN_PORT_STATE, 10, "port_state"}, 209219820Sjeff {OSMTEST_TOKEN_STATE_INFO2, 10, "state_info2"}, 210219820Sjeff {OSMTEST_TOKEN_MKEY_PROT_BITS, 3, "mpb"}, 211219820Sjeff {OSMTEST_TOKEN_LMC, 3, "lmc"}, 212219820Sjeff {OSMTEST_TOKEN_LINK_SPEED, 10, "link_speed"}, 213219820Sjeff {OSMTEST_TOKEN_MTU_SMSL, 8, "mtu_smsl"}, 214219820Sjeff {OSMTEST_TOKEN_VL_CAP, 6, "vl_cap"}, 215219820Sjeff {OSMTEST_TOKEN_VL_HIGH_LIMIT, 13, "vl_high_limit"}, 216219820Sjeff {OSMTEST_TOKEN_VL_ARB_HIGH_CAP, 15, "vl_arb_high_cap"}, 217219820Sjeff {OSMTEST_TOKEN_VL_ARB_LOW_CAP, 14, "vl_arb_low_cap"}, 218219820Sjeff {OSMTEST_TOKEN_MTU_CAP, 7, "mtu_cap"}, 219219820Sjeff {OSMTEST_TOKEN_VL_STALL_LIFE, 13, "vl_stall_life"}, 220219820Sjeff {OSMTEST_TOKEN_VL_ENFORCE, 10, "vl_enforce"}, 221219820Sjeff {OSMTEST_TOKEN_MKEY_VIOL, 16, "m_key_violations"}, 222219820Sjeff {OSMTEST_TOKEN_PKEY_VIOL, 16, "p_key_violations"}, 223219820Sjeff {OSMTEST_TOKEN_QKEY_VIOL, 16, "q_key_violations"}, 224219820Sjeff {OSMTEST_TOKEN_GUID_CAP, 8, "guid_cap"}, 225219820Sjeff {OSMTEST_TOKEN_SUBN_TIMEOUT, 14, "subnet_timeout"}, 226219820Sjeff {OSMTEST_TOKEN_RESP_TIME_VAL, 15, "resp_time_value"}, 227219820Sjeff {OSMTEST_TOKEN_ERR_THRESHOLD, 15, "error_threshold"}, 228219820Sjeff {OSMTEST_TOKEN_MTU, 3, "MTU"}, /* must be after the other mtu... tokens. */ 229219820Sjeff {OSMTEST_TOKEN_FROMLID, 8, "from_lid"}, 230219820Sjeff {OSMTEST_TOKEN_FROMPORTNUM, 13, "from_port_num"}, 231219820Sjeff {OSMTEST_TOKEN_TOPORTNUM, 11, "to_port_num"}, 232219820Sjeff {OSMTEST_TOKEN_TOLID, 6, "to_lid"}, 233219820Sjeff {OSMTEST_TOKEN_UNKNOWN, 0, ""} /* must be last entry */ 234219820Sjeff}; 235219820Sjeff 236219820Sjeff#define IB_MAD_STATUS_CLASS_MASK (CL_HTON16(0xFF00)) 237219820Sjeff 238219820Sjeffstatic const char ib_mad_status_str_busy[] = "IB_MAD_STATUS_BUSY"; 239219820Sjeffstatic const char ib_mad_status_str_redirect[] = "IB_MAD_STATUS_REDIRECT"; 240219820Sjeffstatic const char ib_mad_status_str_unsup_class_ver[] = 241219820Sjeff "IB_MAD_STATUS_UNSUP_CLASS_VER"; 242219820Sjeffstatic const char ib_mad_status_str_unsup_method[] = 243219820Sjeff "IB_MAD_STATUS_UNSUP_METHOD"; 244219820Sjeffstatic const char ib_mad_status_str_unsup_method_attr[] = 245219820Sjeff "IB_MAD_STATUS_UNSUP_METHOD_ATTR"; 246219820Sjeffstatic const char ib_mad_status_str_invalid_field[] = 247219820Sjeff "IB_MAD_STATUS_INVALID_FIELD"; 248219820Sjeffstatic const char ib_mad_status_str_no_resources[] = 249219820Sjeff "IB_SA_MAD_STATUS_NO_RESOURCES"; 250219820Sjeffstatic const char ib_mad_status_str_req_invalid[] = 251219820Sjeff "IB_SA_MAD_STATUS_REQ_INVALID"; 252219820Sjeffstatic const char ib_mad_status_str_no_records[] = 253219820Sjeff "IB_SA_MAD_STATUS_NO_RECORDS"; 254219820Sjeffstatic const char ib_mad_status_str_too_many_records[] = 255219820Sjeff "IB_SA_MAD_STATUS_TOO_MANY_RECORDS"; 256219820Sjeffstatic const char ib_mad_status_str_invalid_gid[] = 257219820Sjeff "IB_SA_MAD_STATUS_INVALID_GID"; 258219820Sjeffstatic const char ib_mad_status_str_insuf_comps[] = 259219820Sjeff "IB_SA_MAD_STATUS_INSUF_COMPS"; 260219820Sjeffstatic const char generic_or_str[] = " | "; 261219820Sjeff 262219820Sjeff/********************************************************************** 263219820Sjeff **********************************************************************/ 264219820Sjeffconst char *ib_get_mad_status_str(IN const ib_mad_t * const p_mad) 265219820Sjeff{ 266219820Sjeff static char line[512]; 267219820Sjeff uint32_t offset = 0; 268219820Sjeff ib_net16_t status; 269219820Sjeff boolean_t first = TRUE; 270219820Sjeff 271219820Sjeff line[offset] = '\0'; 272219820Sjeff 273219820Sjeff status = (ib_net16_t) (p_mad->status & IB_SMP_STATUS_MASK); 274219820Sjeff 275219820Sjeff if (status == 0) { 276219820Sjeff strcat(&line[offset], "IB_SUCCESS"); 277219820Sjeff return (line); 278219820Sjeff } 279219820Sjeff 280219820Sjeff if (status & IB_MAD_STATUS_BUSY) { 281219820Sjeff strcat(&line[offset], ib_mad_status_str_busy); 282219820Sjeff offset += sizeof(ib_mad_status_str_busy); 283219820Sjeff } 284219820Sjeff if (status & IB_MAD_STATUS_REDIRECT) { 285219820Sjeff if (!first) { 286219820Sjeff strcat(&line[offset], generic_or_str); 287219820Sjeff offset += sizeof(generic_or_str) - 1; 288219820Sjeff } 289219820Sjeff first = FALSE; 290219820Sjeff strcat(&line[offset], ib_mad_status_str_redirect); 291219820Sjeff offset += sizeof(ib_mad_status_str_redirect) - 1; 292219820Sjeff } 293219820Sjeff if ((status & IB_MAD_STATUS_INVALID_FIELD) == 294219820Sjeff IB_MAD_STATUS_UNSUP_CLASS_VER) { 295219820Sjeff if (!first) { 296219820Sjeff strcat(&line[offset], generic_or_str); 297219820Sjeff offset += sizeof(generic_or_str) - 1; 298219820Sjeff } 299219820Sjeff first = FALSE; 300219820Sjeff strcat(&line[offset], ib_mad_status_str_unsup_class_ver); 301219820Sjeff offset += sizeof(ib_mad_status_str_unsup_class_ver) - 1; 302219820Sjeff } 303219820Sjeff if ((status & IB_MAD_STATUS_INVALID_FIELD) == 304219820Sjeff IB_MAD_STATUS_UNSUP_METHOD) { 305219820Sjeff if (!first) { 306219820Sjeff strcat(&line[offset], generic_or_str); 307219820Sjeff offset += sizeof(generic_or_str) - 1; 308219820Sjeff } 309219820Sjeff first = FALSE; 310219820Sjeff strcat(&line[offset], ib_mad_status_str_unsup_method); 311219820Sjeff offset += sizeof(ib_mad_status_str_unsup_method) - 1; 312219820Sjeff } 313219820Sjeff if ((status & IB_MAD_STATUS_INVALID_FIELD) == 314219820Sjeff IB_MAD_STATUS_UNSUP_METHOD_ATTR) { 315219820Sjeff if (!first) { 316219820Sjeff strcat(&line[offset], generic_or_str); 317219820Sjeff offset += sizeof(generic_or_str) - 1; 318219820Sjeff } 319219820Sjeff first = FALSE; 320219820Sjeff strcat(&line[offset], ib_mad_status_str_unsup_method_attr); 321219820Sjeff offset += sizeof(ib_mad_status_str_unsup_method_attr) - 1; 322219820Sjeff } 323219820Sjeff if ((status & IB_MAD_STATUS_INVALID_FIELD) == 324219820Sjeff IB_MAD_STATUS_INVALID_FIELD) { 325219820Sjeff if (!first) { 326219820Sjeff strcat(&line[offset], generic_or_str); 327219820Sjeff offset += sizeof(generic_or_str) - 1; 328219820Sjeff } 329219820Sjeff first = FALSE; 330219820Sjeff strcat(&line[offset], ib_mad_status_str_invalid_field); 331219820Sjeff offset += sizeof(ib_mad_status_str_invalid_field) - 1; 332219820Sjeff } 333219820Sjeff if ((status & IB_MAD_STATUS_CLASS_MASK) == 334219820Sjeff IB_SA_MAD_STATUS_NO_RESOURCES) { 335219820Sjeff if (!first) { 336219820Sjeff strcat(&line[offset], generic_or_str); 337219820Sjeff offset += sizeof(generic_or_str) - 1; 338219820Sjeff } 339219820Sjeff first = FALSE; 340219820Sjeff strcat(&line[offset], ib_mad_status_str_no_resources); 341219820Sjeff offset += sizeof(ib_mad_status_str_no_resources) - 1; 342219820Sjeff } 343219820Sjeff if ((status & IB_MAD_STATUS_CLASS_MASK) == IB_SA_MAD_STATUS_REQ_INVALID) { 344219820Sjeff if (!first) { 345219820Sjeff strcat(&line[offset], generic_or_str); 346219820Sjeff offset += sizeof(generic_or_str) - 1; 347219820Sjeff } 348219820Sjeff first = FALSE; 349219820Sjeff strcat(&line[offset], ib_mad_status_str_req_invalid); 350219820Sjeff offset += sizeof(ib_mad_status_str_req_invalid) - 1; 351219820Sjeff } 352219820Sjeff if ((status & IB_MAD_STATUS_CLASS_MASK) == IB_SA_MAD_STATUS_NO_RECORDS) { 353219820Sjeff if (!first) { 354219820Sjeff strcat(&line[offset], generic_or_str); 355219820Sjeff offset += sizeof(generic_or_str) - 1; 356219820Sjeff } 357219820Sjeff first = FALSE; 358219820Sjeff strcat(&line[offset], ib_mad_status_str_no_records); 359219820Sjeff offset += sizeof(ib_mad_status_str_no_records) - 1; 360219820Sjeff } 361219820Sjeff if ((status & IB_MAD_STATUS_CLASS_MASK) == 362219820Sjeff IB_SA_MAD_STATUS_TOO_MANY_RECORDS) { 363219820Sjeff if (!first) { 364219820Sjeff strcat(&line[offset], generic_or_str); 365219820Sjeff offset += sizeof(generic_or_str) - 1; 366219820Sjeff } 367219820Sjeff first = FALSE; 368219820Sjeff strcat(&line[offset], ib_mad_status_str_too_many_records); 369219820Sjeff offset += sizeof(ib_mad_status_str_too_many_records) - 1; 370219820Sjeff } 371219820Sjeff if ((status & IB_MAD_STATUS_CLASS_MASK) == IB_SA_MAD_STATUS_INVALID_GID) { 372219820Sjeff if (!first) { 373219820Sjeff strcat(&line[offset], generic_or_str); 374219820Sjeff offset += sizeof(generic_or_str) - 1; 375219820Sjeff } 376219820Sjeff first = FALSE; 377219820Sjeff strcat(&line[offset], ib_mad_status_str_invalid_gid); 378219820Sjeff offset += sizeof(ib_mad_status_str_invalid_gid) - 1; 379219820Sjeff } 380219820Sjeff if ((status & IB_MAD_STATUS_CLASS_MASK) == IB_SA_MAD_STATUS_INSUF_COMPS) { 381219820Sjeff if (!first) { 382219820Sjeff strcat(&line[offset], generic_or_str); 383219820Sjeff offset += sizeof(generic_or_str) - 1; 384219820Sjeff } 385219820Sjeff first = FALSE; 386219820Sjeff strcat(&line[offset], ib_mad_status_str_insuf_comps); 387219820Sjeff offset += sizeof(ib_mad_status_str_insuf_comps) - 1; 388219820Sjeff } 389219820Sjeff 390219820Sjeff return (line); 391219820Sjeff} 392219820Sjeff 393219820Sjeff/********************************************************************** 394219820Sjeff **********************************************************************/ 395219820Sjeffvoid subnet_construct(IN subnet_t * const p_subn) 396219820Sjeff{ 397219820Sjeff cl_qmap_init(&p_subn->link_tbl); 398219820Sjeff cl_qmap_init(&p_subn->node_lid_tbl); 399219820Sjeff cl_qmap_init(&p_subn->node_guid_tbl); 400219820Sjeff cl_qmap_init(&p_subn->mgrp_mlid_tbl); 401219820Sjeff 402219820Sjeff /* NO WAY TO HAVE UNIQUE PORT BY LID OR GUID */ 403219820Sjeff /* cl_qmap_init( &p_subn->port_lid_tbl ); */ 404219820Sjeff /* cl_qmap_init( &p_subn->port_guid_tbl ); */ 405219820Sjeff 406219820Sjeff /* port key is a lid and num pair */ 407219820Sjeff cl_qmap_init(&p_subn->port_key_tbl); 408219820Sjeff cl_qmap_init(&p_subn->path_tbl); 409219820Sjeff} 410219820Sjeff 411219820Sjeff/********************************************************************** 412219820Sjeff **********************************************************************/ 413219820Sjeffcl_status_t subnet_init(IN subnet_t * const p_subn) 414219820Sjeff{ 415219820Sjeff cl_status_t status = IB_SUCCESS; 416219820Sjeff 417219820Sjeff subnet_construct(p_subn); 418219820Sjeff 419219820Sjeff return (status); 420219820Sjeff} 421219820Sjeff 422219820Sjeff/********************************************************************** 423219820Sjeff **********************************************************************/ 424219820Sjeffvoid osmtest_construct(IN osmtest_t * const p_osmt) 425219820Sjeff{ 426219820Sjeff memset(p_osmt, 0, sizeof(*p_osmt)); 427219820Sjeff osm_log_construct(&p_osmt->log); 428219820Sjeff subnet_construct(&p_osmt->exp_subn); 429219820Sjeff} 430219820Sjeff 431219820Sjeff/********************************************************************** 432219820Sjeff **********************************************************************/ 433219820Sjeffvoid osmtest_destroy(IN osmtest_t * const p_osmt) 434219820Sjeff{ 435219820Sjeff cl_map_item_t *p_item, *p_next_item; 436219820Sjeff 437219820Sjeff /* Currently there is a problem with IBAL exit flow - memory overrun, 438219820Sjeff so bypass vendor deletion - it will be cleaned by the Windows OS */ 439219820Sjeff#ifndef __WIN__ 440219820Sjeff if (p_osmt->p_vendor) 441219820Sjeff osm_vendor_delete(&p_osmt->p_vendor); 442219820Sjeff#endif 443219820Sjeff 444219820Sjeff cl_qpool_destroy(&p_osmt->port_pool); 445219820Sjeff cl_qpool_destroy(&p_osmt->node_pool); 446219820Sjeff 447219820Sjeff /* destroy the qmap tables */ 448219820Sjeff p_next_item = cl_qmap_head(&p_osmt->exp_subn.link_tbl); 449219820Sjeff while (p_next_item != cl_qmap_end(&p_osmt->exp_subn.link_tbl)) { 450219820Sjeff p_item = p_next_item; 451219820Sjeff p_next_item = cl_qmap_next(p_item); 452219820Sjeff free(p_item); 453219820Sjeff } 454219820Sjeff p_next_item = cl_qmap_head(&p_osmt->exp_subn.mgrp_mlid_tbl); 455219820Sjeff while (p_next_item != cl_qmap_end(&p_osmt->exp_subn.mgrp_mlid_tbl)) { 456219820Sjeff p_item = p_next_item; 457219820Sjeff p_next_item = cl_qmap_next(p_item); 458219820Sjeff free(p_item); 459219820Sjeff } 460219820Sjeff p_next_item = cl_qmap_head(&p_osmt->exp_subn.node_guid_tbl); 461219820Sjeff while (p_next_item != cl_qmap_end(&p_osmt->exp_subn.node_guid_tbl)) { 462219820Sjeff p_item = p_next_item; 463219820Sjeff p_next_item = cl_qmap_next(p_item); 464219820Sjeff free(p_item); 465219820Sjeff } 466219820Sjeff 467219820Sjeff p_next_item = cl_qmap_head(&p_osmt->exp_subn.node_lid_tbl); 468219820Sjeff while (p_next_item != cl_qmap_end(&p_osmt->exp_subn.node_lid_tbl)) { 469219820Sjeff p_item = p_next_item; 470219820Sjeff p_next_item = cl_qmap_next(p_item); 471219820Sjeff free(p_item); 472219820Sjeff } 473219820Sjeff 474219820Sjeff p_next_item = cl_qmap_head(&p_osmt->exp_subn.path_tbl); 475219820Sjeff while (p_next_item != cl_qmap_end(&p_osmt->exp_subn.path_tbl)) { 476219820Sjeff p_item = p_next_item; 477219820Sjeff p_next_item = cl_qmap_next(p_item); 478219820Sjeff free(p_item); 479219820Sjeff } 480219820Sjeff p_next_item = cl_qmap_head(&p_osmt->exp_subn.port_key_tbl); 481219820Sjeff while (p_next_item != cl_qmap_end(&p_osmt->exp_subn.port_key_tbl)) { 482219820Sjeff p_item = p_next_item; 483219820Sjeff p_next_item = cl_qmap_next(p_item); 484219820Sjeff free(p_item); 485219820Sjeff } 486219820Sjeff 487219820Sjeff osm_log_destroy(&p_osmt->log); 488219820Sjeff} 489219820Sjeff 490219820Sjeff/********************************************************************** 491219820Sjeff **********************************************************************/ 492219820Sjeffib_api_status_t 493219820Sjeffosmtest_init(IN osmtest_t * const p_osmt, 494219820Sjeff IN const osmtest_opt_t * const p_opt, 495219820Sjeff IN const osm_log_level_t log_flags) 496219820Sjeff{ 497219820Sjeff ib_api_status_t status; 498219820Sjeff 499219820Sjeff /* Can't use log macros here, since we're initializing the log. */ 500219820Sjeff osmtest_construct(p_osmt); 501219820Sjeff 502219820Sjeff status = osm_log_init_v2(&p_osmt->log, p_opt->force_log_flush, 503219820Sjeff 0x0001, p_opt->log_file, 0, TRUE); 504219820Sjeff if (status != IB_SUCCESS) 505219820Sjeff return (status); 506219820Sjeff 507219820Sjeff /* but we do not want any extra stuff here */ 508219820Sjeff osm_log_set_level(&p_osmt->log, log_flags); 509219820Sjeff 510219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_FUNCS, "[\n"); 511219820Sjeff 512219820Sjeff p_osmt->opt = *p_opt; 513219820Sjeff 514219820Sjeff status = cl_qpool_init(&p_osmt->node_pool, POOL_MIN_ITEMS, 0, 515219820Sjeff POOL_MIN_ITEMS, sizeof(node_t), NULL, NULL, 516219820Sjeff NULL); 517219820Sjeff CL_ASSERT(status == CL_SUCCESS); 518219820Sjeff 519219820Sjeff status = cl_qpool_init(&p_osmt->port_pool, POOL_MIN_ITEMS, 0, 520219820Sjeff POOL_MIN_ITEMS, sizeof(port_t), NULL, NULL, 521219820Sjeff NULL); 522219820Sjeff CL_ASSERT(status == CL_SUCCESS); 523219820Sjeff 524219820Sjeff p_osmt->p_vendor = osm_vendor_new(&p_osmt->log, 525219820Sjeff p_opt->transaction_timeout); 526219820Sjeff 527219820Sjeff if (p_osmt->p_vendor == NULL) { 528219820Sjeff status = IB_INSUFFICIENT_RESOURCES; 529219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0001: " 530219820Sjeff "Unable to allocate vendor object"); 531219820Sjeff status = IB_ERROR; 532219820Sjeff goto Exit; 533219820Sjeff } 534219820Sjeff 535219820Sjeff osm_mad_pool_construct(&p_osmt->mad_pool); 536219820Sjeff status = osm_mad_pool_init(&p_osmt->mad_pool); 537219820Sjeff if (status != IB_SUCCESS) 538219820Sjeff goto Exit; 539219820Sjeff 540219820SjeffExit: 541219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_FUNCS, "]\n"); 542219820Sjeff return (status); 543219820Sjeff} 544219820Sjeff 545219820Sjeff/********************************************************************** 546219820Sjeff **********************************************************************/ 547219820Sjeffvoid osmtest_query_res_cb(IN osmv_query_res_t * p_rec) 548219820Sjeff{ 549219820Sjeff osmtest_req_context_t *const p_ctxt = 550219820Sjeff (osmtest_req_context_t *) p_rec->query_context; 551219820Sjeff osmtest_t *const p_osmt = p_ctxt->p_osmt; 552219820Sjeff 553219820Sjeff OSM_LOG_ENTER(&p_osmt->log); 554219820Sjeff 555219820Sjeff p_ctxt->result = *p_rec; 556219820Sjeff 557219820Sjeff if (p_rec->status != IB_SUCCESS) { 558219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0003: " 559219820Sjeff "Error on query (%s)\n", ib_get_err_str(p_rec->status)); 560219820Sjeff } 561219820Sjeff 562219820Sjeff OSM_LOG_EXIT(&p_osmt->log); 563219820Sjeff} 564219820Sjeff 565219820Sjeff/********************************************************************** 566219820Sjeff **********************************************************************/ 567219820Sjeffib_api_status_t 568219820Sjeffosmtest_get_all_recs(IN osmtest_t * const p_osmt, 569219820Sjeff IN ib_net16_t const attr_id, 570219820Sjeff IN size_t const attr_size, 571219820Sjeff IN OUT osmtest_req_context_t * const p_context) 572219820Sjeff{ 573219820Sjeff ib_api_status_t status = IB_SUCCESS; 574219820Sjeff osmv_user_query_t user; 575219820Sjeff osmv_query_req_t req; 576219820Sjeff 577219820Sjeff OSM_LOG_ENTER(&p_osmt->log); 578219820Sjeff 579219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, "Getting all %s records\n", 580219820Sjeff ib_get_sa_attr_str(attr_id)); 581219820Sjeff 582219820Sjeff /* 583219820Sjeff * Do a blocking query for all <attr_id> records in the subnet. 584219820Sjeff * The result is returned in the result field of the caller's 585219820Sjeff * context structure. 586219820Sjeff * 587219820Sjeff * The query structures are locals. 588219820Sjeff */ 589219820Sjeff memset(&req, 0, sizeof(req)); 590219820Sjeff memset(&user, 0, sizeof(user)); 591219820Sjeff 592219820Sjeff p_context->p_osmt = p_osmt; 593219820Sjeff user.attr_id = attr_id; 594219820Sjeff user.attr_offset = cl_ntoh16((uint16_t) (attr_size >> 3)); 595219820Sjeff 596219820Sjeff req.query_type = OSMV_QUERY_USER_DEFINED; 597219820Sjeff req.timeout_ms = p_osmt->opt.transaction_timeout; 598219820Sjeff req.retry_cnt = p_osmt->opt.retry_count; 599219820Sjeff req.flags = OSM_SA_FLAGS_SYNC; 600219820Sjeff req.query_context = p_context; 601219820Sjeff req.pfn_query_cb = osmtest_query_res_cb; 602219820Sjeff req.p_query_input = &user; 603219820Sjeff req.sm_key = 0; 604219820Sjeff 605219820Sjeff status = osmv_query_sa(p_osmt->h_bind, &req); 606219820Sjeff if (status != IB_SUCCESS) { 607219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0004: " 608219820Sjeff "ib_query failed (%s)\n", ib_get_err_str(status)); 609219820Sjeff goto Exit; 610219820Sjeff } 611219820Sjeff 612219820Sjeff status = p_context->result.status; 613219820Sjeff 614219820Sjeff if (status != IB_SUCCESS) { 615219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0064: " 616219820Sjeff "ib_query failed (%s)\n", ib_get_err_str(status)); 617219820Sjeff 618219820Sjeff if (status == IB_REMOTE_ERROR) { 619219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, 620219820Sjeff "Remote error = %s\n", 621219820Sjeff ib_get_mad_status_str(osm_madw_get_mad_ptr 622219820Sjeff (p_context->result. 623219820Sjeff p_result_madw))); 624219820Sjeff } 625219820Sjeff goto Exit; 626219820Sjeff } 627219820Sjeff 628219820SjeffExit: 629219820Sjeff OSM_LOG_EXIT(&p_osmt->log); 630219820Sjeff return (status); 631219820Sjeff} 632219820Sjeff 633219820Sjeff/********************************************************************** 634219820Sjeff **********************************************************************/ 635219820Sjeffib_api_status_t osmtest_validate_sa_class_port_info(IN osmtest_t * const p_osmt) 636219820Sjeff{ 637219820Sjeff ib_api_status_t status = IB_SUCCESS; 638219820Sjeff osmv_query_req_t req; 639219820Sjeff ib_class_port_info_t *p_cpi; 640219820Sjeff osmtest_req_context_t context; 641219820Sjeff osmtest_req_context_t *p_context = &context; 642219820Sjeff ib_sa_mad_t *p_resp_sa_madp; 643219820Sjeff 644219820Sjeff OSM_LOG_ENTER(&p_osmt->log); 645219820Sjeff 646219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Getting ClassPortInfo\n"); 647219820Sjeff 648219820Sjeff /* 649219820Sjeff * Do a blocking query for this record in the subnet. 650219820Sjeff * The result is returned in the result field of the caller's 651219820Sjeff * context structure. 652219820Sjeff * 653219820Sjeff * The query structures are locals. 654219820Sjeff */ 655219820Sjeff memset(&req, 0, sizeof(req)); 656219820Sjeff 657219820Sjeff p_context->p_osmt = p_osmt; 658219820Sjeff req.query_type = OSMV_QUERY_CLASS_PORT_INFO; 659219820Sjeff req.timeout_ms = p_osmt->opt.transaction_timeout; 660219820Sjeff req.retry_cnt = p_osmt->opt.retry_count; 661219820Sjeff req.flags = OSM_SA_FLAGS_SYNC; 662219820Sjeff req.query_context = p_context; 663219820Sjeff req.pfn_query_cb = osmtest_query_res_cb; 664219820Sjeff req.p_query_input = 0; 665219820Sjeff req.sm_key = 0; 666219820Sjeff 667219820Sjeff status = osmv_query_sa(p_osmt->h_bind, &req); 668219820Sjeff if (status != IB_SUCCESS) { 669219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0065: " 670219820Sjeff "ib_query failed (%s)\n", ib_get_err_str(status)); 671219820Sjeff goto Exit; 672219820Sjeff } 673219820Sjeff 674219820Sjeff status = p_context->result.status; 675219820Sjeff 676219820Sjeff if (status != IB_SUCCESS) { 677219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0070: " 678219820Sjeff "ib_query failed (%s)\n", ib_get_err_str(status)); 679219820Sjeff if (status == IB_REMOTE_ERROR) { 680219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, 681219820Sjeff "Remote error = %s\n", 682219820Sjeff ib_get_mad_status_str(osm_madw_get_mad_ptr 683219820Sjeff (p_context->result. 684219820Sjeff p_result_madw))); 685219820Sjeff } 686219820Sjeff goto Exit; 687219820Sjeff } 688219820Sjeff 689219820Sjeff /* ok we got it so please print it out */ 690219820Sjeff p_resp_sa_madp = 691219820Sjeff (ib_sa_mad_t *) osm_madw_get_mad_ptr(context.result.p_result_madw); 692219820Sjeff p_cpi = 693219820Sjeff (ib_class_port_info_t *) ib_sa_mad_get_payload_ptr(p_resp_sa_madp); 694219820Sjeff 695219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_INFO, 696219820Sjeff "\n-----------------------------\n" 697219820Sjeff "SA Class Port Info:\n" 698219820Sjeff " base_ver:%u\n" 699219820Sjeff " class_ver:%u\n" 700219820Sjeff " cap_mask:0x%X\n" 701219820Sjeff " cap_mask2:0x%X\n" 702219820Sjeff " resp_time_val:0x%X\n" 703219820Sjeff "-----------------------------\n", 704219820Sjeff p_cpi->base_ver, p_cpi->class_ver, cl_ntoh16(p_cpi->cap_mask), 705219820Sjeff ib_class_cap_mask2(p_cpi), ib_class_resp_time_val(p_cpi)); 706219820Sjeff 707219820SjeffExit: 708219820Sjeff#if 0 709219820Sjeff if (context.result.p_result_madw != NULL) { 710219820Sjeff osm_mad_pool_put(&p_osmt->mad_pool, 711219820Sjeff context.result.p_result_madw); 712219820Sjeff context.result.p_result_madw = NULL; 713219820Sjeff } 714219820Sjeff#endif 715219820Sjeff 716219820Sjeff OSM_LOG_EXIT(&p_osmt->log); 717219820Sjeff return (status); 718219820Sjeff} 719219820Sjeff 720219820Sjeff/********************************************************************** 721219820Sjeff **********************************************************************/ 722219820Sjeffib_api_status_t 723219820Sjeffosmtest_get_node_rec(IN osmtest_t * const p_osmt, 724219820Sjeff IN ib_net64_t const node_guid, 725219820Sjeff IN OUT osmtest_req_context_t * const p_context) 726219820Sjeff{ 727219820Sjeff ib_api_status_t status = IB_SUCCESS; 728219820Sjeff osmv_user_query_t user; 729219820Sjeff osmv_query_req_t req; 730219820Sjeff ib_node_record_t record; 731219820Sjeff 732219820Sjeff OSM_LOG_ENTER(&p_osmt->log); 733219820Sjeff 734219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, 735219820Sjeff "Getting node record for 0x%016" PRIx64 "\n", 736219820Sjeff cl_ntoh64(node_guid)); 737219820Sjeff 738219820Sjeff /* 739219820Sjeff * Do a blocking query for this record in the subnet. 740219820Sjeff * The result is returned in the result field of the caller's 741219820Sjeff * context structure. 742219820Sjeff * 743219820Sjeff * The query structures are locals. 744219820Sjeff */ 745219820Sjeff memset(&req, 0, sizeof(req)); 746219820Sjeff memset(&user, 0, sizeof(user)); 747219820Sjeff memset(&record, 0, sizeof(record)); 748219820Sjeff 749219820Sjeff record.node_info.node_guid = node_guid; 750219820Sjeff 751219820Sjeff p_context->p_osmt = p_osmt; 752219820Sjeff user.comp_mask = IB_NR_COMPMASK_NODEGUID; 753219820Sjeff user.attr_id = IB_MAD_ATTR_NODE_RECORD; 754219820Sjeff user.attr_offset = cl_ntoh16((uint16_t) (sizeof(record) >> 3)); 755219820Sjeff user.p_attr = &record; 756219820Sjeff 757219820Sjeff req.query_type = OSMV_QUERY_USER_DEFINED; 758219820Sjeff req.timeout_ms = p_osmt->opt.transaction_timeout; 759219820Sjeff req.retry_cnt = p_osmt->opt.retry_count; 760219820Sjeff req.flags = OSM_SA_FLAGS_SYNC; 761219820Sjeff req.query_context = p_context; 762219820Sjeff req.pfn_query_cb = osmtest_query_res_cb; 763219820Sjeff req.p_query_input = &user; 764219820Sjeff req.sm_key = 0; 765219820Sjeff 766219820Sjeff status = osmv_query_sa(p_osmt->h_bind, &req); 767219820Sjeff if (status != IB_SUCCESS) { 768219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0071: " 769219820Sjeff "ib_query failed (%s)\n", ib_get_err_str(status)); 770219820Sjeff goto Exit; 771219820Sjeff } 772219820Sjeff 773219820Sjeff status = p_context->result.status; 774219820Sjeff 775219820Sjeff if (status != IB_SUCCESS) { 776219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0072: " 777219820Sjeff "ib_query failed (%s)\n", ib_get_err_str(status)); 778219820Sjeff if (status == IB_REMOTE_ERROR) { 779219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, 780219820Sjeff "Remote error = %s\n", 781219820Sjeff ib_get_mad_status_str(osm_madw_get_mad_ptr 782219820Sjeff (p_context->result. 783219820Sjeff p_result_madw))); 784219820Sjeff } 785219820Sjeff goto Exit; 786219820Sjeff } 787219820Sjeff 788219820SjeffExit: 789219820Sjeff OSM_LOG_EXIT(&p_osmt->log); 790219820Sjeff return (status); 791219820Sjeff} 792219820Sjeff 793219820Sjeff/********************************************************************** 794219820Sjeff * Get a node record by node LID 795219820Sjeff **********************************************************************/ 796219820Sjeffib_api_status_t 797219820Sjeffosmtest_get_node_rec_by_lid(IN osmtest_t * const p_osmt, 798219820Sjeff IN ib_net16_t const lid, 799219820Sjeff IN OUT osmtest_req_context_t * const p_context) 800219820Sjeff{ 801219820Sjeff ib_api_status_t status = IB_SUCCESS; 802219820Sjeff osmv_user_query_t user; 803219820Sjeff osmv_query_req_t req; 804219820Sjeff ib_node_record_t record; 805219820Sjeff ib_mad_t *p_mad; 806219820Sjeff 807219820Sjeff OSM_LOG_ENTER(&p_osmt->log); 808219820Sjeff 809219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, 810219820Sjeff "Getting node record for LID 0x%02X\n", cl_ntoh16(lid)); 811219820Sjeff 812219820Sjeff /* 813219820Sjeff * Do a blocking query for this record in the subnet. 814219820Sjeff * The result is returned in the result field of the caller's 815219820Sjeff * context structure. 816219820Sjeff * 817219820Sjeff * The query structures are locals. 818219820Sjeff */ 819219820Sjeff memset(&req, 0, sizeof(req)); 820219820Sjeff memset(&user, 0, sizeof(user)); 821219820Sjeff memset(&record, 0, sizeof(record)); 822219820Sjeff 823219820Sjeff record.lid = lid; 824219820Sjeff 825219820Sjeff p_context->p_osmt = p_osmt; 826219820Sjeff user.comp_mask = IB_NR_COMPMASK_LID; 827219820Sjeff user.attr_id = IB_MAD_ATTR_NODE_RECORD; 828219820Sjeff user.attr_offset = cl_ntoh16((uint16_t) (sizeof(record) >> 3)); 829219820Sjeff user.p_attr = &record; 830219820Sjeff 831219820Sjeff req.query_type = OSMV_QUERY_USER_DEFINED; 832219820Sjeff req.timeout_ms = p_osmt->opt.transaction_timeout; 833219820Sjeff req.retry_cnt = p_osmt->opt.retry_count; 834219820Sjeff req.flags = OSM_SA_FLAGS_SYNC; 835219820Sjeff req.query_context = p_context; 836219820Sjeff req.pfn_query_cb = osmtest_query_res_cb; 837219820Sjeff req.p_query_input = &user; 838219820Sjeff req.sm_key = 0; 839219820Sjeff 840219820Sjeff status = osmv_query_sa(p_osmt->h_bind, &req); 841219820Sjeff if (status != IB_SUCCESS) { 842219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0073: " 843219820Sjeff "ib_query failed (%s)\n", ib_get_err_str(status)); 844219820Sjeff goto Exit; 845219820Sjeff } 846219820Sjeff 847219820Sjeff status = p_context->result.status; 848219820Sjeff 849219820Sjeff if (status != IB_SUCCESS) { 850219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0074: " 851219820Sjeff "ib_query failed (%s)\n", ib_get_err_str(status)); 852219820Sjeff if (status == IB_REMOTE_ERROR) { 853219820Sjeff p_mad = 854219820Sjeff osm_madw_get_mad_ptr(p_context->result. 855219820Sjeff p_result_madw); 856219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, 857219820Sjeff "Remote error = %s\n", 858219820Sjeff ib_get_mad_status_str(p_mad)); 859219820Sjeff 860219820Sjeff status = 861219820Sjeff (ib_net16_t) (p_mad->status & IB_SMP_STATUS_MASK); 862219820Sjeff } 863219820Sjeff goto Exit; 864219820Sjeff } 865219820Sjeff 866219820SjeffExit: 867219820Sjeff OSM_LOG_EXIT(&p_osmt->log); 868219820Sjeff return (status); 869219820Sjeff} 870219820Sjeff 871219820Sjeff/********************************************************************** 872219820Sjeff **********************************************************************/ 873219820Sjeffstatic ib_api_status_t 874219820Sjeffosmtest_get_path_rec_by_guid_pair(IN osmtest_t * const p_osmt, 875219820Sjeff IN ib_net64_t sguid, 876219820Sjeff IN ib_net64_t dguid, 877219820Sjeff IN osmtest_req_context_t * p_context) 878219820Sjeff{ 879219820Sjeff cl_status_t status = IB_SUCCESS; 880219820Sjeff osmv_query_req_t req; 881219820Sjeff osmv_guid_pair_t guid_pair; 882219820Sjeff 883219820Sjeff OSM_LOG_ENTER(&p_osmt->log); 884219820Sjeff 885219820Sjeff memset(&req, 0, sizeof(req)); 886219820Sjeff memset(p_context, 0, sizeof(*p_context)); 887219820Sjeff 888219820Sjeff p_context->p_osmt = p_osmt; 889219820Sjeff req.timeout_ms = p_osmt->opt.transaction_timeout; 890219820Sjeff req.retry_cnt = p_osmt->opt.retry_count; 891219820Sjeff req.flags = OSM_SA_FLAGS_SYNC; 892219820Sjeff req.query_context = p_context; 893219820Sjeff req.pfn_query_cb = osmtest_query_res_cb; 894219820Sjeff 895219820Sjeff req.query_type = OSMV_QUERY_PATH_REC_BY_PORT_GUIDS; 896219820Sjeff 897219820Sjeff guid_pair.dest_guid = dguid; 898219820Sjeff guid_pair.src_guid = sguid; 899219820Sjeff 900219820Sjeff req.p_query_input = &guid_pair; 901219820Sjeff req.sm_key = 0; 902219820Sjeff 903219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, 904219820Sjeff "Query for path from 0x%" PRIx64 " to 0x%" PRIx64 "\n", 905219820Sjeff sguid, dguid); 906219820Sjeff 907219820Sjeff status = osmv_query_sa(p_osmt->h_bind, &req); 908219820Sjeff if (status != IB_SUCCESS) { 909219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0063: " 910219820Sjeff "ib_query failed (%s)\n", ib_get_err_str(status)); 911219820Sjeff goto Exit; 912219820Sjeff } 913219820Sjeff 914219820Sjeff status = (*p_context).result.status; 915219820Sjeff 916219820Sjeff if (status != IB_SUCCESS) { 917219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0066: " 918219820Sjeff "ib_query failed (%s)\n", ib_get_err_str(status)); 919219820Sjeff 920219820Sjeff if (status == IB_REMOTE_ERROR) { 921219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, 922219820Sjeff "Remote error = %s\n", 923219820Sjeff ib_get_mad_status_str(osm_madw_get_mad_ptr 924219820Sjeff ((*p_context).result. 925219820Sjeff p_result_madw))); 926219820Sjeff } 927219820Sjeff goto Exit; 928219820Sjeff } 929219820Sjeff 930219820SjeffExit: 931219820Sjeff 932219820Sjeff OSM_LOG_EXIT(&p_osmt->log); 933219820Sjeff return (status); 934219820Sjeff} 935219820Sjeff 936219820Sjeff/********************************************************************** 937219820Sjeff **********************************************************************/ 938219820Sjeffstatic ib_api_status_t 939219820Sjeffosmtest_get_path_rec_by_gid_pair(IN osmtest_t * const p_osmt, 940219820Sjeff IN ib_gid_t sgid, 941219820Sjeff IN ib_gid_t dgid, 942219820Sjeff IN osmtest_req_context_t * p_context) 943219820Sjeff{ 944219820Sjeff cl_status_t status = IB_SUCCESS; 945219820Sjeff osmv_query_req_t req; 946219820Sjeff osmv_gid_pair_t gid_pair; 947219820Sjeff 948219820Sjeff OSM_LOG_ENTER(&p_osmt->log); 949219820Sjeff 950219820Sjeff memset(&req, 0, sizeof(req)); 951219820Sjeff memset(p_context, 0, sizeof(*p_context)); 952219820Sjeff 953219820Sjeff p_context->p_osmt = p_osmt; 954219820Sjeff req.timeout_ms = p_osmt->opt.transaction_timeout; 955219820Sjeff req.retry_cnt = p_osmt->opt.retry_count; 956219820Sjeff req.flags = OSM_SA_FLAGS_SYNC; 957219820Sjeff req.query_context = p_context; 958219820Sjeff req.pfn_query_cb = osmtest_query_res_cb; 959219820Sjeff 960219820Sjeff req.query_type = OSMV_QUERY_PATH_REC_BY_GIDS; 961219820Sjeff 962219820Sjeff gid_pair.dest_gid = dgid; 963219820Sjeff gid_pair.src_gid = sgid; 964219820Sjeff 965219820Sjeff req.p_query_input = &gid_pair; 966219820Sjeff req.sm_key = 0; 967219820Sjeff 968219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, 969219820Sjeff "Query for path from 0x%016" PRIx64 " 0x%016" PRIx64 970219820Sjeff " to 0x%016" PRIx64 " 0x%016" PRIx64 "\n", sgid.unicast.prefix, 971219820Sjeff sgid.unicast.interface_id, dgid.unicast.prefix, 972219820Sjeff dgid.unicast.interface_id); 973219820Sjeff 974219820Sjeff status = osmv_query_sa(p_osmt->h_bind, &req); 975219820Sjeff if (status != IB_SUCCESS) { 976219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 006A: " 977219820Sjeff "ib_query failed (%s)\n", ib_get_err_str(status)); 978219820Sjeff goto Exit; 979219820Sjeff } 980219820Sjeff 981219820Sjeff status = (*p_context).result.status; 982219820Sjeff 983219820Sjeff if (status != IB_SUCCESS) { 984219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 006B: " 985219820Sjeff "ib_query failed (%s)\n", ib_get_err_str(status)); 986219820Sjeff 987219820Sjeff if (status == IB_REMOTE_ERROR) { 988219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, 989219820Sjeff "Remote error = %s\n", 990219820Sjeff ib_get_mad_status_str(osm_madw_get_mad_ptr 991219820Sjeff ((*p_context).result. 992219820Sjeff p_result_madw))); 993219820Sjeff } 994219820Sjeff goto Exit; 995219820Sjeff } 996219820Sjeff 997219820SjeffExit: 998219820Sjeff 999219820Sjeff OSM_LOG_EXIT(&p_osmt->log); 1000219820Sjeff return (status); 1001219820Sjeff} 1002219820Sjeff 1003219820Sjeff#if defined (VENDOR_RMPP_SUPPORT) && defined (DUAL_SIDED_RMPP) 1004219820Sjeff/********************************************************************** 1005219820Sjeff **********************************************************************/ 1006219820Sjeffstatic ib_api_status_t 1007219820Sjeffosmtest_get_multipath_rec(IN osmtest_t * const p_osmt, 1008219820Sjeff IN osmv_multipath_req_t * p_request, 1009219820Sjeff IN osmtest_req_context_t * p_context) 1010219820Sjeff{ 1011219820Sjeff cl_status_t status = IB_SUCCESS; 1012219820Sjeff osmv_query_req_t req; 1013219820Sjeff 1014219820Sjeff OSM_LOG_ENTER(&p_osmt->log); 1015219820Sjeff 1016219820Sjeff /* 1017219820Sjeff * Do a blocking query for this record in the subnet. 1018219820Sjeff * The result is returned in the result field of the caller's 1019219820Sjeff * context structure. 1020219820Sjeff * 1021219820Sjeff * The query structures are locals. 1022219820Sjeff */ 1023219820Sjeff memset(&req, 0, sizeof(req)); 1024219820Sjeff 1025219820Sjeff p_context->p_osmt = p_osmt; 1026219820Sjeff req.timeout_ms = p_osmt->opt.transaction_timeout; 1027219820Sjeff req.retry_cnt = p_osmt->opt.retry_count; 1028219820Sjeff req.flags = OSM_SA_FLAGS_SYNC; 1029219820Sjeff req.query_context = p_context; 1030219820Sjeff req.pfn_query_cb = osmtest_query_res_cb; 1031219820Sjeff 1032219820Sjeff req.query_type = OSMV_QUERY_MULTIPATH_REC; 1033219820Sjeff 1034219820Sjeff req.p_query_input = p_request; 1035219820Sjeff req.sm_key = 0; 1036219820Sjeff 1037219820Sjeff status = osmv_query_sa(p_osmt->h_bind, &req); 1038219820Sjeff if (status != IB_SUCCESS) { 1039219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0068: " 1040219820Sjeff "ib_query failed (%s)\n", ib_get_err_str(status)); 1041219820Sjeff goto Exit; 1042219820Sjeff } 1043219820Sjeff 1044219820Sjeff status = p_context->result.status; 1045219820Sjeff 1046219820Sjeff if (status != IB_SUCCESS) { 1047219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0069: " 1048219820Sjeff "ib_query failed (%s)\n", ib_get_err_str(status)); 1049219820Sjeff 1050219820Sjeff if (status == IB_REMOTE_ERROR) { 1051219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, 1052219820Sjeff "Remote error = %s\n", 1053219820Sjeff ib_get_mad_status_str(osm_madw_get_mad_ptr 1054219820Sjeff (p_context->result. 1055219820Sjeff p_result_madw))); 1056219820Sjeff } 1057219820Sjeff goto Exit; 1058219820Sjeff } 1059219820Sjeff 1060219820SjeffExit: 1061219820Sjeff OSM_LOG_EXIT(&p_osmt->log); 1062219820Sjeff return (status); 1063219820Sjeff} 1064219820Sjeff#endif 1065219820Sjeff 1066219820Sjeff/********************************************************************** 1067219820Sjeff **********************************************************************/ 1068219820Sjeffib_api_status_t 1069219820Sjeffosmtest_get_port_rec(IN osmtest_t * const p_osmt, 1070219820Sjeff IN ib_net16_t const lid, 1071219820Sjeff IN OUT osmtest_req_context_t * const p_context) 1072219820Sjeff{ 1073219820Sjeff ib_api_status_t status = IB_SUCCESS; 1074219820Sjeff osmv_user_query_t user; 1075219820Sjeff osmv_query_req_t req; 1076219820Sjeff ib_portinfo_record_t record; 1077219820Sjeff 1078219820Sjeff OSM_LOG_ENTER(&p_osmt->log); 1079219820Sjeff 1080219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, 1081219820Sjeff "Getting PortInfoRecord for port with LID 0x%X\n", 1082219820Sjeff cl_ntoh16(lid)); 1083219820Sjeff 1084219820Sjeff /* 1085219820Sjeff * Do a blocking query for this record in the subnet. 1086219820Sjeff * The result is returned in the result field of the caller's 1087219820Sjeff * context structure. 1088219820Sjeff * 1089219820Sjeff * The query structures are locals. 1090219820Sjeff */ 1091219820Sjeff memset(&req, 0, sizeof(req)); 1092219820Sjeff memset(&user, 0, sizeof(user)); 1093219820Sjeff memset(&record, 0, sizeof(record)); 1094219820Sjeff 1095219820Sjeff record.lid = lid; 1096219820Sjeff 1097219820Sjeff p_context->p_osmt = p_osmt; 1098219820Sjeff user.comp_mask = IB_PIR_COMPMASK_LID; 1099219820Sjeff user.attr_id = IB_MAD_ATTR_PORTINFO_RECORD; 1100219820Sjeff user.attr_offset = cl_ntoh16((uint16_t) (sizeof(record) >> 3)); 1101219820Sjeff user.p_attr = &record; 1102219820Sjeff 1103219820Sjeff req.query_type = OSMV_QUERY_USER_DEFINED; 1104219820Sjeff req.timeout_ms = p_osmt->opt.transaction_timeout; 1105219820Sjeff req.retry_cnt = p_osmt->opt.retry_count; 1106219820Sjeff req.flags = OSM_SA_FLAGS_SYNC; 1107219820Sjeff req.query_context = p_context; 1108219820Sjeff req.pfn_query_cb = osmtest_query_res_cb; 1109219820Sjeff req.p_query_input = &user; 1110219820Sjeff req.sm_key = 0; 1111219820Sjeff 1112219820Sjeff status = osmv_query_sa(p_osmt->h_bind, &req); 1113219820Sjeff if (status != IB_SUCCESS) { 1114219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0075: " 1115219820Sjeff "ib_query failed (%s)\n", ib_get_err_str(status)); 1116219820Sjeff goto Exit; 1117219820Sjeff } 1118219820Sjeff 1119219820Sjeff status = p_context->result.status; 1120219820Sjeff 1121219820Sjeff if (status != IB_SUCCESS) { 1122219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0076: " 1123219820Sjeff "ib_query failed (%s)\n", ib_get_err_str(status)); 1124219820Sjeff 1125219820Sjeff if (status == IB_REMOTE_ERROR) { 1126219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, 1127219820Sjeff "Remote error = %s\n", 1128219820Sjeff ib_get_mad_status_str(osm_madw_get_mad_ptr 1129219820Sjeff (p_context->result. 1130219820Sjeff p_result_madw))); 1131219820Sjeff } 1132219820Sjeff goto Exit; 1133219820Sjeff } 1134219820Sjeff 1135219820SjeffExit: 1136219820Sjeff OSM_LOG_EXIT(&p_osmt->log); 1137219820Sjeff return (status); 1138219820Sjeff} 1139219820Sjeff 1140219820Sjeff/********************************************************************** 1141219820Sjeff **********************************************************************/ 1142219820Sjeffib_api_status_t 1143219820Sjeffosmtest_get_port_rec_by_num(IN osmtest_t * const p_osmt, 1144219820Sjeff IN ib_net16_t const lid, 1145219820Sjeff IN uint8_t const port_num, 1146219820Sjeff IN OUT osmtest_req_context_t * const p_context) 1147219820Sjeff{ 1148219820Sjeff ib_api_status_t status = IB_SUCCESS; 1149219820Sjeff osmv_user_query_t user; 1150219820Sjeff osmv_query_req_t req; 1151219820Sjeff ib_portinfo_record_t record; 1152219820Sjeff ib_mad_t *p_mad; 1153219820Sjeff 1154219820Sjeff OSM_LOG_ENTER(&p_osmt->log); 1155219820Sjeff 1156219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, 1157219820Sjeff "Getting PortInfoRecord for port with LID 0x%X Num:0x%X\n", 1158219820Sjeff cl_ntoh16(lid), port_num); 1159219820Sjeff 1160219820Sjeff /* 1161219820Sjeff * Do a blocking query for this record in the subnet. 1162219820Sjeff * The result is returned in the result field of the caller's 1163219820Sjeff * context structure. 1164219820Sjeff * 1165219820Sjeff * The query structures are locals. 1166219820Sjeff */ 1167219820Sjeff memset(&req, 0, sizeof(req)); 1168219820Sjeff memset(&user, 0, sizeof(user)); 1169219820Sjeff memset(&record, 0, sizeof(record)); 1170219820Sjeff 1171219820Sjeff record.lid = lid; 1172219820Sjeff record.port_num = port_num; 1173219820Sjeff user.p_attr = &record; 1174219820Sjeff 1175219820Sjeff p_context->p_osmt = p_osmt; 1176219820Sjeff 1177219820Sjeff req.query_type = OSMV_QUERY_PORT_REC_BY_LID_AND_NUM; 1178219820Sjeff req.timeout_ms = p_osmt->opt.transaction_timeout; 1179219820Sjeff req.retry_cnt = p_osmt->opt.retry_count; 1180219820Sjeff req.flags = OSM_SA_FLAGS_SYNC; 1181219820Sjeff req.query_context = p_context; 1182219820Sjeff req.pfn_query_cb = osmtest_query_res_cb; 1183219820Sjeff req.p_query_input = &user; 1184219820Sjeff req.sm_key = 0; 1185219820Sjeff 1186219820Sjeff status = osmv_query_sa(p_osmt->h_bind, &req); 1187219820Sjeff if (status != IB_SUCCESS) { 1188219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0077: " 1189219820Sjeff "ib_query failed (%s)\n", ib_get_err_str(status)); 1190219820Sjeff goto Exit; 1191219820Sjeff } 1192219820Sjeff 1193219820Sjeff status = p_context->result.status; 1194219820Sjeff 1195219820Sjeff if (status != IB_SUCCESS) { 1196219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0078: " 1197219820Sjeff "ib_query failed (%s)\n", ib_get_err_str(status)); 1198219820Sjeff 1199219820Sjeff if (status == IB_REMOTE_ERROR) { 1200219820Sjeff p_mad = 1201219820Sjeff osm_madw_get_mad_ptr(p_context->result. 1202219820Sjeff p_result_madw); 1203219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, 1204219820Sjeff "Remote error = %s\n", 1205219820Sjeff ib_get_mad_status_str(p_mad)); 1206219820Sjeff status = 1207219820Sjeff (ib_net16_t) (p_mad->status & IB_SMP_STATUS_MASK); 1208219820Sjeff } 1209219820Sjeff goto Exit; 1210219820Sjeff } 1211219820Sjeff 1212219820SjeffExit: 1213219820Sjeff OSM_LOG_EXIT(&p_osmt->log); 1214219820Sjeff return (status); 1215219820Sjeff} 1216219820Sjeff 1217219820Sjeff/********************************************************************** 1218219820Sjeff **********************************************************************/ 1219219820Sjeffib_api_status_t 1220219820Sjeffosmtest_stress_port_recs_large(IN osmtest_t * const p_osmt, 1221219820Sjeff OUT uint32_t * const p_num_recs, 1222219820Sjeff OUT uint32_t * const p_num_queries) 1223219820Sjeff{ 1224219820Sjeff osmtest_req_context_t context; 1225219820Sjeff ib_portinfo_record_t *p_rec; 1226219820Sjeff uint32_t i; 1227219820Sjeff cl_status_t status; 1228219820Sjeff uint32_t num_recs = 0; 1229219820Sjeff 1230219820Sjeff OSM_LOG_ENTER(&p_osmt->log); 1231219820Sjeff 1232219820Sjeff memset(&context, 0, sizeof(context)); 1233219820Sjeff /* 1234219820Sjeff * Do a blocking query for all PortInfoRecords in the subnet. 1235219820Sjeff */ 1236219820Sjeff status = osmtest_get_all_recs(p_osmt, IB_MAD_ATTR_PORTINFO_RECORD, 1237219820Sjeff sizeof(*p_rec), &context); 1238219820Sjeff 1239219820Sjeff if (status != IB_SUCCESS) { 1240219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0006: " 1241219820Sjeff "osmtest_get_all_recs failed (%s)\n", 1242219820Sjeff ib_get_err_str(status)); 1243219820Sjeff goto Exit; 1244219820Sjeff } 1245219820Sjeff 1246219820Sjeff /* 1247219820Sjeff * Populate the database with the received records. 1248219820Sjeff */ 1249219820Sjeff num_recs = context.result.result_cnt; 1250219820Sjeff *p_num_recs += num_recs; 1251219820Sjeff ++*p_num_queries; 1252219820Sjeff 1253219820Sjeff if (osm_log_is_active(&p_osmt->log, OSM_LOG_VERBOSE)) { 1254219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, 1255219820Sjeff "Received %u records\n", num_recs); 1256219820Sjeff 1257219820Sjeff for (i = 0; i < num_recs; i++) { 1258219820Sjeff p_rec = 1259219820Sjeff osmv_get_query_portinfo_rec(context.result. 1260219820Sjeff p_result_madw, i); 1261219820Sjeff osm_dump_portinfo_record(&p_osmt->log, p_rec, 1262219820Sjeff OSM_LOG_VERBOSE); 1263219820Sjeff } 1264219820Sjeff } 1265219820Sjeff 1266219820SjeffExit: 1267219820Sjeff /* 1268219820Sjeff * Return the IB query MAD to the pool as necessary. 1269219820Sjeff */ 1270219820Sjeff if (context.result.p_result_madw != NULL) { 1271219820Sjeff osm_mad_pool_put(&p_osmt->mad_pool, 1272219820Sjeff context.result.p_result_madw); 1273219820Sjeff context.result.p_result_madw = NULL; 1274219820Sjeff } 1275219820Sjeff 1276219820Sjeff OSM_LOG_EXIT(&p_osmt->log); 1277219820Sjeff return (status); 1278219820Sjeff} 1279219820Sjeff 1280219820Sjeff/********************************************************************** 1281219820Sjeff **********************************************************************/ 1282219820Sjeffib_api_status_t 1283219820Sjeffosmtest_stress_node_recs_large(IN osmtest_t * const p_osmt, 1284219820Sjeff OUT uint32_t * const p_num_recs, 1285219820Sjeff OUT uint32_t * const p_num_queries) 1286219820Sjeff{ 1287219820Sjeff osmtest_req_context_t context; 1288219820Sjeff ib_node_record_t *p_rec; 1289219820Sjeff uint32_t i; 1290219820Sjeff cl_status_t status; 1291219820Sjeff uint32_t num_recs = 0; 1292219820Sjeff 1293219820Sjeff OSM_LOG_ENTER(&p_osmt->log); 1294219820Sjeff 1295219820Sjeff memset(&context, 0, sizeof(context)); 1296219820Sjeff 1297219820Sjeff /* 1298219820Sjeff * Do a blocking query for all NodeRecords in the subnet. 1299219820Sjeff */ 1300219820Sjeff status = osmtest_get_all_recs(p_osmt, IB_MAD_ATTR_NODE_RECORD, 1301219820Sjeff sizeof(*p_rec), &context); 1302219820Sjeff 1303219820Sjeff if (status != IB_SUCCESS) { 1304219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0007: " 1305219820Sjeff "osmtest_get_all_recs failed (%s)\n", 1306219820Sjeff ib_get_err_str(status)); 1307219820Sjeff goto Exit; 1308219820Sjeff } 1309219820Sjeff 1310219820Sjeff /* 1311219820Sjeff * Populate the database with the received records. 1312219820Sjeff */ 1313219820Sjeff num_recs = context.result.result_cnt; 1314219820Sjeff *p_num_recs += num_recs; 1315219820Sjeff ++*p_num_queries; 1316219820Sjeff 1317219820Sjeff if (osm_log_is_active(&p_osmt->log, OSM_LOG_VERBOSE)) { 1318219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, 1319219820Sjeff "Received %u records\n", num_recs); 1320219820Sjeff 1321219820Sjeff for (i = 0; i < num_recs; i++) { 1322219820Sjeff p_rec = 1323219820Sjeff osmv_get_query_node_rec(context.result. 1324219820Sjeff p_result_madw, i); 1325219820Sjeff osm_dump_node_record(&p_osmt->log, p_rec, 1326219820Sjeff OSM_LOG_VERBOSE); 1327219820Sjeff } 1328219820Sjeff } 1329219820Sjeff 1330219820SjeffExit: 1331219820Sjeff /* 1332219820Sjeff * Return the IB query MAD to the pool as necessary. 1333219820Sjeff */ 1334219820Sjeff if (context.result.p_result_madw != NULL) { 1335219820Sjeff osm_mad_pool_put(&p_osmt->mad_pool, 1336219820Sjeff context.result.p_result_madw); 1337219820Sjeff context.result.p_result_madw = NULL; 1338219820Sjeff } 1339219820Sjeff 1340219820Sjeff OSM_LOG_EXIT(&p_osmt->log); 1341219820Sjeff return (status); 1342219820Sjeff} 1343219820Sjeff 1344219820Sjeff/********************************************************************** 1345219820Sjeff **********************************************************************/ 1346219820Sjeffib_api_status_t 1347219820Sjeffosmtest_stress_path_recs_large(IN osmtest_t * const p_osmt, 1348219820Sjeff OUT uint32_t * const p_num_recs, 1349219820Sjeff OUT uint32_t * const p_num_queries) 1350219820Sjeff{ 1351219820Sjeff osmtest_req_context_t context; 1352219820Sjeff ib_path_rec_t *p_rec; 1353219820Sjeff uint32_t i; 1354219820Sjeff cl_status_t status; 1355219820Sjeff uint32_t num_recs = 0; 1356219820Sjeff 1357219820Sjeff OSM_LOG_ENTER(&p_osmt->log); 1358219820Sjeff 1359219820Sjeff memset(&context, 0, sizeof(context)); 1360219820Sjeff 1361219820Sjeff /* 1362219820Sjeff * Do a blocking query for all PathRecords in the subnet. 1363219820Sjeff */ 1364219820Sjeff status = osmtest_get_all_recs(p_osmt, IB_MAD_ATTR_PATH_RECORD, 1365219820Sjeff sizeof(*p_rec), &context); 1366219820Sjeff if (status != IB_SUCCESS) { 1367219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0008: " 1368219820Sjeff "osmtest_get_all_recs failed (%s)\n", 1369219820Sjeff ib_get_err_str(status)); 1370219820Sjeff goto Exit; 1371219820Sjeff } 1372219820Sjeff 1373219820Sjeff /* 1374219820Sjeff * Populate the database with the received records. 1375219820Sjeff */ 1376219820Sjeff num_recs = context.result.result_cnt; 1377219820Sjeff *p_num_recs += num_recs; 1378219820Sjeff ++*p_num_queries; 1379219820Sjeff 1380219820Sjeff if (osm_log_is_active(&p_osmt->log, OSM_LOG_VERBOSE)) { 1381219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, 1382219820Sjeff "Received %u records\n", num_recs); 1383219820Sjeff 1384219820Sjeff for (i = 0; i < num_recs; i++) { 1385219820Sjeff p_rec = 1386219820Sjeff osmv_get_query_path_rec(context.result. 1387219820Sjeff p_result_madw, i); 1388219820Sjeff osm_dump_path_record(&p_osmt->log, p_rec, 1389219820Sjeff OSM_LOG_VERBOSE); 1390219820Sjeff } 1391219820Sjeff } 1392219820Sjeff 1393219820SjeffExit: 1394219820Sjeff /* 1395219820Sjeff * Return the IB query MAD to the pool as necessary. 1396219820Sjeff */ 1397219820Sjeff if (context.result.p_result_madw != NULL) { 1398219820Sjeff osm_mad_pool_put(&p_osmt->mad_pool, 1399219820Sjeff context.result.p_result_madw); 1400219820Sjeff context.result.p_result_madw = NULL; 1401219820Sjeff } 1402219820Sjeff 1403219820Sjeff OSM_LOG_EXIT(&p_osmt->log); 1404219820Sjeff return (status); 1405219820Sjeff} 1406219820Sjeff 1407219820Sjeff/********************************************************************** 1408219820Sjeff **********************************************************************/ 1409219820Sjeffib_api_status_t 1410219820Sjeffosmtest_stress_path_recs_by_guid(IN osmtest_t * const p_osmt, 1411219820Sjeff OUT uint32_t * const p_num_recs, 1412219820Sjeff OUT uint32_t * const p_num_queries) 1413219820Sjeff{ 1414219820Sjeff osmtest_req_context_t context; 1415219820Sjeff ib_path_rec_t *p_rec; 1416219820Sjeff uint32_t i; 1417219820Sjeff cl_status_t status = IB_SUCCESS; 1418219820Sjeff uint32_t num_recs = 0; 1419219820Sjeff node_t *p_src_node, *p_dst_node; 1420219820Sjeff cl_qmap_t *p_tbl; 1421219820Sjeff 1422219820Sjeff OSM_LOG_ENTER(&p_osmt->log); 1423219820Sjeff 1424219820Sjeff memset(&context, 0, sizeof(context)); 1425219820Sjeff 1426219820Sjeff context.p_osmt = p_osmt; 1427219820Sjeff 1428219820Sjeff p_tbl = &p_osmt->exp_subn.node_guid_tbl; 1429219820Sjeff 1430219820Sjeff p_src_node = (node_t *) cl_qmap_head(p_tbl); 1431219820Sjeff 1432219820Sjeff /* 1433219820Sjeff * Go over all nodes that exist in the subnet 1434219820Sjeff * for each pair that are not switch nodes get the path record 1435219820Sjeff */ 1436219820Sjeff while (p_src_node != (node_t *) cl_qmap_end(p_tbl)) { 1437219820Sjeff p_dst_node = (node_t *) cl_qmap_head(p_tbl); 1438219820Sjeff 1439219820Sjeff while (p_dst_node != (node_t *) cl_qmap_end(p_tbl)) { 1440219820Sjeff /* 1441219820Sjeff * Do a blocking query for CA to CA Path Record 1442219820Sjeff */ 1443219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, 1444219820Sjeff "Source : guid = 0x%" PRIx64 " type = %d" 1445219820Sjeff "Target : guid = 0x%" PRIx64 " type = %d\n", 1446219820Sjeff cl_ntoh64(p_src_node->rec.node_info.port_guid), 1447219820Sjeff p_src_node->rec.node_info.node_type, 1448219820Sjeff cl_ntoh64(p_dst_node->rec.node_info.port_guid), 1449219820Sjeff p_dst_node->rec.node_info.node_type); 1450219820Sjeff 1451219820Sjeff if (p_src_node->rec.node_info.node_type == 1452219820Sjeff IB_NODE_TYPE_CA 1453219820Sjeff && p_dst_node->rec.node_info.node_type == 1454219820Sjeff IB_NODE_TYPE_CA) { 1455219820Sjeff status = 1456219820Sjeff osmtest_get_path_rec_by_guid_pair(p_osmt, 1457219820Sjeff p_src_node-> 1458219820Sjeff rec. 1459219820Sjeff node_info. 1460219820Sjeff port_guid, 1461219820Sjeff p_dst_node-> 1462219820Sjeff rec. 1463219820Sjeff node_info. 1464219820Sjeff port_guid, 1465219820Sjeff &context); 1466219820Sjeff 1467219820Sjeff /* In a case of TIMEOUT you still can try sending but cant count, maybe its a temporary issue */ 1468219820Sjeff if (status != IB_SUCCESS) { 1469219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, 1470219820Sjeff "ERR 0009: " 1471219820Sjeff "osmtest_get_path_rec_by_guid_pair failed (%s)\n", 1472219820Sjeff ib_get_err_str(status)); 1473219820Sjeff if (status != IB_TIMEOUT) 1474219820Sjeff goto Exit; 1475219820Sjeff } else { 1476219820Sjeff /* we might have received several records */ 1477219820Sjeff num_recs = context.result.result_cnt; 1478219820Sjeff /* 1479219820Sjeff * Populate the database with the received records. 1480219820Sjeff */ 1481219820Sjeff *p_num_recs += num_recs; 1482219820Sjeff ++*p_num_queries; 1483219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, 1484219820Sjeff "Received %u records\n", num_recs); 1485219820Sjeff /* Dont waste time if not VERBOSE and above */ 1486219820Sjeff if (p_osmt->log.level & OSM_LOG_VERBOSE) { 1487219820Sjeff for (i = 0; i < num_recs; i++) { 1488219820Sjeff p_rec = 1489219820Sjeff osmv_get_query_path_rec 1490219820Sjeff (context.result. 1491219820Sjeff p_result_madw, i); 1492219820Sjeff osm_dump_path_record 1493219820Sjeff (&p_osmt->log, 1494219820Sjeff p_rec, 1495219820Sjeff OSM_LOG_VERBOSE); 1496219820Sjeff } 1497219820Sjeff } 1498219820Sjeff } 1499219820Sjeff if (context.result.p_result_madw != NULL) { 1500219820Sjeff osm_mad_pool_put(&p_osmt->mad_pool, 1501219820Sjeff context.result. 1502219820Sjeff p_result_madw); 1503219820Sjeff context.result.p_result_madw = NULL; 1504219820Sjeff } 1505219820Sjeff } 1506219820Sjeff /* next one please */ 1507219820Sjeff p_dst_node = 1508219820Sjeff (node_t *) cl_qmap_next(&p_dst_node->map_item); 1509219820Sjeff } 1510219820Sjeff 1511219820Sjeff p_src_node = (node_t *) cl_qmap_next(&p_src_node->map_item); 1512219820Sjeff } 1513219820Sjeff 1514219820SjeffExit: 1515219820Sjeff OSM_LOG_EXIT(&p_osmt->log); 1516219820Sjeff return (status); 1517219820Sjeff} 1518219820Sjeff 1519219820Sjeff/********************************************************************** 1520219820Sjeff **********************************************************************/ 1521219820Sjeffib_api_status_t 1522219820Sjeffosmtest_stress_port_recs_small(IN osmtest_t * const p_osmt, 1523219820Sjeff OUT uint32_t * const p_num_recs, 1524219820Sjeff OUT uint32_t * const p_num_queries) 1525219820Sjeff{ 1526219820Sjeff osmtest_req_context_t context; 1527219820Sjeff ib_portinfo_record_t *p_rec; 1528219820Sjeff uint32_t i; 1529219820Sjeff cl_status_t status; 1530219820Sjeff uint32_t num_recs = 0; 1531219820Sjeff 1532219820Sjeff OSM_LOG_ENTER(&p_osmt->log); 1533219820Sjeff 1534219820Sjeff memset(&context, 0, sizeof(context)); 1535219820Sjeff 1536219820Sjeff /* 1537219820Sjeff * Do a blocking query for our own PortInfoRecord in the subnet. 1538219820Sjeff */ 1539219820Sjeff status = osmtest_get_port_rec(p_osmt, 1540219820Sjeff cl_ntoh16(p_osmt->local_port.lid), 1541219820Sjeff &context); 1542219820Sjeff 1543219820Sjeff if (status != IB_SUCCESS) { 1544219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0010: " 1545219820Sjeff "osmtest_get_port_rec failed (%s)\n", 1546219820Sjeff ib_get_err_str(status)); 1547219820Sjeff goto Exit; 1548219820Sjeff } 1549219820Sjeff 1550219820Sjeff /* 1551219820Sjeff * Populate the database with the received records. 1552219820Sjeff */ 1553219820Sjeff num_recs = context.result.result_cnt; 1554219820Sjeff *p_num_recs += num_recs; 1555219820Sjeff ++*p_num_queries; 1556219820Sjeff 1557219820Sjeff if (osm_log_is_active(&p_osmt->log, OSM_LOG_VERBOSE)) { 1558219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, 1559219820Sjeff "Received %u records\n", num_recs); 1560219820Sjeff 1561219820Sjeff for (i = 0; i < num_recs; i++) { 1562219820Sjeff p_rec = 1563219820Sjeff osmv_get_query_portinfo_rec(context.result. 1564219820Sjeff p_result_madw, i); 1565219820Sjeff osm_dump_portinfo_record(&p_osmt->log, p_rec, 1566219820Sjeff OSM_LOG_VERBOSE); 1567219820Sjeff } 1568219820Sjeff } 1569219820Sjeff 1570219820SjeffExit: 1571219820Sjeff /* 1572219820Sjeff * Return the IB query MAD to the pool as necessary. 1573219820Sjeff */ 1574219820Sjeff if (context.result.p_result_madw != NULL) { 1575219820Sjeff osm_mad_pool_put(&p_osmt->mad_pool, 1576219820Sjeff context.result.p_result_madw); 1577219820Sjeff context.result.p_result_madw = NULL; 1578219820Sjeff } 1579219820Sjeff 1580219820Sjeff OSM_LOG_EXIT(&p_osmt->log); 1581219820Sjeff return (status); 1582219820Sjeff} 1583219820Sjeff 1584219820Sjeff/********************************************************************** 1585219820Sjeff **********************************************************************/ 1586219820Sjeffib_api_status_t 1587219820Sjeffosmtest_get_local_port_lmc(IN osmtest_t * const p_osmt, 1588219820Sjeff IN ib_net16_t lid, OUT uint8_t * const p_lmc) 1589219820Sjeff{ 1590219820Sjeff osmtest_req_context_t context; 1591219820Sjeff ib_portinfo_record_t *p_rec; 1592219820Sjeff uint32_t i; 1593219820Sjeff cl_status_t status; 1594219820Sjeff uint32_t num_recs = 0; 1595219820Sjeff 1596219820Sjeff OSM_LOG_ENTER(&p_osmt->log); 1597219820Sjeff 1598219820Sjeff memset(&context, 0, sizeof(context)); 1599219820Sjeff 1600219820Sjeff /* 1601219820Sjeff * Do a blocking query for our own PortInfoRecord in the subnet. 1602219820Sjeff */ 1603219820Sjeff status = osmtest_get_port_rec(p_osmt, cl_ntoh16(lid), &context); 1604219820Sjeff 1605219820Sjeff if (status != IB_SUCCESS) { 1606219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 001A: " 1607219820Sjeff "osmtest_get_port_rec failed (%s)\n", 1608219820Sjeff ib_get_err_str(status)); 1609219820Sjeff goto Exit; 1610219820Sjeff } 1611219820Sjeff 1612219820Sjeff num_recs = context.result.result_cnt; 1613219820Sjeff 1614219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Received %u records\n", num_recs); 1615219820Sjeff 1616219820Sjeff for (i = 0; i < num_recs; i++) { 1617219820Sjeff p_rec = 1618219820Sjeff osmv_get_query_portinfo_rec(context.result.p_result_madw, 1619219820Sjeff i); 1620219820Sjeff osm_dump_portinfo_record(&p_osmt->log, p_rec, OSM_LOG_VERBOSE); 1621219820Sjeff if (p_lmc) { 1622219820Sjeff *p_lmc = ib_port_info_get_lmc(&p_rec->port_info); 1623219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, "LMC %d\n", *p_lmc); 1624219820Sjeff } 1625219820Sjeff } 1626219820Sjeff 1627219820SjeffExit: 1628219820Sjeff /* 1629219820Sjeff * Return the IB query MAD to the pool as necessary. 1630219820Sjeff */ 1631219820Sjeff if (context.result.p_result_madw != NULL) { 1632219820Sjeff osm_mad_pool_put(&p_osmt->mad_pool, 1633219820Sjeff context.result.p_result_madw); 1634219820Sjeff context.result.p_result_madw = NULL; 1635219820Sjeff } 1636219820Sjeff 1637219820Sjeff OSM_LOG_EXIT(&p_osmt->log); 1638219820Sjeff return (status); 1639219820Sjeff} 1640219820Sjeff 1641219820Sjeff/********************************************************************** 1642219820Sjeff * Use a wrong SM_Key in a simple port query and report success if 1643219820Sjeff * failed. 1644219820Sjeff **********************************************************************/ 1645219820Sjeffib_api_status_t osmtest_wrong_sm_key_ignored(IN osmtest_t * const p_osmt) 1646219820Sjeff{ 1647219820Sjeff ib_api_status_t status = IB_SUCCESS; 1648219820Sjeff osmv_user_query_t user; 1649219820Sjeff osmv_query_req_t req; 1650219820Sjeff ib_portinfo_record_t record; 1651219820Sjeff osmtest_req_context_t context; 1652219820Sjeff osmtest_req_context_t *p_context = &context; 1653219820Sjeff uint8_t port_num = 1; 1654219820Sjeff 1655219820Sjeff OSM_LOG_ENTER(&p_osmt->log); 1656219820Sjeff 1657219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_INFO, 1658219820Sjeff "Trying PortInfoRecord for port with LID 0x%X Num:0x%X\n", 1659219820Sjeff p_osmt->local_port.sm_lid, port_num); 1660219820Sjeff 1661219820Sjeff /* 1662219820Sjeff * Do a blocking query for this record in the subnet. 1663219820Sjeff * The result is returned in the result field of the caller's 1664219820Sjeff * context structure. 1665219820Sjeff * 1666219820Sjeff * The query structures are locals. 1667219820Sjeff */ 1668219820Sjeff memset(&req, 0, sizeof(req)); 1669219820Sjeff memset(&user, 0, sizeof(user)); 1670219820Sjeff memset(&record, 0, sizeof(record)); 1671219820Sjeff 1672219820Sjeff record.lid = p_osmt->local_port.sm_lid; 1673219820Sjeff record.port_num = port_num; 1674219820Sjeff user.p_attr = &record; 1675219820Sjeff 1676219820Sjeff p_context->p_osmt = p_osmt; 1677219820Sjeff 1678219820Sjeff req.query_type = OSMV_QUERY_PORT_REC_BY_LID_AND_NUM; 1679219820Sjeff req.timeout_ms = p_osmt->opt.transaction_timeout; 1680219820Sjeff req.retry_cnt = p_osmt->opt.retry_count; 1681219820Sjeff req.flags = OSM_SA_FLAGS_SYNC; 1682219820Sjeff req.query_context = p_context; 1683219820Sjeff req.pfn_query_cb = osmtest_query_res_cb; 1684219820Sjeff req.p_query_input = &user; 1685219820Sjeff req.sm_key = 9999; 1686219820Sjeff context.result.p_result_madw = NULL; 1687219820Sjeff 1688219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n"); 1689219820Sjeff status = osmv_query_sa(p_osmt->h_bind, &req); 1690219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n"); 1691219820Sjeff 1692219820Sjeff /* since we use a wrong sm_key we should get a timeout */ 1693219820Sjeff if (status != IB_TIMEOUT) { 1694219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0011: " 1695219820Sjeff "Did not get a timeout but got (%s)\n", 1696219820Sjeff ib_get_err_str(status)); 1697219820Sjeff if (status == IB_SUCCESS) { 1698219820Sjeff /* assign some error value to status, since IB_SUCCESS is a bad rc */ 1699219820Sjeff status = IB_ERROR; 1700219820Sjeff } 1701219820Sjeff goto Exit; 1702219820Sjeff } else { 1703219820Sjeff status = IB_SUCCESS; 1704219820Sjeff } 1705219820Sjeff 1706219820SjeffExit: 1707219820Sjeff if (context.result.p_result_madw != NULL) { 1708219820Sjeff osm_mad_pool_put(&p_osmt->mad_pool, 1709219820Sjeff context.result.p_result_madw); 1710219820Sjeff context.result.p_result_madw = NULL; 1711219820Sjeff } 1712219820Sjeff 1713219820Sjeff OSM_LOG_EXIT(&p_osmt->log); 1714219820Sjeff return (status); 1715219820Sjeff} 1716219820Sjeff 1717219820Sjeff/********************************************************************** 1718219820Sjeff **********************************************************************/ 1719219820Sjeffstatic ib_api_status_t 1720219820Sjeffosmtest_write_port_info(IN osmtest_t * const p_osmt, 1721219820Sjeff IN FILE * fh, 1722219820Sjeff IN const ib_portinfo_record_t * const p_rec) 1723219820Sjeff{ 1724219820Sjeff int result; 1725219820Sjeff cl_status_t status = IB_SUCCESS; 1726219820Sjeff 1727219820Sjeff OSM_LOG_ENTER(&p_osmt->log); 1728219820Sjeff 1729219820Sjeff result = fprintf(fh, 1730219820Sjeff "DEFINE_PORT\n" 1731219820Sjeff "lid 0x%X\n" 1732219820Sjeff "port_num 0x%X\n" 1733219820Sjeff "m_key 0x%016" PRIx64 "\n" 1734219820Sjeff "subnet_prefix 0x%016" PRIx64 "\n" 1735219820Sjeff "base_lid 0x%X\n" 1736219820Sjeff "master_sm_base_lid 0x%X\n" 1737219820Sjeff "capability_mask 0x%X\n" 1738219820Sjeff "diag_code 0x%X\n" 1739219820Sjeff "m_key_lease_period 0x%X\n" 1740219820Sjeff "local_port_num 0x%X\n" 1741219820Sjeff "link_width_enabled 0x%X\n" 1742219820Sjeff "link_width_supported 0x%X\n" 1743219820Sjeff "link_width_active 0x%X\n" 1744219820Sjeff "link_speed_supported 0x%X\n" 1745219820Sjeff "port_state %s\n" 1746219820Sjeff "state_info2 0x%X\n" 1747219820Sjeff "mpb 0x%X\n" 1748219820Sjeff "lmc 0x%X\n" 1749219820Sjeff "link_speed 0x%X\n" 1750219820Sjeff "mtu_smsl 0x%X\n" 1751219820Sjeff "vl_cap 0x%X\n" 1752219820Sjeff "vl_high_limit 0x%X\n" 1753219820Sjeff "vl_arb_high_cap 0x%X\n" 1754219820Sjeff "vl_arb_low_cap 0x%X\n" 1755219820Sjeff "mtu_cap 0x%X\n" 1756219820Sjeff "vl_stall_life 0x%X\n" 1757219820Sjeff "vl_enforce 0x%X\n" 1758219820Sjeff "m_key_violations 0x%X\n" 1759219820Sjeff "p_key_violations 0x%X\n" 1760219820Sjeff "q_key_violations 0x%X\n" 1761219820Sjeff "guid_cap 0x%X\n" 1762219820Sjeff "subnet_timeout 0x%X\n" 1763219820Sjeff "resp_time_value 0x%X\n" 1764219820Sjeff "error_threshold 0x%X\n" 1765219820Sjeff "END\n\n", 1766219820Sjeff cl_ntoh16(p_rec->lid), 1767219820Sjeff p_rec->port_num, 1768219820Sjeff cl_ntoh64(p_rec->port_info.m_key), 1769219820Sjeff cl_ntoh64(p_rec->port_info.subnet_prefix), 1770219820Sjeff cl_ntoh16(p_rec->port_info.base_lid), 1771219820Sjeff cl_ntoh16(p_rec->port_info.master_sm_base_lid), 1772219820Sjeff cl_ntoh32(p_rec->port_info.capability_mask), 1773219820Sjeff cl_ntoh16(p_rec->port_info.diag_code), 1774219820Sjeff cl_ntoh16(p_rec->port_info.m_key_lease_period), 1775219820Sjeff p_rec->port_info.local_port_num, 1776219820Sjeff p_rec->port_info.link_width_enabled, 1777219820Sjeff p_rec->port_info.link_width_supported, 1778219820Sjeff p_rec->port_info.link_width_active, 1779219820Sjeff ib_port_info_get_link_speed_sup(&p_rec->port_info), 1780219820Sjeff ib_get_port_state_str(ib_port_info_get_port_state 1781219820Sjeff (&p_rec->port_info)), 1782219820Sjeff p_rec->port_info.state_info2, 1783219820Sjeff ib_port_info_get_mpb(&p_rec->port_info), 1784219820Sjeff ib_port_info_get_lmc(&p_rec->port_info), 1785219820Sjeff p_rec->port_info.link_speed, p_rec->port_info.mtu_smsl, 1786219820Sjeff p_rec->port_info.vl_cap, 1787219820Sjeff p_rec->port_info.vl_high_limit, 1788219820Sjeff p_rec->port_info.vl_arb_high_cap, 1789219820Sjeff p_rec->port_info.vl_arb_low_cap, 1790219820Sjeff p_rec->port_info.mtu_cap, 1791219820Sjeff p_rec->port_info.vl_stall_life, 1792219820Sjeff p_rec->port_info.vl_enforce, 1793219820Sjeff cl_ntoh16(p_rec->port_info.m_key_violations), 1794219820Sjeff cl_ntoh16(p_rec->port_info.p_key_violations), 1795219820Sjeff cl_ntoh16(p_rec->port_info.q_key_violations), 1796219820Sjeff p_rec->port_info.guid_cap, 1797219820Sjeff ib_port_info_get_timeout(&p_rec->port_info), 1798219820Sjeff p_rec->port_info.resp_time_value, 1799219820Sjeff p_rec->port_info.error_threshold); 1800219820Sjeff 1801219820Sjeff if (result < 0) { 1802219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0161: " 1803219820Sjeff "Write failed\n"); 1804219820Sjeff status = IB_ERROR; 1805219820Sjeff goto Exit; 1806219820Sjeff } 1807219820Sjeff 1808219820SjeffExit: 1809219820Sjeff OSM_LOG_EXIT(&p_osmt->log); 1810219820Sjeff return (status); 1811219820Sjeff} 1812219820Sjeff 1813219820Sjeff/********************************************************************** 1814219820Sjeff **********************************************************************/ 1815219820Sjeffstatic ib_api_status_t 1816219820Sjeffosmtest_write_path_info(IN osmtest_t * const p_osmt, 1817219820Sjeff IN FILE * fh, IN const ib_path_rec_t * const p_rec) 1818219820Sjeff{ 1819219820Sjeff int result; 1820219820Sjeff cl_status_t status = IB_SUCCESS; 1821219820Sjeff 1822219820Sjeff OSM_LOG_ENTER(&p_osmt->log); 1823219820Sjeff 1824219820Sjeff result = fprintf(fh, 1825219820Sjeff "DEFINE_PATH\n" 1826219820Sjeff "dgid 0x%016" PRIx64 " 0x%016" 1827219820Sjeff PRIx64 "\nsgid 0x%016" PRIx64 1828219820Sjeff " 0x%016" PRIx64 "\ndlid 0x%X\n" 1829219820Sjeff "slid 0x%X\n" 1830219820Sjeff "# hop_flow_raw 0x%X\n" 1831219820Sjeff "# tclass 0x%X\n" 1832219820Sjeff "# num_path 0x%X\n" 1833219820Sjeff "pkey 0x%X\n" 1834219820Sjeff "# sl 0x%X\n" 1835219820Sjeff "# qos_class 0x%X\n" 1836219820Sjeff "# mtu 0x%X\n" 1837219820Sjeff "# rate 0x%X\n" 1838219820Sjeff "# pkt_life 0x%X\n" 1839219820Sjeff "# preference 0x%X\n" "END\n\n", 1840219820Sjeff cl_ntoh64(p_rec->dgid.unicast.prefix), 1841219820Sjeff cl_ntoh64(p_rec->dgid.unicast.interface_id), 1842219820Sjeff cl_ntoh64(p_rec->sgid.unicast.prefix), 1843219820Sjeff cl_ntoh64(p_rec->sgid.unicast.interface_id), 1844219820Sjeff cl_ntoh16(p_rec->dlid), cl_ntoh16(p_rec->slid), 1845219820Sjeff cl_ntoh32(p_rec->hop_flow_raw), p_rec->tclass, 1846219820Sjeff p_rec->num_path, cl_ntoh16(p_rec->pkey), 1847219820Sjeff ib_path_rec_sl(p_rec), ib_path_rec_qos_class(p_rec), 1848219820Sjeff p_rec->mtu, p_rec->rate, p_rec->pkt_life, 1849219820Sjeff p_rec->preference); 1850219820Sjeff 1851219820Sjeff if (result < 0) { 1852219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0162: " 1853219820Sjeff "Write failed\n"); 1854219820Sjeff status = IB_ERROR; 1855219820Sjeff goto Exit; 1856219820Sjeff } 1857219820Sjeff 1858219820SjeffExit: 1859219820Sjeff OSM_LOG_EXIT(&p_osmt->log); 1860219820Sjeff return (status); 1861219820Sjeff} 1862219820Sjeff 1863219820Sjeff/********************************************************************** 1864219820Sjeff **********************************************************************/ 1865219820Sjeffstatic ib_api_status_t 1866219820Sjeffosmtest_write_node_info(IN osmtest_t * const p_osmt, 1867219820Sjeff IN FILE * fh, IN const ib_node_record_t * const p_rec) 1868219820Sjeff{ 1869219820Sjeff int result; 1870219820Sjeff cl_status_t status = IB_SUCCESS; 1871219820Sjeff char desc[IB_NODE_DESCRIPTION_SIZE + 1]; 1872219820Sjeff 1873219820Sjeff OSM_LOG_ENTER(&p_osmt->log); 1874219820Sjeff 1875219820Sjeff memcpy(desc, p_rec->node_desc.description, IB_NODE_DESCRIPTION_SIZE); 1876219820Sjeff desc[IB_NODE_DESCRIPTION_SIZE] = '\0'; 1877219820Sjeff 1878219820Sjeff result = fprintf(fh, 1879219820Sjeff "DEFINE_NODE\n" 1880219820Sjeff "lid 0x%X\n" 1881219820Sjeff "base_version 0x%X\n" 1882219820Sjeff "class_version 0x%X\n" 1883219820Sjeff "node_type 0x%X # (%s)\n" 1884219820Sjeff "num_ports 0x%X\n" 1885219820Sjeff "sys_guid 0x%016" PRIx64 "\n" 1886219820Sjeff "node_guid 0x%016" PRIx64 "\n" 1887219820Sjeff "port_guid 0x%016" PRIx64 "\n" 1888219820Sjeff "partition_cap 0x%X\n" 1889219820Sjeff "device_id 0x%X\n" 1890219820Sjeff "revision 0x%X\n" 1891219820Sjeff "# port_num 0x%X\n" 1892219820Sjeff "# vendor_id 0x%X\n" 1893219820Sjeff "# node_desc %s\n" 1894219820Sjeff "END\n\n", 1895219820Sjeff cl_ntoh16(p_rec->lid), 1896219820Sjeff p_rec->node_info.base_version, 1897219820Sjeff p_rec->node_info.class_version, 1898219820Sjeff p_rec->node_info.node_type, 1899219820Sjeff ib_get_node_type_str(p_rec->node_info.node_type), 1900219820Sjeff p_rec->node_info.num_ports, 1901219820Sjeff cl_ntoh64(p_rec->node_info.sys_guid), 1902219820Sjeff cl_ntoh64(p_rec->node_info.node_guid), 1903219820Sjeff cl_ntoh64(p_rec->node_info.port_guid), 1904219820Sjeff cl_ntoh16(p_rec->node_info.partition_cap), 1905219820Sjeff cl_ntoh16(p_rec->node_info.device_id), 1906219820Sjeff cl_ntoh32(p_rec->node_info.revision), 1907219820Sjeff ib_node_info_get_local_port_num(&p_rec->node_info), 1908219820Sjeff cl_ntoh32(ib_node_info_get_vendor_id 1909219820Sjeff (&p_rec->node_info)), desc); 1910219820Sjeff 1911219820Sjeff if (result < 0) { 1912219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0163: " 1913219820Sjeff "Write failed\n"); 1914219820Sjeff status = IB_ERROR; 1915219820Sjeff goto Exit; 1916219820Sjeff } 1917219820Sjeff 1918219820SjeffExit: 1919219820Sjeff OSM_LOG_EXIT(&p_osmt->log); 1920219820Sjeff return (status); 1921219820Sjeff} 1922219820Sjeff 1923219820Sjeff/********************************************************************** 1924219820Sjeff **********************************************************************/ 1925219820Sjeffstatic ib_api_status_t 1926219820Sjeffosmtest_write_link(IN osmtest_t * const p_osmt, 1927219820Sjeff IN FILE * fh, IN const ib_link_record_t * const p_rec) 1928219820Sjeff{ 1929219820Sjeff int result; 1930219820Sjeff cl_status_t status = IB_SUCCESS; 1931219820Sjeff 1932219820Sjeff OSM_LOG_ENTER(&p_osmt->log); 1933219820Sjeff 1934219820Sjeff result = fprintf(fh, 1935219820Sjeff "DEFINE_LINK\n" 1936219820Sjeff "from_lid 0x%X\n" 1937219820Sjeff "from_port_num 0x%X\n" 1938219820Sjeff "to_port_num 0x%X\n" 1939219820Sjeff "to_lid 0x%X\n" 1940219820Sjeff "END\n\n", 1941219820Sjeff cl_ntoh16(p_rec->from_lid), 1942219820Sjeff p_rec->from_port_num, 1943219820Sjeff p_rec->to_port_num, cl_ntoh16(p_rec->to_lid)); 1944219820Sjeff 1945219820Sjeff if (result < 0) { 1946219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0164: " 1947219820Sjeff "Write failed\n"); 1948219820Sjeff status = IB_ERROR; 1949219820Sjeff goto Exit; 1950219820Sjeff } 1951219820Sjeff 1952219820SjeffExit: 1953219820Sjeff OSM_LOG_EXIT(&p_osmt->log); 1954219820Sjeff return (status); 1955219820Sjeff} 1956219820Sjeff 1957219820Sjeff/********************************************************************** 1958219820Sjeff **********************************************************************/ 1959219820Sjeffstatic ib_api_status_t 1960219820Sjeffosmtest_write_all_link_recs(IN osmtest_t * const p_osmt, IN FILE * fh) 1961219820Sjeff{ 1962219820Sjeff osmtest_req_context_t context; 1963219820Sjeff const ib_link_record_t *p_rec; 1964219820Sjeff uint32_t i; 1965219820Sjeff cl_status_t status; 1966219820Sjeff size_t num_recs; 1967219820Sjeff int result; 1968219820Sjeff 1969219820Sjeff OSM_LOG_ENTER(&p_osmt->log); 1970219820Sjeff 1971219820Sjeff memset(&context, 0, sizeof(context)); 1972219820Sjeff 1973219820Sjeff /* 1974219820Sjeff * Do a blocking query for all NodeRecords in the subnet. 1975219820Sjeff */ 1976219820Sjeff status = osmtest_get_all_recs(p_osmt, IB_MAD_ATTR_LINK_RECORD, 1977219820Sjeff sizeof(*p_rec), &context); 1978219820Sjeff 1979219820Sjeff if (status != IB_SUCCESS) { 1980219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0165: " 1981219820Sjeff "osmtest_get_all_recs failed (%s)\n", 1982219820Sjeff ib_get_err_str(status)); 1983219820Sjeff goto Exit; 1984219820Sjeff } 1985219820Sjeff 1986219820Sjeff /* 1987219820Sjeff * Write the received records out to the file. 1988219820Sjeff */ 1989219820Sjeff num_recs = context.result.result_cnt; 1990219820Sjeff 1991219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, 1992219820Sjeff "Received %zu records\n", num_recs); 1993219820Sjeff 1994219820Sjeff result = fprintf(fh, "#\n" "# Link Records\n" "#\n"); 1995219820Sjeff if (result < 0) { 1996219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0166: " 1997219820Sjeff "Write failed\n"); 1998219820Sjeff status = IB_ERROR; 1999219820Sjeff goto Exit; 2000219820Sjeff } 2001219820Sjeff 2002219820Sjeff for (i = 0; i < num_recs; i++) { 2003219820Sjeff p_rec = 2004219820Sjeff (ib_link_record_t *) osmv_get_query_result(context.result. 2005219820Sjeff p_result_madw, 2006219820Sjeff i); 2007219820Sjeff 2008219820Sjeff osmtest_write_link(p_osmt, fh, p_rec); 2009219820Sjeff } 2010219820Sjeff 2011219820SjeffExit: 2012219820Sjeff /* 2013219820Sjeff * Return the IB query MAD to the pool as necessary. 2014219820Sjeff */ 2015219820Sjeff if (context.result.p_result_madw != NULL) { 2016219820Sjeff osm_mad_pool_put(&p_osmt->mad_pool, 2017219820Sjeff context.result.p_result_madw); 2018219820Sjeff context.result.p_result_madw = NULL; 2019219820Sjeff } 2020219820Sjeff 2021219820Sjeff OSM_LOG_EXIT(&p_osmt->log); 2022219820Sjeff return (status); 2023219820Sjeff} 2024219820Sjeff 2025219820Sjeff/********************************************************************** 2026219820Sjeff **********************************************************************/ 2027219820Sjeffstatic ib_api_status_t 2028219820Sjeffosmtest_get_path_rec_by_lid_pair(IN osmtest_t * const p_osmt, 2029219820Sjeff IN ib_net16_t slid, 2030219820Sjeff IN ib_net16_t dlid, 2031219820Sjeff IN osmtest_req_context_t * p_context) 2032219820Sjeff{ 2033219820Sjeff cl_status_t status = IB_SUCCESS; 2034219820Sjeff osmv_query_req_t req; 2035219820Sjeff osmv_lid_pair_t lid_pair; 2036219820Sjeff 2037219820Sjeff OSM_LOG_ENTER(&p_osmt->log); 2038219820Sjeff 2039219820Sjeff memset(&req, 0, sizeof(req)); 2040219820Sjeff memset(p_context, 0, sizeof(*p_context)); 2041219820Sjeff 2042219820Sjeff p_context->p_osmt = p_osmt; 2043219820Sjeff req.timeout_ms = p_osmt->opt.transaction_timeout; 2044219820Sjeff req.retry_cnt = p_osmt->opt.retry_count; 2045219820Sjeff req.flags = OSM_SA_FLAGS_SYNC; 2046219820Sjeff req.query_context = p_context; 2047219820Sjeff req.pfn_query_cb = osmtest_query_res_cb; 2048219820Sjeff 2049219820Sjeff req.query_type = OSMV_QUERY_PATH_REC_BY_LIDS; 2050219820Sjeff 2051219820Sjeff lid_pair.dest_lid = dlid; 2052219820Sjeff lid_pair.src_lid = slid; 2053219820Sjeff 2054219820Sjeff req.p_query_input = &lid_pair; 2055219820Sjeff req.sm_key = 0; 2056219820Sjeff 2057219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, 2058219820Sjeff "Query for path from 0x%X to 0x%X\n", slid, dlid); 2059219820Sjeff status = osmv_query_sa(p_osmt->h_bind, &req); 2060219820Sjeff if (status != IB_SUCCESS) { 2061219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0053: " 2062219820Sjeff "ib_query failed (%s)\n", ib_get_err_str(status)); 2063219820Sjeff goto Exit; 2064219820Sjeff } 2065219820Sjeff 2066219820Sjeff status = (*p_context).result.status; 2067219820Sjeff 2068219820Sjeff if (status != IB_SUCCESS) { 2069219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0067: " 2070219820Sjeff "ib_query failed (%s)\n", ib_get_err_str(status)); 2071219820Sjeff 2072219820Sjeff if (status == IB_REMOTE_ERROR) { 2073219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, 2074219820Sjeff "Remote error = %s\n", 2075219820Sjeff ib_get_mad_status_str(osm_madw_get_mad_ptr 2076219820Sjeff ((*p_context).result. 2077219820Sjeff p_result_madw))); 2078219820Sjeff } 2079219820Sjeff goto Exit; 2080219820Sjeff } 2081219820Sjeff 2082219820SjeffExit: 2083219820Sjeff OSM_LOG_EXIT(&p_osmt->log); 2084219820Sjeff return (status); 2085219820Sjeff} 2086219820Sjeff 2087219820Sjeff#ifdef VENDOR_RMPP_SUPPORT 2088219820Sjeff/********************************************************************** 2089219820Sjeff * ASSUMES RMPP 2090219820Sjeff **********************************************************************/ 2091219820Sjeffstatic ib_api_status_t 2092219820Sjeffosmtest_write_all_node_recs(IN osmtest_t * const p_osmt, IN FILE * fh) 2093219820Sjeff{ 2094219820Sjeff osmtest_req_context_t context; 2095219820Sjeff const ib_node_record_t *p_rec; 2096219820Sjeff uint32_t i; 2097219820Sjeff cl_status_t status; 2098219820Sjeff size_t num_recs; 2099219820Sjeff int result; 2100219820Sjeff 2101219820Sjeff OSM_LOG_ENTER(&p_osmt->log); 2102219820Sjeff 2103219820Sjeff memset(&context, 0, sizeof(context)); 2104219820Sjeff 2105219820Sjeff /* 2106219820Sjeff * Do a blocking query for all NodeRecords in the subnet. 2107219820Sjeff */ 2108219820Sjeff status = osmtest_get_all_recs(p_osmt, IB_MAD_ATTR_NODE_RECORD, 2109219820Sjeff sizeof(*p_rec), &context); 2110219820Sjeff 2111219820Sjeff if (status != IB_SUCCESS) { 2112219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0022: " 2113219820Sjeff "osmtest_get_all_recs failed (%s)\n", 2114219820Sjeff ib_get_err_str(status)); 2115219820Sjeff goto Exit; 2116219820Sjeff } 2117219820Sjeff 2118219820Sjeff /* 2119219820Sjeff * Write the received records out to the file. 2120219820Sjeff */ 2121219820Sjeff num_recs = context.result.result_cnt; 2122219820Sjeff 2123219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Received %zu records\n", num_recs); 2124219820Sjeff 2125219820Sjeff result = fprintf(fh, "#\n" "# Node Records\n" "#\n"); 2126219820Sjeff if (result < 0) { 2127219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0023: " 2128219820Sjeff "Write failed\n"); 2129219820Sjeff status = IB_ERROR; 2130219820Sjeff goto Exit; 2131219820Sjeff } 2132219820Sjeff 2133219820Sjeff for (i = 0; i < num_recs; i++) { 2134219820Sjeff p_rec = 2135219820Sjeff osmv_get_query_node_rec(context.result.p_result_madw, i); 2136219820Sjeff osmtest_write_node_info(p_osmt, fh, p_rec); 2137219820Sjeff } 2138219820Sjeff 2139219820SjeffExit: 2140219820Sjeff /* 2141219820Sjeff * Return the IB query MAD to the pool as necessary. 2142219820Sjeff */ 2143219820Sjeff if (context.result.p_result_madw != NULL) { 2144219820Sjeff osm_mad_pool_put(&p_osmt->mad_pool, 2145219820Sjeff context.result.p_result_madw); 2146219820Sjeff context.result.p_result_madw = NULL; 2147219820Sjeff } 2148219820Sjeff 2149219820Sjeff OSM_LOG_EXIT(&p_osmt->log); 2150219820Sjeff return (status); 2151219820Sjeff} 2152219820Sjeff 2153219820Sjeff/********************************************************************** 2154219820Sjeff * ASSUMES RMPP 2155219820Sjeff **********************************************************************/ 2156219820Sjeffstatic ib_api_status_t 2157219820Sjeffosmtest_write_all_port_recs(IN osmtest_t * const p_osmt, IN FILE * fh) 2158219820Sjeff{ 2159219820Sjeff osmtest_req_context_t context; 2160219820Sjeff const ib_portinfo_record_t *p_rec; 2161219820Sjeff uint32_t i; 2162219820Sjeff cl_status_t status; 2163219820Sjeff size_t num_recs; 2164219820Sjeff int result; 2165219820Sjeff 2166219820Sjeff OSM_LOG_ENTER(&p_osmt->log); 2167219820Sjeff 2168219820Sjeff memset(&context, 0, sizeof(context)); 2169219820Sjeff 2170219820Sjeff /* 2171219820Sjeff * Do a blocking query for all NodeRecords in the subnet. 2172219820Sjeff */ 2173219820Sjeff status = osmtest_get_all_recs(p_osmt, IB_MAD_ATTR_PORTINFO_RECORD, 2174219820Sjeff sizeof(*p_rec), &context); 2175219820Sjeff 2176219820Sjeff if (status != IB_SUCCESS) { 2177219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0167: " 2178219820Sjeff "osmtest_get_all_recs failed (%s)\n", 2179219820Sjeff ib_get_err_str(status)); 2180219820Sjeff goto Exit; 2181219820Sjeff } 2182219820Sjeff 2183219820Sjeff /* 2184219820Sjeff * Write the received records out to the file. 2185219820Sjeff */ 2186219820Sjeff num_recs = context.result.result_cnt; 2187219820Sjeff 2188219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Received %zu records\n", num_recs); 2189219820Sjeff 2190219820Sjeff result = fprintf(fh, "#\n" "# PortInfo Records\n" "#\n"); 2191219820Sjeff if (result < 0) { 2192219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0024: " 2193219820Sjeff "Write failed\n"); 2194219820Sjeff status = IB_ERROR; 2195219820Sjeff goto Exit; 2196219820Sjeff } 2197219820Sjeff 2198219820Sjeff for (i = 0; i < num_recs; i++) { 2199219820Sjeff p_rec = 2200219820Sjeff osmv_get_query_portinfo_rec(context.result.p_result_madw, 2201219820Sjeff i); 2202219820Sjeff osmtest_write_port_info(p_osmt, fh, p_rec); 2203219820Sjeff } 2204219820Sjeff 2205219820SjeffExit: 2206219820Sjeff /* 2207219820Sjeff * Return the IB query MAD to the pool as necessary. 2208219820Sjeff */ 2209219820Sjeff if (context.result.p_result_madw != NULL) { 2210219820Sjeff osm_mad_pool_put(&p_osmt->mad_pool, 2211219820Sjeff context.result.p_result_madw); 2212219820Sjeff context.result.p_result_madw = NULL; 2213219820Sjeff } 2214219820Sjeff 2215219820Sjeff OSM_LOG_EXIT(&p_osmt->log); 2216219820Sjeff return (status); 2217219820Sjeff} 2218219820Sjeff 2219219820Sjeff/********************************************************************** 2220219820Sjeff * ASSUMES RMPP 2221219820Sjeff **********************************************************************/ 2222219820Sjeffstatic ib_api_status_t 2223219820Sjeffosmtest_write_all_path_recs(IN osmtest_t * const p_osmt, IN FILE * fh) 2224219820Sjeff{ 2225219820Sjeff osmtest_req_context_t context; 2226219820Sjeff const ib_path_rec_t *p_rec; 2227219820Sjeff uint32_t i; 2228219820Sjeff cl_status_t status; 2229219820Sjeff size_t num_recs; 2230219820Sjeff int result; 2231219820Sjeff 2232219820Sjeff OSM_LOG_ENTER(&p_osmt->log); 2233219820Sjeff 2234219820Sjeff memset(&context, 0, sizeof(context)); 2235219820Sjeff 2236219820Sjeff /* 2237219820Sjeff * Do a blocking query for all PathRecords in the subnet. 2238219820Sjeff */ 2239219820Sjeff status = osmtest_get_all_recs(p_osmt, IB_MAD_ATTR_PATH_RECORD, 2240219820Sjeff sizeof(*p_rec), &context); 2241219820Sjeff 2242219820Sjeff if (status != IB_SUCCESS) { 2243219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0025: " 2244219820Sjeff "osmtest_get_all_recs failed (%s)\n", 2245219820Sjeff ib_get_err_str(status)); 2246219820Sjeff goto Exit; 2247219820Sjeff } 2248219820Sjeff 2249219820Sjeff /* 2250219820Sjeff * Write the received records out to the file. 2251219820Sjeff */ 2252219820Sjeff num_recs = context.result.result_cnt; 2253219820Sjeff 2254219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Received %zu records\n", num_recs); 2255219820Sjeff 2256219820Sjeff result = fprintf(fh, "#\n" "# Path Records\n" "#\n"); 2257219820Sjeff if (result < 0) { 2258219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0026: " 2259219820Sjeff "Write failed\n"); 2260219820Sjeff status = IB_ERROR; 2261219820Sjeff goto Exit; 2262219820Sjeff } 2263219820Sjeff 2264219820Sjeff for (i = 0; i < num_recs; i++) { 2265219820Sjeff p_rec = 2266219820Sjeff osmv_get_query_path_rec(context.result.p_result_madw, i); 2267219820Sjeff osmtest_write_path_info(p_osmt, fh, p_rec); 2268219820Sjeff } 2269219820Sjeff 2270219820SjeffExit: 2271219820Sjeff /* 2272219820Sjeff * Return the IB query MAD to the pool as necessary. 2273219820Sjeff */ 2274219820Sjeff if (context.result.p_result_madw != NULL) { 2275219820Sjeff osm_mad_pool_put(&p_osmt->mad_pool, 2276219820Sjeff context.result.p_result_madw); 2277219820Sjeff context.result.p_result_madw = NULL; 2278219820Sjeff } 2279219820Sjeff 2280219820Sjeff OSM_LOG_EXIT(&p_osmt->log); 2281219820Sjeff return (status); 2282219820Sjeff} 2283219820Sjeff 2284219820Sjeff#else 2285219820Sjeff/* 2286219820Sjeff * NON RMPP BASED QUERY FOR ALL NODES: BASED ON THE MAX LID GIVEN BY THE USER 2287219820Sjeff */ 2288219820Sjeffstatic ib_api_status_t 2289219820Sjeffosmtest_write_all_node_recs(IN osmtest_t * const p_osmt, IN FILE * fh) 2290219820Sjeff{ 2291219820Sjeff osmtest_req_context_t context; 2292219820Sjeff node_t *p_node; 2293219820Sjeff node_t *p_guid_node; 2294219820Sjeff const ib_node_record_t *p_rec; 2295219820Sjeff cl_status_t status = CL_SUCCESS; 2296219820Sjeff int result; 2297219820Sjeff uint16_t lid; 2298219820Sjeff 2299219820Sjeff OSM_LOG_ENTER(&p_osmt->log); 2300219820Sjeff 2301219820Sjeff result = fprintf(fh, "#\n" "# Node Records\n" "#\n"); 2302219820Sjeff if (result < 0) { 2303219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0027: " 2304219820Sjeff "Write failed\n"); 2305219820Sjeff status = IB_ERROR; 2306219820Sjeff goto Exit; 2307219820Sjeff } 2308219820Sjeff 2309219820Sjeff /* 2310219820Sjeff * Go over all LIDs in the range 1 to max_lid and do a 2311219820Sjeff * NodeRecord query by that lid. 2312219820Sjeff */ 2313219820Sjeff for (lid = 1; lid <= p_osmt->max_lid; lid++) { 2314219820Sjeff /* prepare the query context */ 2315219820Sjeff memset(&context, 0, sizeof(context)); 2316219820Sjeff 2317219820Sjeff status = 2318219820Sjeff osmtest_get_node_rec_by_lid(p_osmt, cl_ntoh16(lid), 2319219820Sjeff &context); 2320219820Sjeff if (status != IB_SUCCESS) { 2321219820Sjeff if (status != IB_SA_MAD_STATUS_NO_RECORDS) { 2322219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, "ERR 0028: " 2323219820Sjeff "failed to get node info for LID:0x%02X (%s)\n", 2324219820Sjeff cl_ntoh16(lid), ib_get_err_str(status)); 2325219820Sjeff goto Exit; 2326219820Sjeff } else { 2327219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, "WRN 0121: " 2328219820Sjeff "failed to get node info for LID:0x%02X (%s)\n", 2329219820Sjeff cl_ntoh16(lid), ib_get_err_str(status)); 2330219820Sjeff status = IB_SUCCESS; 2331219820Sjeff } 2332219820Sjeff } else { 2333219820Sjeff /* OK we got something */ 2334219820Sjeff p_rec = 2335219820Sjeff osmv_get_query_node_rec(context.result. 2336219820Sjeff p_result_madw, 0); 2337219820Sjeff osmtest_write_node_info(p_osmt, fh, p_rec); 2338219820Sjeff 2339219820Sjeff /* create a subnet object */ 2340219820Sjeff p_node = node_new(); 2341219820Sjeff CL_ASSERT(p_node != NULL); 2342219820Sjeff 2343219820Sjeff /* copy the info to the subnet node object */ 2344219820Sjeff p_node->rec = *p_rec; 2345219820Sjeff 2346219820Sjeff cl_qmap_insert(&p_osmt->exp_subn.node_lid_tbl, 2347219820Sjeff p_node->rec.lid, &p_node->map_item); 2348219820Sjeff 2349219820Sjeff p_guid_node = node_new(); 2350219820Sjeff CL_ASSERT(p_guid_node != NULL); 2351219820Sjeff 2352219820Sjeff *p_guid_node = *p_node; 2353219820Sjeff 2354219820Sjeff cl_qmap_insert(&p_osmt->exp_subn.node_guid_tbl, 2355219820Sjeff p_guid_node->rec.node_info.node_guid, 2356219820Sjeff &p_guid_node->map_item); 2357219820Sjeff 2358219820Sjeff } 2359219820Sjeff 2360219820Sjeff if (context.result.p_result_madw != NULL) { 2361219820Sjeff osm_mad_pool_put(&p_osmt->mad_pool, 2362219820Sjeff context.result.p_result_madw); 2363219820Sjeff context.result.p_result_madw = NULL; 2364219820Sjeff } 2365219820Sjeff } 2366219820Sjeff 2367219820SjeffExit: 2368219820Sjeff if (context.result.p_result_madw != NULL) { 2369219820Sjeff osm_mad_pool_put(&p_osmt->mad_pool, 2370219820Sjeff context.result.p_result_madw); 2371219820Sjeff context.result.p_result_madw = NULL; 2372219820Sjeff } 2373219820Sjeff 2374219820Sjeff OSM_LOG_EXIT(&p_osmt->log); 2375219820Sjeff return (status); 2376219820Sjeff} 2377219820Sjeff 2378219820Sjeff/* 2379219820Sjeff * GET ALL PORT RECORDS IN THE FABRIC - 2380219820Sjeff * one by one by using the node info received 2381219820Sjeff */ 2382219820Sjeffstatic ib_api_status_t 2383219820Sjeffosmtest_write_all_port_recs(IN osmtest_t * const p_osmt, IN FILE * fh) 2384219820Sjeff{ 2385219820Sjeff osmtest_req_context_t context; 2386219820Sjeff const ib_node_record_t *p_node_rec; 2387219820Sjeff const ib_portinfo_record_t *p_rec; 2388219820Sjeff uint8_t port_num; 2389219820Sjeff cl_status_t status = CL_SUCCESS; 2390219820Sjeff cl_qmap_t *p_tbl; 2391219820Sjeff node_t *p_node; 2392219820Sjeff port_t *p_port; 2393219820Sjeff int result; 2394219820Sjeff 2395219820Sjeff OSM_LOG_ENTER(&p_osmt->log); 2396219820Sjeff 2397219820Sjeff memset(&context, 0, sizeof(context)); 2398219820Sjeff 2399219820Sjeff /* print header */ 2400219820Sjeff result = fprintf(fh, "#\n" "# PortInfo Records\n" "#\n"); 2401219820Sjeff if (result < 0) { 2402219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0029: " 2403219820Sjeff "Write failed\n"); 2404219820Sjeff status = IB_ERROR; 2405219820Sjeff goto Exit; 2406219820Sjeff } 2407219820Sjeff 2408219820Sjeff /* use the pre-explored set of nodes */ 2409219820Sjeff p_tbl = &p_osmt->exp_subn.node_lid_tbl; 2410219820Sjeff p_node = (node_t *) cl_qmap_head(p_tbl); 2411219820Sjeff 2412219820Sjeff /* 2413219820Sjeff * Go over all LIDs in the range 1 to max_lid and do a 2414219820Sjeff * NodeRecord query by that lid. 2415219820Sjeff */ 2416219820Sjeff while (p_node != (node_t *) cl_qmap_end(p_tbl)) { 2417219820Sjeff 2418219820Sjeff p_node_rec = &(p_node->rec); 2419219820Sjeff 2420219820Sjeff /* go through all ports of the node: */ 2421219820Sjeff for (port_num = 0; port_num <= p_node_rec->node_info.num_ports; 2422219820Sjeff port_num++) { 2423219820Sjeff /* prepare the query context */ 2424219820Sjeff memset(&context, 0, sizeof(context)); 2425219820Sjeff 2426219820Sjeff status = osmtest_get_port_rec_by_num(p_osmt, 2427219820Sjeff p_node_rec->lid, 2428219820Sjeff port_num, 2429219820Sjeff &context); 2430219820Sjeff if (status != IB_SUCCESS) { 2431219820Sjeff if (status != IB_SA_MAD_STATUS_NO_RECORDS) { 2432219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, 2433219820Sjeff "WRN 0122: " 2434219820Sjeff "Error encountered getting port info for LID:0x%04X Num:0x%02X (%s)\n", 2435219820Sjeff p_node_rec->lid, port_num, 2436219820Sjeff ib_get_err_str(status)); 2437219820Sjeff goto Exit; 2438219820Sjeff } else { 2439219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, 2440219820Sjeff "WRN 0123: " 2441219820Sjeff "failed to get port info for LID:0x%04X Num:0x%02X (%s)\n", 2442219820Sjeff p_node_rec->lid, port_num, 2443219820Sjeff ib_get_err_str(status)); 2444219820Sjeff status = IB_SUCCESS; 2445219820Sjeff } 2446219820Sjeff } else { 2447219820Sjeff /* OK we got something */ 2448219820Sjeff p_rec = 2449219820Sjeff osmv_get_query_portinfo_rec(context.result. 2450219820Sjeff p_result_madw, 2451219820Sjeff 0); 2452219820Sjeff osmtest_write_port_info(p_osmt, fh, p_rec); 2453219820Sjeff 2454219820Sjeff /* create a subnet object */ 2455219820Sjeff p_port = port_new(); 2456219820Sjeff CL_ASSERT(p_port != NULL); 2457219820Sjeff 2458219820Sjeff /* copy the info to the subnet node object */ 2459219820Sjeff p_port->rec = *p_rec; 2460219820Sjeff 2461219820Sjeff cl_qmap_insert(&p_osmt->exp_subn.port_key_tbl, 2462219820Sjeff port_gen_id(p_node_rec->lid, 2463219820Sjeff port_num), 2464219820Sjeff &p_port->map_item); 2465219820Sjeff } 2466219820Sjeff 2467219820Sjeff if (context.result.p_result_madw != NULL) { 2468219820Sjeff osm_mad_pool_put(&p_osmt->mad_pool, 2469219820Sjeff context.result.p_result_madw); 2470219820Sjeff context.result.p_result_madw = NULL; 2471219820Sjeff } 2472219820Sjeff } 2473219820Sjeff p_node = (node_t *) cl_qmap_next(&p_node->map_item); 2474219820Sjeff } 2475219820Sjeff 2476219820Sjeff /* we must set the exist status to avoid abort of the over all algorith */ 2477219820Sjeff 2478219820SjeffExit: 2479219820Sjeff /* 2480219820Sjeff * Return the IB query MAD to the pool as necessary. 2481219820Sjeff */ 2482219820Sjeff 2483219820Sjeff if (context.result.p_result_madw != NULL) { 2484219820Sjeff osm_mad_pool_put(&p_osmt->mad_pool, 2485219820Sjeff context.result.p_result_madw); 2486219820Sjeff context.result.p_result_madw = NULL; 2487219820Sjeff } 2488219820Sjeff 2489219820Sjeff OSM_LOG_EXIT(&p_osmt->log); 2490219820Sjeff return (status); 2491219820Sjeff} 2492219820Sjeff 2493219820Sjeff/********************************************************************** 2494219820Sjeff * ASSUMES NO RMPP 2495219820Sjeff **********************************************************************/ 2496219820Sjeffstatic ib_api_status_t 2497219820Sjeffosmtest_write_all_path_recs(IN osmtest_t * const p_osmt, IN FILE * fh) 2498219820Sjeff{ 2499219820Sjeff osmtest_req_context_t context; 2500219820Sjeff const ib_path_rec_t *p_rec; 2501219820Sjeff cl_status_t status = CL_SUCCESS; 2502219820Sjeff int num_recs, i; 2503219820Sjeff cl_qmap_t *p_tbl; 2504219820Sjeff node_t *p_src_node, *p_dst_node; 2505219820Sjeff ib_api_status_t got_status = IB_SUCCESS; 2506219820Sjeff 2507219820Sjeff OSM_LOG_ENTER(&p_osmt->log); 2508219820Sjeff 2509219820Sjeff memset(&context, 0, sizeof(context)); 2510219820Sjeff 2511219820Sjeff /* 2512219820Sjeff * Go over all nodes that exist in the subnet 2513219820Sjeff * for each pair that are not switch nodes get the path record 2514219820Sjeff */ 2515219820Sjeff 2516219820Sjeff context.p_osmt = p_osmt; 2517219820Sjeff 2518219820Sjeff p_tbl = &p_osmt->exp_subn.node_lid_tbl; 2519219820Sjeff 2520219820Sjeff p_src_node = (node_t *) cl_qmap_head(p_tbl); 2521219820Sjeff 2522219820Sjeff while (p_src_node != (node_t *) cl_qmap_end(p_tbl)) { 2523219820Sjeff /* HACK we use capability_mask to know diff a CA node from switch node */ 2524219820Sjeff /* if(p_src_node->rec.node_info.capability_mask ) { */ 2525219820Sjeff p_dst_node = (node_t *) cl_qmap_head(p_tbl); 2526219820Sjeff 2527219820Sjeff while (p_dst_node != (node_t *) cl_qmap_end(p_tbl)) { 2528219820Sjeff /* HACK we use capability_mask to know diff a CA node from switch node */ 2529219820Sjeff /* if (p_dst_node->rec.node_info.capability_mask) { */ 2530219820Sjeff 2531219820Sjeff /* query for it: */ 2532219820Sjeff status = osmtest_get_path_rec_by_lid_pair(p_osmt, 2533219820Sjeff p_src_node-> 2534219820Sjeff rec.lid, 2535219820Sjeff p_dst_node-> 2536219820Sjeff rec.lid, 2537219820Sjeff &context); 2538219820Sjeff 2539219820Sjeff if (status != IB_SUCCESS) { 2540219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 012D: " 2541219820Sjeff "failed to get path info from LID:0x%X To LID:0x%X (%s)\n", 2542219820Sjeff p_src_node->rec.lid, 2543219820Sjeff p_dst_node->rec.lid, 2544219820Sjeff ib_get_err_str(status)); 2545219820Sjeff /* remember the first error status */ 2546219820Sjeff got_status = 2547219820Sjeff (got_status == 2548219820Sjeff IB_SUCCESS) ? status : got_status; 2549219820Sjeff } else { 2550219820Sjeff /* we might have received several records */ 2551219820Sjeff num_recs = context.result.result_cnt; 2552219820Sjeff for (i = 0; i < num_recs; i++) { 2553219820Sjeff p_rec = 2554219820Sjeff osmv_get_query_path_rec(context. 2555219820Sjeff result. 2556219820Sjeff p_result_madw, 2557219820Sjeff i); 2558219820Sjeff osmtest_write_path_info(p_osmt, fh, 2559219820Sjeff p_rec); 2560219820Sjeff } 2561219820Sjeff } 2562219820Sjeff/* } */ 2563219820Sjeff 2564219820Sjeff if (context.result.p_result_madw != NULL) { 2565219820Sjeff osm_mad_pool_put(&p_osmt->mad_pool, 2566219820Sjeff context.result.p_result_madw); 2567219820Sjeff context.result.p_result_madw = NULL; 2568219820Sjeff } 2569219820Sjeff 2570219820Sjeff /* next one please */ 2571219820Sjeff p_dst_node = 2572219820Sjeff (node_t *) cl_qmap_next(&p_dst_node->map_item); 2573219820Sjeff } 2574219820Sjeff/* } */ 2575219820Sjeff 2576219820Sjeff p_src_node = (node_t *) cl_qmap_next(&p_src_node->map_item); 2577219820Sjeff } 2578219820Sjeff 2579219820Sjeff if (got_status != IB_SUCCESS) 2580219820Sjeff status = got_status; 2581219820Sjeff 2582219820Sjeff /* 2583219820Sjeff * Return the IB query MAD to the pool as necessary. 2584219820Sjeff */ 2585219820Sjeff if (context.result.p_result_madw != NULL) { 2586219820Sjeff osm_mad_pool_put(&p_osmt->mad_pool, 2587219820Sjeff context.result.p_result_madw); 2588219820Sjeff context.result.p_result_madw = NULL; 2589219820Sjeff } 2590219820Sjeff 2591219820Sjeff OSM_LOG_EXIT(&p_osmt->log); 2592219820Sjeff return (status); 2593219820Sjeff} 2594219820Sjeff 2595219820Sjeff#endif 2596219820Sjeff 2597219820Sjeff/********************************************************************** 2598219820Sjeff **********************************************************************/ 2599219820Sjeffstatic ib_api_status_t 2600219820Sjeffosmtest_create_inventory_file(IN osmtest_t * const p_osmt) 2601219820Sjeff{ 2602219820Sjeff FILE *fh; 2603219820Sjeff ib_api_status_t status = IB_SUCCESS; 2604219820Sjeff 2605219820Sjeff OSM_LOG_ENTER(&p_osmt->log); 2606219820Sjeff 2607219820Sjeff fh = fopen(p_osmt->opt.file_name, "w"); 2608219820Sjeff if (fh == NULL) { 2609219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0079: " 2610219820Sjeff "Unable to open inventory file (%s)\n", 2611219820Sjeff p_osmt->opt.file_name); 2612219820Sjeff status = IB_ERROR; 2613219820Sjeff goto Exit; 2614219820Sjeff } 2615219820Sjeff 2616219820Sjeff /* HACK: the order is important: nodes ports paths */ 2617219820Sjeff status = osmtest_write_all_node_recs(p_osmt, fh); 2618219820Sjeff if (status != IB_SUCCESS) 2619219820Sjeff goto Exit; 2620219820Sjeff 2621219820Sjeff status = osmtest_write_all_port_recs(p_osmt, fh); 2622219820Sjeff if (status != IB_SUCCESS) 2623219820Sjeff goto Exit; 2624219820Sjeff 2625219820Sjeff if (!p_osmt->opt.ignore_path_records) { 2626219820Sjeff status = osmtest_write_all_path_recs(p_osmt, fh); 2627219820Sjeff if (status != IB_SUCCESS) 2628219820Sjeff goto Exit; 2629219820Sjeff } 2630219820Sjeff 2631219820Sjeff status = osmtest_write_all_link_recs(p_osmt, fh); 2632219820Sjeff if (status != IB_SUCCESS) 2633219820Sjeff goto Exit; 2634219820Sjeff 2635219820Sjeff fclose(fh); 2636219820Sjeff 2637219820SjeffExit: 2638219820Sjeff OSM_LOG_EXIT(&p_osmt->log); 2639219820Sjeff return (status); 2640219820Sjeff} 2641219820Sjeff 2642219820Sjeff/********************************************************************** 2643219820Sjeff **********************************************************************/ 2644219820Sjeffstatic ib_api_status_t osmtest_stress_large_rmpp_pr(IN osmtest_t * const p_osmt) 2645219820Sjeff{ 2646219820Sjeff ib_api_status_t status = IB_SUCCESS; 2647219820Sjeff uint64_t num_recs = 0; 2648219820Sjeff uint64_t num_queries = 0; 2649219820Sjeff uint32_t delta_recs; 2650219820Sjeff uint32_t delta_queries; 2651219820Sjeff uint32_t print_freq = 0; 2652219820Sjeff struct timeval start_tv, end_tv; 2653219820Sjeff long sec_diff, usec_diff; 2654219820Sjeff float ratio; 2655219820Sjeff 2656219820Sjeff OSM_LOG_ENTER(&p_osmt->log); 2657219820Sjeff gettimeofday(&start_tv, NULL); 2658277361Shselasky printf("-I- Start time is : %09ld:%06ld [sec:usec]\n", (long)start_tv.tv_sec, 2659219820Sjeff (long)start_tv.tv_usec); 2660219820Sjeff 2661219820Sjeff while (num_queries < STRESS_LARGE_PR_RMPP_THR) { 2662219820Sjeff delta_recs = 0; 2663219820Sjeff delta_queries = 0; 2664219820Sjeff 2665219820Sjeff status = osmtest_stress_path_recs_by_guid(p_osmt, &delta_recs, 2666219820Sjeff &delta_queries); 2667219820Sjeff if (status != IB_SUCCESS) 2668219820Sjeff goto Exit; 2669219820Sjeff 2670219820Sjeff num_recs += delta_recs; 2671219820Sjeff num_queries += delta_queries; 2672219820Sjeff 2673219820Sjeff print_freq += delta_recs; 2674219820Sjeff if (print_freq > 10000) { 2675219820Sjeff gettimeofday(&end_tv, NULL); 2676219820Sjeff if (end_tv.tv_usec > start_tv.tv_usec) { 2677219820Sjeff sec_diff = end_tv.tv_sec - start_tv.tv_sec; 2678219820Sjeff usec_diff = end_tv.tv_usec - start_tv.tv_usec; 2679219820Sjeff } else { 2680219820Sjeff sec_diff = end_tv.tv_sec - start_tv.tv_sec - 1; 2681219820Sjeff usec_diff = 2682219820Sjeff 1000000 - (start_tv.tv_usec - 2683219820Sjeff end_tv.tv_usec); 2684219820Sjeff } 2685219820Sjeff printf("-I- End time is : %09ld:%06ld [sec:usec]\n", 2686277361Shselasky (long)end_tv.tv_sec, (long)end_tv.tv_usec); 2687219820Sjeff printf("-I- Querying %" PRId64 2688219820Sjeff " Path Record queries CA to CA (rmpp)\n\ttook %04ld:%06ld [sec:usec]\n", 2689219820Sjeff num_queries, sec_diff, usec_diff); 2690219820Sjeff if (num_recs == 0) 2691219820Sjeff ratio = 0; 2692219820Sjeff else 2693219820Sjeff ratio = ((float)num_queries / (float)num_recs); 2694219820Sjeff printf("-I- Queries to Record Ratio is %" PRIu64 2695219820Sjeff " records, %" PRIu64 " queries : %.2f \n", 2696219820Sjeff num_recs, num_queries, ratio); 2697219820Sjeff print_freq = 0; 2698219820Sjeff } 2699219820Sjeff } 2700219820Sjeff 2701219820SjeffExit: 2702219820Sjeff gettimeofday(&end_tv, NULL); 2703219820Sjeff printf("-I- End time is : %09ld:%06ld [sec:usec]\n", 2704277361Shselasky (long)end_tv.tv_sec, (long)end_tv.tv_usec); 2705219820Sjeff if (end_tv.tv_usec > start_tv.tv_usec) { 2706219820Sjeff sec_diff = end_tv.tv_sec - start_tv.tv_sec; 2707219820Sjeff usec_diff = end_tv.tv_usec - start_tv.tv_usec; 2708219820Sjeff } else { 2709219820Sjeff sec_diff = end_tv.tv_sec - start_tv.tv_sec - 1; 2710219820Sjeff usec_diff = 1000000 - (start_tv.tv_usec - end_tv.tv_usec); 2711219820Sjeff } 2712219820Sjeff 2713219820Sjeff printf("-I- Querying %" PRId64 2714219820Sjeff " Path Record queries (rmpp) took %04ld:%06ld [sec:usec]\n", 2715219820Sjeff num_queries, sec_diff, usec_diff); 2716219820Sjeff 2717219820Sjeff OSM_LOG_EXIT(&p_osmt->log); 2718219820Sjeff return (status); 2719219820Sjeff} 2720219820Sjeff 2721219820Sjeff/********************************************************************** 2722219820Sjeff **********************************************************************/ 2723219820Sjeffstatic ib_api_status_t osmtest_stress_large_rmpp(IN osmtest_t * const p_osmt) 2724219820Sjeff{ 2725219820Sjeff ib_api_status_t status = IB_SUCCESS; 2726219820Sjeff uint64_t num_recs = 0; 2727219820Sjeff uint64_t num_queries = 0; 2728219820Sjeff uint32_t delta_recs; 2729219820Sjeff uint32_t delta_queries; 2730219820Sjeff uint32_t print_freq = 0; 2731219820Sjeff struct timeval start_tv, end_tv; 2732219820Sjeff long sec_diff, usec_diff; 2733219820Sjeff 2734219820Sjeff OSM_LOG_ENTER(&p_osmt->log); 2735219820Sjeff gettimeofday(&start_tv, NULL); 2736277361Shselasky printf("-I- Start time is : %09ld:%06ld [sec:usec]\n", (long)start_tv.tv_sec, 2737219820Sjeff (long)start_tv.tv_usec); 2738219820Sjeff 2739219820Sjeff while (num_queries < STRESS_LARGE_RMPP_THR) { 2740219820Sjeff delta_recs = 0; 2741219820Sjeff delta_queries = 0; 2742219820Sjeff 2743219820Sjeff status = osmtest_stress_node_recs_large(p_osmt, &delta_recs, 2744219820Sjeff &delta_queries); 2745219820Sjeff if (status != IB_SUCCESS) 2746219820Sjeff goto Exit; 2747219820Sjeff 2748219820Sjeff status = osmtest_stress_path_recs_large(p_osmt, &delta_recs, 2749219820Sjeff &delta_queries); 2750219820Sjeff if (status != IB_SUCCESS) 2751219820Sjeff goto Exit; 2752219820Sjeff 2753219820Sjeff status = osmtest_stress_port_recs_large(p_osmt, &delta_recs, 2754219820Sjeff &delta_queries); 2755219820Sjeff if (status != IB_SUCCESS) 2756219820Sjeff goto Exit; 2757219820Sjeff 2758219820Sjeff num_recs += delta_recs; 2759219820Sjeff num_queries += delta_queries; 2760219820Sjeff 2761219820Sjeff print_freq += delta_recs; 2762219820Sjeff 2763219820Sjeff if (print_freq > 100000) { 2764219820Sjeff gettimeofday(&end_tv, NULL); 2765219820Sjeff if (end_tv.tv_usec > start_tv.tv_usec) { 2766219820Sjeff sec_diff = end_tv.tv_sec - start_tv.tv_sec; 2767219820Sjeff usec_diff = end_tv.tv_usec - start_tv.tv_usec; 2768219820Sjeff } else { 2769219820Sjeff sec_diff = end_tv.tv_sec - start_tv.tv_sec - 1; 2770219820Sjeff usec_diff = 2771219820Sjeff 1000000 - (start_tv.tv_usec - 2772219820Sjeff end_tv.tv_usec); 2773219820Sjeff } 2774219820Sjeff printf("-I- End time is : %09ld:%06ld [sec:usec]\n", 2775277361Shselasky (long)end_tv.tv_sec, (long)end_tv.tv_usec); 2776219820Sjeff printf("-I- Querying %" PRId64 2777219820Sjeff " large mixed queries (rmpp) took %04ld:%06ld [sec:usec]\n", 2778219820Sjeff num_queries, sec_diff, usec_diff); 2779219820Sjeff printf("%" PRIu64 " records, %" PRIu64 " queries\n", 2780219820Sjeff num_recs, num_queries); 2781219820Sjeff print_freq = 0; 2782219820Sjeff } 2783219820Sjeff } 2784219820Sjeff 2785219820SjeffExit: 2786219820Sjeff gettimeofday(&end_tv, NULL); 2787219820Sjeff printf("-I- End time is : %09ld:%06ld [sec:usec]\n", 2788277361Shselasky (long)end_tv.tv_sec, (long)end_tv.tv_usec); 2789219820Sjeff if (end_tv.tv_usec > start_tv.tv_usec) { 2790219820Sjeff sec_diff = end_tv.tv_sec - start_tv.tv_sec; 2791219820Sjeff usec_diff = end_tv.tv_usec - start_tv.tv_usec; 2792219820Sjeff } else { 2793219820Sjeff sec_diff = end_tv.tv_sec - start_tv.tv_sec - 1; 2794219820Sjeff usec_diff = 1000000 - (start_tv.tv_usec - end_tv.tv_usec); 2795219820Sjeff } 2796219820Sjeff 2797219820Sjeff printf("-I- Querying %" PRId64 2798219820Sjeff " large mixed queries (rmpp) took %04ld:%06ld [sec:usec]\n", 2799219820Sjeff num_queries, sec_diff, usec_diff); 2800219820Sjeff 2801219820Sjeff OSM_LOG_EXIT(&p_osmt->log); 2802219820Sjeff return (status); 2803219820Sjeff} 2804219820Sjeff 2805219820Sjeff/********************************************************************** 2806219820Sjeff **********************************************************************/ 2807219820Sjeffstatic ib_api_status_t osmtest_stress_small_rmpp(IN osmtest_t * const p_osmt) 2808219820Sjeff{ 2809219820Sjeff ib_api_status_t status = IB_SUCCESS; 2810219820Sjeff uint64_t num_recs = 0; 2811219820Sjeff uint64_t num_queries = 0; 2812219820Sjeff uint32_t delta_recs; 2813219820Sjeff uint32_t delta_queries; 2814219820Sjeff uint32_t print_freq = 0; 2815219820Sjeff int num_timeouts = 0; 2816219820Sjeff struct timeval start_tv, end_tv; 2817219820Sjeff long sec_diff, usec_diff; 2818219820Sjeff 2819219820Sjeff OSM_LOG_ENTER(&p_osmt->log); 2820219820Sjeff gettimeofday(&start_tv, NULL); 2821219820Sjeff printf("-I- Start time is : %09ld:%06ld [sec:usec]\n", 2822277361Shselasky (long)start_tv.tv_sec, (long)start_tv.tv_usec); 2823219820Sjeff 2824219820Sjeff while ((num_queries < STRESS_SMALL_RMPP_THR) && (num_timeouts < 100)) { 2825219820Sjeff delta_recs = 0; 2826219820Sjeff delta_queries = 0; 2827219820Sjeff 2828219820Sjeff status = osmtest_stress_port_recs_small(p_osmt, &delta_recs, 2829219820Sjeff &delta_queries); 2830219820Sjeff if (status != IB_SUCCESS) 2831219820Sjeff goto Exit; 2832219820Sjeff 2833219820Sjeff num_recs += delta_recs; 2834219820Sjeff num_queries += delta_queries; 2835219820Sjeff 2836219820Sjeff print_freq += delta_recs; 2837219820Sjeff if (print_freq > 5000) { 2838219820Sjeff gettimeofday(&end_tv, NULL); 2839219820Sjeff printf("%" PRIu64 " records, %" PRIu64 " queries\n", 2840219820Sjeff num_recs, num_queries); 2841219820Sjeff if (end_tv.tv_usec > start_tv.tv_usec) { 2842219820Sjeff sec_diff = end_tv.tv_sec - start_tv.tv_sec; 2843219820Sjeff usec_diff = end_tv.tv_usec - start_tv.tv_usec; 2844219820Sjeff } else { 2845219820Sjeff sec_diff = end_tv.tv_sec - start_tv.tv_sec - 1; 2846219820Sjeff usec_diff = 2847219820Sjeff 1000000 - (start_tv.tv_usec - 2848219820Sjeff end_tv.tv_usec); 2849219820Sjeff } 2850219820Sjeff printf("-I- End time is : %09ld:%06ld [sec:usec]\n", 2851277361Shselasky (long)end_tv.tv_sec, (long)end_tv.tv_usec); 2852219820Sjeff printf("-I- Querying %" PRId64 2853219820Sjeff " port_info queries (single mad) took %04ld:%06ld [sec:usec]\n", 2854219820Sjeff num_queries, sec_diff, usec_diff); 2855219820Sjeff print_freq = 0; 2856219820Sjeff } 2857219820Sjeff } 2858219820Sjeff 2859219820SjeffExit: 2860219820Sjeff gettimeofday(&end_tv, NULL); 2861219820Sjeff printf("-I- End time is : %09ld:%06ld [sec:usec]\n", 2862277361Shselasky (long)end_tv.tv_sec, (long)end_tv.tv_usec); 2863219820Sjeff if (end_tv.tv_usec > start_tv.tv_usec) { 2864219820Sjeff sec_diff = end_tv.tv_sec - start_tv.tv_sec; 2865219820Sjeff usec_diff = end_tv.tv_usec - start_tv.tv_usec; 2866219820Sjeff } else { 2867219820Sjeff sec_diff = end_tv.tv_sec - start_tv.tv_sec - 1; 2868219820Sjeff usec_diff = 1000000 - (start_tv.tv_usec - end_tv.tv_usec); 2869219820Sjeff } 2870219820Sjeff 2871219820Sjeff printf("-I- Querying %" PRId64 2872219820Sjeff " port_info queries (single mad) took %04ld:%06ld [sec:usec]\n", 2873219820Sjeff num_queries, sec_diff, usec_diff); 2874219820Sjeff if (num_timeouts > 50) { 2875219820Sjeff status = IB_TIMEOUT; 2876219820Sjeff } 2877219820Sjeff /* Exit: */ 2878219820Sjeff OSM_LOG_EXIT(&p_osmt->log); 2879219820Sjeff return (status); 2880219820Sjeff} 2881219820Sjeff 2882219820Sjeff/********************************************************************** 2883219820Sjeff **********************************************************************/ 2884219820Sjeffstatic void 2885219820Sjeffosmtest_prepare_db_generic(IN osmtest_t * const p_osmt, 2886219820Sjeff IN cl_qmap_t * const p_tbl) 2887219820Sjeff{ 2888219820Sjeff generic_t *p_generic; 2889219820Sjeff 2890219820Sjeff OSM_LOG_ENTER(&p_osmt->log); 2891219820Sjeff 2892219820Sjeff p_generic = (generic_t *) cl_qmap_head(p_tbl); 2893219820Sjeff 2894219820Sjeff while (p_generic != (generic_t *) cl_qmap_end(p_tbl)) { 2895219820Sjeff p_generic->count = 0; 2896219820Sjeff p_generic = (generic_t *) cl_qmap_next(&p_generic->map_item); 2897219820Sjeff } 2898219820Sjeff 2899219820Sjeff OSM_LOG_EXIT(&p_osmt->log); 2900219820Sjeff} 2901219820Sjeff 2902219820Sjeff/********************************************************************** 2903219820Sjeff **********************************************************************/ 2904219820Sjeffstatic void osmtest_prepare_db(IN osmtest_t * const p_osmt) 2905219820Sjeff{ 2906219820Sjeff OSM_LOG_ENTER(&p_osmt->log); 2907219820Sjeff 2908219820Sjeff osmtest_prepare_db_generic(p_osmt, &p_osmt->exp_subn.node_lid_tbl); 2909219820Sjeff osmtest_prepare_db_generic(p_osmt, &p_osmt->exp_subn.path_tbl); 2910219820Sjeff 2911219820Sjeff OSM_LOG_EXIT(&p_osmt->log); 2912219820Sjeff} 2913219820Sjeff 2914219820Sjeff/********************************************************************** 2915219820Sjeff **********************************************************************/ 2916219820Sjeffstatic ib_api_status_t osmtest_check_missing_nodes(IN osmtest_t * const p_osmt) 2917219820Sjeff{ 2918219820Sjeff const node_t *p_node; 2919219820Sjeff cl_status_t status = IB_SUCCESS; 2920219820Sjeff cl_qmap_t *p_tbl; 2921219820Sjeff 2922219820Sjeff OSM_LOG_ENTER(&p_osmt->log); 2923219820Sjeff 2924219820Sjeff p_tbl = &p_osmt->exp_subn.node_lid_tbl; 2925219820Sjeff 2926219820Sjeff p_node = (node_t *) cl_qmap_head(p_tbl); 2927219820Sjeff 2928219820Sjeff while (p_node != (node_t *) cl_qmap_end(p_tbl)) { 2929219820Sjeff if (p_node->count == 0) { 2930219820Sjeff /* 2931219820Sjeff * This node was not reported by the SA 2932219820Sjeff */ 2933219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0080: " 2934219820Sjeff "Missing node 0x%016" PRIx64 "\n", 2935219820Sjeff cl_ntoh64(p_node->rec.node_info.node_guid)); 2936219820Sjeff status = IB_ERROR; 2937219820Sjeff } 2938219820Sjeff 2939219820Sjeff p_node = (node_t *) cl_qmap_next(&p_node->map_item); 2940219820Sjeff } 2941219820Sjeff 2942219820Sjeff OSM_LOG_EXIT(&p_osmt->log); 2943219820Sjeff return (status); 2944219820Sjeff} 2945219820Sjeff 2946219820Sjeff/********************************************************************** 2947219820Sjeff **********************************************************************/ 2948219820Sjeffstatic ib_api_status_t osmtest_check_missing_ports(IN osmtest_t * const p_osmt) 2949219820Sjeff{ 2950219820Sjeff const port_t *p_port; 2951219820Sjeff cl_status_t status = IB_SUCCESS; 2952219820Sjeff cl_qmap_t *p_tbl; 2953219820Sjeff 2954219820Sjeff OSM_LOG_ENTER(&p_osmt->log); 2955219820Sjeff 2956219820Sjeff p_tbl = &p_osmt->exp_subn.port_key_tbl; 2957219820Sjeff 2958219820Sjeff p_port = (port_t *) cl_qmap_head(p_tbl); 2959219820Sjeff 2960219820Sjeff while (p_port != (port_t *) cl_qmap_end(p_tbl)) { 2961219820Sjeff if (p_port->count == 0) { 2962219820Sjeff /* 2963219820Sjeff * This port was not reported by the SA 2964219820Sjeff */ 2965219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0081: " 2966219820Sjeff "Missing port LID:0x%X Num:0x%X\n", 2967219820Sjeff cl_ntoh16(p_port->rec.lid), 2968219820Sjeff p_port->rec.port_num); 2969219820Sjeff status = IB_ERROR; 2970219820Sjeff } 2971219820Sjeff 2972219820Sjeff p_port = (port_t *) cl_qmap_next(&p_port->map_item); 2973219820Sjeff } 2974219820Sjeff 2975219820Sjeff OSM_LOG_EXIT(&p_osmt->log); 2976219820Sjeff return (status); 2977219820Sjeff} 2978219820Sjeff 2979219820Sjeff/********************************************************************** 2980219820Sjeff **********************************************************************/ 2981219820Sjeffstatic ib_api_status_t osmtest_check_missing_paths(IN osmtest_t * const p_osmt) 2982219820Sjeff{ 2983219820Sjeff const path_t *p_path; 2984219820Sjeff cl_status_t status = IB_SUCCESS; 2985219820Sjeff cl_qmap_t *p_tbl; 2986219820Sjeff 2987219820Sjeff OSM_LOG_ENTER(&p_osmt->log); 2988219820Sjeff 2989219820Sjeff p_tbl = &p_osmt->exp_subn.path_tbl; 2990219820Sjeff 2991219820Sjeff p_path = (path_t *) cl_qmap_head(p_tbl); 2992219820Sjeff 2993219820Sjeff while (p_path != (path_t *) cl_qmap_end(p_tbl)) { 2994219820Sjeff if (p_path->count == 0) { 2995219820Sjeff /* 2996219820Sjeff * This path was not reported by the SA 2997219820Sjeff */ 2998219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0051: " 2999219820Sjeff "SA did not return path SLID 0x%X to DLID 0x%X\n", 3000219820Sjeff cl_ntoh16(p_path->rec.slid), 3001219820Sjeff cl_ntoh16(p_path->rec.dlid)); 3002219820Sjeff status = IB_ERROR; 3003219820Sjeff goto Exit; 3004219820Sjeff } 3005219820Sjeff 3006219820Sjeff p_path = (path_t *) cl_qmap_next(&p_path->map_item); 3007219820Sjeff } 3008219820Sjeff 3009219820SjeffExit: 3010219820Sjeff OSM_LOG_EXIT(&p_osmt->log); 3011219820Sjeff return (status); 3012219820Sjeff} 3013219820Sjeff 3014219820Sjeff/********************************************************************** 3015219820Sjeff **********************************************************************/ 3016276976Shselaskystatic inline uint32_t osmtest_path_rec_key_get(IN const ib_path_rec_t * const p_rec) 3017219820Sjeff{ 3018219820Sjeff return (p_rec->dlid << 16 | p_rec->slid); 3019219820Sjeff} 3020219820Sjeff 3021219820Sjeff/********************************************************************** 3022219820Sjeff **********************************************************************/ 3023219820Sjeffstatic boolean_t 3024219820Sjeffosmtest_path_rec_kay_is_valid(IN osmtest_t * const p_osmt, 3025219820Sjeff IN const path_t * const p_path) 3026219820Sjeff{ 3027219820Sjeff if ((p_path->comp.dlid == 0) || (p_path->comp.slid == 0)) { 3028219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0168: " 3029219820Sjeff "SLID and DLID must be specified for defined paths\n"); 3030219820Sjeff return (FALSE); 3031219820Sjeff } 3032219820Sjeff 3033219820Sjeff return (TRUE); 3034219820Sjeff} 3035219820Sjeff 3036219820Sjeff/********************************************************************** 3037219820Sjeff **********************************************************************/ 3038219820Sjeffstatic ib_api_status_t 3039219820Sjeffosmtest_validate_path_data(IN osmtest_t * const p_osmt, 3040219820Sjeff IN path_t * const p_path, 3041219820Sjeff IN const ib_path_rec_t * const p_rec) 3042219820Sjeff{ 3043219820Sjeff cl_status_t status = IB_SUCCESS; 3044219820Sjeff uint8_t lmc = 0; 3045219820Sjeff 3046219820Sjeff OSM_LOG_ENTER(&p_osmt->log); 3047219820Sjeff 3048219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, 3049219820Sjeff "Checking path SLID 0x%X to DLID 0x%X\n", 3050219820Sjeff cl_ntoh16(p_rec->slid), cl_ntoh16(p_rec->dlid)); 3051219820Sjeff 3052219820Sjeff status = 3053219820Sjeff osmtest_get_local_port_lmc(p_osmt, p_osmt->local_port.lid, &lmc); 3054219820Sjeff if (status != IB_SUCCESS) 3055219820Sjeff goto Exit; 3056219820Sjeff 3057219820Sjeff /* HACK: Assume uniform LMC across endports in the subnet */ 3058219820Sjeff /* This is the only LMC mode which OpenSM currently supports */ 3059219820Sjeff /* In absence of this assumption, validation of this is much more complicated */ 3060219820Sjeff if (lmc == 0) { 3061219820Sjeff /* 3062219820Sjeff * Has this record already been returned? 3063219820Sjeff */ 3064219820Sjeff if (p_path->count != 0) { 3065219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0056: " 3066219820Sjeff "Already received path SLID 0x%X to DLID 0x%X\n", 3067219820Sjeff cl_ntoh16(p_rec->slid), cl_ntoh16(p_rec->dlid)); 3068219820Sjeff status = IB_ERROR; 3069219820Sjeff goto Exit; 3070219820Sjeff } 3071219820Sjeff } else { 3072219820Sjeff /* Also, this doesn't detect fewer than the correct number of paths being returned */ 3073219820Sjeff if (p_path->count >= (uint32_t) (1 << (2 * lmc))) { 3074219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0052: " 3075219820Sjeff "Already received path SLID 0x%X to DLID 0x%X count %d LMC %d\n", 3076219820Sjeff cl_ntoh16(p_rec->slid), cl_ntoh16(p_rec->dlid), 3077219820Sjeff p_path->count, lmc); 3078219820Sjeff status = IB_ERROR; 3079219820Sjeff goto Exit; 3080219820Sjeff } 3081219820Sjeff } 3082219820Sjeff 3083219820Sjeff ++p_path->count; 3084219820Sjeff 3085219820Sjeff /* 3086219820Sjeff * Check the fields the user wants checked. 3087219820Sjeff */ 3088219820Sjeff if ((p_path->comp.dgid.unicast.interface_id & 3089219820Sjeff p_path->rec.dgid.unicast.interface_id) != 3090219820Sjeff (p_path->comp.dgid.unicast.interface_id & 3091219820Sjeff p_rec->dgid.unicast.interface_id)) { 3092219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0169: " 3093219820Sjeff "DGID mismatch on path SLID 0x%X to DLID 0x%X\n" 3094219820Sjeff "\t\t\t\tExpected 0x%016" PRIx64 " 0x%016" PRIx64 "\n" 3095219820Sjeff "\t\t\t\tReceived 0x%016" PRIx64 " 0x%016" PRIx64 "\n", 3096219820Sjeff cl_ntoh16(p_path->rec.slid), 3097219820Sjeff cl_ntoh16(p_path->rec.dlid), 3098219820Sjeff cl_ntoh64(p_path->rec.dgid.unicast.prefix), 3099219820Sjeff cl_ntoh64(p_path->rec.dgid.unicast.interface_id), 3100219820Sjeff cl_ntoh64(p_rec->dgid.unicast.prefix), 3101219820Sjeff cl_ntoh64(p_rec->dgid.unicast.interface_id)); 3102219820Sjeff status = IB_ERROR; 3103219820Sjeff goto Exit; 3104219820Sjeff } 3105219820Sjeff 3106219820Sjeff /* 3107219820Sjeff * Check the fields the user wants checked. 3108219820Sjeff */ 3109219820Sjeff if ((p_path->comp.sgid.unicast.interface_id & 3110219820Sjeff p_path->rec.sgid.unicast.interface_id) != 3111219820Sjeff (p_path->comp.sgid.unicast.interface_id & 3112219820Sjeff p_rec->sgid.unicast.interface_id)) { 3113219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0057: " 3114219820Sjeff "SGID mismatch on path SLID 0x%X to DLID 0x%X\n" 3115219820Sjeff "\t\t\t\tExpected 0x%016" PRIx64 " 0x%016" PRIx64 ",\n" 3116219820Sjeff "\t\t\t\tReceived 0x%016" PRIx64 " 0x%016" PRIx64 ".\n", 3117219820Sjeff cl_ntoh16(p_path->rec.slid), 3118219820Sjeff cl_ntoh16(p_path->rec.dlid), 3119219820Sjeff cl_ntoh64(p_path->rec.sgid.unicast.prefix), 3120219820Sjeff cl_ntoh64(p_path->rec.sgid.unicast.interface_id), 3121219820Sjeff cl_ntoh64(p_rec->sgid.unicast.prefix), 3122219820Sjeff cl_ntoh64(p_rec->sgid.unicast.interface_id)); 3123219820Sjeff status = IB_ERROR; 3124219820Sjeff goto Exit; 3125219820Sjeff } 3126219820Sjeff 3127219820Sjeff /* 3128219820Sjeff * Compare the fields the user wishes to validate. 3129219820Sjeff */ 3130219820Sjeff if ((p_path->comp.pkey & p_path->rec.pkey) != 3131219820Sjeff (p_path->comp.pkey & p_rec->pkey)) { 3132219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0012: " 3133219820Sjeff "PKEY mismatch on path SLID 0x%X to DLID 0x%X\n" 3134219820Sjeff "\t\t\t\tExpected 0x%X, received 0x%X\n", 3135219820Sjeff cl_ntoh16(p_path->rec.slid), 3136219820Sjeff cl_ntoh16(p_path->rec.dlid), 3137219820Sjeff cl_ntoh16(p_path->rec.pkey), cl_ntoh16(p_rec->pkey)); 3138219820Sjeff status = IB_ERROR; 3139219820Sjeff goto Exit; 3140219820Sjeff } 3141219820Sjeff 3142219820SjeffExit: 3143219820Sjeff OSM_LOG_EXIT(&p_osmt->log); 3144219820Sjeff return (status); 3145219820Sjeff} 3146219820Sjeff 3147219820Sjeff/********************************************************************** 3148219820Sjeff **********************************************************************/ 3149219820Sjeffstatic ib_api_status_t 3150219820Sjeffosmtest_validate_node_data(IN osmtest_t * const p_osmt, 3151219820Sjeff IN node_t * const p_node, 3152219820Sjeff IN const ib_node_record_t * const p_rec) 3153219820Sjeff{ 3154219820Sjeff cl_status_t status = IB_SUCCESS; 3155219820Sjeff 3156219820Sjeff OSM_LOG_ENTER(&p_osmt->log); 3157219820Sjeff 3158219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, 3159219820Sjeff "Checking node 0x%016" PRIx64 ", LID 0x%X\n", 3160219820Sjeff cl_ntoh64(p_rec->node_info.node_guid), cl_ntoh16(p_rec->lid)); 3161219820Sjeff 3162219820Sjeff /* 3163219820Sjeff * Has this record already been returned? 3164219820Sjeff */ 3165219820Sjeff if (p_node->count != 0) { 3166219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0013: " 3167219820Sjeff "Already received node 0x%016" PRIx64 "\n", 3168219820Sjeff cl_ntoh64(p_node->rec.node_info.node_guid)); 3169219820Sjeff status = IB_ERROR; 3170219820Sjeff goto Exit; 3171219820Sjeff } 3172219820Sjeff 3173219820Sjeff ++p_node->count; 3174219820Sjeff 3175219820Sjeff /* 3176219820Sjeff * Compare the fields the user wishes to validate. 3177219820Sjeff */ 3178219820Sjeff if ((p_node->comp.lid & p_node->rec.lid) != 3179219820Sjeff (p_node->comp.lid & p_rec->lid)) { 3180219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0014: " 3181219820Sjeff "Field mismatch node 0x%016" PRIx64 ", LID 0x%X\n" 3182219820Sjeff "\t\t\t\tExpected LID 0x%X, received 0x%X\n", 3183219820Sjeff cl_ntoh64(p_rec->node_info.node_guid), 3184219820Sjeff cl_ntoh16(p_rec->lid), p_node->rec.lid, p_rec->lid); 3185219820Sjeff status = IB_ERROR; 3186219820Sjeff goto Exit; 3187219820Sjeff } 3188219820Sjeff 3189219820Sjeff if ((p_node->comp.node_info.base_version & 3190219820Sjeff p_node->rec.node_info.base_version) != 3191219820Sjeff (p_node->comp.node_info.base_version & 3192219820Sjeff p_rec->node_info.base_version)) { 3193219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0015: " 3194219820Sjeff "Field mismatch node 0x%016" PRIx64 ", LID 0x%X\n" 3195219820Sjeff "\t\t\t\tExpected base_version 0x%X, received 0x%X\n", 3196219820Sjeff cl_ntoh64(p_rec->node_info.node_guid), 3197219820Sjeff cl_ntoh16(p_rec->lid), 3198219820Sjeff p_node->rec.node_info.base_version, 3199219820Sjeff p_rec->node_info.base_version); 3200219820Sjeff status = IB_ERROR; 3201219820Sjeff goto Exit; 3202219820Sjeff } 3203219820Sjeff 3204219820Sjeff if ((p_node->comp.node_info.class_version & 3205219820Sjeff p_node->rec.node_info.class_version) != 3206219820Sjeff (p_node->comp.node_info.class_version & 3207219820Sjeff p_rec->node_info.class_version)) { 3208219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0016: " 3209219820Sjeff "Field mismatch node 0x%016" PRIx64 ", LID 0x%X\n" 3210219820Sjeff "\t\t\t\tExpected class_version 0x%X, received 0x%X\n", 3211219820Sjeff cl_ntoh64(p_rec->node_info.node_guid), 3212219820Sjeff cl_ntoh16(p_rec->lid), 3213219820Sjeff p_node->rec.node_info.class_version, 3214219820Sjeff p_rec->node_info.class_version); 3215219820Sjeff status = IB_ERROR; 3216219820Sjeff goto Exit; 3217219820Sjeff } 3218219820Sjeff 3219219820Sjeff if ((p_node->comp.node_info.node_type & 3220219820Sjeff p_node->rec.node_info.node_type) != 3221219820Sjeff (p_node->comp.node_info.node_type & p_rec->node_info.node_type)) { 3222219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0017: " 3223219820Sjeff "Field mismatch node 0x%016" PRIx64 ", LID 0x%X\n" 3224219820Sjeff "\t\t\t\tExpected node_type 0x%X, received 0x%X\n", 3225219820Sjeff cl_ntoh64(p_rec->node_info.node_guid), 3226219820Sjeff cl_ntoh16(p_rec->lid), 3227219820Sjeff p_node->rec.node_info.node_type, 3228219820Sjeff p_rec->node_info.node_type); 3229219820Sjeff status = IB_ERROR; 3230219820Sjeff goto Exit; 3231219820Sjeff } 3232219820Sjeff 3233219820Sjeff if ((p_node->comp.node_info.sys_guid & 3234219820Sjeff p_node->rec.node_info.sys_guid) != 3235219820Sjeff (p_node->comp.node_info.sys_guid & p_rec->node_info.sys_guid)) { 3236219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0018: " 3237219820Sjeff "Field mismatch node 0x%016" PRIx64 ", LID 0x%X\n" 3238219820Sjeff "\t\t\t\tExpected sys_guid 0x%016" PRIx64 3239219820Sjeff ", received 0x%016" PRIx64 "\n", 3240219820Sjeff cl_ntoh64(p_rec->node_info.node_guid), 3241219820Sjeff cl_ntoh16(p_rec->lid), 3242219820Sjeff cl_ntoh64(p_node->rec.node_info.sys_guid), 3243219820Sjeff cl_ntoh64(p_rec->node_info.sys_guid)); 3244219820Sjeff status = IB_ERROR; 3245219820Sjeff goto Exit; 3246219820Sjeff } 3247219820Sjeff 3248219820Sjeff if ((p_node->comp.node_info.node_guid & 3249219820Sjeff p_node->rec.node_info.node_guid) != 3250219820Sjeff (p_node->comp.node_info.node_guid & p_rec->node_info.node_guid)) { 3251219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0019: " 3252219820Sjeff "Field mismatch node 0x%016" PRIx64 ", LID 0x%X\n" 3253219820Sjeff "\t\t\t\tExpected node_guid 0x%016" PRIx64 3254219820Sjeff ", received 0x%016" PRIx64 "\n", 3255219820Sjeff cl_ntoh64(p_rec->node_info.node_guid), 3256219820Sjeff cl_ntoh16(p_rec->lid), 3257219820Sjeff cl_ntoh64(p_node->rec.node_info.node_guid), 3258219820Sjeff cl_ntoh64(p_rec->node_info.node_guid)); 3259219820Sjeff status = IB_ERROR; 3260219820Sjeff goto Exit; 3261219820Sjeff } 3262219820Sjeff 3263219820Sjeff if ((p_node->comp.node_info.port_guid & 3264219820Sjeff p_node->rec.node_info.port_guid) != 3265219820Sjeff (p_node->comp.node_info.port_guid & p_rec->node_info.port_guid)) { 3266219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0031: " 3267219820Sjeff "Field mismatch node 0x%016" PRIx64 ", LID 0x%X\n" 3268219820Sjeff "\t\t\t\tExpected port_guid 0x%016" PRIx64 3269219820Sjeff ", received 0x%016" PRIx64 "\n", 3270219820Sjeff cl_ntoh64(p_rec->node_info.node_guid), 3271219820Sjeff cl_ntoh16(p_rec->lid), 3272219820Sjeff cl_ntoh64(p_node->rec.node_info.port_guid), 3273219820Sjeff cl_ntoh64(p_rec->node_info.port_guid)); 3274219820Sjeff status = IB_ERROR; 3275219820Sjeff goto Exit; 3276219820Sjeff } 3277219820Sjeff 3278219820Sjeff if ((p_node->comp.node_info.partition_cap & 3279219820Sjeff p_node->rec.node_info.partition_cap) != 3280219820Sjeff (p_node->comp.node_info.partition_cap & 3281219820Sjeff p_rec->node_info.partition_cap)) { 3282219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0032: " 3283219820Sjeff "Field mismatch node 0x%016" PRIx64 ", LID 0x%X\n" 3284219820Sjeff "\t\t\t\tExpected partition_cap 0x%X, received 0x%X\n", 3285219820Sjeff cl_ntoh64(p_rec->node_info.node_guid), 3286219820Sjeff cl_ntoh16(p_rec->lid), 3287219820Sjeff cl_ntoh16(p_node->rec.node_info.partition_cap), 3288219820Sjeff cl_ntoh16(p_rec->node_info.partition_cap)); 3289219820Sjeff status = IB_ERROR; 3290219820Sjeff goto Exit; 3291219820Sjeff } 3292219820Sjeff 3293219820Sjeff if ((p_node->comp.node_info.device_id & 3294219820Sjeff p_node->rec.node_info.device_id) != 3295219820Sjeff (p_node->comp.node_info.device_id & p_rec->node_info.device_id)) { 3296219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0033: " 3297219820Sjeff "Field mismatch node 0x%016" PRIx64 ", LID 0x%X\n" 3298219820Sjeff "\t\t\t\tExpected device_id 0x%X, received 0x%X\n", 3299219820Sjeff cl_ntoh64(p_rec->node_info.node_guid), 3300219820Sjeff cl_ntoh16(p_rec->lid), 3301219820Sjeff cl_ntoh16(p_node->rec.node_info.device_id), 3302219820Sjeff cl_ntoh16(p_rec->node_info.device_id)); 3303219820Sjeff status = IB_ERROR; 3304219820Sjeff goto Exit; 3305219820Sjeff } 3306219820Sjeff 3307219820Sjeff if ((p_node->comp.node_info.revision & 3308219820Sjeff p_node->rec.node_info.revision) != 3309219820Sjeff (p_node->comp.node_info.revision & p_rec->node_info.revision)) { 3310219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0034: " 3311219820Sjeff "Field mismatch node 0x%016" PRIx64 ", LID 0x%X\n" 3312219820Sjeff "\t\t\t\tExpected revision 0x%X, received 0x%X\n", 3313219820Sjeff cl_ntoh64(p_rec->node_info.node_guid), 3314219820Sjeff cl_ntoh16(p_rec->lid), 3315219820Sjeff cl_ntoh32(p_node->rec.node_info.revision), 3316219820Sjeff cl_ntoh32(p_rec->node_info.revision)); 3317219820Sjeff status = IB_ERROR; 3318219820Sjeff goto Exit; 3319219820Sjeff } 3320219820Sjeff 3321219820SjeffExit: 3322219820Sjeff OSM_LOG_EXIT(&p_osmt->log); 3323219820Sjeff return (status); 3324219820Sjeff} 3325219820Sjeff 3326219820Sjeff/********************************************************************** 3327219820Sjeff **********************************************************************/ 3328219820Sjeffstatic ib_api_status_t 3329219820Sjeffosmtest_validate_node_rec(IN osmtest_t * const p_osmt, 3330219820Sjeff IN const ib_node_record_t * const p_rec) 3331219820Sjeff{ 3332219820Sjeff cl_status_t status = IB_SUCCESS; 3333219820Sjeff node_t *p_node; 3334219820Sjeff const cl_qmap_t *p_tbl; 3335219820Sjeff 3336219820Sjeff OSM_LOG_ENTER(&p_osmt->log); 3337219820Sjeff 3338219820Sjeff /* 3339219820Sjeff * Find proper node record in the database. 3340219820Sjeff */ 3341219820Sjeff p_tbl = &p_osmt->exp_subn.node_lid_tbl; 3342219820Sjeff p_node = (node_t *) cl_qmap_get(p_tbl, p_rec->lid); 3343219820Sjeff if (p_node == (node_t *) cl_qmap_end(p_tbl)) { 3344219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0035: " 3345219820Sjeff "Unexpected node 0x%016" PRIx64 ", LID 0x%X\n", 3346219820Sjeff cl_ntoh64(p_rec->node_info.node_guid), 3347219820Sjeff cl_ntoh16(p_rec->lid)); 3348219820Sjeff status = IB_ERROR; 3349219820Sjeff goto Exit; 3350219820Sjeff } 3351219820Sjeff 3352219820Sjeff status = osmtest_validate_node_data(p_osmt, p_node, p_rec); 3353219820Sjeff 3354219820SjeffExit: 3355219820Sjeff OSM_LOG_EXIT(&p_osmt->log); 3356219820Sjeff return (status); 3357219820Sjeff} 3358219820Sjeff 3359219820Sjeff/********************************************************************** 3360219820Sjeff **********************************************************************/ 3361219820Sjeffstatic ib_api_status_t 3362219820Sjeffosmtest_validate_port_data(IN osmtest_t * const p_osmt, 3363219820Sjeff IN port_t * const p_port, 3364219820Sjeff IN const ib_portinfo_record_t * const p_rec) 3365219820Sjeff{ 3366219820Sjeff cl_status_t status = IB_SUCCESS; 3367219820Sjeff 3368219820Sjeff OSM_LOG_ENTER(&p_osmt->log); 3369219820Sjeff 3370219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, 3371219820Sjeff "Checking port LID 0x%X, Num 0x%X\n", 3372219820Sjeff cl_ntoh16(p_rec->lid), p_rec->port_num); 3373219820Sjeff 3374219820Sjeff /* 3375219820Sjeff * Has this record already been returned? 3376219820Sjeff */ 3377219820Sjeff if (p_port->count != 0) { 3378219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0036: " 3379219820Sjeff "Already received port LID 0x%X, Num 0x%X\n", 3380219820Sjeff cl_ntoh16(p_rec->lid), p_rec->port_num); 3381219820Sjeff status = IB_ERROR; 3382219820Sjeff goto Exit; 3383219820Sjeff } 3384219820Sjeff 3385219820Sjeff ++p_port->count; 3386219820Sjeff 3387219820Sjeff /* 3388219820Sjeff * Compare the fields the user wishes to validate. 3389219820Sjeff */ 3390219820Sjeff if ((p_port->comp.lid & p_port->rec.lid) != 3391219820Sjeff (p_port->comp.lid & p_rec->lid)) { 3392219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0037: " 3393219820Sjeff "Field mismatch port LID 0x%X Num:0x%X\n" 3394219820Sjeff "\t\t\t\tExpected LID 0x%X, received 0x%X\n", 3395219820Sjeff cl_ntoh16(p_rec->lid), p_rec->port_num, 3396219820Sjeff p_port->rec.lid, p_rec->lid); 3397219820Sjeff status = IB_ERROR; 3398219820Sjeff goto Exit; 3399219820Sjeff } 3400219820Sjeff 3401219820Sjeff if ((p_port->comp.port_num & p_port->rec.port_num) != 3402219820Sjeff (p_port->comp.port_num & p_rec->port_num)) { 3403219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0038: " 3404219820Sjeff "Field mismatch port LID 0x%X Num:0x%X\n" 3405219820Sjeff "\t\t\t\tExpected port_num 0x%X, received 0x%X\n", 3406219820Sjeff cl_ntoh16(p_rec->lid), p_rec->port_num, 3407219820Sjeff p_port->rec.port_num, p_rec->port_num); 3408219820Sjeff status = IB_ERROR; 3409219820Sjeff goto Exit; 3410219820Sjeff } 3411219820Sjeff 3412219820Sjeff if ((p_port->comp.port_info.m_key & p_port->rec.port_info.m_key) != 3413219820Sjeff (p_port->comp.port_info.m_key & p_rec->port_info.m_key)) { 3414219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0039: " 3415219820Sjeff "Field mismatch port LID 0x%X Num:0x%X\n" 3416219820Sjeff "\t\t\t\tExpected m_key 0x%016" PRIx64 3417219820Sjeff ", received 0x%016" PRIx64 "\n", cl_ntoh16(p_rec->lid), 3418219820Sjeff p_rec->port_num, p_port->rec.port_info.m_key, 3419219820Sjeff p_rec->port_info.m_key); 3420219820Sjeff status = IB_ERROR; 3421219820Sjeff goto Exit; 3422219820Sjeff } 3423219820Sjeff 3424219820Sjeff if ((p_port->comp.port_info.subnet_prefix & p_port->rec.port_info. 3425219820Sjeff subnet_prefix) != 3426219820Sjeff (p_port->comp.port_info.subnet_prefix & p_rec->port_info. 3427219820Sjeff subnet_prefix)) { 3428219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0040: " 3429219820Sjeff "Field mismatch port LID 0x%X Num:0x%X\n" 3430219820Sjeff "\t\t\t\tExpected subnet_prefix 0x%016" PRIx64 3431219820Sjeff ", received 0x%016" PRIx64 "\n", cl_ntoh16(p_rec->lid), 3432219820Sjeff p_rec->port_num, p_port->rec.port_info.subnet_prefix, 3433219820Sjeff p_rec->port_info.subnet_prefix); 3434219820Sjeff status = IB_ERROR; 3435219820Sjeff goto Exit; 3436219820Sjeff } 3437219820Sjeff 3438219820Sjeff if ((p_port->comp.port_info.base_lid & p_port->rec.port_info. 3439219820Sjeff base_lid) != 3440219820Sjeff (p_port->comp.port_info.base_lid & p_rec->port_info.base_lid)) { 3441219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0041: " 3442219820Sjeff "Field mismatch port LID 0x%X Num:0x%X\n" 3443219820Sjeff "\t\t\t\tExpected base_lid 0x%X, received 0x%X\n", 3444219820Sjeff cl_ntoh16(p_rec->lid), p_rec->port_num, 3445219820Sjeff p_port->rec.port_info.base_lid, 3446219820Sjeff p_rec->port_info.base_lid); 3447219820Sjeff status = IB_ERROR; 3448219820Sjeff goto Exit; 3449219820Sjeff } 3450219820Sjeff 3451219820Sjeff if ((p_port->comp.port_info.master_sm_base_lid & p_port->rec.port_info. 3452219820Sjeff master_sm_base_lid) != 3453219820Sjeff (p_port->comp.port_info.master_sm_base_lid & p_rec->port_info. 3454219820Sjeff master_sm_base_lid)) { 3455219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0042: " 3456219820Sjeff "Field mismatch port LID 0x%X Num:0x%X\n" 3457219820Sjeff "\t\t\t\tExpected master_sm_base_lid 0x%X, received 0x%X\n", 3458219820Sjeff cl_ntoh16(p_rec->lid), p_rec->port_num, 3459219820Sjeff p_port->rec.port_info.master_sm_base_lid, 3460219820Sjeff p_rec->port_info.master_sm_base_lid); 3461219820Sjeff status = IB_ERROR; 3462219820Sjeff goto Exit; 3463219820Sjeff } 3464219820Sjeff 3465219820Sjeff if ((p_port->comp.port_info.capability_mask & p_port->rec.port_info. 3466219820Sjeff capability_mask) != 3467219820Sjeff (p_port->comp.port_info.capability_mask & p_rec->port_info. 3468219820Sjeff capability_mask)) { 3469219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0043: " 3470219820Sjeff "Field mismatch port LID 0x%X Num:0x%X\n" 3471219820Sjeff "\t\t\t\tExpected capability_mask 0x%X, received 0x%X\n", 3472219820Sjeff cl_ntoh16(p_rec->lid), p_rec->port_num, 3473219820Sjeff cl_ntoh32(p_port->rec.port_info.capability_mask), 3474219820Sjeff cl_ntoh32(p_rec->port_info.capability_mask)); 3475219820Sjeff status = IB_ERROR; 3476219820Sjeff goto Exit; 3477219820Sjeff } 3478219820Sjeff 3479219820Sjeff if ((p_port->comp.port_info.diag_code & p_port->rec.port_info. 3480219820Sjeff diag_code) != 3481219820Sjeff (p_port->comp.port_info.diag_code & p_rec->port_info.diag_code)) { 3482219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0044: " 3483219820Sjeff "Field mismatch port LID 0x%X Num:0x%X\n" 3484219820Sjeff "\t\t\t\tExpected diag_code 0x%X, received 0x%X\n", 3485219820Sjeff cl_ntoh16(p_rec->lid), p_rec->port_num, 3486219820Sjeff p_port->rec.port_info.diag_code, 3487219820Sjeff p_rec->port_info.diag_code); 3488219820Sjeff status = IB_ERROR; 3489219820Sjeff goto Exit; 3490219820Sjeff } 3491219820Sjeff 3492219820Sjeff if ((p_port->comp.port_info.m_key_lease_period & p_port->rec.port_info. 3493219820Sjeff m_key_lease_period) != 3494219820Sjeff (p_port->comp.port_info.m_key_lease_period & p_rec->port_info. 3495219820Sjeff m_key_lease_period)) { 3496219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0045: " 3497219820Sjeff "Field mismatch port LID 0x%X Num:0x%X\n" 3498219820Sjeff "\t\t\t\tExpected m_key_lease_period 0x%X, received 0x%X\n", 3499219820Sjeff cl_ntoh16(p_rec->lid), p_rec->port_num, 3500219820Sjeff p_port->rec.port_info.m_key_lease_period, 3501219820Sjeff p_rec->port_info.m_key_lease_period); 3502219820Sjeff status = IB_ERROR; 3503219820Sjeff goto Exit; 3504219820Sjeff } 3505219820Sjeff 3506219820Sjeff if ((p_port->comp.port_info.local_port_num & p_port->rec.port_info. 3507219820Sjeff local_port_num) != 3508219820Sjeff (p_port->comp.port_info.local_port_num & p_rec->port_info. 3509219820Sjeff local_port_num)) { 3510219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0046: " 3511219820Sjeff "Field mismatch port LID 0x%X Num:0x%X\n" 3512219820Sjeff "\t\t\t\tExpected local_port_num 0x%X, received 0x%X\n", 3513219820Sjeff cl_ntoh16(p_rec->lid), p_rec->port_num, 3514219820Sjeff p_port->rec.port_info.local_port_num, 3515219820Sjeff p_rec->port_info.local_port_num); 3516219820Sjeff status = IB_ERROR; 3517219820Sjeff goto Exit; 3518219820Sjeff } 3519219820Sjeff 3520219820Sjeff if ((p_port->comp.port_info.link_width_enabled & p_port->rec.port_info. 3521219820Sjeff link_width_enabled) != 3522219820Sjeff (p_port->comp.port_info.link_width_enabled & p_rec->port_info. 3523219820Sjeff link_width_enabled)) { 3524219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0047: " 3525219820Sjeff "Field mismatch port LID 0x%X Num:0x%X\n" 3526219820Sjeff "\t\t\t\tExpected link_width_enabled 0x%X, received 0x%X\n", 3527219820Sjeff cl_ntoh16(p_rec->lid), p_rec->port_num, 3528219820Sjeff p_port->rec.port_info.link_width_enabled, 3529219820Sjeff p_rec->port_info.link_width_enabled); 3530219820Sjeff status = IB_ERROR; 3531219820Sjeff goto Exit; 3532219820Sjeff } 3533219820Sjeff 3534219820Sjeff if ((p_port->comp.port_info.link_width_supported & p_port->rec. 3535219820Sjeff port_info.link_width_supported) != 3536219820Sjeff (p_port->comp.port_info.link_width_supported & p_rec->port_info. 3537219820Sjeff link_width_supported)) { 3538219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0048: " 3539219820Sjeff "Field mismatch port LID 0x%X Num:0x%X\n" 3540219820Sjeff "\t\t\t\tExpected link_width_supported 0x%X, received 0x%X\n", 3541219820Sjeff cl_ntoh16(p_rec->lid), p_rec->port_num, 3542219820Sjeff p_port->rec.port_info.link_width_supported, 3543219820Sjeff p_rec->port_info.link_width_supported); 3544219820Sjeff status = IB_ERROR; 3545219820Sjeff goto Exit; 3546219820Sjeff } 3547219820Sjeff 3548219820Sjeff if ((p_port->comp.port_info.link_width_active & p_port->rec.port_info. 3549219820Sjeff link_width_active) != 3550219820Sjeff (p_port->comp.port_info.link_width_active & p_rec->port_info. 3551219820Sjeff link_width_active)) { 3552219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0049: " 3553219820Sjeff "Field mismatch port LID 0x%X Num:0x%X\n" 3554219820Sjeff "\t\t\t\tExpected link_width_active 0x%X, received 0x%X\n", 3555219820Sjeff cl_ntoh16(p_rec->lid), p_rec->port_num, 3556219820Sjeff p_port->rec.port_info.link_width_active, 3557219820Sjeff p_rec->port_info.link_width_active); 3558219820Sjeff status = IB_ERROR; 3559219820Sjeff goto Exit; 3560219820Sjeff } 3561219820Sjeff 3562219820Sjeff if ((p_port->comp.port_info.link_speed & p_port->rec.port_info. 3563219820Sjeff link_speed) != 3564219820Sjeff (p_port->comp.port_info.link_speed & p_rec->port_info.link_speed)) { 3565219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0054: " 3566219820Sjeff "Field mismatch port LID 0x%X Num:0x%X\n" 3567219820Sjeff "\t\t\t\tExpected link_speed 0x%X, received 0x%X\n", 3568219820Sjeff cl_ntoh16(p_rec->lid), p_rec->port_num, 3569219820Sjeff p_port->rec.port_info.link_speed, 3570219820Sjeff p_rec->port_info.link_speed); 3571219820Sjeff status = IB_ERROR; 3572219820Sjeff goto Exit; 3573219820Sjeff } 3574219820Sjeff 3575219820Sjeff if ((p_port->comp.port_info.state_info1 & p_port->rec.port_info. 3576219820Sjeff state_info1) != 3577219820Sjeff (p_port->comp.port_info.state_info1 & p_rec->port_info. 3578219820Sjeff state_info1)) { 3579219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0055: " 3580219820Sjeff "Field mismatch port LID 0x%X Num:0x%X\n" 3581219820Sjeff "\t\t\t\tExpected state_info1 0x%X, received 0x%X\n", 3582219820Sjeff cl_ntoh16(p_rec->lid), p_rec->port_num, 3583219820Sjeff p_port->rec.port_info.state_info1, 3584219820Sjeff p_rec->port_info.state_info1); 3585219820Sjeff status = IB_ERROR; 3586219820Sjeff goto Exit; 3587219820Sjeff } 3588219820Sjeff 3589219820Sjeff if ((p_port->comp.port_info.state_info2 & p_port->rec.port_info. 3590219820Sjeff state_info2) != 3591219820Sjeff (p_port->comp.port_info.state_info2 & p_rec->port_info. 3592219820Sjeff state_info2)) { 3593219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0058: " 3594219820Sjeff "Field mismatch port LID 0x%X Num:0x%X\n" 3595219820Sjeff "\t\t\t\tExpected state_info2 0x%X, received 0x%X\n", 3596219820Sjeff cl_ntoh16(p_rec->lid), p_rec->port_num, 3597219820Sjeff p_port->rec.port_info.state_info2, 3598219820Sjeff p_rec->port_info.state_info2); 3599219820Sjeff status = IB_ERROR; 3600219820Sjeff goto Exit; 3601219820Sjeff } 3602219820Sjeff 3603219820Sjeff if ((p_port->comp.port_info.mkey_lmc & p_port->rec.port_info. 3604219820Sjeff mkey_lmc) != 3605219820Sjeff (p_port->comp.port_info.mkey_lmc & p_rec->port_info.mkey_lmc)) { 3606219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0059: " 3607219820Sjeff "Field mismatch port LID 0x%X Num:0x%X\n" 3608219820Sjeff "\t\t\t\tExpected mkey_lmc 0x%X, received 0x%X\n", 3609219820Sjeff cl_ntoh16(p_rec->lid), p_rec->port_num, 3610219820Sjeff p_port->rec.port_info.mkey_lmc, 3611219820Sjeff p_rec->port_info.mkey_lmc); 3612219820Sjeff status = IB_ERROR; 3613219820Sjeff goto Exit; 3614219820Sjeff } 3615219820Sjeff 3616219820Sjeff if ((p_port->comp.port_info.link_speed & p_port->rec.port_info. 3617219820Sjeff link_speed) != 3618219820Sjeff (p_port->comp.port_info.link_speed & p_rec->port_info.link_speed)) { 3619219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0060: " 3620219820Sjeff "Field mismatch port LID 0x%X Num:0x%X\n" 3621219820Sjeff "\t\t\t\tExpected link_speed 0x%X, received 0x%X\n", 3622219820Sjeff cl_ntoh16(p_rec->lid), p_rec->port_num, 3623219820Sjeff p_port->rec.port_info.link_speed, 3624219820Sjeff p_rec->port_info.link_speed); 3625219820Sjeff status = IB_ERROR; 3626219820Sjeff goto Exit; 3627219820Sjeff } 3628219820Sjeff 3629219820Sjeff if ((p_port->comp.port_info.mtu_smsl & p_port->rec.port_info. 3630219820Sjeff mtu_smsl) != 3631219820Sjeff (p_port->comp.port_info.mtu_smsl & p_rec->port_info.mtu_smsl)) { 3632219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0061: " 3633219820Sjeff "Field mismatch port LID 0x%X Num:0x%X\n" 3634219820Sjeff "\t\t\t\tExpected mtu_smsl 0x%X, received 0x%X\n", 3635219820Sjeff cl_ntoh16(p_rec->lid), p_rec->port_num, 3636219820Sjeff p_port->rec.port_info.mtu_smsl, 3637219820Sjeff p_rec->port_info.mtu_smsl); 3638219820Sjeff status = IB_ERROR; 3639219820Sjeff goto Exit; 3640219820Sjeff } 3641219820Sjeff 3642219820Sjeff if ((p_port->comp.port_info.vl_cap & p_port->rec.port_info.vl_cap) != 3643219820Sjeff (p_port->comp.port_info.vl_cap & p_rec->port_info.vl_cap)) { 3644219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0062: " 3645219820Sjeff "Field mismatch port LID 0x%X Num:0x%X\n" 3646219820Sjeff "\t\t\t\tExpected vl_cap 0x%X, received 0x%X\n", 3647219820Sjeff cl_ntoh16(p_rec->lid), p_rec->port_num, 3648219820Sjeff p_port->rec.port_info.vl_cap, p_rec->port_info.vl_cap); 3649219820Sjeff status = IB_ERROR; 3650219820Sjeff goto Exit; 3651219820Sjeff } 3652219820Sjeff 3653219820Sjeff if ((p_port->comp.port_info.vl_high_limit & p_port->rec.port_info. 3654219820Sjeff vl_high_limit) != 3655219820Sjeff (p_port->comp.port_info.vl_high_limit & p_rec->port_info. 3656219820Sjeff vl_high_limit)) { 3657219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0082: " 3658219820Sjeff "Field mismatch port LID 0x%X Num:0x%X\n" 3659219820Sjeff "\t\t\t\tExpected vl_high_limit 0x%X, received 0x%X\n", 3660219820Sjeff cl_ntoh16(p_rec->lid), p_rec->port_num, 3661219820Sjeff p_port->rec.port_info.vl_high_limit, 3662219820Sjeff p_rec->port_info.vl_high_limit); 3663219820Sjeff status = IB_ERROR; 3664219820Sjeff goto Exit; 3665219820Sjeff } 3666219820Sjeff 3667219820Sjeff if ((p_port->comp.port_info.vl_arb_high_cap & p_port->rec.port_info. 3668219820Sjeff vl_arb_high_cap) != 3669219820Sjeff (p_port->comp.port_info.vl_arb_high_cap & p_rec->port_info. 3670219820Sjeff vl_arb_high_cap)) { 3671219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0083: " 3672219820Sjeff "Field mismatch port LID 0x%X Num:0x%X\n" 3673219820Sjeff "\t\t\t\tExpected vl_arb_high_cap 0x%X, received 0x%X\n", 3674219820Sjeff cl_ntoh16(p_rec->lid), p_rec->port_num, 3675219820Sjeff p_port->rec.port_info.vl_arb_high_cap, 3676219820Sjeff p_rec->port_info.vl_arb_high_cap); 3677219820Sjeff status = IB_ERROR; 3678219820Sjeff goto Exit; 3679219820Sjeff } 3680219820Sjeff 3681219820Sjeff if ((p_port->comp.port_info.vl_arb_low_cap & p_port->rec.port_info. 3682219820Sjeff vl_arb_low_cap) != 3683219820Sjeff (p_port->comp.port_info.vl_arb_low_cap & p_rec->port_info. 3684219820Sjeff vl_arb_low_cap)) { 3685219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0084: " 3686219820Sjeff "Field mismatch port LID 0x%X Num:0x%X\n" 3687219820Sjeff "\t\t\t\tExpected vl_arb_low_cap 0x%X, received 0x%X\n", 3688219820Sjeff cl_ntoh16(p_rec->lid), p_rec->port_num, 3689219820Sjeff p_port->rec.port_info.vl_arb_low_cap, 3690219820Sjeff p_rec->port_info.vl_arb_low_cap); 3691219820Sjeff status = IB_ERROR; 3692219820Sjeff goto Exit; 3693219820Sjeff } 3694219820Sjeff 3695219820Sjeff if ((p_port->comp.port_info.mtu_cap & p_port->rec.port_info.mtu_cap) != 3696219820Sjeff (p_port->comp.port_info.mtu_cap & p_rec->port_info.mtu_cap)) { 3697219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0085: " 3698219820Sjeff "Field mismatch port LID 0x%X Num:0x%X\n" 3699219820Sjeff "\t\t\t\tExpected mtu_cap 0x%X, received 0x%X\n", 3700219820Sjeff cl_ntoh16(p_rec->lid), p_rec->port_num, 3701219820Sjeff p_port->rec.port_info.mtu_cap, 3702219820Sjeff p_rec->port_info.mtu_cap); 3703219820Sjeff status = IB_ERROR; 3704219820Sjeff goto Exit; 3705219820Sjeff } 3706219820Sjeff#if 0 3707219820Sjeff /* this is a dynamic attribute */ 3708219820Sjeff if ((p_port->comp.port_info.vl_stall_life & p_port->rec.port_info. 3709219820Sjeff vl_stall_life) != 3710219820Sjeff (p_port->comp.port_info.vl_stall_life & p_rec->port_info. 3711219820Sjeff vl_stall_life)) { 3712219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 012F: " 3713219820Sjeff "Field mismatch port LID 0x%X Num:0x%X\n" 3714219820Sjeff "\t\t\t\tExpected vl_stall_life 0x%X, received 0x%X\n", 3715219820Sjeff cl_ntoh16(p_rec->lid), p_rec->port_num, 3716219820Sjeff p_port->rec.port_info.vl_stall_life, 3717219820Sjeff p_rec->port_info.vl_stall_life); 3718219820Sjeff status = IB_ERROR; 3719219820Sjeff goto Exit; 3720219820Sjeff } 3721219820Sjeff#endif 3722219820Sjeff 3723219820Sjeff if ((p_port->comp.port_info.vl_enforce & p_port->rec.port_info. 3724219820Sjeff vl_enforce) != 3725219820Sjeff (p_port->comp.port_info.vl_enforce & p_rec->port_info.vl_enforce)) { 3726219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0086: " 3727219820Sjeff "Field mismatch port LID 0x%X Num:0x%X\n" 3728219820Sjeff "\t\t\t\tExpected vl_enforce 0x%X, received 0x%X\n", 3729219820Sjeff cl_ntoh16(p_rec->lid), p_rec->port_num, 3730219820Sjeff p_port->rec.port_info.vl_enforce, 3731219820Sjeff p_rec->port_info.vl_enforce); 3732219820Sjeff status = IB_ERROR; 3733219820Sjeff goto Exit; 3734219820Sjeff } 3735219820Sjeff 3736219820Sjeff if ((p_port->comp.port_info.m_key_violations & p_port->rec.port_info. 3737219820Sjeff m_key_violations) != 3738219820Sjeff (p_port->comp.port_info.m_key_violations & p_rec->port_info. 3739219820Sjeff m_key_violations)) { 3740219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0087: " 3741219820Sjeff "Field mismatch port LID 0x%X Num:0x%X\n" 3742219820Sjeff "\t\t\t\tExpected m_key_violations 0x%X, received 0x%X\n", 3743219820Sjeff cl_ntoh16(p_rec->lid), p_rec->port_num, 3744219820Sjeff cl_ntoh16(p_port->rec.port_info.m_key_violations), 3745219820Sjeff cl_ntoh16(p_rec->port_info.m_key_violations)); 3746219820Sjeff status = IB_ERROR; 3747219820Sjeff goto Exit; 3748219820Sjeff } 3749219820Sjeff 3750219820Sjeff if ((p_port->comp.port_info.p_key_violations & p_port->rec.port_info. 3751219820Sjeff p_key_violations) != 3752219820Sjeff (p_port->comp.port_info.p_key_violations & p_rec->port_info. 3753219820Sjeff p_key_violations)) { 3754219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0088: " 3755219820Sjeff "Field mismatch port LID 0x%X Num:0x%X\n" 3756219820Sjeff "\t\t\t\tExpected p_key_violations 0x%X, received 0x%X\n", 3757219820Sjeff cl_ntoh16(p_rec->lid), p_rec->port_num, 3758219820Sjeff cl_ntoh16(p_port->rec.port_info.p_key_violations), 3759219820Sjeff cl_ntoh16(p_rec->port_info.p_key_violations)); 3760219820Sjeff status = IB_ERROR; 3761219820Sjeff goto Exit; 3762219820Sjeff } 3763219820Sjeff 3764219820Sjeff if ((p_port->comp.port_info.q_key_violations & p_port->rec.port_info. 3765219820Sjeff q_key_violations) != 3766219820Sjeff (p_port->comp.port_info.q_key_violations & p_rec->port_info. 3767219820Sjeff q_key_violations)) { 3768219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0089: " 3769219820Sjeff "Field mismatch port LID 0x%X Num:0x%X\n" 3770219820Sjeff "\t\t\t\tExpected q_key_violations 0x%X, received 0x%X\n", 3771219820Sjeff cl_ntoh16(p_rec->lid), p_rec->port_num, 3772219820Sjeff cl_ntoh16(p_port->rec.port_info.q_key_violations), 3773219820Sjeff cl_ntoh16(p_rec->port_info.q_key_violations)); 3774219820Sjeff status = IB_ERROR; 3775219820Sjeff goto Exit; 3776219820Sjeff } 3777219820Sjeff 3778219820Sjeff if ((p_port->comp.port_info.guid_cap & p_port->rec.port_info. 3779219820Sjeff guid_cap) != 3780219820Sjeff (p_port->comp.port_info.guid_cap & p_rec->port_info.guid_cap)) { 3781219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0090: " 3782219820Sjeff "Field mismatch port LID 0x%X Num:0x%X\n" 3783219820Sjeff "\t\t\t\tExpected guid_cap 0x%X, received 0x%X\n", 3784219820Sjeff cl_ntoh16(p_rec->lid), p_rec->port_num, 3785219820Sjeff p_port->rec.port_info.guid_cap, 3786219820Sjeff p_rec->port_info.guid_cap); 3787219820Sjeff status = IB_ERROR; 3788219820Sjeff goto Exit; 3789219820Sjeff } 3790219820Sjeff 3791219820Sjeff if ((p_port->comp.port_info.subnet_timeout & p_port->rec.port_info. 3792219820Sjeff subnet_timeout) != 3793219820Sjeff (p_port->comp.port_info.subnet_timeout & p_rec->port_info. 3794219820Sjeff subnet_timeout)) { 3795219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0091: " 3796219820Sjeff "Field mismatch port LID 0x%X Num:0x%X\n" 3797219820Sjeff "\t\t\t\tExpected subnet_timeout 0x%X, received 0x%X\n", 3798219820Sjeff cl_ntoh16(p_rec->lid), p_rec->port_num, 3799219820Sjeff ib_port_info_get_timeout(&p_port->rec.port_info), 3800219820Sjeff ib_port_info_get_timeout(&p_rec->port_info)); 3801219820Sjeff status = IB_ERROR; 3802219820Sjeff goto Exit; 3803219820Sjeff } 3804219820Sjeff 3805219820Sjeff if ((p_port->comp.port_info.resp_time_value & p_port->rec.port_info. 3806219820Sjeff resp_time_value) != 3807219820Sjeff (p_port->comp.port_info.resp_time_value & p_rec->port_info. 3808219820Sjeff resp_time_value)) { 3809219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0092: " 3810219820Sjeff "Field mismatch port LID 0x%X Num:0x%X\n" 3811219820Sjeff "\t\t\t\tExpected resp_time_value 0x%X, received 0x%X\n", 3812219820Sjeff cl_ntoh16(p_rec->lid), p_rec->port_num, 3813219820Sjeff p_port->rec.port_info.resp_time_value, 3814219820Sjeff p_rec->port_info.resp_time_value); 3815219820Sjeff status = IB_ERROR; 3816219820Sjeff goto Exit; 3817219820Sjeff } 3818219820Sjeff 3819219820Sjeff if ((p_port->comp.port_info.error_threshold & p_port->rec.port_info. 3820219820Sjeff error_threshold) != 3821219820Sjeff (p_port->comp.port_info.error_threshold & p_rec->port_info. 3822219820Sjeff error_threshold)) { 3823219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0093: " 3824219820Sjeff "Field mismatch port LID 0x%X Num:0x%X\n" 3825219820Sjeff "\t\t\t\tExpected error_threshold 0x%X, received 0x%X\n", 3826219820Sjeff cl_ntoh16(p_rec->lid), p_rec->port_num, 3827219820Sjeff p_port->rec.port_info.error_threshold, 3828219820Sjeff p_rec->port_info.error_threshold); 3829219820Sjeff status = IB_ERROR; 3830219820Sjeff goto Exit; 3831219820Sjeff } 3832219820Sjeff 3833219820SjeffExit: 3834219820Sjeff OSM_LOG_EXIT(&p_osmt->log); 3835219820Sjeff return (status); 3836219820Sjeff} 3837219820Sjeff 3838219820Sjeff/********************************************************************** 3839219820Sjeff **********************************************************************/ 3840219820Sjeffstatic ib_api_status_t 3841219820Sjeffosmtest_validate_port_rec(IN osmtest_t * const p_osmt, 3842219820Sjeff IN const ib_portinfo_record_t * const p_rec) 3843219820Sjeff{ 3844219820Sjeff cl_status_t status = IB_SUCCESS; 3845219820Sjeff port_t *p_port; 3846219820Sjeff const cl_qmap_t *p_tbl; 3847219820Sjeff 3848219820Sjeff OSM_LOG_ENTER(&p_osmt->log); 3849219820Sjeff 3850219820Sjeff /* 3851219820Sjeff * Find proper port record in the database. 3852219820Sjeff * (we use by guid - since lid is not unique) 3853219820Sjeff */ 3854219820Sjeff p_tbl = &p_osmt->exp_subn.port_key_tbl; 3855219820Sjeff p_port = 3856219820Sjeff (port_t *) cl_qmap_get(p_tbl, 3857219820Sjeff port_gen_id(p_rec->lid, p_rec->port_num)); 3858219820Sjeff if (p_port == (port_t *) cl_qmap_end(p_tbl)) { 3859219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0094: " 3860219820Sjeff "Unexpected port LID 0x%X, Num:0x%X\n", 3861219820Sjeff cl_ntoh16(p_rec->lid), p_rec->port_num); 3862219820Sjeff status = IB_ERROR; 3863219820Sjeff goto Exit; 3864219820Sjeff } 3865219820Sjeff 3866219820Sjeff status = osmtest_validate_port_data(p_osmt, p_port, p_rec); 3867219820Sjeff 3868219820SjeffExit: 3869219820Sjeff OSM_LOG_EXIT(&p_osmt->log); 3870219820Sjeff return (status); 3871219820Sjeff} 3872219820Sjeff 3873219820Sjeff/********************************************************************** 3874219820Sjeff **********************************************************************/ 3875219820Sjeffstatic ib_api_status_t 3876219820Sjeffosmtest_validate_path_rec(IN osmtest_t * const p_osmt, 3877219820Sjeff IN const ib_path_rec_t * const p_rec) 3878219820Sjeff{ 3879219820Sjeff cl_status_t status = IB_SUCCESS; 3880219820Sjeff path_t *p_path; 3881219820Sjeff const cl_qmap_t *p_tbl; 3882219820Sjeff 3883219820Sjeff OSM_LOG_ENTER(&p_osmt->log); 3884219820Sjeff 3885219820Sjeff /* 3886219820Sjeff * Find proper path record in the database. 3887219820Sjeff */ 3888219820Sjeff p_tbl = &p_osmt->exp_subn.path_tbl; 3889219820Sjeff p_path = (path_t *) cl_qmap_get(p_tbl, osmtest_path_rec_key_get(p_rec)); 3890219820Sjeff if (p_path == (path_t *) cl_qmap_end(p_tbl)) { 3891219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0095: " 3892219820Sjeff "Unexpected path SLID 0x%X to DLID 0x%X\n", 3893219820Sjeff cl_ntoh16(p_rec->slid), cl_ntoh16(p_rec->dlid)); 3894219820Sjeff status = IB_ERROR; 3895219820Sjeff goto Exit; 3896219820Sjeff } 3897219820Sjeff 3898219820Sjeff status = osmtest_validate_path_data(p_osmt, p_path, p_rec); 3899219820Sjeff 3900219820SjeffExit: 3901219820Sjeff OSM_LOG_EXIT(&p_osmt->log); 3902219820Sjeff return (status); 3903219820Sjeff} 3904219820Sjeff 3905219820Sjeff#ifdef VENDOR_RMPP_SUPPORT 3906219820Sjeffib_net64_t portguid = 0; 3907219820Sjeff 3908219820Sjeff/********************************************************************** 3909219820Sjeff **********************************************************************/ 3910219820Sjeffstatic ib_api_status_t 3911219820Sjeffosmtest_validate_all_node_recs(IN osmtest_t * const p_osmt) 3912219820Sjeff{ 3913219820Sjeff osmtest_req_context_t context; 3914219820Sjeff const ib_node_record_t *p_rec; 3915219820Sjeff uint32_t i; 3916219820Sjeff cl_status_t status; 3917219820Sjeff size_t num_recs; 3918219820Sjeff 3919219820Sjeff OSM_LOG_ENTER(&p_osmt->log); 3920219820Sjeff 3921219820Sjeff memset(&context, 0, sizeof(context)); 3922219820Sjeff 3923219820Sjeff /* 3924219820Sjeff * Do a blocking query for all NodeRecords in the subnet. 3925219820Sjeff */ 3926219820Sjeff status = osmtest_get_all_recs(p_osmt, IB_MAD_ATTR_NODE_RECORD, 3927219820Sjeff sizeof(*p_rec), &context); 3928219820Sjeff 3929219820Sjeff if (status != IB_SUCCESS) { 3930219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0096: " 3931219820Sjeff "osmtest_get_all_recs failed (%s)\n", 3932219820Sjeff ib_get_err_str(status)); 3933219820Sjeff goto Exit; 3934219820Sjeff } 3935219820Sjeff 3936219820Sjeff num_recs = context.result.result_cnt; 3937219820Sjeff 3938219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Received %zu records\n", 3939219820Sjeff num_recs); 3940219820Sjeff 3941219820Sjeff /* 3942219820Sjeff * Compare the received records to the database. 3943219820Sjeff */ 3944219820Sjeff osmtest_prepare_db(p_osmt); 3945219820Sjeff 3946219820Sjeff for (i = 0; i < num_recs; i++) { 3947219820Sjeff p_rec = 3948219820Sjeff osmv_get_query_node_rec(context.result.p_result_madw, i); 3949219820Sjeff 3950219820Sjeff status = osmtest_validate_node_rec(p_osmt, p_rec); 3951219820Sjeff if (status != IB_SUCCESS) { 3952219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0097: " 3953219820Sjeff "osmtest_valid_node_rec failed (%s)\n", 3954219820Sjeff ib_get_err_str(status)); 3955219820Sjeff goto Exit; 3956219820Sjeff } 3957219820Sjeff if (!portguid) 3958219820Sjeff portguid = p_rec->node_info.port_guid; 3959219820Sjeff } 3960219820Sjeff 3961219820Sjeff status = osmtest_check_missing_nodes(p_osmt); 3962219820Sjeff if (status != IB_SUCCESS) { 3963219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0098: " 3964219820Sjeff "osmtest_check_missing_nodes failed (%s)\n", 3965219820Sjeff ib_get_err_str(status)); 3966219820Sjeff goto Exit; 3967219820Sjeff } 3968219820Sjeff 3969219820SjeffExit: 3970219820Sjeff /* 3971219820Sjeff * Return the IB query MAD to the pool as necessary. 3972219820Sjeff */ 3973219820Sjeff if (context.result.p_result_madw != NULL) { 3974219820Sjeff osm_mad_pool_put(&p_osmt->mad_pool, 3975219820Sjeff context.result.p_result_madw); 3976219820Sjeff context.result.p_result_madw = NULL; 3977219820Sjeff } 3978219820Sjeff 3979219820Sjeff OSM_LOG_EXIT(&p_osmt->log); 3980219820Sjeff return (status); 3981219820Sjeff} 3982219820Sjeff 3983219820Sjeff/********************************************************************** 3984219820Sjeff **********************************************************************/ 3985219820Sjeffstatic ib_api_status_t 3986219820Sjeffosmtest_validate_all_guidinfo_recs(IN osmtest_t * const p_osmt) 3987219820Sjeff{ 3988219820Sjeff osmtest_req_context_t context; 3989219820Sjeff const ib_guidinfo_record_t *p_rec; 3990219820Sjeff cl_status_t status; 3991219820Sjeff size_t num_recs; 3992219820Sjeff 3993219820Sjeff OSM_LOG_ENTER(&p_osmt->log); 3994219820Sjeff 3995219820Sjeff memset(&context, 0, sizeof(context)); 3996219820Sjeff 3997219820Sjeff /* 3998219820Sjeff * Do a blocking query for all GuidInfoRecords in the subnet. 3999219820Sjeff */ 4000219820Sjeff status = osmtest_get_all_recs(p_osmt, IB_MAD_ATTR_GUIDINFO_RECORD, 4001219820Sjeff sizeof(*p_rec), &context); 4002219820Sjeff 4003219820Sjeff if (status != IB_SUCCESS) { 4004219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0099: " 4005219820Sjeff "osmtest_get_all_recs failed (%s)\n", 4006219820Sjeff ib_get_err_str(status)); 4007219820Sjeff goto Exit; 4008219820Sjeff } 4009219820Sjeff 4010219820Sjeff num_recs = context.result.result_cnt; 4011219820Sjeff 4012219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Received %zu records\n", 4013219820Sjeff num_recs); 4014219820Sjeff 4015219820Sjeff /* No validation as yet */ 4016219820Sjeff 4017219820SjeffExit: 4018219820Sjeff /* 4019219820Sjeff * Return the IB query MAD to the pool as necessary. 4020219820Sjeff */ 4021219820Sjeff if (context.result.p_result_madw != NULL) { 4022219820Sjeff osm_mad_pool_put(&p_osmt->mad_pool, 4023219820Sjeff context.result.p_result_madw); 4024219820Sjeff context.result.p_result_madw = NULL; 4025219820Sjeff } 4026219820Sjeff 4027219820Sjeff OSM_LOG_EXIT(&p_osmt->log); 4028219820Sjeff return (status); 4029219820Sjeff} 4030219820Sjeff 4031219820Sjeff/********************************************************************** 4032219820Sjeff **********************************************************************/ 4033219820Sjeffstatic ib_api_status_t 4034219820Sjeffosmtest_validate_all_path_recs(IN osmtest_t * const p_osmt) 4035219820Sjeff{ 4036219820Sjeff osmtest_req_context_t context; 4037219820Sjeff const ib_path_rec_t *p_rec; 4038219820Sjeff uint32_t i; 4039219820Sjeff cl_status_t status; 4040219820Sjeff size_t num_recs; 4041219820Sjeff 4042219820Sjeff OSM_LOG_ENTER(&p_osmt->log); 4043219820Sjeff 4044219820Sjeff memset(&context, 0, sizeof(context)); 4045219820Sjeff 4046219820Sjeff /* 4047219820Sjeff * Do a blocking query for all PathRecords in the subnet. 4048219820Sjeff */ 4049219820Sjeff status = osmtest_get_all_recs(p_osmt, IB_MAD_ATTR_PATH_RECORD, 4050219820Sjeff sizeof(*p_rec), &context); 4051219820Sjeff 4052219820Sjeff if (status != IB_SUCCESS) { 4053219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 009A: " 4054219820Sjeff "osmtest_get_all_recs failed (%s)\n", 4055219820Sjeff ib_get_err_str(status)); 4056219820Sjeff goto Exit; 4057219820Sjeff } 4058219820Sjeff 4059219820Sjeff num_recs = context.result.result_cnt; 4060219820Sjeff 4061219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Received %zu records\n", 4062219820Sjeff num_recs); 4063219820Sjeff 4064219820Sjeff /* 4065219820Sjeff * Compare the received records to the database. 4066219820Sjeff */ 4067219820Sjeff osmtest_prepare_db(p_osmt); 4068219820Sjeff 4069219820Sjeff for (i = 0; i < num_recs; i++) { 4070219820Sjeff p_rec = 4071219820Sjeff osmv_get_query_path_rec(context.result.p_result_madw, i); 4072219820Sjeff 4073219820Sjeff status = osmtest_validate_path_rec(p_osmt, p_rec); 4074219820Sjeff if (status != IB_SUCCESS) { 4075219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0100: " 4076219820Sjeff "osmtest_validate_path_rec failed (%s)\n", 4077219820Sjeff ib_get_err_str(status)); 4078219820Sjeff goto Exit; 4079219820Sjeff } 4080219820Sjeff } 4081219820Sjeff 4082219820Sjeff status = osmtest_check_missing_paths(p_osmt); 4083219820Sjeff if (status != IB_SUCCESS) { 4084219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0101: " 4085219820Sjeff "osmtest_check_missing_paths failed (%s)\n", 4086219820Sjeff ib_get_err_str(status)); 4087219820Sjeff goto Exit; 4088219820Sjeff } 4089219820Sjeff 4090219820SjeffExit: 4091219820Sjeff /* 4092219820Sjeff * Return the IB query MAD to the pool as necessary. 4093219820Sjeff */ 4094219820Sjeff if (context.result.p_result_madw != NULL) { 4095219820Sjeff osm_mad_pool_put(&p_osmt->mad_pool, 4096219820Sjeff context.result.p_result_madw); 4097219820Sjeff context.result.p_result_madw = NULL; 4098219820Sjeff } 4099219820Sjeff 4100219820Sjeff OSM_LOG_EXIT(&p_osmt->log); 4101219820Sjeff return (status); 4102219820Sjeff} 4103219820Sjeff 4104219820Sjeff/********************************************************************** 4105219820Sjeff * Get link record by LID 4106219820Sjeff **********************************************************************/ 4107219820Sjeffib_api_status_t 4108219820Sjeffosmtest_get_link_rec_by_lid(IN osmtest_t * const p_osmt, 4109219820Sjeff IN ib_net16_t const from_lid, 4110219820Sjeff IN ib_net16_t const to_lid, 4111219820Sjeff IN OUT osmtest_req_context_t * const p_context) 4112219820Sjeff{ 4113219820Sjeff ib_api_status_t status = IB_SUCCESS; 4114219820Sjeff osmv_user_query_t user; 4115219820Sjeff osmv_query_req_t req; 4116219820Sjeff ib_link_record_t record; 4117219820Sjeff ib_mad_t *p_mad; 4118219820Sjeff 4119219820Sjeff OSM_LOG_ENTER(&p_osmt->log); 4120219820Sjeff 4121219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, 4122219820Sjeff "Getting link record from LID 0x%02X to LID 0x%02X\n", 4123219820Sjeff cl_ntoh16(from_lid), cl_ntoh16(to_lid)); 4124219820Sjeff 4125219820Sjeff /* 4126219820Sjeff * Do a blocking query for this record in the subnet. 4127219820Sjeff * The result is returned in the result field of the caller's 4128219820Sjeff * context structure. 4129219820Sjeff * 4130219820Sjeff * The query structures are locals. 4131219820Sjeff */ 4132219820Sjeff memset(&req, 0, sizeof(req)); 4133219820Sjeff memset(&user, 0, sizeof(user)); 4134219820Sjeff memset(&record, 0, sizeof(record)); 4135219820Sjeff 4136219820Sjeff record.from_lid = from_lid; 4137219820Sjeff record.to_lid = to_lid; 4138219820Sjeff p_context->p_osmt = p_osmt; 4139219820Sjeff if (from_lid) 4140219820Sjeff user.comp_mask |= IB_LR_COMPMASK_FROM_LID; 4141219820Sjeff if (to_lid) 4142219820Sjeff user.comp_mask |= IB_LR_COMPMASK_TO_LID; 4143219820Sjeff user.attr_id = IB_MAD_ATTR_LINK_RECORD; 4144219820Sjeff user.attr_offset = cl_ntoh16((uint16_t) (sizeof(record) >> 3)); 4145219820Sjeff user.p_attr = &record; 4146219820Sjeff 4147219820Sjeff req.query_type = OSMV_QUERY_USER_DEFINED; 4148219820Sjeff req.timeout_ms = p_osmt->opt.transaction_timeout; 4149219820Sjeff req.retry_cnt = p_osmt->opt.retry_count; 4150219820Sjeff req.flags = OSM_SA_FLAGS_SYNC; 4151219820Sjeff req.query_context = p_context; 4152219820Sjeff req.pfn_query_cb = osmtest_query_res_cb; 4153219820Sjeff req.p_query_input = &user; 4154219820Sjeff req.sm_key = 0; 4155219820Sjeff 4156219820Sjeff status = osmv_query_sa(p_osmt->h_bind, &req); 4157219820Sjeff if (status != IB_SUCCESS) { 4158219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 007A: " 4159219820Sjeff "ib_query failed (%s)\n", ib_get_err_str(status)); 4160219820Sjeff goto Exit; 4161219820Sjeff } 4162219820Sjeff 4163219820Sjeff status = p_context->result.status; 4164219820Sjeff 4165219820Sjeff if (status != IB_SUCCESS) { 4166219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 007B: " 4167219820Sjeff "ib_query failed (%s)\n", ib_get_err_str(status)); 4168219820Sjeff if (status == IB_REMOTE_ERROR) { 4169219820Sjeff p_mad = 4170219820Sjeff osm_madw_get_mad_ptr(p_context->result. 4171219820Sjeff p_result_madw); 4172219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, 4173219820Sjeff "osmtest_get_link_rec_by_lid: " 4174219820Sjeff "Remote error = %s\n", 4175219820Sjeff ib_get_mad_status_str(p_mad)); 4176219820Sjeff 4177219820Sjeff status = 4178219820Sjeff (ib_net16_t) (p_mad->status & IB_SMP_STATUS_MASK); 4179219820Sjeff } 4180219820Sjeff goto Exit; 4181219820Sjeff } 4182219820Sjeff 4183219820SjeffExit: 4184219820Sjeff OSM_LOG_EXIT(&p_osmt->log); 4185219820Sjeff return (status); 4186219820Sjeff} 4187219820Sjeff 4188219820Sjeff/********************************************************************** 4189219820Sjeff * Get GUIDInfo record by LID 4190219820Sjeff **********************************************************************/ 4191219820Sjeffib_api_status_t 4192219820Sjeffosmtest_get_guidinfo_rec_by_lid(IN osmtest_t * const p_osmt, 4193219820Sjeff IN ib_net16_t const lid, 4194219820Sjeff IN OUT osmtest_req_context_t * const p_context) 4195219820Sjeff{ 4196219820Sjeff ib_api_status_t status = IB_SUCCESS; 4197219820Sjeff osmv_user_query_t user; 4198219820Sjeff osmv_query_req_t req; 4199219820Sjeff ib_guidinfo_record_t record; 4200219820Sjeff ib_mad_t *p_mad; 4201219820Sjeff 4202219820Sjeff OSM_LOG_ENTER(&p_osmt->log); 4203219820Sjeff 4204219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, 4205219820Sjeff "Getting GUIDInfo record for LID 0x%02X\n", cl_ntoh16(lid)); 4206219820Sjeff 4207219820Sjeff /* 4208219820Sjeff * Do a blocking query for this record in the subnet. 4209219820Sjeff * The result is returned in the result field of the caller's 4210219820Sjeff * context structure. 4211219820Sjeff * 4212219820Sjeff * The query structures are locals. 4213219820Sjeff */ 4214219820Sjeff memset(&req, 0, sizeof(req)); 4215219820Sjeff memset(&user, 0, sizeof(user)); 4216219820Sjeff memset(&record, 0, sizeof(record)); 4217219820Sjeff 4218219820Sjeff record.lid = lid; 4219219820Sjeff p_context->p_osmt = p_osmt; 4220219820Sjeff user.comp_mask = IB_GIR_COMPMASK_LID; 4221219820Sjeff user.attr_id = IB_MAD_ATTR_GUIDINFO_RECORD; 4222219820Sjeff user.attr_offset = cl_ntoh16((uint16_t) (sizeof(record) >> 3)); 4223219820Sjeff user.p_attr = &record; 4224219820Sjeff 4225219820Sjeff req.query_type = OSMV_QUERY_USER_DEFINED; 4226219820Sjeff req.timeout_ms = p_osmt->opt.transaction_timeout; 4227219820Sjeff req.retry_cnt = p_osmt->opt.retry_count; 4228219820Sjeff 4229219820Sjeff req.flags = OSM_SA_FLAGS_SYNC; 4230219820Sjeff req.query_context = p_context; 4231219820Sjeff req.pfn_query_cb = osmtest_query_res_cb; 4232219820Sjeff req.p_query_input = &user; 4233219820Sjeff req.sm_key = 0; 4234219820Sjeff 4235219820Sjeff status = osmv_query_sa(p_osmt->h_bind, &req); 4236219820Sjeff if (status != IB_SUCCESS) { 4237219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 007C: " 4238219820Sjeff "ib_query failed (%s)\n", ib_get_err_str(status)); 4239219820Sjeff goto Exit; 4240219820Sjeff } 4241219820Sjeff 4242219820Sjeff status = p_context->result.status; 4243219820Sjeff 4244219820Sjeff if (status != IB_SUCCESS) { 4245219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 007D: " 4246219820Sjeff "ib_query failed (%s)\n", ib_get_err_str(status)); 4247219820Sjeff if (status == IB_REMOTE_ERROR) { 4248219820Sjeff p_mad = 4249219820Sjeff osm_madw_get_mad_ptr(p_context->result. 4250219820Sjeff p_result_madw); 4251219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, 4252219820Sjeff "Remote error = %s\n", 4253219820Sjeff ib_get_mad_status_str(p_mad)); 4254219820Sjeff 4255219820Sjeff status = 4256219820Sjeff (ib_net16_t) (p_mad->status & IB_SMP_STATUS_MASK); 4257219820Sjeff } 4258219820Sjeff goto Exit; 4259219820Sjeff } 4260219820Sjeff 4261219820SjeffExit: 4262219820Sjeff OSM_LOG_EXIT(&p_osmt->log); 4263219820Sjeff return (status); 4264219820Sjeff} 4265219820Sjeff 4266219820Sjeff/********************************************************************** 4267219820Sjeff * Get PKeyTable record by LID 4268219820Sjeff **********************************************************************/ 4269219820Sjeffib_api_status_t 4270219820Sjeffosmtest_get_pkeytbl_rec_by_lid(IN osmtest_t * const p_osmt, 4271219820Sjeff IN ib_net16_t const lid, 4272219820Sjeff IN ib_net64_t const sm_key, 4273219820Sjeff IN OUT osmtest_req_context_t * const p_context) 4274219820Sjeff{ 4275219820Sjeff ib_api_status_t status = IB_SUCCESS; 4276219820Sjeff osmv_user_query_t user; 4277219820Sjeff osmv_query_req_t req; 4278219820Sjeff ib_pkey_table_record_t record; 4279219820Sjeff ib_mad_t *p_mad; 4280219820Sjeff 4281219820Sjeff OSM_LOG_ENTER(&p_osmt->log); 4282219820Sjeff 4283219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, 4284219820Sjeff "Getting PKeyTable record for LID 0x%02X\n", cl_ntoh16(lid)); 4285219820Sjeff 4286219820Sjeff /* 4287219820Sjeff * Do a blocking query for this record in the subnet. 4288219820Sjeff * The result is returned in the result field of the caller's 4289219820Sjeff * context structure. 4290219820Sjeff * 4291219820Sjeff * The query structures are locals. 4292219820Sjeff */ 4293219820Sjeff memset(&req, 0, sizeof(req)); 4294219820Sjeff memset(&user, 0, sizeof(user)); 4295219820Sjeff memset(&record, 0, sizeof(record)); 4296219820Sjeff 4297219820Sjeff record.lid = lid; 4298219820Sjeff p_context->p_osmt = p_osmt; 4299219820Sjeff user.comp_mask = IB_PKEY_COMPMASK_LID; 4300219820Sjeff user.attr_id = IB_MAD_ATTR_PKEY_TBL_RECORD; 4301219820Sjeff user.attr_offset = cl_ntoh16((uint16_t) (sizeof(record) >> 3)); 4302219820Sjeff user.p_attr = &record; 4303219820Sjeff 4304219820Sjeff req.query_type = OSMV_QUERY_USER_DEFINED; 4305219820Sjeff req.timeout_ms = p_osmt->opt.transaction_timeout; 4306219820Sjeff req.retry_cnt = p_osmt->opt.retry_count; 4307219820Sjeff 4308219820Sjeff req.flags = OSM_SA_FLAGS_SYNC; 4309219820Sjeff req.query_context = p_context; 4310219820Sjeff req.pfn_query_cb = osmtest_query_res_cb; 4311219820Sjeff req.p_query_input = &user; 4312219820Sjeff req.sm_key = sm_key; 4313219820Sjeff 4314219820Sjeff status = osmv_query_sa(p_osmt->h_bind, &req); 4315219820Sjeff if (status != IB_SUCCESS) { 4316219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 007E: " 4317219820Sjeff "ib_query failed (%s)\n", ib_get_err_str(status)); 4318219820Sjeff goto Exit; 4319219820Sjeff } 4320219820Sjeff 4321219820Sjeff status = p_context->result.status; 4322219820Sjeff 4323219820Sjeff if (status != IB_SUCCESS) { 4324219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 007F: " 4325219820Sjeff "ib_query failed (%s)\n", ib_get_err_str(status)); 4326219820Sjeff if (status == IB_REMOTE_ERROR) { 4327219820Sjeff p_mad = 4328219820Sjeff osm_madw_get_mad_ptr(p_context->result. 4329219820Sjeff p_result_madw); 4330219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, 4331219820Sjeff "Remote error = %s\n", 4332219820Sjeff ib_get_mad_status_str(p_mad)); 4333219820Sjeff 4334219820Sjeff status = 4335219820Sjeff (ib_net16_t) (p_mad->status & IB_SMP_STATUS_MASK); 4336219820Sjeff } 4337219820Sjeff goto Exit; 4338219820Sjeff } 4339219820Sjeff 4340219820SjeffExit: 4341219820Sjeff OSM_LOG_EXIT(&p_osmt->log); 4342219820Sjeff return (status); 4343219820Sjeff} 4344219820Sjeff 4345219820Sjeff/********************************************************************** 4346219820Sjeff * Get SwitchInfo record by LID 4347219820Sjeff **********************************************************************/ 4348219820Sjeffib_api_status_t 4349219820Sjeffosmtest_get_sw_info_rec_by_lid(IN osmtest_t * const p_osmt, 4350219820Sjeff IN ib_net16_t const lid, 4351219820Sjeff IN OUT osmtest_req_context_t * const p_context) 4352219820Sjeff{ 4353219820Sjeff ib_api_status_t status = IB_SUCCESS; 4354219820Sjeff osmv_user_query_t user; 4355219820Sjeff osmv_query_req_t req; 4356219820Sjeff ib_switch_info_record_t record; 4357219820Sjeff ib_mad_t *p_mad; 4358219820Sjeff 4359219820Sjeff OSM_LOG_ENTER(&p_osmt->log); 4360219820Sjeff 4361219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, 4362219820Sjeff "Getting SwitchInfo record for LID 0x%02X\n", cl_ntoh16(lid)); 4363219820Sjeff 4364219820Sjeff /* 4365219820Sjeff * Do a blocking query for this record in the subnet. 4366219820Sjeff * The result is returned in the result field of the caller's 4367219820Sjeff * context structure. 4368219820Sjeff * 4369219820Sjeff * The query structures are locals. 4370219820Sjeff */ 4371219820Sjeff memset(&req, 0, sizeof(req)); 4372219820Sjeff memset(&user, 0, sizeof(user)); 4373219820Sjeff memset(&record, 0, sizeof(record)); 4374219820Sjeff 4375219820Sjeff record.lid = lid; 4376219820Sjeff p_context->p_osmt = p_osmt; 4377219820Sjeff if (lid) 4378219820Sjeff user.comp_mask = IB_SWIR_COMPMASK_LID; 4379219820Sjeff user.attr_id = IB_MAD_ATTR_SWITCH_INFO_RECORD; 4380219820Sjeff user.attr_offset = cl_ntoh16((uint16_t) (sizeof(record) >> 3)); 4381219820Sjeff user.p_attr = &record; 4382219820Sjeff 4383219820Sjeff req.query_type = OSMV_QUERY_USER_DEFINED; 4384219820Sjeff req.timeout_ms = p_osmt->opt.transaction_timeout; 4385219820Sjeff req.retry_cnt = p_osmt->opt.retry_count; 4386219820Sjeff 4387219820Sjeff req.flags = OSM_SA_FLAGS_SYNC; 4388219820Sjeff req.query_context = p_context; 4389219820Sjeff req.pfn_query_cb = osmtest_query_res_cb; 4390219820Sjeff req.p_query_input = &user; 4391219820Sjeff req.sm_key = 0; 4392219820Sjeff 4393219820Sjeff status = osmv_query_sa(p_osmt->h_bind, &req); 4394219820Sjeff if (status != IB_SUCCESS) { 4395219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 006C: " 4396219820Sjeff "ib_query failed (%s)\n", ib_get_err_str(status)); 4397219820Sjeff goto Exit; 4398219820Sjeff } 4399219820Sjeff 4400219820Sjeff status = p_context->result.status; 4401219820Sjeff 4402219820Sjeff if (status != IB_SUCCESS) { 4403219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 006D: " 4404219820Sjeff "ib_query failed (%s)\n", ib_get_err_str(status)); 4405219820Sjeff if (status == IB_REMOTE_ERROR) { 4406219820Sjeff p_mad = 4407219820Sjeff osm_madw_get_mad_ptr(p_context->result. 4408219820Sjeff p_result_madw); 4409219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, 4410219820Sjeff "Remote error = %s\n", 4411219820Sjeff ib_get_mad_status_str(p_mad)); 4412219820Sjeff 4413219820Sjeff status = 4414219820Sjeff (ib_net16_t) (p_mad->status & IB_SMP_STATUS_MASK); 4415219820Sjeff } 4416219820Sjeff goto Exit; 4417219820Sjeff } 4418219820Sjeff 4419219820SjeffExit: 4420219820Sjeff OSM_LOG_EXIT(&p_osmt->log); 4421219820Sjeff return (status); 4422219820Sjeff} 4423219820Sjeff 4424219820Sjeff/********************************************************************** 4425219820Sjeff * Get LFT record by LID 4426219820Sjeff **********************************************************************/ 4427219820Sjeffib_api_status_t 4428219820Sjeffosmtest_get_lft_rec_by_lid(IN osmtest_t * const p_osmt, 4429219820Sjeff IN ib_net16_t const lid, 4430219820Sjeff IN OUT osmtest_req_context_t * const p_context) 4431219820Sjeff{ 4432219820Sjeff ib_api_status_t status = IB_SUCCESS; 4433219820Sjeff osmv_user_query_t user; 4434219820Sjeff osmv_query_req_t req; 4435219820Sjeff ib_lft_record_t record; 4436219820Sjeff ib_mad_t *p_mad; 4437219820Sjeff 4438219820Sjeff OSM_LOG_ENTER(&p_osmt->log); 4439219820Sjeff 4440219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, 4441219820Sjeff "Getting LFT record for LID 0x%02X\n", cl_ntoh16(lid)); 4442219820Sjeff 4443219820Sjeff /* 4444219820Sjeff * Do a blocking query for this record in the subnet. 4445219820Sjeff * The result is returned in the result field of the caller's 4446219820Sjeff * context structure. 4447219820Sjeff * 4448219820Sjeff * The query structures are locals. 4449219820Sjeff */ 4450219820Sjeff memset(&req, 0, sizeof(req)); 4451219820Sjeff memset(&user, 0, sizeof(user)); 4452219820Sjeff memset(&record, 0, sizeof(record)); 4453219820Sjeff 4454219820Sjeff record.lid = lid; 4455219820Sjeff p_context->p_osmt = p_osmt; 4456219820Sjeff if (lid) 4457219820Sjeff user.comp_mask = IB_LFTR_COMPMASK_LID; 4458219820Sjeff user.attr_id = IB_MAD_ATTR_LFT_RECORD; 4459219820Sjeff user.attr_offset = cl_ntoh16((uint16_t) (sizeof(record) >> 3)); 4460219820Sjeff user.p_attr = &record; 4461219820Sjeff 4462219820Sjeff req.query_type = OSMV_QUERY_USER_DEFINED; 4463219820Sjeff req.timeout_ms = p_osmt->opt.transaction_timeout; 4464219820Sjeff req.retry_cnt = p_osmt->opt.retry_count; 4465219820Sjeff 4466219820Sjeff req.flags = OSM_SA_FLAGS_SYNC; 4467219820Sjeff req.query_context = p_context; 4468219820Sjeff req.pfn_query_cb = osmtest_query_res_cb; 4469219820Sjeff req.p_query_input = &user; 4470219820Sjeff req.sm_key = 0; 4471219820Sjeff 4472219820Sjeff status = osmv_query_sa(p_osmt->h_bind, &req); 4473219820Sjeff if (status != IB_SUCCESS) { 4474219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 008A: " 4475219820Sjeff "ib_query failed (%s)\n", ib_get_err_str(status)); 4476219820Sjeff goto Exit; 4477219820Sjeff } 4478219820Sjeff 4479219820Sjeff status = p_context->result.status; 4480219820Sjeff 4481219820Sjeff if (status != IB_SUCCESS) { 4482219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 008B: " 4483219820Sjeff "ib_query failed (%s)\n", ib_get_err_str(status)); 4484219820Sjeff if (status == IB_REMOTE_ERROR) { 4485219820Sjeff p_mad = 4486219820Sjeff osm_madw_get_mad_ptr(p_context->result. 4487219820Sjeff p_result_madw); 4488219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, 4489219820Sjeff "Remote error = %s\n", 4490219820Sjeff ib_get_mad_status_str(p_mad)); 4491219820Sjeff 4492219820Sjeff status = 4493219820Sjeff (ib_net16_t) (p_mad->status & IB_SMP_STATUS_MASK); 4494219820Sjeff } 4495219820Sjeff goto Exit; 4496219820Sjeff } 4497219820Sjeff 4498219820SjeffExit: 4499219820Sjeff OSM_LOG_EXIT(&p_osmt->log); 4500219820Sjeff return (status); 4501219820Sjeff} 4502219820Sjeff 4503219820Sjeff/********************************************************************** 4504219820Sjeff * Get MFT record by LID 4505219820Sjeff **********************************************************************/ 4506219820Sjeffib_api_status_t 4507219820Sjeffosmtest_get_mft_rec_by_lid(IN osmtest_t * const p_osmt, 4508219820Sjeff IN ib_net16_t const lid, 4509219820Sjeff IN OUT osmtest_req_context_t * const p_context) 4510219820Sjeff{ 4511219820Sjeff ib_api_status_t status = IB_SUCCESS; 4512219820Sjeff osmv_user_query_t user; 4513219820Sjeff osmv_query_req_t req; 4514219820Sjeff ib_mft_record_t record; 4515219820Sjeff ib_mad_t *p_mad; 4516219820Sjeff 4517219820Sjeff OSM_LOG_ENTER(&p_osmt->log); 4518219820Sjeff 4519219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, 4520219820Sjeff "Getting MFT record for LID 0x%02X\n", cl_ntoh16(lid)); 4521219820Sjeff 4522219820Sjeff /* 4523219820Sjeff * Do a blocking query for this record in the subnet. 4524219820Sjeff * The result is returned in the result field of the caller's 4525219820Sjeff * context structure. 4526219820Sjeff * 4527219820Sjeff * The query structures are locals. 4528219820Sjeff */ 4529219820Sjeff memset(&req, 0, sizeof(req)); 4530219820Sjeff memset(&user, 0, sizeof(user)); 4531219820Sjeff memset(&record, 0, sizeof(record)); 4532219820Sjeff 4533219820Sjeff record.lid = lid; 4534219820Sjeff p_context->p_osmt = p_osmt; 4535219820Sjeff if (lid) 4536219820Sjeff user.comp_mask = IB_MFTR_COMPMASK_LID; 4537219820Sjeff user.attr_id = IB_MAD_ATTR_MFT_RECORD; 4538219820Sjeff user.attr_offset = cl_ntoh16((uint16_t) (sizeof(record) >> 3)); 4539219820Sjeff user.p_attr = &record; 4540219820Sjeff 4541219820Sjeff req.query_type = OSMV_QUERY_USER_DEFINED; 4542219820Sjeff req.timeout_ms = p_osmt->opt.transaction_timeout; 4543219820Sjeff req.retry_cnt = p_osmt->opt.retry_count; 4544219820Sjeff 4545219820Sjeff req.flags = OSM_SA_FLAGS_SYNC; 4546219820Sjeff req.query_context = p_context; 4547219820Sjeff req.pfn_query_cb = osmtest_query_res_cb; 4548219820Sjeff req.p_query_input = &user; 4549219820Sjeff req.sm_key = 0; 4550219820Sjeff 4551219820Sjeff status = osmv_query_sa(p_osmt->h_bind, &req); 4552219820Sjeff if (status != IB_SUCCESS) { 4553219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 009B: " 4554219820Sjeff "ib_query failed (%s)\n", ib_get_err_str(status)); 4555219820Sjeff goto Exit; 4556219820Sjeff } 4557219820Sjeff 4558219820Sjeff status = p_context->result.status; 4559219820Sjeff 4560219820Sjeff if (status != IB_SUCCESS) { 4561219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 009C: " 4562219820Sjeff "ib_query failed (%s)\n", ib_get_err_str(status)); 4563219820Sjeff if (status == IB_REMOTE_ERROR) { 4564219820Sjeff p_mad = 4565219820Sjeff osm_madw_get_mad_ptr(p_context->result. 4566219820Sjeff p_result_madw); 4567219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, 4568219820Sjeff "Remote error = %s\n", 4569219820Sjeff ib_get_mad_status_str(p_mad)); 4570219820Sjeff 4571219820Sjeff status = 4572219820Sjeff (ib_net16_t) (p_mad->status & IB_SMP_STATUS_MASK); 4573219820Sjeff } 4574219820Sjeff goto Exit; 4575219820Sjeff } 4576219820Sjeff 4577219820SjeffExit: 4578219820Sjeff OSM_LOG_EXIT(&p_osmt->log); 4579219820Sjeff return (status); 4580219820Sjeff} 4581219820Sjeff 4582219820Sjeff/********************************************************************** 4583219820Sjeff **********************************************************************/ 4584219820Sjeffstatic ib_api_status_t 4585219820Sjeffosmtest_sminfo_record_request(IN osmtest_t * const p_osmt, 4586219820Sjeff IN uint8_t method, 4587219820Sjeff IN void *p_options, 4588219820Sjeff IN OUT osmtest_req_context_t * const p_context) 4589219820Sjeff{ 4590219820Sjeff ib_api_status_t status = IB_SUCCESS; 4591219820Sjeff osmv_user_query_t user; 4592219820Sjeff osmv_query_req_t req; 4593219820Sjeff ib_sminfo_record_t record; 4594219820Sjeff ib_mad_t *p_mad; 4595219820Sjeff osmtest_sm_info_rec_t *p_sm_info_opt; 4596219820Sjeff 4597219820Sjeff OSM_LOG_ENTER(&p_osmt->log); 4598219820Sjeff 4599219820Sjeff /* 4600219820Sjeff * Do a blocking query for these records in the subnet. 4601219820Sjeff * The result is returned in the result field of the caller's 4602219820Sjeff * context structure. 4603219820Sjeff * 4604219820Sjeff * The query structures are locals. 4605219820Sjeff */ 4606219820Sjeff memset(&req, 0, sizeof(req)); 4607219820Sjeff memset(&user, 0, sizeof(user)); 4608219820Sjeff memset(&record, 0, sizeof(record)); 4609219820Sjeff 4610219820Sjeff p_context->p_osmt = p_osmt; 4611219820Sjeff user.attr_id = IB_MAD_ATTR_SMINFO_RECORD; 4612219820Sjeff user.attr_offset = cl_ntoh16((uint16_t) (sizeof(record) >> 3)); 4613219820Sjeff p_sm_info_opt = p_options; 4614219820Sjeff if (p_sm_info_opt->sm_guid != 0) { 4615219820Sjeff record.sm_info.guid = p_sm_info_opt->sm_guid; 4616219820Sjeff user.comp_mask |= IB_SMIR_COMPMASK_GUID; 4617219820Sjeff } 4618219820Sjeff if (p_sm_info_opt->lid != 0) { 4619219820Sjeff record.lid = p_sm_info_opt->lid; 4620219820Sjeff user.comp_mask |= IB_SMIR_COMPMASK_LID; 4621219820Sjeff } 4622219820Sjeff if (p_sm_info_opt->priority != 0) { 4623219820Sjeff record.sm_info.pri_state = 4624219820Sjeff (p_sm_info_opt->priority & 0x0F) << 4; 4625219820Sjeff user.comp_mask |= IB_SMIR_COMPMASK_PRIORITY; 4626219820Sjeff } 4627219820Sjeff if (p_sm_info_opt->sm_state != 0) { 4628219820Sjeff record.sm_info.pri_state |= p_sm_info_opt->sm_state & 0x0F; 4629219820Sjeff user.comp_mask |= IB_SMIR_COMPMASK_SMSTATE; 4630219820Sjeff } 4631219820Sjeff 4632219820Sjeff user.method = method; 4633219820Sjeff user.p_attr = &record; 4634219820Sjeff 4635219820Sjeff req.query_type = OSMV_QUERY_USER_DEFINED; 4636219820Sjeff req.timeout_ms = p_osmt->opt.transaction_timeout; 4637219820Sjeff req.retry_cnt = p_osmt->opt.retry_count; 4638219820Sjeff 4639219820Sjeff req.flags = OSM_SA_FLAGS_SYNC; 4640219820Sjeff req.query_context = p_context; 4641219820Sjeff req.pfn_query_cb = osmtest_query_res_cb; 4642219820Sjeff req.p_query_input = &user; 4643219820Sjeff req.sm_key = 0; 4644219820Sjeff 4645219820Sjeff status = osmv_query_sa(p_osmt->h_bind, &req); 4646219820Sjeff if (status != IB_SUCCESS) { 4647219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 008C: " 4648219820Sjeff "ib_query failed (%s)\n", ib_get_err_str(status)); 4649219820Sjeff goto Exit; 4650219820Sjeff } 4651219820Sjeff 4652219820Sjeff status = p_context->result.status; 4653219820Sjeff 4654219820Sjeff if (status != IB_SUCCESS) { 4655219820Sjeff if (status != IB_INVALID_PARAMETER) { 4656219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 008D: " 4657219820Sjeff "ib_query failed (%s)\n", 4658219820Sjeff ib_get_err_str(status)); 4659219820Sjeff } 4660219820Sjeff if (status == IB_REMOTE_ERROR) { 4661219820Sjeff p_mad = 4662219820Sjeff osm_madw_get_mad_ptr(p_context->result. 4663219820Sjeff p_result_madw); 4664219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, 4665219820Sjeff "Remote error = %s\n", 4666219820Sjeff ib_get_mad_status_str(p_mad)); 4667219820Sjeff 4668219820Sjeff status = 4669219820Sjeff (ib_net16_t) (p_mad->status & IB_SMP_STATUS_MASK); 4670219820Sjeff } 4671219820Sjeff goto Exit; 4672219820Sjeff } 4673219820Sjeff 4674219820SjeffExit: 4675219820Sjeff OSM_LOG_EXIT(&p_osmt->log); 4676219820Sjeff return (status); 4677219820Sjeff} 4678219820Sjeff 4679219820Sjeff/********************************************************************** 4680219820Sjeff **********************************************************************/ 4681219820Sjeffstatic ib_api_status_t 4682219820Sjeffosmtest_informinfo_request(IN osmtest_t * const p_osmt, 4683219820Sjeff IN ib_net16_t attr_id, 4684219820Sjeff IN uint8_t method, 4685219820Sjeff IN void *p_options, 4686219820Sjeff IN OUT osmtest_req_context_t * const p_context) 4687219820Sjeff{ 4688219820Sjeff ib_api_status_t status = IB_SUCCESS; 4689219820Sjeff osmv_user_query_t user; 4690219820Sjeff osmv_query_req_t req; 4691219820Sjeff ib_inform_info_t rec; 4692219820Sjeff ib_inform_info_record_t record; 4693219820Sjeff ib_mad_t *p_mad; 4694219820Sjeff osmtest_inform_info_t *p_inform_info_opt; 4695219820Sjeff osmtest_inform_info_rec_t *p_inform_info_rec_opt; 4696219820Sjeff 4697219820Sjeff OSM_LOG_ENTER(&p_osmt->log); 4698219820Sjeff 4699219820Sjeff /* 4700219820Sjeff * Do a blocking query for these records in the subnet. 4701219820Sjeff * The result is returned in the result field of the caller's 4702219820Sjeff * context structure. 4703219820Sjeff * 4704219820Sjeff * The query structures are locals. 4705219820Sjeff */ 4706219820Sjeff memset(&req, 0, sizeof(req)); 4707219820Sjeff memset(&user, 0, sizeof(user)); 4708219820Sjeff memset(&rec, 0, sizeof(rec)); 4709219820Sjeff memset(&record, 0, sizeof(record)); 4710219820Sjeff 4711219820Sjeff p_context->p_osmt = p_osmt; 4712219820Sjeff user.attr_id = attr_id; 4713219820Sjeff if (attr_id == IB_MAD_ATTR_INFORM_INFO_RECORD) { 4714219820Sjeff user.attr_offset = cl_ntoh16((uint16_t) (sizeof(record) >> 3)); 4715219820Sjeff p_inform_info_rec_opt = p_options; 4716219820Sjeff if (p_inform_info_rec_opt->subscriber_gid.unicast.prefix != 0 && 4717219820Sjeff p_inform_info_rec_opt->subscriber_gid.unicast. 4718219820Sjeff interface_id != 0) { 4719219820Sjeff record.subscriber_gid = 4720219820Sjeff p_inform_info_rec_opt->subscriber_gid; 4721219820Sjeff user.comp_mask = IB_IIR_COMPMASK_SUBSCRIBERGID; 4722219820Sjeff } 4723219820Sjeff record.subscriber_enum = 4724219820Sjeff cl_hton16(p_inform_info_rec_opt->subscriber_enum); 4725219820Sjeff user.comp_mask |= IB_IIR_COMPMASK_ENUM; 4726219820Sjeff user.p_attr = &record; 4727219820Sjeff } else { 4728219820Sjeff user.attr_offset = cl_ntoh16((uint16_t) (sizeof(rec) >> 3)); 4729219820Sjeff /* comp mask bits below are for InformInfoRecord rather than InformInfo */ 4730219820Sjeff /* as currently no comp mask bits defined for InformInfo!!! */ 4731219820Sjeff user.comp_mask = IB_IIR_COMPMASK_SUBSCRIBE; 4732219820Sjeff p_inform_info_opt = p_options; 4733219820Sjeff rec.subscribe = (uint8_t) p_inform_info_opt->subscribe; 4734219820Sjeff if (p_inform_info_opt->qpn) { 4735219820Sjeff rec.g_or_v.generic.qpn_resp_time_val = 4736219820Sjeff cl_hton32(p_inform_info_opt->qpn << 8); 4737219820Sjeff user.comp_mask |= IB_IIR_COMPMASK_QPN; 4738219820Sjeff } 4739219820Sjeff if (p_inform_info_opt->trap) { 4740219820Sjeff rec.g_or_v.generic.trap_num = 4741219820Sjeff cl_hton16(p_inform_info_opt->trap); 4742219820Sjeff user.comp_mask |= IB_IIR_COMPMASK_TRAPNUMB; 4743219820Sjeff } 4744219820Sjeff user.p_attr = &rec; 4745219820Sjeff } 4746219820Sjeff user.method = method; 4747219820Sjeff 4748219820Sjeff req.query_type = OSMV_QUERY_USER_DEFINED; 4749219820Sjeff req.timeout_ms = p_osmt->opt.transaction_timeout; 4750219820Sjeff req.retry_cnt = p_osmt->opt.retry_count; 4751219820Sjeff 4752219820Sjeff req.flags = OSM_SA_FLAGS_SYNC; 4753219820Sjeff req.query_context = p_context; 4754219820Sjeff req.pfn_query_cb = osmtest_query_res_cb; 4755219820Sjeff req.p_query_input = &user; 4756219820Sjeff req.sm_key = 0; 4757219820Sjeff 4758219820Sjeff status = osmv_query_sa(p_osmt->h_bind, &req); 4759219820Sjeff if (status != IB_SUCCESS) { 4760219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 008E: " 4761219820Sjeff "ib_query failed (%s)\n", ib_get_err_str(status)); 4762219820Sjeff goto Exit; 4763219820Sjeff } 4764219820Sjeff 4765219820Sjeff status = p_context->result.status; 4766219820Sjeff 4767219820Sjeff if (status != IB_SUCCESS) { 4768219820Sjeff if (status != IB_INVALID_PARAMETER) { 4769219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 008F: " 4770219820Sjeff "ib_query failed (%s)\n", 4771219820Sjeff ib_get_err_str(status)); 4772219820Sjeff } 4773219820Sjeff if (status == IB_REMOTE_ERROR) { 4774219820Sjeff p_mad = 4775219820Sjeff osm_madw_get_mad_ptr(p_context->result. 4776219820Sjeff p_result_madw); 4777219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, 4778219820Sjeff "Remote error = %s\n", 4779219820Sjeff ib_get_mad_status_str(p_mad)); 4780219820Sjeff 4781219820Sjeff status = 4782219820Sjeff (ib_net16_t) (p_mad->status & IB_SMP_STATUS_MASK); 4783219820Sjeff } 4784219820Sjeff goto Exit; 4785219820Sjeff } 4786219820Sjeff 4787219820SjeffExit: 4788219820Sjeff OSM_LOG_EXIT(&p_osmt->log); 4789219820Sjeff return (status); 4790219820Sjeff} 4791219820Sjeff#endif 4792219820Sjeff 4793219820Sjeff/********************************************************************** 4794219820Sjeff **********************************************************************/ 4795219820Sjeffstatic ib_api_status_t 4796219820Sjeffosmtest_validate_single_path_rec_lid_pair(IN osmtest_t * const p_osmt, 4797219820Sjeff IN path_t * const p_path) 4798219820Sjeff{ 4799219820Sjeff osmtest_req_context_t context; 4800219820Sjeff const ib_path_rec_t *p_rec; 4801219820Sjeff cl_status_t status = IB_SUCCESS; 4802219820Sjeff size_t num_recs; 4803219820Sjeff 4804219820Sjeff OSM_LOG_ENTER(&p_osmt->log); 4805219820Sjeff 4806219820Sjeff memset(&context, 0, sizeof(context)); 4807219820Sjeff 4808219820Sjeff status = osmtest_get_path_rec_by_lid_pair(p_osmt, 4809219820Sjeff p_path->rec.slid, 4810219820Sjeff p_path->rec.dlid, &context); 4811219820Sjeff if (status != IB_SUCCESS) { 4812219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0102: " 4813219820Sjeff "ib_query failed (%s)\n", ib_get_err_str(status)); 4814219820Sjeff goto Exit; 4815219820Sjeff } 4816219820Sjeff 4817219820Sjeff num_recs = context.result.result_cnt; 4818219820Sjeff if (num_recs != 1) { 4819219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0103: " 4820219820Sjeff "Too many records. Expected 1, received %zu\n", 4821219820Sjeff num_recs); 4822219820Sjeff 4823219820Sjeff status = IB_ERROR; 4824219820Sjeff } else { 4825219820Sjeff p_rec = 4826219820Sjeff osmv_get_query_path_rec(context.result.p_result_madw, 0); 4827219820Sjeff 4828219820Sjeff status = osmtest_validate_path_data(p_osmt, p_path, p_rec); 4829219820Sjeff if (status != IB_SUCCESS) { 4830219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0104: " 4831219820Sjeff "osmtest_validate_path_data failed (%s)\n", 4832219820Sjeff ib_get_err_str(status)); 4833219820Sjeff } 4834219820Sjeff } 4835219820Sjeff 4836219820SjeffExit: 4837219820Sjeff /* 4838219820Sjeff * Return the IB query MAD to the pool as necessary. 4839219820Sjeff */ 4840219820Sjeff if (context.result.p_result_madw != NULL) { 4841219820Sjeff osm_mad_pool_put(&p_osmt->mad_pool, 4842219820Sjeff context.result.p_result_madw); 4843219820Sjeff context.result.p_result_madw = NULL; 4844219820Sjeff } 4845219820Sjeff 4846219820Sjeff OSM_LOG_EXIT(&p_osmt->log); 4847219820Sjeff return (status); 4848219820Sjeff} 4849219820Sjeff 4850219820Sjeff/********************************************************************** 4851219820Sjeff **********************************************************************/ 4852219820Sjeffstatic ib_api_status_t 4853219820Sjeffosmtest_validate_single_node_rec_lid(IN osmtest_t * const p_osmt, 4854219820Sjeff IN ib_net16_t const lid, 4855219820Sjeff IN node_t * const p_node) 4856219820Sjeff{ 4857219820Sjeff cl_status_t status = IB_SUCCESS; 4858219820Sjeff osmv_user_query_t user; 4859219820Sjeff osmv_query_req_t req; 4860219820Sjeff ib_node_record_t record; 4861219820Sjeff 4862219820Sjeff osmtest_req_context_t context; 4863219820Sjeff const ib_node_record_t *p_rec; 4864219820Sjeff int num_recs, i; 4865219820Sjeff 4866219820Sjeff OSM_LOG_ENTER(&p_osmt->log); 4867219820Sjeff 4868219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, 4869219820Sjeff "Getting NodeRecord for node with LID 0x%X\n", cl_ntoh16(lid)); 4870219820Sjeff 4871219820Sjeff memset(&context, 0, sizeof(context)); 4872219820Sjeff memset(&req, 0, sizeof(req)); 4873219820Sjeff memset(&user, 0, sizeof(user)); 4874219820Sjeff memset(&record, 0, sizeof(record)); 4875219820Sjeff 4876219820Sjeff record.lid = lid; 4877219820Sjeff 4878219820Sjeff context.p_osmt = p_osmt; 4879219820Sjeff user.comp_mask = IB_NR_COMPMASK_LID; 4880219820Sjeff user.attr_id = IB_MAD_ATTR_NODE_RECORD; 4881219820Sjeff user.attr_offset = cl_ntoh16((uint16_t) (sizeof(record) >> 3)); 4882219820Sjeff user.p_attr = &record; 4883219820Sjeff 4884219820Sjeff req.query_type = OSMV_QUERY_USER_DEFINED; 4885219820Sjeff req.timeout_ms = p_osmt->opt.transaction_timeout; 4886219820Sjeff req.retry_cnt = p_osmt->opt.retry_count; 4887219820Sjeff req.flags = OSM_SA_FLAGS_SYNC; 4888219820Sjeff req.query_context = &context; 4889219820Sjeff req.pfn_query_cb = osmtest_query_res_cb; 4890219820Sjeff req.p_query_input = &user; 4891219820Sjeff req.sm_key = 0; 4892219820Sjeff 4893219820Sjeff status = osmv_query_sa(p_osmt->h_bind, &req); 4894219820Sjeff 4895219820Sjeff if (status != IB_SUCCESS) { 4896219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0105: " 4897219820Sjeff "ib_query failed (%s)\n", ib_get_err_str(status)); 4898219820Sjeff goto Exit; 4899219820Sjeff } 4900219820Sjeff 4901219820Sjeff status = context.result.status; 4902219820Sjeff 4903219820Sjeff if (status != IB_SUCCESS) { 4904219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0106: " 4905219820Sjeff "ib_query failed (%s)\n", ib_get_err_str(status)); 4906219820Sjeff 4907219820Sjeff if (status == IB_REMOTE_ERROR) { 4908219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, 4909219820Sjeff "Remote error = %s\n", 4910219820Sjeff ib_get_mad_status_str(osm_madw_get_mad_ptr 4911219820Sjeff (context.result. 4912219820Sjeff p_result_madw))); 4913219820Sjeff } 4914219820Sjeff goto Exit; 4915219820Sjeff } 4916219820Sjeff 4917219820Sjeff num_recs = context.result.result_cnt; 4918219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, 4919219820Sjeff "Received %d nodes\n", num_recs); 4920219820Sjeff 4921219820Sjeff for (i = 0; i < num_recs; i++) { 4922219820Sjeff p_rec = 4923219820Sjeff osmv_get_query_node_rec(context.result.p_result_madw, i); 4924219820Sjeff 4925219820Sjeff status = osmtest_validate_node_rec(p_osmt, p_rec); 4926219820Sjeff if (status != IB_SUCCESS) { 4927219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0107: " 4928219820Sjeff "osmtest_validate_node_data failed (%s)\n", 4929219820Sjeff ib_get_err_str(status)); 4930219820Sjeff goto Exit; 4931219820Sjeff } 4932219820Sjeff } 4933219820Sjeff 4934219820SjeffExit: 4935219820Sjeff /* 4936219820Sjeff * Return the IB query MAD to the pool as necessary. 4937219820Sjeff */ 4938219820Sjeff if (context.result.p_result_madw != NULL) { 4939219820Sjeff osm_mad_pool_put(&p_osmt->mad_pool, 4940219820Sjeff context.result.p_result_madw); 4941219820Sjeff context.result.p_result_madw = NULL; 4942219820Sjeff } 4943219820Sjeff 4944219820Sjeff OSM_LOG_EXIT(&p_osmt->log); 4945219820Sjeff return (status); 4946219820Sjeff} 4947219820Sjeff 4948219820Sjeff/********************************************************************** 4949219820Sjeff **********************************************************************/ 4950219820Sjeffstatic ib_api_status_t 4951219820Sjeffosmtest_validate_single_port_rec_lid(IN osmtest_t * const p_osmt, 4952219820Sjeff IN port_t * const p_port) 4953219820Sjeff{ 4954219820Sjeff osmtest_req_context_t context; 4955219820Sjeff 4956219820Sjeff const ib_portinfo_record_t *p_rec; 4957219820Sjeff cl_status_t status = IB_SUCCESS; 4958219820Sjeff 4959219820Sjeff OSM_LOG_ENTER(&p_osmt->log); 4960219820Sjeff 4961219820Sjeff memset(&context, 0, sizeof(context)); 4962219820Sjeff 4963219820Sjeff context.p_osmt = p_osmt; 4964219820Sjeff osmtest_get_port_rec_by_num(p_osmt, 4965219820Sjeff p_port->rec.lid, 4966219820Sjeff p_port->rec.port_num, &context); 4967219820Sjeff if (status != IB_SUCCESS) { 4968219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0108: " 4969219820Sjeff "ib_query failed (%s)\n", ib_get_err_str(status)); 4970219820Sjeff 4971219820Sjeff goto Exit; 4972219820Sjeff } 4973219820Sjeff 4974219820Sjeff /* we should have got exactly one port */ 4975219820Sjeff p_rec = osmv_get_query_portinfo_rec(context.result.p_result_madw, 0); 4976219820Sjeff status = osmtest_validate_port_rec(p_osmt, p_rec); 4977219820Sjeff if (status != IB_SUCCESS) { 4978219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0109: " 4979219820Sjeff "osmtest_validate_port_data failed (%s)\n", 4980219820Sjeff ib_get_err_str(status)); 4981219820Sjeff } 4982219820Sjeff 4983219820SjeffExit: 4984219820Sjeff /* 4985219820Sjeff * Return the IB query MAD to the pool as necessary. 4986219820Sjeff */ 4987219820Sjeff if (context.result.p_result_madw != NULL) { 4988219820Sjeff osm_mad_pool_put(&p_osmt->mad_pool, 4989219820Sjeff context.result.p_result_madw); 4990219820Sjeff context.result.p_result_madw = NULL; 4991219820Sjeff } 4992219820Sjeff 4993219820Sjeff OSM_LOG_EXIT(&p_osmt->log); 4994219820Sjeff return (status); 4995219820Sjeff} 4996219820Sjeff 4997219820Sjeff/********************************************************************** 4998219820Sjeff **********************************************************************/ 4999219820Sjeffstatic ib_api_status_t 5000219820Sjeffosmtest_validate_single_path_rec_guid_pair(IN osmtest_t * const p_osmt, 5001219820Sjeff IN const osmv_guid_pair_t * 5002219820Sjeff const p_pair) 5003219820Sjeff{ 5004219820Sjeff osmtest_req_context_t context; 5005219820Sjeff const ib_path_rec_t *p_rec; 5006219820Sjeff cl_status_t status = IB_SUCCESS; 5007219820Sjeff size_t num_recs; 5008219820Sjeff osmv_query_req_t req; 5009219820Sjeff uint32_t i; 5010219820Sjeff boolean_t got_error = FALSE; 5011219820Sjeff 5012219820Sjeff OSM_LOG_ENTER(&p_osmt->log); 5013219820Sjeff 5014219820Sjeff memset(&req, 0, sizeof(req)); 5015219820Sjeff memset(&context, 0, sizeof(context)); 5016219820Sjeff 5017219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, 5018219820Sjeff "\n\t\t\t\tChecking src 0x%016" PRIx64 5019219820Sjeff " to dest 0x%016" PRIx64 "\n", 5020219820Sjeff cl_ntoh64(p_pair->src_guid), cl_ntoh64(p_pair->dest_guid)); 5021219820Sjeff 5022219820Sjeff context.p_osmt = p_osmt; 5023219820Sjeff 5024219820Sjeff req.timeout_ms = p_osmt->opt.transaction_timeout; 5025219820Sjeff req.retry_cnt = p_osmt->opt.retry_count; 5026219820Sjeff req.flags = OSM_SA_FLAGS_SYNC; 5027219820Sjeff req.query_context = &context; 5028219820Sjeff req.pfn_query_cb = osmtest_query_res_cb; 5029219820Sjeff 5030219820Sjeff req.query_type = OSMV_QUERY_PATH_REC_BY_PORT_GUIDS; 5031219820Sjeff req.p_query_input = p_pair; 5032219820Sjeff req.sm_key = 0; 5033219820Sjeff 5034219820Sjeff status = osmv_query_sa(p_osmt->h_bind, &req); 5035219820Sjeff if (status != IB_SUCCESS) { 5036219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0110: " 5037219820Sjeff "ib_query failed (%s)\n", ib_get_err_str(status)); 5038219820Sjeff goto Exit; 5039219820Sjeff } 5040219820Sjeff 5041219820Sjeff status = context.result.status; 5042219820Sjeff 5043219820Sjeff if (status != IB_SUCCESS) { 5044219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0111: " 5045219820Sjeff "ib_query failed (%s)\n", ib_get_err_str(status)); 5046219820Sjeff 5047219820Sjeff if (status == IB_REMOTE_ERROR) { 5048219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, 5049219820Sjeff "Remote error = %s\n", 5050219820Sjeff ib_get_mad_status_str(osm_madw_get_mad_ptr 5051219820Sjeff (context.result. 5052219820Sjeff p_result_madw))); 5053219820Sjeff } 5054219820Sjeff goto Exit; 5055219820Sjeff } 5056219820Sjeff 5057219820Sjeff num_recs = context.result.result_cnt; 5058219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "%zu records\n", num_recs); 5059219820Sjeff 5060219820Sjeff for (i = 0; i < num_recs; i++) { 5061219820Sjeff p_rec = 5062219820Sjeff osmv_get_query_path_rec(context.result.p_result_madw, i); 5063219820Sjeff 5064219820Sjeff /* 5065219820Sjeff * Make sure the GUID values are correct 5066219820Sjeff */ 5067219820Sjeff if (p_rec->dgid.unicast.interface_id != p_pair->dest_guid) { 5068219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0112: " 5069219820Sjeff "Destination GUID mismatch\n" 5070219820Sjeff "\t\t\t\texpected 0x%016" PRIx64 5071219820Sjeff ", received 0x%016" PRIx64 "\n", 5072219820Sjeff cl_ntoh64(p_pair->dest_guid), 5073219820Sjeff cl_ntoh64(p_rec->dgid.unicast.interface_id)); 5074219820Sjeff got_error = TRUE; 5075219820Sjeff } 5076219820Sjeff 5077219820Sjeff if (p_rec->sgid.unicast.interface_id != p_pair->src_guid) { 5078219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0113: " 5079219820Sjeff "Source GUID mismatch\n" 5080219820Sjeff "\t\t\t\texpected 0x%016" PRIx64 5081219820Sjeff ", received 0x%016" PRIx64 ".\n", 5082219820Sjeff cl_ntoh64(p_pair->src_guid), 5083219820Sjeff cl_ntoh64(p_rec->sgid.unicast.interface_id)); 5084219820Sjeff got_error = TRUE; 5085219820Sjeff } 5086219820Sjeff 5087219820Sjeff status = osmtest_validate_path_rec(p_osmt, p_rec); 5088219820Sjeff if (status != IB_SUCCESS) { 5089219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0114: " 5090219820Sjeff "osmtest_validate_path_rec failed (%s)\n", 5091219820Sjeff ib_get_err_str(status)); 5092219820Sjeff got_error = TRUE; 5093219820Sjeff } 5094219820Sjeff if (got_error || (status != IB_SUCCESS)) { 5095219820Sjeff osm_dump_path_record(&p_osmt->log, p_rec, 5096219820Sjeff OSM_LOG_VERBOSE); 5097219820Sjeff if (status == IB_SUCCESS) 5098219820Sjeff status = IB_ERROR; 5099219820Sjeff goto Exit; 5100219820Sjeff } 5101219820Sjeff } 5102219820Sjeff 5103219820SjeffExit: 5104219820Sjeff /* 5105219820Sjeff * Return the IB query MAD to the pool as necessary. 5106219820Sjeff */ 5107219820Sjeff if (context.result.p_result_madw != NULL) { 5108219820Sjeff osm_mad_pool_put(&p_osmt->mad_pool, 5109219820Sjeff context.result.p_result_madw); 5110219820Sjeff context.result.p_result_madw = NULL; 5111219820Sjeff } 5112219820Sjeff 5113219820Sjeff OSM_LOG_EXIT(&p_osmt->log); 5114219820Sjeff return (status); 5115219820Sjeff} 5116219820Sjeff 5117219820Sjeff/********************************************************************** 5118219820Sjeff **********************************************************************/ 5119219820Sjeffstatic ib_api_status_t 5120219820Sjeffosmtest_validate_single_path_recs(IN osmtest_t * const p_osmt) 5121219820Sjeff{ 5122219820Sjeff path_t *p_path; 5123219820Sjeff cl_status_t status = IB_SUCCESS; 5124219820Sjeff const cl_qmap_t *p_path_tbl; 5125219820Sjeff/* We skip node to node path record validation since it might contains 5126219820Sjeff NONEXISTENT PATHS, i.e. when using UPDN */ 5127219820Sjeff osmv_guid_pair_t guid_pair; 5128219820Sjeff uint16_t cnt; 5129219820Sjeff 5130219820Sjeff OSM_LOG_ENTER(&p_osmt->log); 5131219820Sjeff 5132219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, 5133219820Sjeff "Validating individual path record queries\n"); 5134219820Sjeff p_path_tbl = &p_osmt->exp_subn.path_tbl; 5135219820Sjeff 5136219820Sjeff osmtest_prepare_db(p_osmt); 5137219820Sjeff 5138219820Sjeff /* 5139219820Sjeff * Walk the list of all path records, and ask for each one 5140219820Sjeff * specifically. Make sure we get it. 5141219820Sjeff */ 5142219820Sjeff cnt = 0; 5143219820Sjeff p_path = (path_t *) cl_qmap_head(p_path_tbl); 5144219820Sjeff while (p_path != (path_t *) cl_qmap_end(p_path_tbl)) { 5145219820Sjeff status = 5146219820Sjeff osmtest_validate_single_path_rec_lid_pair(p_osmt, p_path); 5147219820Sjeff if (status != IB_SUCCESS) 5148219820Sjeff goto Exit; 5149219820Sjeff cnt++; 5150219820Sjeff p_path = (path_t *) cl_qmap_next(&p_path->map_item); 5151219820Sjeff } 5152219820Sjeff 5153219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, 5154219820Sjeff "Total of %u path records validated using LID based query\n", 5155219820Sjeff cnt); 5156219820Sjeff 5157219820Sjeff status = osmtest_check_missing_paths(p_osmt); 5158219820Sjeff if (status != IB_SUCCESS) { 5159219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0115: " 5160219820Sjeff "osmtest_check_missing_paths failed (%s)\n", 5161219820Sjeff ib_get_err_str(status)); 5162219820Sjeff goto Exit; 5163219820Sjeff } 5164219820Sjeff 5165219820Sjeff /* 5166219820Sjeff * Do the whole thing again with port GUID pairs. 5167219820Sjeff * Note that multiple path records may be returned 5168219820Sjeff * for each guid pair if LMC > 0. 5169219820Sjeff */ 5170219820Sjeff osmtest_prepare_db(p_osmt); 5171219820Sjeff cnt = 0; 5172219820Sjeff p_path = (path_t *) cl_qmap_head(p_path_tbl); 5173219820Sjeff while (p_path != (path_t *) cl_qmap_end(p_path_tbl)) { 5174219820Sjeff guid_pair.src_guid = p_path->rec.sgid.unicast.interface_id; 5175219820Sjeff guid_pair.dest_guid = p_path->rec.dgid.unicast.interface_id; 5176219820Sjeff status = osmtest_validate_single_path_rec_guid_pair(p_osmt, 5177219820Sjeff &guid_pair); 5178219820Sjeff if (status != IB_SUCCESS) 5179219820Sjeff goto Exit; 5180219820Sjeff cnt++; 5181219820Sjeff p_path = (path_t *) cl_qmap_next(&p_path->map_item); 5182219820Sjeff } 5183219820Sjeff 5184219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, 5185219820Sjeff "Total of %u path records validated using GUID based query\n", 5186219820Sjeff cnt); 5187219820Sjeff 5188219820Sjeff status = osmtest_check_missing_paths(p_osmt); 5189219820Sjeff if (status != IB_SUCCESS) { 5190219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0116: " 5191219820Sjeff "osmtest_check_missing_paths failed (%s)\n", 5192219820Sjeff ib_get_err_str(status)); 5193219820Sjeff goto Exit; 5194219820Sjeff } 5195219820Sjeff 5196219820SjeffExit: 5197219820Sjeff OSM_LOG_EXIT(&p_osmt->log); 5198219820Sjeff return (status); 5199219820Sjeff} 5200219820Sjeff 5201219820Sjeff/********************************************************************** 5202219820Sjeff **********************************************************************/ 5203219820Sjeffstatic ib_api_status_t 5204219820Sjeffosmtest_validate_single_node_recs(IN osmtest_t * const p_osmt) 5205219820Sjeff{ 5206219820Sjeff node_t *p_node; 5207219820Sjeff cl_status_t status = IB_SUCCESS; 5208219820Sjeff const cl_qmap_t *p_node_lid_tbl; 5209219820Sjeff uint16_t cnt = 0; 5210219820Sjeff 5211219820Sjeff OSM_LOG_ENTER(&p_osmt->log); 5212219820Sjeff 5213219820Sjeff p_node_lid_tbl = &p_osmt->exp_subn.node_lid_tbl; 5214219820Sjeff 5215219820Sjeff osmtest_prepare_db(p_osmt); 5216219820Sjeff 5217219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, 5218219820Sjeff "Validating individual node record queries\n"); 5219219820Sjeff 5220219820Sjeff /* 5221219820Sjeff * Walk the list of all node records, and ask for each one 5222219820Sjeff * specifically. Make sure we get it. 5223219820Sjeff */ 5224219820Sjeff p_node = (node_t *) cl_qmap_head(p_node_lid_tbl); 5225219820Sjeff while (p_node != (node_t *) cl_qmap_end(p_node_lid_tbl)) { 5226219820Sjeff status = osmtest_validate_single_node_rec_lid(p_osmt, 5227219820Sjeff (ib_net16_t) 5228219820Sjeff cl_qmap_key((cl_map_item_t *) p_node), p_node); 5229219820Sjeff if (status != IB_SUCCESS) { 5230219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 011A: " 5231219820Sjeff "osmtest_validate_single_node_rec_lid (%s)\n", 5232219820Sjeff ib_get_err_str(status)); 5233219820Sjeff goto Exit; 5234219820Sjeff } 5235219820Sjeff cnt++; 5236219820Sjeff p_node = (node_t *) cl_qmap_next(&p_node->map_item); 5237219820Sjeff } 5238219820Sjeff 5239219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, 5240219820Sjeff "Total of %u node records validated\n", cnt); 5241219820Sjeff 5242219820Sjeff status = osmtest_check_missing_nodes(p_osmt); 5243219820Sjeff if (status != IB_SUCCESS) { 5244219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0117: " 5245219820Sjeff "osmtest_check_missing_nodes (%s)\n", 5246219820Sjeff ib_get_err_str(status)); 5247219820Sjeff goto Exit; 5248219820Sjeff } 5249219820Sjeff 5250219820SjeffExit: 5251219820Sjeff OSM_LOG_EXIT(&p_osmt->log); 5252219820Sjeff return (status); 5253219820Sjeff} 5254219820Sjeff 5255219820Sjeff/********************************************************************** 5256219820Sjeff **********************************************************************/ 5257219820Sjeffstatic ib_api_status_t 5258219820Sjeffosmtest_validate_single_port_recs(IN osmtest_t * const p_osmt) 5259219820Sjeff{ 5260219820Sjeff port_t *p_port; 5261219820Sjeff cl_status_t status = IB_SUCCESS; 5262219820Sjeff const cl_qmap_t *p_port_key_tbl; 5263219820Sjeff uint16_t cnt = 0; 5264219820Sjeff 5265219820Sjeff OSM_LOG_ENTER(&p_osmt->log); 5266219820Sjeff 5267219820Sjeff p_port_key_tbl = &p_osmt->exp_subn.port_key_tbl; 5268219820Sjeff 5269219820Sjeff osmtest_prepare_db(p_osmt); 5270219820Sjeff 5271219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, 5272219820Sjeff "Validating individual port record queries\n"); 5273219820Sjeff 5274219820Sjeff /* 5275219820Sjeff * Walk the list of all port records, and ask for each one 5276219820Sjeff * specifically. Make sure we get it. 5277219820Sjeff */ 5278219820Sjeff p_port = (port_t *) cl_qmap_head(p_port_key_tbl); 5279219820Sjeff while (p_port != (port_t *) cl_qmap_end(p_port_key_tbl)) { 5280219820Sjeff status = osmtest_validate_single_port_rec_lid(p_osmt, p_port); 5281219820Sjeff if (status != IB_SUCCESS) { 5282219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 011B: " 5283219820Sjeff "osmtest_validate_single_port_rec_lid (%s)\n", 5284219820Sjeff ib_get_err_str(status)); 5285219820Sjeff goto Exit; 5286219820Sjeff } 5287219820Sjeff cnt++; 5288219820Sjeff p_port = (port_t *) cl_qmap_next(&p_port->map_item); 5289219820Sjeff } 5290219820Sjeff 5291219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, 5292219820Sjeff "Total of %u port records validated\n", cnt); 5293219820Sjeff 5294219820Sjeff status = osmtest_check_missing_ports(p_osmt); 5295219820Sjeff if (status != IB_SUCCESS) { 5296219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0118: " 5297219820Sjeff "osmtest_check_missing_paths failed (%s)\n", 5298219820Sjeff ib_get_err_str(status)); 5299219820Sjeff goto Exit; 5300219820Sjeff } 5301219820Sjeff 5302219820SjeffExit: 5303219820Sjeff OSM_LOG_EXIT(&p_osmt->log); 5304219820Sjeff return (status); 5305219820Sjeff} 5306219820Sjeff 5307219820Sjeff/********************************************************************** 5308219820Sjeff **********************************************************************/ 5309219820Sjeffstatic ib_api_status_t osmtest_validate_against_db(IN osmtest_t * const p_osmt) 5310219820Sjeff{ 5311219820Sjeff ib_api_status_t status = IB_SUCCESS; 5312219820Sjeff ib_gid_t portgid, mgid; 5313219820Sjeff osmtest_sm_info_rec_t sm_info_rec_opt; 5314219820Sjeff osmtest_inform_info_t inform_info_opt; 5315219820Sjeff osmtest_inform_info_rec_t inform_info_rec_opt; 5316219820Sjeff#ifdef VENDOR_RMPP_SUPPORT 5317219820Sjeff ib_net64_t sm_key; 5318219820Sjeff ib_net16_t test_lid; 5319219820Sjeff uint8_t lmc; 5320219820Sjeff osmtest_req_context_t context; 5321219820Sjeff#ifdef DUAL_SIDED_RMPP 5322219820Sjeff osmv_multipath_req_t request; 5323219820Sjeff#endif 5324219820Sjeff uint8_t i; 5325219820Sjeff#endif 5326219820Sjeff 5327219820Sjeff OSM_LOG_ENTER(&p_osmt->log); 5328219820Sjeff 5329219820Sjeff#ifdef VENDOR_RMPP_SUPPORT 5330219820Sjeff status = osmtest_validate_all_node_recs(p_osmt); 5331219820Sjeff if (status != IB_SUCCESS) 5332219820Sjeff goto Exit; 5333219820Sjeff#endif 5334219820Sjeff 5335219820Sjeff status = osmtest_validate_single_node_recs(p_osmt); 5336219820Sjeff if (status != IB_SUCCESS) 5337219820Sjeff goto Exit; 5338219820Sjeff 5339219820Sjeff /* Exercise SA PathRecord multicast destination code */ 5340219820Sjeff memset(&context, 0, sizeof(context)); 5341219820Sjeff ib_gid_set_default(&portgid, portguid); 5342219820Sjeff /* Set IPoIB broadcast MGID */ 5343219820Sjeff mgid.unicast.prefix = CL_HTON64(0xff12401bffff0000ULL); 5344219820Sjeff mgid.unicast.interface_id = CL_HTON64(0x00000000ffffffffULL); 5345219820Sjeff /* Can't check status as don't know whether port is running IPoIB */ 5346219820Sjeff osmtest_get_path_rec_by_gid_pair(p_osmt, portgid, mgid, &context); 5347219820Sjeff 5348219820Sjeff /* Other link local unicast PathRecord */ 5349219820Sjeff memset(&context, 0, sizeof(context)); 5350219820Sjeff ib_gid_set_default(&portgid, portguid); 5351219820Sjeff ib_gid_set_default(&mgid, portguid); 5352219820Sjeff mgid.raw[7] = 0xff; /* not default GID prefix */ 5353219820Sjeff /* Can't check status as don't know whether ??? */ 5354219820Sjeff osmtest_get_path_rec_by_gid_pair(p_osmt, portgid, mgid, &context); 5355219820Sjeff 5356219820Sjeff /* Off subnet (site local) unicast PathRecord */ 5357219820Sjeff memset(&context, 0, sizeof(context)); 5358219820Sjeff ib_gid_set_default(&portgid, portguid); 5359219820Sjeff ib_gid_set_default(&mgid, portguid); 5360219820Sjeff mgid.raw[1] = 0xc0; /* site local */ 5361219820Sjeff /* Can't check status as don't know whether ??? */ 5362219820Sjeff osmtest_get_path_rec_by_gid_pair(p_osmt, portgid, mgid, &context); 5363219820Sjeff 5364219820Sjeff /* More than link local scope multicast PathRecord */ 5365219820Sjeff memset(&context, 0, sizeof(context)); 5366219820Sjeff ib_gid_set_default(&portgid, portguid); 5367219820Sjeff /* Set IPoIB broadcast MGID */ 5368219820Sjeff mgid.unicast.prefix = CL_HTON64(0xff15401bffff0000ULL); /* site local */ 5369219820Sjeff mgid.unicast.interface_id = CL_HTON64(0x00000000ffffffffULL); 5370219820Sjeff /* Can't check status as don't know whether port is running IPoIB */ 5371219820Sjeff osmtest_get_path_rec_by_gid_pair(p_osmt, portgid, mgid, &context); 5372219820Sjeff 5373219820Sjeff#if defined (VENDOR_RMPP_SUPPORT) && defined (DUAL_SIDED_RMPP) 5374219820Sjeff memset(&context, 0, sizeof(context)); 5375219820Sjeff memset(&request, 0, sizeof(request)); 5376219820Sjeff request.comp_mask = 5377219820Sjeff IB_MPR_COMPMASK_SGIDCOUNT | IB_MPR_COMPMASK_DGIDCOUNT; 5378219820Sjeff request.sgid_count = 1; 5379219820Sjeff request.dgid_count = 1; 5380219820Sjeff ib_gid_set_default(&request.gids[0], portguid); 5381219820Sjeff ib_gid_set_default(&request.gids[1], portguid); 5382219820Sjeff status = osmtest_get_multipath_rec(p_osmt, &request, &context); 5383219820Sjeff if (status != IB_SUCCESS) 5384219820Sjeff goto Exit; 5385219820Sjeff 5386219820Sjeff memset(&context, 0, sizeof(context)); 5387219820Sjeff memset(&request, 0, sizeof(request)); 5388219820Sjeff 5389219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n"); 5390219820Sjeff status = osmtest_get_multipath_rec(p_osmt, &request, &context); 5391219820Sjeff if (status != IB_SUCCESS) { 5392219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, 5393219820Sjeff "Got error %s\n", ib_get_err_str(status)); 5394219820Sjeff } 5395219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n"); 5396219820Sjeff 5397219820Sjeff if (status == IB_SUCCESS) { 5398219820Sjeff status = IB_ERROR; 5399219820Sjeff goto Exit; 5400219820Sjeff } 5401219820Sjeff 5402219820Sjeff memset(&context, 0, sizeof(context)); 5403219820Sjeff memset(&request, 0, sizeof(request)); 5404219820Sjeff request.comp_mask = IB_MPR_COMPMASK_SGIDCOUNT; 5405219820Sjeff request.sgid_count = 1; 5406219820Sjeff ib_gid_set_default(&request.gids[0], portguid); 5407219820Sjeff 5408219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n"); 5409219820Sjeff status = osmtest_get_multipath_rec(p_osmt, &request, &context); 5410219820Sjeff if (status != IB_SUCCESS) { 5411219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, 5412219820Sjeff "Got error %s\n", ib_get_err_str(status)); 5413219820Sjeff } 5414219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n"); 5415219820Sjeff 5416219820Sjeff if (status == IB_SUCCESS) { 5417219820Sjeff status = IB_ERROR; 5418219820Sjeff goto Exit; 5419219820Sjeff } 5420219820Sjeff 5421219820Sjeff memset(&context, 0, sizeof(context)); 5422219820Sjeff memset(&request, 0, sizeof(request)); 5423219820Sjeff request.comp_mask = 5424219820Sjeff IB_MPR_COMPMASK_SGIDCOUNT | IB_MPR_COMPMASK_DGIDCOUNT; 5425219820Sjeff request.sgid_count = 1; 5426219820Sjeff request.dgid_count = 1; 5427219820Sjeff ib_gid_set_default(&request.gids[0], portguid); 5428219820Sjeff /* Set IPoIB broadcast MGID as DGID */ 5429219820Sjeff request.gids[1].unicast.prefix = CL_HTON64(0xff12401bffff0000ULL); 5430219820Sjeff request.gids[1].unicast.interface_id = CL_HTON64(0x00000000ffffffffULL); 5431219820Sjeff 5432219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n"); 5433219820Sjeff status = osmtest_get_multipath_rec(p_osmt, &request, &context); 5434219820Sjeff if (status != IB_SUCCESS) { 5435219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, 5436219820Sjeff "Got error %s\n", ib_get_err_str(status)); 5437219820Sjeff } 5438219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n"); 5439219820Sjeff 5440219820Sjeff if (status == IB_SUCCESS) { 5441219820Sjeff status = IB_ERROR; 5442219820Sjeff goto Exit; 5443219820Sjeff } 5444219820Sjeff 5445219820Sjeff memset(&context, 0, sizeof(context)); 5446219820Sjeff request.comp_mask = 5447219820Sjeff IB_MPR_COMPMASK_SGIDCOUNT | IB_MPR_COMPMASK_DGIDCOUNT; 5448219820Sjeff request.sgid_count = 1; 5449219820Sjeff request.dgid_count = 1; 5450219820Sjeff /* Set IPoIB broadcast MGID as SGID */ 5451219820Sjeff request.gids[0].unicast.prefix = CL_HTON64(0xff12401bffff0000ULL); 5452219820Sjeff request.gids[0].unicast.interface_id = CL_HTON64(0x00000000ffffffffULL); 5453219820Sjeff ib_gid_set_default(&request.gids[1], portguid); 5454219820Sjeff 5455219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n"); 5456219820Sjeff status = osmtest_get_multipath_rec(p_osmt, &request, &context); 5457219820Sjeff if (status != IB_SUCCESS) { 5458219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, 5459219820Sjeff "Got error %s\n", ib_get_err_str(status)); 5460219820Sjeff } 5461219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n"); 5462219820Sjeff 5463219820Sjeff if (status == IB_SUCCESS) { 5464219820Sjeff status = IB_ERROR; 5465219820Sjeff goto Exit; 5466219820Sjeff } 5467219820Sjeff 5468219820Sjeff memset(&context, 0, sizeof(context)); 5469219820Sjeff memset(&request, 0, sizeof(request)); 5470219820Sjeff request.comp_mask = 5471219820Sjeff IB_MPR_COMPMASK_SGIDCOUNT | IB_MPR_COMPMASK_DGIDCOUNT | 5472219820Sjeff IB_MPR_COMPMASK_NUMBPATH; 5473219820Sjeff request.sgid_count = 2; 5474219820Sjeff request.dgid_count = 2; 5475219820Sjeff request.num_path = 2; 5476219820Sjeff ib_gid_set_default(&request.gids[0], portguid); 5477219820Sjeff ib_gid_set_default(&request.gids[1], portguid); 5478219820Sjeff ib_gid_set_default(&request.gids[2], portguid); 5479219820Sjeff ib_gid_set_default(&request.gids[3], portguid); 5480219820Sjeff status = osmtest_get_multipath_rec(p_osmt, &request, &context); 5481219820Sjeff if (status != IB_SUCCESS) 5482219820Sjeff goto Exit; 5483219820Sjeff#endif 5484219820Sjeff 5485219820Sjeff#ifdef VENDOR_RMPP_SUPPORT 5486219820Sjeff /* GUIDInfoRecords */ 5487219820Sjeff status = osmtest_validate_all_guidinfo_recs(p_osmt); 5488219820Sjeff if (status != IB_SUCCESS) 5489219820Sjeff goto Exit; 5490219820Sjeff 5491219820Sjeff /* If LMC > 0, test non base LID SA PortInfoRecord request */ 5492219820Sjeff status = 5493219820Sjeff osmtest_get_local_port_lmc(p_osmt, p_osmt->local_port.lid, &lmc); 5494219820Sjeff if (status != IB_SUCCESS) 5495219820Sjeff goto Exit; 5496219820Sjeff 5497219820Sjeff if (lmc != 0) { 5498219820Sjeff status = 5499219820Sjeff osmtest_get_local_port_lmc(p_osmt, 5500219820Sjeff p_osmt->local_port.lid + 1, 5501219820Sjeff NULL); 5502219820Sjeff if (status != IB_SUCCESS) 5503219820Sjeff goto Exit; 5504219820Sjeff } 5505219820Sjeff 5506219820Sjeff status = osmtest_get_local_port_lmc(p_osmt, 0xffff, NULL); 5507219820Sjeff if (status != IB_SUCCESS) 5508219820Sjeff goto Exit; 5509219820Sjeff 5510219820Sjeff test_lid = cl_ntoh16(p_osmt->local_port.lid); 5511219820Sjeff 5512219820Sjeff /* More GUIDInfo Record tests */ 5513219820Sjeff memset(&context, 0, sizeof(context)); 5514219820Sjeff status = osmtest_get_guidinfo_rec_by_lid(p_osmt, test_lid, &context); 5515219820Sjeff if (status != IB_SUCCESS) 5516219820Sjeff goto Exit; 5517219820Sjeff 5518219820Sjeff memset(&context, 0, sizeof(context)); 5519219820Sjeff status = osmtest_get_guidinfo_rec_by_lid(p_osmt, 0xffff, &context); 5520219820Sjeff if (status != IB_SUCCESS) 5521219820Sjeff goto Exit; 5522219820Sjeff 5523219820Sjeff /* Some PKeyTable Record tests */ 5524219820Sjeff sm_key = OSM_DEFAULT_SM_KEY; 5525219820Sjeff memset(&context, 0, sizeof(context)); 5526219820Sjeff status = 5527219820Sjeff osmtest_get_pkeytbl_rec_by_lid(p_osmt, test_lid, sm_key, &context); 5528219820Sjeff if (status != IB_SUCCESS) 5529219820Sjeff goto Exit; 5530219820Sjeff 5531219820Sjeff memset(&context, 0, sizeof(context)); 5532219820Sjeff 5533219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n"); 5534219820Sjeff status = osmtest_get_pkeytbl_rec_by_lid(p_osmt, test_lid, 0, &context); 5535219820Sjeff if (status != IB_SUCCESS) { 5536219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, 5537219820Sjeff "Got error %s\n", ib_get_err_str(status)); 5538219820Sjeff } 5539219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n"); 5540219820Sjeff 5541219820Sjeff if (status == IB_SUCCESS) { 5542219820Sjeff status = IB_ERROR; 5543219820Sjeff goto Exit; 5544219820Sjeff } 5545219820Sjeff 5546219820Sjeff memset(&context, 0, sizeof(context)); 5547219820Sjeff status = 5548219820Sjeff osmtest_get_pkeytbl_rec_by_lid(p_osmt, 0xffff, sm_key, &context); 5549219820Sjeff if (status != IB_SUCCESS) 5550219820Sjeff goto Exit; 5551219820Sjeff 5552219820Sjeff /* SwitchInfo Record tests */ 5553219820Sjeff memset(&context, 0, sizeof(context)); 5554219820Sjeff status = osmtest_get_sw_info_rec_by_lid(p_osmt, 0, &context); 5555219820Sjeff if (status != IB_SUCCESS) 5556219820Sjeff goto Exit; 5557219820Sjeff 5558219820Sjeff memset(&context, 0, sizeof(context)); 5559219820Sjeff status = osmtest_get_sw_info_rec_by_lid(p_osmt, test_lid, &context); 5560219820Sjeff if (status != IB_SUCCESS) 5561219820Sjeff goto Exit; 5562219820Sjeff 5563219820Sjeff /* LFT Record tests */ 5564219820Sjeff memset(&context, 0, sizeof(context)); 5565219820Sjeff status = osmtest_get_lft_rec_by_lid(p_osmt, 0, &context); 5566219820Sjeff if (status != IB_SUCCESS) 5567219820Sjeff goto Exit; 5568219820Sjeff 5569219820Sjeff memset(&context, 0, sizeof(context)); 5570219820Sjeff status = osmtest_get_lft_rec_by_lid(p_osmt, test_lid, &context); 5571219820Sjeff if (status != IB_SUCCESS) 5572219820Sjeff goto Exit; 5573219820Sjeff 5574219820Sjeff /* MFT Record tests */ 5575219820Sjeff memset(&context, 0, sizeof(context)); 5576219820Sjeff status = osmtest_get_mft_rec_by_lid(p_osmt, 0, &context); 5577219820Sjeff if (status != IB_SUCCESS) 5578219820Sjeff goto Exit; 5579219820Sjeff 5580219820Sjeff memset(&context, 0, sizeof(context)); 5581219820Sjeff status = osmtest_get_mft_rec_by_lid(p_osmt, test_lid, &context); 5582219820Sjeff if (status != IB_SUCCESS) 5583219820Sjeff goto Exit; 5584219820Sjeff 5585219820Sjeff /* Some LinkRecord tests */ 5586219820Sjeff /* FromLID */ 5587219820Sjeff memset(&context, 0, sizeof(context)); 5588219820Sjeff status = osmtest_get_link_rec_by_lid(p_osmt, test_lid, 0, &context); 5589219820Sjeff if (status != IB_SUCCESS) 5590219820Sjeff goto Exit; 5591219820Sjeff 5592219820Sjeff /* ToLID */ 5593219820Sjeff memset(&context, 0, sizeof(context)); 5594219820Sjeff status = osmtest_get_link_rec_by_lid(p_osmt, 0, test_lid, &context); 5595219820Sjeff if (status != IB_SUCCESS) 5596219820Sjeff goto Exit; 5597219820Sjeff 5598219820Sjeff /* FromLID & ToLID */ 5599219820Sjeff memset(&context, 0, sizeof(context)); 5600219820Sjeff status = 5601219820Sjeff osmtest_get_link_rec_by_lid(p_osmt, test_lid, test_lid, &context); 5602219820Sjeff if (status != IB_SUCCESS) 5603219820Sjeff goto Exit; 5604219820Sjeff 5605219820Sjeff /* NodeRecord test */ 5606219820Sjeff memset(&context, 0, sizeof(context)); 5607219820Sjeff status = osmtest_get_node_rec_by_lid(p_osmt, 0xffff, &context); 5608219820Sjeff if (status != IB_SUCCESS) 5609219820Sjeff goto Exit; 5610219820Sjeff 5611219820Sjeff /* SMInfoRecord tests */ 5612219820Sjeff memset(&sm_info_rec_opt, 0, sizeof(sm_info_rec_opt)); 5613219820Sjeff memset(&context, 0, sizeof(context)); 5614219820Sjeff status = osmtest_sminfo_record_request(p_osmt, IB_MAD_METHOD_SET, 5615219820Sjeff &sm_info_rec_opt, &context); 5616219820Sjeff if (status == IB_SUCCESS) { 5617219820Sjeff status = IB_ERROR; 5618219820Sjeff goto Exit; 5619219820Sjeff } else { 5620219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "IS EXPECTED ERROR ^^^^\n"); 5621219820Sjeff } 5622219820Sjeff 5623219820Sjeff memset(&sm_info_rec_opt, 0, sizeof(sm_info_rec_opt)); 5624219820Sjeff memset(&context, 0, sizeof(context)); 5625219820Sjeff status = osmtest_sminfo_record_request(p_osmt, IB_MAD_METHOD_GETTABLE, 5626219820Sjeff &sm_info_rec_opt, &context); 5627219820Sjeff if (status != IB_SUCCESS) 5628219820Sjeff goto Exit; 5629219820Sjeff 5630219820Sjeff memset(&sm_info_rec_opt, 0, sizeof(sm_info_rec_opt)); 5631219820Sjeff sm_info_rec_opt.lid = test_lid; /* local LID */ 5632219820Sjeff memset(&context, 0, sizeof(context)); 5633219820Sjeff status = osmtest_sminfo_record_request(p_osmt, IB_MAD_METHOD_GETTABLE, 5634219820Sjeff &sm_info_rec_opt, &context); 5635219820Sjeff if (status != IB_SUCCESS) 5636219820Sjeff goto Exit; 5637219820Sjeff 5638219820Sjeff if (portguid != 0) { 5639219820Sjeff memset(&sm_info_rec_opt, 0, sizeof(sm_info_rec_opt)); 5640219820Sjeff sm_info_rec_opt.sm_guid = portguid; /* local GUID */ 5641219820Sjeff memset(&context, 0, sizeof(context)); 5642219820Sjeff status = 5643219820Sjeff osmtest_sminfo_record_request(p_osmt, 5644219820Sjeff IB_MAD_METHOD_GETTABLE, 5645219820Sjeff &sm_info_rec_opt, &context); 5646219820Sjeff if (status != IB_SUCCESS) 5647219820Sjeff goto Exit; 5648219820Sjeff } 5649219820Sjeff 5650219820Sjeff for (i = 1; i < 16; i++) { 5651219820Sjeff memset(&sm_info_rec_opt, 0, sizeof(sm_info_rec_opt)); 5652219820Sjeff sm_info_rec_opt.priority = i; 5653219820Sjeff memset(&context, 0, sizeof(context)); 5654219820Sjeff status = 5655219820Sjeff osmtest_sminfo_record_request(p_osmt, 5656219820Sjeff IB_MAD_METHOD_GETTABLE, 5657219820Sjeff &sm_info_rec_opt, &context); 5658219820Sjeff if (status != IB_SUCCESS) 5659219820Sjeff goto Exit; 5660219820Sjeff } 5661219820Sjeff 5662219820Sjeff for (i = 1; i < 4; i++) { 5663219820Sjeff memset(&sm_info_rec_opt, 0, sizeof(sm_info_rec_opt)); 5664219820Sjeff sm_info_rec_opt.sm_state = i; 5665219820Sjeff memset(&context, 0, sizeof(context)); 5666219820Sjeff status = 5667219820Sjeff osmtest_sminfo_record_request(p_osmt, 5668219820Sjeff IB_MAD_METHOD_GETTABLE, 5669219820Sjeff &sm_info_rec_opt, &context); 5670219820Sjeff if (status != IB_SUCCESS) 5671219820Sjeff goto Exit; 5672219820Sjeff } 5673219820Sjeff 5674219820Sjeff /* InformInfoRecord tests */ 5675219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "InformInfoRecord " 5676219820Sjeff "Sending a BAD - Set Unsubscribe request\n"); 5677219820Sjeff memset(&inform_info_opt, 0, sizeof(inform_info_opt)); 5678219820Sjeff memset(&inform_info_rec_opt, 0, sizeof(inform_info_rec_opt)); 5679219820Sjeff memset(&context, 0, sizeof(context)); 5680219820Sjeff status = 5681219820Sjeff osmtest_informinfo_request(p_osmt, IB_MAD_ATTR_INFORM_INFO_RECORD, 5682219820Sjeff IB_MAD_METHOD_SET, &inform_info_rec_opt, 5683219820Sjeff &context); 5684219820Sjeff if (status == IB_SUCCESS) { 5685219820Sjeff status = IB_ERROR; 5686219820Sjeff goto Exit; 5687219820Sjeff } else { 5688219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "InformInfoRecord " 5689219820Sjeff "IS EXPECTED ERROR ^^^^\n"); 5690219820Sjeff } 5691219820Sjeff 5692219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "InformInfoRecord " 5693219820Sjeff "Sending a Good - Empty GetTable request\n"); 5694219820Sjeff memset(&context, 0, sizeof(context)); 5695219820Sjeff status = 5696219820Sjeff osmtest_informinfo_request(p_osmt, IB_MAD_ATTR_INFORM_INFO_RECORD, 5697219820Sjeff IB_MAD_METHOD_GETTABLE, 5698219820Sjeff &inform_info_rec_opt, &context); 5699219820Sjeff if (status != IB_SUCCESS) 5700219820Sjeff goto Exit; 5701219820Sjeff 5702219820Sjeff /* InformInfo tests */ 5703219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "InformInfo " 5704219820Sjeff "Sending a BAD - Empty Get request " 5705219820Sjeff "(should fail with NO_RECORDS)\n"); 5706219820Sjeff memset(&context, 0, sizeof(context)); 5707219820Sjeff status = osmtest_informinfo_request(p_osmt, IB_MAD_ATTR_INFORM_INFO, 5708219820Sjeff IB_MAD_METHOD_GET, &inform_info_opt, 5709219820Sjeff &context); 5710219820Sjeff if (status == IB_SUCCESS) { 5711219820Sjeff status = IB_ERROR; 5712219820Sjeff goto Exit; 5713219820Sjeff } else { 5714219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "InformInfo " 5715219820Sjeff "IS EXPECTED ERROR ^^^^\n"); 5716219820Sjeff } 5717219820Sjeff 5718219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "InformInfo " 5719219820Sjeff "Sending a BAD - Set Unsubscribe request\n"); 5720219820Sjeff memset(&context, 0, sizeof(context)); 5721219820Sjeff status = osmtest_informinfo_request(p_osmt, IB_MAD_ATTR_INFORM_INFO, 5722219820Sjeff IB_MAD_METHOD_SET, &inform_info_opt, 5723219820Sjeff &context); 5724219820Sjeff if (status == IB_SUCCESS) { 5725219820Sjeff status = IB_ERROR; 5726219820Sjeff goto Exit; 5727219820Sjeff } else { 5728219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "InformInfo UnSubscribe " 5729219820Sjeff "IS EXPECTED ERROR ^^^^\n"); 5730219820Sjeff } 5731219820Sjeff 5732219820Sjeff /* Now subscribe */ 5733219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "InformInfo " 5734219820Sjeff "Sending a Good - Set Subscribe request\n"); 5735219820Sjeff inform_info_opt.subscribe = TRUE; 5736219820Sjeff memset(&context, 0, sizeof(context)); 5737219820Sjeff status = osmtest_informinfo_request(p_osmt, IB_MAD_ATTR_INFORM_INFO, 5738219820Sjeff IB_MAD_METHOD_SET, &inform_info_opt, 5739219820Sjeff &context); 5740219820Sjeff if (status != IB_SUCCESS) 5741219820Sjeff goto Exit; 5742219820Sjeff 5743219820Sjeff /* Now unsubscribe (QPN needs to be 1 to work) */ 5744219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "InformInfo " 5745219820Sjeff "Sending a Good - Set Unsubscribe request\n"); 5746219820Sjeff inform_info_opt.subscribe = FALSE; 5747219820Sjeff inform_info_opt.qpn = 1; 5748219820Sjeff memset(&context, 0, sizeof(context)); 5749219820Sjeff status = osmtest_informinfo_request(p_osmt, IB_MAD_ATTR_INFORM_INFO, 5750219820Sjeff IB_MAD_METHOD_SET, &inform_info_opt, 5751219820Sjeff &context); 5752219820Sjeff if (status != IB_SUCCESS) 5753219820Sjeff goto Exit; 5754219820Sjeff 5755219820Sjeff /* Now subscribe again */ 5756219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "InformInfo " 5757219820Sjeff "Sending a Good - Set Subscribe request\n"); 5758219820Sjeff inform_info_opt.subscribe = TRUE; 5759219820Sjeff inform_info_opt.qpn = 1; 5760219820Sjeff memset(&context, 0, sizeof(context)); 5761219820Sjeff status = osmtest_informinfo_request(p_osmt, IB_MAD_ATTR_INFORM_INFO, 5762219820Sjeff IB_MAD_METHOD_SET, &inform_info_opt, 5763219820Sjeff &context); 5764219820Sjeff if (status != IB_SUCCESS) 5765219820Sjeff goto Exit; 5766219820Sjeff 5767219820Sjeff /* Subscribe over existing subscription */ 5768219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "InformInfo " 5769219820Sjeff "Sending a Good - Set Subscribe (again) request\n"); 5770219820Sjeff inform_info_opt.qpn = 0; 5771219820Sjeff memset(&context, 0, sizeof(context)); 5772219820Sjeff status = osmtest_informinfo_request(p_osmt, IB_MAD_ATTR_INFORM_INFO, 5773219820Sjeff IB_MAD_METHOD_SET, &inform_info_opt, 5774219820Sjeff &context); 5775219820Sjeff if (status != IB_SUCCESS) 5776219820Sjeff goto Exit; 5777219820Sjeff 5778219820Sjeff /* More InformInfoRecord tests */ 5779219820Sjeff /* RID lookup (with currently invalid enum) */ 5780219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "InformInfoRecord " 5781219820Sjeff "Sending a Good - GetTable by GID\n"); 5782219820Sjeff ib_gid_set_default(&inform_info_rec_opt.subscriber_gid, 5783219820Sjeff p_osmt->local_port.port_guid); 5784219820Sjeff inform_info_rec_opt.subscriber_enum = 1; 5785219820Sjeff memset(&context, 0, sizeof(context)); 5786219820Sjeff status = 5787219820Sjeff osmtest_informinfo_request(p_osmt, IB_MAD_ATTR_INFORM_INFO_RECORD, 5788219820Sjeff IB_MAD_METHOD_GETTABLE, 5789219820Sjeff &inform_info_rec_opt, &context); 5790219820Sjeff if (status != IB_SUCCESS) 5791219820Sjeff goto Exit; 5792219820Sjeff 5793219820Sjeff /* Enum lookup */ 5794219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "InformInfoRecord " 5795219820Sjeff "Sending a Good - GetTable (subscriber_enum == 0) request\n"); 5796219820Sjeff inform_info_rec_opt.subscriber_enum = 0; 5797219820Sjeff memset(&context, 0, sizeof(context)); 5798219820Sjeff status = 5799219820Sjeff osmtest_informinfo_request(p_osmt, IB_MAD_ATTR_INFORM_INFO_RECORD, 5800219820Sjeff IB_MAD_METHOD_GETTABLE, 5801219820Sjeff &inform_info_rec_opt, &context); 5802219820Sjeff if (status != IB_SUCCESS) 5803219820Sjeff goto Exit; 5804219820Sjeff 5805219820Sjeff /* Get all InformInfoRecords */ 5806219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "InformInfoRecord " 5807219820Sjeff "Sending a Good - GetTable (ALL records) request\n"); 5808219820Sjeff memset(&inform_info_rec_opt, 0, sizeof(inform_info_rec_opt)); 5809219820Sjeff memset(&context, 0, sizeof(context)); 5810219820Sjeff status = 5811219820Sjeff osmtest_informinfo_request(p_osmt, IB_MAD_ATTR_INFORM_INFO_RECORD, 5812219820Sjeff IB_MAD_METHOD_GETTABLE, 5813219820Sjeff &inform_info_rec_opt, &context); 5814219820Sjeff if (status != IB_SUCCESS) 5815219820Sjeff goto Exit; 5816219820Sjeff 5817219820Sjeff /* Another subscription */ 5818219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "InformInfo " 5819219820Sjeff "Sending another Good - Set Subscribe (again) request\n"); 5820219820Sjeff inform_info_opt.qpn = 0; 5821219820Sjeff inform_info_opt.trap = 0x1234; 5822219820Sjeff memset(&context, 0, sizeof(context)); 5823219820Sjeff status = osmtest_informinfo_request(p_osmt, IB_MAD_ATTR_INFORM_INFO, 5824219820Sjeff IB_MAD_METHOD_SET, &inform_info_opt, 5825219820Sjeff &context); 5826219820Sjeff if (status != IB_SUCCESS) 5827219820Sjeff goto Exit; 5828219820Sjeff 5829219820Sjeff /* Get all InformInfoRecords again */ 5830219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "InformInfoRecord " 5831219820Sjeff "Sending a Good - GetTable (ALL records) request\n"); 5832219820Sjeff memset(&inform_info_rec_opt, 0, sizeof(inform_info_rec_opt)); 5833219820Sjeff memset(&context, 0, sizeof(context)); 5834219820Sjeff status = 5835219820Sjeff osmtest_informinfo_request(p_osmt, IB_MAD_ATTR_INFORM_INFO_RECORD, 5836219820Sjeff IB_MAD_METHOD_GETTABLE, 5837219820Sjeff &inform_info_rec_opt, &context); 5838219820Sjeff if (status != IB_SUCCESS) 5839219820Sjeff goto Exit; 5840219820Sjeff 5841219820Sjeff /* Cleanup subscriptions before further testing */ 5842219820Sjeff /* Does order of deletion matter ? Test this !!! */ 5843219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "InformInfo " 5844219820Sjeff "Sending a Good - Set (cleanup) request\n"); 5845219820Sjeff inform_info_opt.subscribe = FALSE; 5846219820Sjeff inform_info_opt.qpn = 1; 5847219820Sjeff memset(&context, 0, sizeof(context)); 5848219820Sjeff status = osmtest_informinfo_request(p_osmt, IB_MAD_ATTR_INFORM_INFO, 5849219820Sjeff IB_MAD_METHOD_SET, 5850219820Sjeff &inform_info_opt, &context); 5851219820Sjeff if (status != IB_SUCCESS) 5852219820Sjeff goto Exit; 5853219820Sjeff 5854219820Sjeff /* Get all InformInfoRecords again */ 5855219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "InformInfoRecord " 5856219820Sjeff "Sending a Good - GetTable (ALL records) request\n"); 5857219820Sjeff memset(&inform_info_rec_opt, 0, sizeof(inform_info_rec_opt)); 5858219820Sjeff memset(&context, 0, sizeof(context)); 5859219820Sjeff status = 5860219820Sjeff osmtest_informinfo_request(p_osmt, IB_MAD_ATTR_INFORM_INFO_RECORD, 5861219820Sjeff IB_MAD_METHOD_GETTABLE, 5862219820Sjeff &inform_info_rec_opt, &context); 5863219820Sjeff if (status != IB_SUCCESS) 5864219820Sjeff goto Exit; 5865219820Sjeff 5866219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "InformInfo" 5867219820Sjeff "Sending a Good - Set (cleanup) request\n"); 5868219820Sjeff inform_info_opt.subscribe = FALSE; 5869219820Sjeff inform_info_opt.qpn = 1; 5870219820Sjeff inform_info_opt.trap = 0; 5871219820Sjeff memset(&context, 0, sizeof(context)); 5872219820Sjeff status = osmtest_informinfo_request(p_osmt, IB_MAD_ATTR_INFORM_INFO, 5873219820Sjeff IB_MAD_METHOD_SET, 5874219820Sjeff &inform_info_opt, &context); 5875219820Sjeff if (status != IB_SUCCESS) 5876219820Sjeff goto Exit; 5877219820Sjeff 5878219820Sjeff /* Get all InformInfoRecords a final time */ 5879219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "InformInfoRecord " 5880219820Sjeff "Sending a Good - GetTable (ALL records) request\n"); 5881219820Sjeff memset(&inform_info_rec_opt, 0, sizeof(inform_info_rec_opt)); 5882219820Sjeff memset(&context, 0, sizeof(context)); 5883219820Sjeff status = 5884219820Sjeff osmtest_informinfo_request(p_osmt, IB_MAD_ATTR_INFORM_INFO_RECORD, 5885219820Sjeff IB_MAD_METHOD_GETTABLE, 5886219820Sjeff &inform_info_rec_opt, &context); 5887219820Sjeff if (status != IB_SUCCESS) 5888219820Sjeff goto Exit; 5889219820Sjeff 5890219820Sjeff if (lmc != 0) { 5891219820Sjeff test_lid = cl_ntoh16(p_osmt->local_port.lid + 1); 5892219820Sjeff 5893219820Sjeff /* Another GUIDInfo Record test */ 5894219820Sjeff memset(&context, 0, sizeof(context)); 5895219820Sjeff status = 5896219820Sjeff osmtest_get_guidinfo_rec_by_lid(p_osmt, test_lid, &context); 5897219820Sjeff if (status != IB_SUCCESS) 5898219820Sjeff goto Exit; 5899219820Sjeff 5900219820Sjeff /* Another PKeyTable Record test */ 5901219820Sjeff memset(&context, 0, sizeof(context)); 5902219820Sjeff status = 5903219820Sjeff osmtest_get_pkeytbl_rec_by_lid(p_osmt, test_lid, sm_key, 5904219820Sjeff &context); 5905219820Sjeff if (status != IB_SUCCESS) 5906219820Sjeff goto Exit; 5907219820Sjeff 5908219820Sjeff /* Another SwitchInfo Record test */ 5909219820Sjeff memset(&context, 0, sizeof(context)); 5910219820Sjeff status = 5911219820Sjeff osmtest_get_sw_info_rec_by_lid(p_osmt, test_lid, &context); 5912219820Sjeff if (status != IB_SUCCESS) 5913219820Sjeff goto Exit; 5914219820Sjeff 5915219820Sjeff /* Another LFT Record test */ 5916219820Sjeff memset(&context, 0, sizeof(context)); 5917219820Sjeff status = osmtest_get_lft_rec_by_lid(p_osmt, test_lid, &context); 5918219820Sjeff if (status != IB_SUCCESS) 5919219820Sjeff goto Exit; 5920219820Sjeff 5921219820Sjeff /* Another MFT Record test */ 5922219820Sjeff memset(&context, 0, sizeof(context)); 5923219820Sjeff status = osmtest_get_mft_rec_by_lid(p_osmt, test_lid, &context); 5924219820Sjeff if (status != IB_SUCCESS) 5925219820Sjeff goto Exit; 5926219820Sjeff 5927219820Sjeff /* More LinkRecord tests */ 5928219820Sjeff /* FromLID */ 5929219820Sjeff memset(&context, 0, sizeof(context)); 5930219820Sjeff status = 5931219820Sjeff osmtest_get_link_rec_by_lid(p_osmt, test_lid, 0, &context); 5932219820Sjeff if (status != IB_SUCCESS) 5933219820Sjeff goto Exit; 5934219820Sjeff 5935219820Sjeff /* ToLID */ 5936219820Sjeff memset(&context, 0, sizeof(context)); 5937219820Sjeff status = 5938219820Sjeff osmtest_get_link_rec_by_lid(p_osmt, 0, test_lid, &context); 5939219820Sjeff if (status != IB_SUCCESS) 5940219820Sjeff goto Exit; 5941219820Sjeff 5942219820Sjeff /* Another NodeRecord test */ 5943219820Sjeff memset(&context, 0, sizeof(context)); 5944219820Sjeff status = 5945219820Sjeff osmtest_get_node_rec_by_lid(p_osmt, test_lid, &context); 5946219820Sjeff if (status != IB_SUCCESS) 5947219820Sjeff goto Exit; 5948219820Sjeff } 5949219820Sjeff 5950219820Sjeff /* PathRecords */ 5951219820Sjeff if (!p_osmt->opt.ignore_path_records) { 5952219820Sjeff status = osmtest_validate_all_path_recs(p_osmt); 5953219820Sjeff if (status != IB_SUCCESS) 5954219820Sjeff goto Exit; 5955219820Sjeff 5956219820Sjeff if (lmc != 0) { 5957219820Sjeff memset(&context, 0, sizeof(context)); 5958219820Sjeff status = 5959219820Sjeff osmtest_get_path_rec_by_lid_pair(p_osmt, test_lid, 5960219820Sjeff test_lid, 5961219820Sjeff &context); 5962219820Sjeff if (status != IB_SUCCESS) 5963219820Sjeff goto Exit; 5964219820Sjeff 5965219820Sjeff memset(&context, 0, sizeof(context)); 5966219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, 5967219820Sjeff EXPECTING_ERRORS_START "\n"); 5968219820Sjeff status = 5969219820Sjeff osmtest_get_path_rec_by_lid_pair(p_osmt, 0xffff, 5970219820Sjeff 0xffff, &context); 5971219820Sjeff if (status != IB_SUCCESS) { 5972219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, 5973219820Sjeff "Got error %s\n", 5974219820Sjeff ib_get_err_str(status)); 5975219820Sjeff } 5976219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, 5977219820Sjeff EXPECTING_ERRORS_END "\n"); 5978219820Sjeff 5979219820Sjeff if (status == IB_SUCCESS) { 5980219820Sjeff status = IB_ERROR; 5981219820Sjeff goto Exit; 5982219820Sjeff } 5983219820Sjeff 5984219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, 5985219820Sjeff EXPECTING_ERRORS_START "\n"); 5986219820Sjeff 5987219820Sjeff status = 5988219820Sjeff osmtest_get_path_rec_by_lid_pair(p_osmt, test_lid, 5989219820Sjeff 0xffff, &context); 5990219820Sjeff if (status != IB_SUCCESS) { 5991219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, 5992219820Sjeff "Got error %s\n", 5993219820Sjeff ib_get_err_str(status)); 5994219820Sjeff } 5995219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, 5996219820Sjeff EXPECTING_ERRORS_END "\n"); 5997219820Sjeff 5998219820Sjeff if (status == IB_SUCCESS) { 5999219820Sjeff status = IB_ERROR; 6000219820Sjeff goto Exit; 6001219820Sjeff } 6002219820Sjeff } 6003219820Sjeff } 6004219820Sjeff#endif 6005219820Sjeff 6006219820Sjeff status = osmtest_validate_single_port_recs(p_osmt); 6007219820Sjeff if (status != IB_SUCCESS) 6008219820Sjeff goto Exit; 6009219820Sjeff 6010219820Sjeff if (!p_osmt->opt.ignore_path_records) { 6011219820Sjeff status = osmtest_validate_single_path_recs(p_osmt); 6012219820Sjeff if (status != IB_SUCCESS) 6013219820Sjeff goto Exit; 6014219820Sjeff } 6015219820Sjeff 6016219820SjeffExit: 6017219820Sjeff OSM_LOG_EXIT(&p_osmt->log); 6018219820Sjeff return (status); 6019219820Sjeff} 6020219820Sjeff 6021219820Sjeff/********************************************************************** 6022219820Sjeff **********************************************************************/ 6023219820Sjeffstatic const osmtest_token_t *str_get_token(IN char *const p_str) 6024219820Sjeff{ 6025219820Sjeff const osmtest_token_t *p_tok; 6026219820Sjeff uint32_t index = 0; 6027219820Sjeff 6028219820Sjeff p_tok = &token_array[index]; 6029219820Sjeff 6030219820Sjeff while (p_tok->val != OSMTEST_TOKEN_UNKNOWN) { 6031219820Sjeff if (strnicmp(p_str, p_tok->str, p_tok->str_size) == 0) 6032219820Sjeff return (p_tok); 6033219820Sjeff 6034219820Sjeff p_tok = &token_array[++index]; 6035219820Sjeff } 6036219820Sjeff 6037219820Sjeff return (NULL); 6038219820Sjeff} 6039219820Sjeff 6040219820Sjeff/********************************************************************** 6041219820Sjeff Returns true if not whitespace character encountered before EOL. 6042219820Sjeff**********************************************************************/ 6043219820Sjeffstatic boolean_t 6044219820Sjeffstr_skip_white(IN char line[], IN OUT uint32_t * const p_offset) 6045219820Sjeff{ 6046219820Sjeff while (((line[*p_offset] == '\t') || 6047219820Sjeff (line[*p_offset] == ' ')) && 6048219820Sjeff (line[*p_offset] != '\n') && (line[*p_offset] != '\0')) { 6049219820Sjeff ++*p_offset; 6050219820Sjeff } 6051219820Sjeff 6052219820Sjeff if ((line[*p_offset] == '\n') || (line[*p_offset] == '\0')) 6053219820Sjeff return (FALSE); 6054219820Sjeff else 6055219820Sjeff return (TRUE); 6056219820Sjeff} 6057219820Sjeff 6058219820Sjeff/********************************************************************** 6059219820Sjeff Returns true if not whitespace character encountered before EOL. 6060219820Sjeff**********************************************************************/ 6061219820Sjeffstatic void str_skip_token(IN char line[], IN OUT uint32_t * const p_offset) 6062219820Sjeff{ 6063219820Sjeff while ((line[*p_offset] != '\t') && 6064219820Sjeff (line[*p_offset] != ' ') && (line[*p_offset] != '\0')) { 6065219820Sjeff ++*p_offset; 6066219820Sjeff } 6067219820Sjeff} 6068219820Sjeff 6069219820Sjeff/********************************************************************** 6070219820Sjeff **********************************************************************/ 6071219820Sjeffstatic ib_api_status_t 6072219820Sjeffosmtest_parse_node(IN osmtest_t * const p_osmt, 6073219820Sjeff IN FILE * const fh, IN OUT uint32_t * const p_line_num) 6074219820Sjeff{ 6075219820Sjeff ib_api_status_t status = IB_SUCCESS; 6076219820Sjeff uint32_t offset; 6077219820Sjeff char line[OSMTEST_MAX_LINE_LEN]; 6078219820Sjeff boolean_t done = FALSE; 6079219820Sjeff node_t *p_node; 6080219820Sjeff node_t *p_guid_node; 6081219820Sjeff const osmtest_token_t *p_tok; 6082219820Sjeff 6083219820Sjeff OSM_LOG_ENTER(&p_osmt->log); 6084219820Sjeff 6085219820Sjeff p_node = node_new(); 6086219820Sjeff CL_ASSERT(p_node != NULL); 6087219820Sjeff 6088219820Sjeff /* 6089219820Sjeff * Parse the inventory file and create the database. 6090219820Sjeff */ 6091219820Sjeff while (!done) { 6092219820Sjeff if (fgets(line, OSMTEST_MAX_LINE_LEN, fh) == NULL) { 6093219820Sjeff /* 6094219820Sjeff * End of file in the middle of a definition. 6095219820Sjeff */ 6096219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0119: " 6097219820Sjeff "Unexpected end of file\n"); 6098219820Sjeff status = IB_ERROR; 6099219820Sjeff goto Exit; 6100219820Sjeff } 6101219820Sjeff 6102219820Sjeff ++*p_line_num; 6103219820Sjeff 6104219820Sjeff /* 6105219820Sjeff * Skip whitespace 6106219820Sjeff */ 6107219820Sjeff offset = 0; 6108219820Sjeff if (!str_skip_white(line, &offset)) 6109219820Sjeff continue; /* whole line was whitespace */ 6110219820Sjeff 6111219820Sjeff p_tok = str_get_token(&line[offset]); 6112219820Sjeff if (p_tok == NULL) { 6113219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0120: " 6114219820Sjeff "Ignoring line %u with unknown token: %s\n", 6115219820Sjeff *p_line_num, &line[offset]); 6116219820Sjeff continue; 6117219820Sjeff } 6118219820Sjeff 6119219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, 6120219820Sjeff "Found '%s' (line %u)\n", p_tok->str, *p_line_num); 6121219820Sjeff 6122219820Sjeff str_skip_token(line, &offset); 6123219820Sjeff 6124219820Sjeff switch (p_tok->val) { 6125219820Sjeff case OSMTEST_TOKEN_COMMENT: 6126219820Sjeff break; 6127219820Sjeff 6128219820Sjeff case OSMTEST_TOKEN_LID: 6129219820Sjeff p_node->comp.lid = 0xFFFF; 6130219820Sjeff p_node->rec.lid = 6131219820Sjeff cl_hton16((uint16_t) 6132219820Sjeff strtoul(&line[offset], NULL, 0)); 6133219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, "lid = 0x%X\n", 6134219820Sjeff cl_ntoh16(p_node->rec.lid)); 6135219820Sjeff break; 6136219820Sjeff 6137219820Sjeff case OSMTEST_TOKEN_BASE_VERSION: 6138219820Sjeff p_node->comp.node_info.base_version = 0xFF; 6139219820Sjeff p_node->rec.node_info.base_version = 6140219820Sjeff (uint8_t) strtoul(&line[offset], NULL, 0); 6141219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, 6142219820Sjeff "base_version = 0x%X\n", 6143219820Sjeff p_node->rec.node_info.base_version); 6144219820Sjeff break; 6145219820Sjeff 6146219820Sjeff case OSMTEST_TOKEN_CLASS_VERSION: 6147219820Sjeff p_node->comp.node_info.class_version = 0xFF; 6148219820Sjeff p_node->rec.node_info.class_version = 6149219820Sjeff (uint8_t) strtoul(&line[offset], NULL, 0); 6150219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, 6151219820Sjeff "class_version = 0x%X\n", 6152219820Sjeff p_node->rec.node_info.class_version); 6153219820Sjeff break; 6154219820Sjeff 6155219820Sjeff case OSMTEST_TOKEN_NODE_TYPE: 6156219820Sjeff p_node->comp.node_info.node_type = 0xFF; 6157219820Sjeff p_node->rec.node_info.node_type = 6158219820Sjeff (uint8_t) strtoul(&line[offset], NULL, 0); 6159219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, 6160219820Sjeff "node_type = 0x%X\n", 6161219820Sjeff p_node->rec.node_info.node_type); 6162219820Sjeff break; 6163219820Sjeff 6164219820Sjeff case OSMTEST_TOKEN_NUM_PORTS: 6165219820Sjeff p_node->comp.node_info.num_ports = 0xFF; 6166219820Sjeff p_node->rec.node_info.num_ports = 6167219820Sjeff (uint8_t) strtoul(&line[offset], NULL, 0); 6168219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, 6169219820Sjeff "num_ports = 0x%X\n", 6170219820Sjeff p_node->rec.node_info.num_ports); 6171219820Sjeff break; 6172219820Sjeff 6173219820Sjeff case OSMTEST_TOKEN_SYS_GUID: 6174219820Sjeff p_node->comp.node_info.sys_guid = 0xFFFFFFFFFFFFFFFFULL; 6175219820Sjeff p_node->rec.node_info.sys_guid = 6176219820Sjeff cl_hton64(strtoull(&line[offset], NULL, 0)); 6177219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, 6178219820Sjeff "sys_guid = 0x%016" PRIx64 "\n", 6179219820Sjeff cl_ntoh64(p_node->rec.node_info.sys_guid)); 6180219820Sjeff break; 6181219820Sjeff 6182219820Sjeff case OSMTEST_TOKEN_NODE_GUID: 6183219820Sjeff p_node->comp.node_info.node_guid = 6184219820Sjeff 0xFFFFFFFFFFFFFFFFULL; 6185219820Sjeff p_node->rec.node_info.node_guid = 6186219820Sjeff cl_hton64(strtoull(&line[offset], NULL, 0)); 6187219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, 6188219820Sjeff "node_guid = 0x%016" PRIx64 "\n", 6189219820Sjeff cl_ntoh64(p_node->rec.node_info.node_guid)); 6190219820Sjeff break; 6191219820Sjeff 6192219820Sjeff case OSMTEST_TOKEN_PORT_GUID: 6193219820Sjeff p_node->comp.node_info.port_guid = 6194219820Sjeff 0xFFFFFFFFFFFFFFFFULL; 6195219820Sjeff p_node->rec.node_info.port_guid = 6196219820Sjeff cl_hton64(strtoull(&line[offset], NULL, 0)); 6197219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, 6198219820Sjeff "port_guid = 0x%016" PRIx64 "\n", 6199219820Sjeff cl_ntoh64(p_node->rec.node_info.port_guid)); 6200219820Sjeff break; 6201219820Sjeff 6202219820Sjeff case OSMTEST_TOKEN_PARTITION_CAP: 6203219820Sjeff p_node->comp.node_info.partition_cap = 0xFFFF; 6204219820Sjeff p_node->rec.node_info.partition_cap = 6205219820Sjeff cl_hton16((uint16_t) 6206219820Sjeff strtoul(&line[offset], NULL, 0)); 6207219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, 6208219820Sjeff "partition_cap = 0x%X\n", 6209219820Sjeff cl_ntoh16(p_node->rec.node_info.partition_cap)); 6210219820Sjeff break; 6211219820Sjeff 6212219820Sjeff case OSMTEST_TOKEN_DEVICE_ID: 6213219820Sjeff p_node->comp.node_info.device_id = 0xFFFF; 6214219820Sjeff p_node->rec.node_info.device_id = cl_hton16((uint16_t) 6215219820Sjeff strtoul 6216219820Sjeff (&line 6217219820Sjeff [offset], 6218219820Sjeff NULL, 0)); 6219219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, 6220219820Sjeff "device_id = 0x%X\n", 6221219820Sjeff cl_ntoh16(p_node->rec.node_info.device_id)); 6222219820Sjeff break; 6223219820Sjeff 6224219820Sjeff case OSMTEST_TOKEN_REVISION: 6225219820Sjeff p_node->comp.node_info.revision = 0xFFFFFFFF; 6226219820Sjeff p_node->rec.node_info.revision = 6227219820Sjeff cl_hton32(strtoul(&line[offset], NULL, 0)); 6228219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, 6229219820Sjeff "revision = 0x%X\n", 6230219820Sjeff cl_ntoh32(p_node->rec.node_info.revision)); 6231219820Sjeff break; 6232219820Sjeff 6233219820Sjeff case OSMTEST_TOKEN_PORT_NUM: 6234219820Sjeff p_node->comp.node_info.port_num_vendor_id |= 6235219820Sjeff IB_NODE_INFO_PORT_NUM_MASK; 6236219820Sjeff p_node->rec.node_info.port_num_vendor_id |= 6237219820Sjeff (uint8_t) strtoul(&line[offset], NULL, 0); 6238219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, 6239219820Sjeff "local_port_num = 0x%X\n", 6240219820Sjeff ib_node_info_get_local_port_num 6241219820Sjeff (&p_node->rec.node_info)); 6242219820Sjeff break; 6243219820Sjeff 6244219820Sjeff case OSMTEST_TOKEN_VENDOR_ID: 6245219820Sjeff p_node->comp.node_info.port_num_vendor_id |= 6246219820Sjeff IB_NODE_INFO_VEND_ID_MASK; 6247219820Sjeff p_node->rec.node_info.port_num_vendor_id |= 6248219820Sjeff cl_hton32(strtoul(&line[offset], NULL, 0)); 6249219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, 6250219820Sjeff "vendor_id = 0x%X\n", 6251219820Sjeff cl_ntoh32(ib_node_info_get_vendor_id 6252219820Sjeff (&p_node->rec.node_info))); 6253219820Sjeff break; 6254219820Sjeff 6255219820Sjeff case OSMTEST_TOKEN_END: 6256219820Sjeff done = TRUE; 6257219820Sjeff break; 6258219820Sjeff 6259219820Sjeff default: 6260219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0121: " 6261219820Sjeff "Ignoring line %u with unknown token: %s\n", 6262219820Sjeff *p_line_num, &line[offset]); 6263219820Sjeff 6264219820Sjeff break; 6265219820Sjeff } 6266219820Sjeff } 6267219820Sjeff 6268219820Sjeff /* 6269219820Sjeff * Make sure the user specified enough information, then 6270219820Sjeff * add this object to the database. 6271219820Sjeff */ 6272219820Sjeff if (p_node->comp.lid == 0) { 6273219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0122: " 6274219820Sjeff "LID must be specified for defined nodes\n"); 6275219820Sjeff node_delete(p_node); 6276219820Sjeff goto Exit; 6277219820Sjeff } 6278219820Sjeff 6279219820Sjeff cl_qmap_insert(&p_osmt->exp_subn.node_lid_tbl, 6280219820Sjeff p_node->rec.lid, &p_node->map_item); 6281219820Sjeff 6282219820Sjeff p_guid_node = node_new(); 6283219820Sjeff CL_ASSERT(p_node != NULL); 6284219820Sjeff 6285219820Sjeff *p_guid_node = *p_node; 6286219820Sjeff 6287219820Sjeff cl_qmap_insert(&p_osmt->exp_subn.node_guid_tbl, 6288219820Sjeff p_guid_node->rec.node_info.node_guid, 6289219820Sjeff &p_guid_node->map_item); 6290219820Sjeff 6291219820SjeffExit: 6292219820Sjeff OSM_LOG_EXIT(&p_osmt->log); 6293219820Sjeff return (status); 6294219820Sjeff} 6295219820Sjeff 6296219820Sjeff/********************************************************************** 6297219820Sjeff **********************************************************************/ 6298219820Sjeffstatic ib_api_status_t 6299219820Sjeffosmtest_parse_port(IN osmtest_t * const p_osmt, 6300219820Sjeff IN FILE * const fh, IN OUT uint32_t * const p_line_num) 6301219820Sjeff{ 6302219820Sjeff ib_api_status_t status = IB_SUCCESS; 6303219820Sjeff uint32_t offset; 6304219820Sjeff char line[OSMTEST_MAX_LINE_LEN]; 6305219820Sjeff boolean_t done = FALSE; 6306219820Sjeff port_t *p_port; 6307219820Sjeff const osmtest_token_t *p_tok; 6308219820Sjeff 6309219820Sjeff OSM_LOG_ENTER(&p_osmt->log); 6310219820Sjeff 6311219820Sjeff p_port = port_new(); 6312219820Sjeff CL_ASSERT(p_port != NULL); 6313219820Sjeff 6314219820Sjeff /* 6315219820Sjeff * Parse the inventory file and create the database. 6316219820Sjeff */ 6317219820Sjeff while (!done) { 6318219820Sjeff if (fgets(line, OSMTEST_MAX_LINE_LEN, fh) == NULL) { 6319219820Sjeff /* 6320219820Sjeff * End of file in the middle of a definition. 6321219820Sjeff */ 6322219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0123: " 6323219820Sjeff "Unexpected end of file\n"); 6324219820Sjeff status = IB_ERROR; 6325219820Sjeff goto Exit; 6326219820Sjeff } 6327219820Sjeff 6328219820Sjeff ++*p_line_num; 6329219820Sjeff 6330219820Sjeff /* 6331219820Sjeff * Skip whitespace 6332219820Sjeff */ 6333219820Sjeff offset = 0; 6334219820Sjeff if (!str_skip_white(line, &offset)) 6335219820Sjeff continue; /* whole line was whitespace */ 6336219820Sjeff 6337219820Sjeff p_tok = str_get_token(&line[offset]); 6338219820Sjeff if (p_tok == NULL) { 6339219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0124: " 6340219820Sjeff "Ignoring line %u with unknown token: %s\n", 6341219820Sjeff *p_line_num, &line[offset]); 6342219820Sjeff continue; 6343219820Sjeff } 6344219820Sjeff 6345219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, 6346219820Sjeff "Found '%s' (line %u)\n", p_tok->str, *p_line_num); 6347219820Sjeff 6348219820Sjeff str_skip_token(line, &offset); 6349219820Sjeff 6350219820Sjeff switch (p_tok->val) { 6351219820Sjeff case OSMTEST_TOKEN_COMMENT: 6352219820Sjeff break; 6353219820Sjeff 6354219820Sjeff case OSMTEST_TOKEN_LID: 6355219820Sjeff p_port->comp.lid = 0xFFFF; 6356219820Sjeff p_port->rec.lid = 6357219820Sjeff cl_hton16((uint16_t) 6358219820Sjeff strtoul(&line[offset], NULL, 0)); 6359219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, "lid = 0x%X\n", 6360219820Sjeff cl_ntoh16(p_port->rec.lid)); 6361219820Sjeff break; 6362219820Sjeff 6363219820Sjeff case OSMTEST_TOKEN_PORT_NUM: 6364219820Sjeff p_port->comp.port_num = 0xFF; 6365219820Sjeff p_port->rec.port_num = 6366219820Sjeff (uint8_t) strtoul(&line[offset], NULL, 0); 6367219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, 6368219820Sjeff "port_num = 0x%u\n", p_port->rec.port_num); 6369219820Sjeff break; 6370219820Sjeff 6371219820Sjeff case OSMTEST_TOKEN_MKEY: 6372219820Sjeff p_port->comp.port_info.m_key = 0xFFFFFFFFFFFFFFFFULL; 6373219820Sjeff p_port->rec.port_info.m_key = 6374219820Sjeff cl_hton64(strtoull(&line[offset], NULL, 0)); 6375219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, 6376219820Sjeff "m_key = 0x%016" PRIx64 "\n", 6377219820Sjeff cl_ntoh64(p_port->rec.port_info.m_key)); 6378219820Sjeff break; 6379219820Sjeff 6380219820Sjeff case OSMTEST_TOKEN_SUBN_PREF: 6381219820Sjeff p_port->comp.port_info.subnet_prefix = 6382219820Sjeff 0xFFFFFFFFFFFFFFFFULL; 6383219820Sjeff p_port->rec.port_info.subnet_prefix = 6384219820Sjeff cl_hton64(strtoull(&line[offset], NULL, 0)); 6385219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, 6386219820Sjeff "subnet_prefix = 0x%016" PRIx64 "\n", 6387219820Sjeff cl_ntoh64(p_port->rec.port_info.subnet_prefix)); 6388219820Sjeff break; 6389219820Sjeff 6390219820Sjeff case OSMTEST_TOKEN_BASE_LID: 6391219820Sjeff p_port->comp.port_info.base_lid = 0xFFFF; 6392219820Sjeff p_port->rec.port_info.base_lid = 6393219820Sjeff cl_hton16((uint16_t) 6394219820Sjeff strtoul(&line[offset], NULL, 0)); 6395219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, 6396219820Sjeff "base_lid = 0x%X\n", 6397219820Sjeff cl_ntoh16(p_port->rec.port_info.base_lid)); 6398219820Sjeff break; 6399219820Sjeff 6400219820Sjeff case OSMTEST_TOKEN_SM_BASE_LID: 6401219820Sjeff p_port->comp.port_info.master_sm_base_lid = 0xFFFF; 6402219820Sjeff p_port->rec.port_info.master_sm_base_lid = 6403219820Sjeff cl_hton16((uint16_t) 6404219820Sjeff strtoul(&line[offset], NULL, 0)); 6405219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, 6406219820Sjeff "master_sm_base_lid = 0x%X\n", 6407219820Sjeff cl_ntoh16(p_port->rec.port_info.master_sm_base_lid)); 6408219820Sjeff break; 6409219820Sjeff 6410219820Sjeff case OSMTEST_TOKEN_CAP_MASK: 6411219820Sjeff p_port->comp.port_info.capability_mask = 0xFFFFFFFF; 6412219820Sjeff p_port->rec.port_info.capability_mask = 6413219820Sjeff cl_hton32((uint32_t) 6414219820Sjeff strtoul(&line[offset], NULL, 0)); 6415219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, 6416219820Sjeff "capability_mask = 0x%X\n", 6417219820Sjeff cl_ntoh32(p_port->rec.port_info.capability_mask)); 6418219820Sjeff break; 6419219820Sjeff 6420219820Sjeff case OSMTEST_TOKEN_DIAG_CODE: 6421219820Sjeff p_port->comp.port_info.diag_code = 0xFFFF; 6422219820Sjeff p_port->rec.port_info.diag_code = 6423219820Sjeff cl_hton16((uint16_t) 6424219820Sjeff strtoul(&line[offset], NULL, 0)); 6425219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, 6426219820Sjeff "diag_code = 0x%X\n", 6427219820Sjeff cl_ntoh16(p_port->rec.port_info.diag_code)); 6428219820Sjeff break; 6429219820Sjeff 6430219820Sjeff case OSMTEST_TOKEN_MKEY_LEASE_PER: 6431219820Sjeff p_port->comp.port_info.m_key_lease_period = 0xFFFF; 6432219820Sjeff p_port->rec.port_info.m_key_lease_period = 6433219820Sjeff cl_hton16((uint16_t) 6434219820Sjeff strtoul(&line[offset], NULL, 0)); 6435219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, 6436219820Sjeff "m_key_lease_period = 0x%X\n", 6437219820Sjeff cl_ntoh16(p_port->rec.port_info.m_key_lease_period)); 6438219820Sjeff break; 6439219820Sjeff 6440219820Sjeff case OSMTEST_TOKEN_LOC_PORT_NUM: 6441219820Sjeff p_port->comp.port_info.local_port_num = 0xFF; 6442219820Sjeff p_port->rec.port_info.local_port_num = 6443219820Sjeff (uint8_t) strtoul(&line[offset], NULL, 0); 6444219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, 6445219820Sjeff "local_port_num = 0x%u\n", 6446219820Sjeff p_port->rec.port_info.local_port_num); 6447219820Sjeff break; 6448219820Sjeff 6449219820Sjeff case OSMTEST_TOKEN_LINK_WID_EN: 6450219820Sjeff p_port->comp.port_info.link_width_enabled = 0xFF; 6451219820Sjeff p_port->rec.port_info.link_width_enabled = 6452219820Sjeff (uint8_t) strtoul(&line[offset], NULL, 0); 6453219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, 6454219820Sjeff "link_width_enabled = 0x%u\n", 6455219820Sjeff p_port->rec.port_info.link_width_enabled); 6456219820Sjeff break; 6457219820Sjeff 6458219820Sjeff case OSMTEST_TOKEN_LINK_WID_SUP: 6459219820Sjeff p_port->comp.port_info.link_width_supported = 0xFF; 6460219820Sjeff p_port->rec.port_info.link_width_supported = 6461219820Sjeff (uint8_t) strtoul(&line[offset], NULL, 0); 6462219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, 6463219820Sjeff "link_width_supported = 0x%u\n", 6464219820Sjeff p_port->rec.port_info.link_width_supported); 6465219820Sjeff break; 6466219820Sjeff 6467219820Sjeff case OSMTEST_TOKEN_LINK_WID_ACT: 6468219820Sjeff p_port->comp.port_info.link_width_active = 0xFF; 6469219820Sjeff p_port->rec.port_info.link_width_active = 6470219820Sjeff (uint8_t) strtoul(&line[offset], NULL, 0); 6471219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, 6472219820Sjeff "link_width_active = 0x%u\n", 6473219820Sjeff p_port->rec.port_info.link_width_active); 6474219820Sjeff break; 6475219820Sjeff 6476219820Sjeff case OSMTEST_TOKEN_LINK_SPEED_SUP: 6477219820Sjeff p_port->comp.port_info.state_info1 = 0xFF; 6478219820Sjeff ib_port_info_set_link_speed_sup((uint8_t) 6479219820Sjeff strtoul(&line[offset], 6480219820Sjeff NULL, 0), 6481219820Sjeff &p_port->rec.port_info); 6482219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, 6483219820Sjeff "link_speed_supported = 0x%u\n", 6484219820Sjeff ib_port_info_get_link_speed_sup(&p_port->rec.port_info)); 6485219820Sjeff break; 6486219820Sjeff 6487219820Sjeff case OSMTEST_TOKEN_PORT_STATE: 6488219820Sjeff str_skip_white(line, &offset); 6489219820Sjeff p_port->comp.port_info.state_info1 = 0xFF; 6490219820Sjeff ib_port_info_set_port_state(&p_port->rec.port_info, 6491219820Sjeff ib_get_port_state_from_str 6492219820Sjeff (&line[offset])); 6493219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, 6494219820Sjeff "port_state = 0x%u\n", 6495219820Sjeff ib_port_info_get_port_state(&p_port->rec.port_info)); 6496219820Sjeff break; 6497219820Sjeff 6498219820Sjeff case OSMTEST_TOKEN_STATE_INFO2: 6499219820Sjeff p_port->comp.port_info.state_info2 = 0xFF; 6500219820Sjeff p_port->rec.port_info.state_info2 = 6501219820Sjeff (uint8_t) strtoul(&line[offset], NULL, 0); 6502219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, 6503219820Sjeff "state_info2 = 0x%u\n", 6504219820Sjeff p_port->rec.port_info.state_info2); 6505219820Sjeff break; 6506219820Sjeff 6507219820Sjeff case OSMTEST_TOKEN_MKEY_PROT_BITS: 6508219820Sjeff p_port->comp.port_info.mkey_lmc = 0xFF; 6509219820Sjeff ib_port_info_set_mpb(&p_port->rec.port_info, 6510219820Sjeff (uint8_t) strtoul(&line[offset], 6511219820Sjeff NULL, 0)); 6512219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, "mpb = 0x%u\n", 6513219820Sjeff ib_port_info_get_mpb(&p_port->rec.port_info)); 6514219820Sjeff break; 6515219820Sjeff 6516219820Sjeff case OSMTEST_TOKEN_LMC: 6517219820Sjeff p_port->comp.port_info.mkey_lmc = 0xFF; 6518219820Sjeff ib_port_info_set_lmc(&p_port->rec.port_info, 6519219820Sjeff (uint8_t) strtoul(&line[offset], 6520219820Sjeff NULL, 0)); 6521219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, "lmc = 0x%u\n", 6522219820Sjeff ib_port_info_get_lmc(&p_port->rec.port_info)); 6523219820Sjeff break; 6524219820Sjeff 6525219820Sjeff case OSMTEST_TOKEN_LINK_SPEED: 6526219820Sjeff p_port->comp.port_info.link_speed = 0xFF; 6527219820Sjeff p_port->rec.port_info.link_speed = 6528219820Sjeff (uint8_t) strtoul(&line[offset], NULL, 0); 6529219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, 6530219820Sjeff "link_speed = 0x%u\n", 6531219820Sjeff p_port->rec.port_info.link_speed); 6532219820Sjeff break; 6533219820Sjeff 6534219820Sjeff case OSMTEST_TOKEN_MTU_SMSL: 6535219820Sjeff p_port->comp.port_info.mtu_smsl = 0xFF; 6536219820Sjeff p_port->rec.port_info.mtu_smsl = 6537219820Sjeff (uint8_t) strtoul(&line[offset], NULL, 0); 6538219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, 6539219820Sjeff "mtu_smsl = 0x%u\n", 6540219820Sjeff p_port->rec.port_info.mtu_smsl); 6541219820Sjeff break; 6542219820Sjeff 6543219820Sjeff case OSMTEST_TOKEN_VL_CAP: 6544219820Sjeff p_port->comp.port_info.vl_cap = 0xFF; 6545219820Sjeff p_port->rec.port_info.vl_cap = 6546219820Sjeff (uint8_t) strtoul(&line[offset], NULL, 0); 6547219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, "vl_cap = 0x%u\n", 6548219820Sjeff p_port->rec.port_info.vl_cap); 6549219820Sjeff break; 6550219820Sjeff 6551219820Sjeff case OSMTEST_TOKEN_VL_HIGH_LIMIT: 6552219820Sjeff p_port->comp.port_info.vl_high_limit = 0xFF; 6553219820Sjeff p_port->rec.port_info.vl_high_limit = 6554219820Sjeff (uint8_t) strtoul(&line[offset], NULL, 0); 6555219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, 6556219820Sjeff "vl_high_limit = 0x%u\n", 6557219820Sjeff p_port->rec.port_info.vl_high_limit); 6558219820Sjeff break; 6559219820Sjeff 6560219820Sjeff case OSMTEST_TOKEN_VL_ARB_HIGH_CAP: 6561219820Sjeff p_port->comp.port_info.vl_arb_high_cap = 0xFF; 6562219820Sjeff p_port->rec.port_info.vl_arb_high_cap = 6563219820Sjeff (uint8_t) strtoul(&line[offset], NULL, 0); 6564219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, 6565219820Sjeff "vl_arb_high_cap = 0x%u\n", 6566219820Sjeff p_port->rec.port_info.vl_arb_high_cap); 6567219820Sjeff break; 6568219820Sjeff 6569219820Sjeff case OSMTEST_TOKEN_VL_ARB_LOW_CAP: 6570219820Sjeff p_port->comp.port_info.vl_arb_low_cap = 0xFF; 6571219820Sjeff p_port->rec.port_info.vl_arb_low_cap = 6572219820Sjeff (uint8_t) strtoul(&line[offset], NULL, 0); 6573219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, 6574219820Sjeff "vl_arb_low_cap = 0x%u\n", 6575219820Sjeff p_port->rec.port_info.vl_arb_low_cap); 6576219820Sjeff break; 6577219820Sjeff 6578219820Sjeff case OSMTEST_TOKEN_MTU_CAP: 6579219820Sjeff p_port->comp.port_info.mtu_cap = 0xFF; 6580219820Sjeff p_port->rec.port_info.mtu_cap = 6581219820Sjeff (uint8_t) strtoul(&line[offset], NULL, 0); 6582219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, "mtu_cap = 0x%u\n", 6583219820Sjeff p_port->rec.port_info.mtu_cap); 6584219820Sjeff break; 6585219820Sjeff 6586219820Sjeff case OSMTEST_TOKEN_VL_STALL_LIFE: 6587219820Sjeff p_port->comp.port_info.vl_stall_life = 0xFF; 6588219820Sjeff p_port->rec.port_info.vl_stall_life = 6589219820Sjeff (uint8_t) strtoul(&line[offset], NULL, 0); 6590219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, 6591219820Sjeff "vl_stall_life = 0x%u\n", 6592219820Sjeff p_port->rec.port_info.vl_stall_life); 6593219820Sjeff break; 6594219820Sjeff 6595219820Sjeff case OSMTEST_TOKEN_VL_ENFORCE: 6596219820Sjeff p_port->comp.port_info.vl_enforce = 0xFF; 6597219820Sjeff p_port->rec.port_info.vl_enforce = 6598219820Sjeff (uint8_t) strtoul(&line[offset], NULL, 0); 6599219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, 6600219820Sjeff "vl_enforce = 0x%u\n", 6601219820Sjeff p_port->rec.port_info.vl_enforce); 6602219820Sjeff break; 6603219820Sjeff 6604219820Sjeff case OSMTEST_TOKEN_MKEY_VIOL: 6605219820Sjeff p_port->comp.port_info.m_key_violations = 0xFFFF; 6606219820Sjeff p_port->rec.port_info.m_key_violations = 6607219820Sjeff cl_hton16((uint16_t) 6608219820Sjeff strtoul(&line[offset], NULL, 0)); 6609219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, 6610219820Sjeff "m_key_violations = 0x%X\n", 6611219820Sjeff cl_ntoh16(p_port->rec.port_info.m_key_violations)); 6612219820Sjeff break; 6613219820Sjeff 6614219820Sjeff case OSMTEST_TOKEN_PKEY_VIOL: 6615219820Sjeff p_port->comp.port_info.p_key_violations = 0xFFFF; 6616219820Sjeff p_port->rec.port_info.p_key_violations = 6617219820Sjeff cl_hton16((uint16_t) 6618219820Sjeff strtoul(&line[offset], NULL, 0)); 6619219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, 6620219820Sjeff "p_key_violations = 0x%X\n", 6621219820Sjeff cl_ntoh16(p_port->rec.port_info.p_key_violations)); 6622219820Sjeff break; 6623219820Sjeff 6624219820Sjeff case OSMTEST_TOKEN_QKEY_VIOL: 6625219820Sjeff p_port->comp.port_info.q_key_violations = 0xFFFF; 6626219820Sjeff p_port->rec.port_info.q_key_violations = 6627219820Sjeff cl_hton16((uint16_t) 6628219820Sjeff strtoul(&line[offset], NULL, 0)); 6629219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, 6630219820Sjeff "q_key_violations = 0x%X\n", 6631219820Sjeff cl_ntoh16(p_port->rec.port_info.q_key_violations)); 6632219820Sjeff break; 6633219820Sjeff 6634219820Sjeff case OSMTEST_TOKEN_GUID_CAP: 6635219820Sjeff p_port->comp.port_info.guid_cap = 0xFF; 6636219820Sjeff p_port->rec.port_info.guid_cap = 6637219820Sjeff (uint8_t) strtoul(&line[offset], NULL, 0); 6638219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, 6639219820Sjeff "guid_cap = 0x%u\n", 6640219820Sjeff p_port->rec.port_info.guid_cap); 6641219820Sjeff break; 6642219820Sjeff 6643219820Sjeff case OSMTEST_TOKEN_SUBN_TIMEOUT: 6644219820Sjeff p_port->comp.port_info.subnet_timeout = 0x1F; 6645219820Sjeff p_port->rec.port_info.subnet_timeout = 6646219820Sjeff (uint8_t) strtoul(&line[offset], NULL, 0); 6647219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, 6648219820Sjeff "subnet_timeout = 0x%u\n", 6649219820Sjeff ib_port_info_get_timeout(&p_port->rec.port_info)); 6650219820Sjeff break; 6651219820Sjeff 6652219820Sjeff case OSMTEST_TOKEN_RESP_TIME_VAL: 6653219820Sjeff p_port->comp.port_info.resp_time_value = 0xFF; 6654219820Sjeff p_port->rec.port_info.resp_time_value = 6655219820Sjeff (uint8_t) strtoul(&line[offset], NULL, 0); 6656219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, 6657219820Sjeff "resp_time_value = 0x%u\n", 6658219820Sjeff p_port->rec.port_info.resp_time_value); 6659219820Sjeff break; 6660219820Sjeff 6661219820Sjeff case OSMTEST_TOKEN_ERR_THRESHOLD: 6662219820Sjeff p_port->comp.port_info.error_threshold = 0xFF; 6663219820Sjeff p_port->rec.port_info.error_threshold = 6664219820Sjeff (uint8_t) strtoul(&line[offset], NULL, 0); 6665219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, 6666219820Sjeff "error_threshold = 0x%u\n", 6667219820Sjeff p_port->rec.port_info.error_threshold); 6668219820Sjeff break; 6669219820Sjeff 6670219820Sjeff case OSMTEST_TOKEN_END: 6671219820Sjeff done = TRUE; 6672219820Sjeff break; 6673219820Sjeff 6674219820Sjeff default: 6675219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0125: " 6676219820Sjeff "Ignoring line %u with unknown token: %s\n", 6677219820Sjeff *p_line_num, &line[offset]); 6678219820Sjeff break; 6679219820Sjeff } 6680219820Sjeff } 6681219820Sjeff 6682219820Sjeff /* 6683219820Sjeff * Make sure the user specified enough information, then 6684219820Sjeff * add this object to the database. 6685219820Sjeff */ 6686219820Sjeff if (p_port->comp.lid == 0) { 6687219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0126: " 6688219820Sjeff "LID must be specified for defined ports\n"); 6689219820Sjeff port_delete(p_port); 6690219820Sjeff status = IB_ERROR; 6691219820Sjeff goto Exit; 6692219820Sjeff } 6693219820Sjeff 6694219820Sjeff cl_qmap_insert(&p_osmt->exp_subn.port_key_tbl, 6695219820Sjeff port_gen_id(p_port->rec.lid, p_port->rec.port_num), 6696219820Sjeff &p_port->map_item); 6697219820Sjeff 6698219820SjeffExit: 6699219820Sjeff OSM_LOG_EXIT(&p_osmt->log); 6700219820Sjeff return (status); 6701219820Sjeff} 6702219820Sjeff 6703219820Sjeff/********************************************************************** 6704219820Sjeff **********************************************************************/ 6705219820Sjeffstatic ib_api_status_t 6706219820Sjeffosmtest_parse_path(IN osmtest_t * const p_osmt, 6707219820Sjeff IN FILE * const fh, IN OUT uint32_t * const p_line_num) 6708219820Sjeff{ 6709219820Sjeff ib_api_status_t status = IB_SUCCESS; 6710219820Sjeff uint32_t offset; 6711219820Sjeff char line[OSMTEST_MAX_LINE_LEN]; 6712219820Sjeff boolean_t done = FALSE; 6713219820Sjeff path_t *p_path; 6714219820Sjeff const osmtest_token_t *p_tok; 6715219820Sjeff boolean_t got_error = FALSE; 6716219820Sjeff 6717219820Sjeff OSM_LOG_ENTER(&p_osmt->log); 6718219820Sjeff 6719219820Sjeff p_path = path_new(); 6720219820Sjeff CL_ASSERT(p_path != NULL); 6721219820Sjeff 6722219820Sjeff /* 6723219820Sjeff * Parse the inventory file and create the database. 6724219820Sjeff */ 6725219820Sjeff while (!done) { 6726219820Sjeff if (fgets(line, OSMTEST_MAX_LINE_LEN, fh) == NULL) { 6727219820Sjeff /* 6728219820Sjeff * End of file in the middle of a definition. 6729219820Sjeff */ 6730219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0127: " 6731219820Sjeff "Unexpected end of file\n"); 6732219820Sjeff status = IB_ERROR; 6733219820Sjeff goto Exit; 6734219820Sjeff } 6735219820Sjeff 6736219820Sjeff ++*p_line_num; 6737219820Sjeff 6738219820Sjeff /* 6739219820Sjeff * Skip whitespace 6740219820Sjeff */ 6741219820Sjeff offset = 0; 6742219820Sjeff if (!str_skip_white(line, &offset)) 6743219820Sjeff continue; /* whole line was whitespace */ 6744219820Sjeff 6745219820Sjeff p_tok = str_get_token(&line[offset]); 6746219820Sjeff if (p_tok == NULL) { 6747219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0128: " 6748219820Sjeff "Ignoring line %u with unknown token: %s\n", 6749219820Sjeff *p_line_num, &line[offset]); 6750219820Sjeff got_error = TRUE; 6751219820Sjeff continue; 6752219820Sjeff } 6753219820Sjeff 6754219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, 6755219820Sjeff "Found '%s' (line %u)\n", p_tok->str, *p_line_num); 6756219820Sjeff 6757219820Sjeff str_skip_token(line, &offset); 6758219820Sjeff 6759219820Sjeff switch (p_tok->val) { 6760219820Sjeff case OSMTEST_TOKEN_COMMENT: 6761219820Sjeff break; 6762219820Sjeff 6763219820Sjeff case OSMTEST_TOKEN_DGID: 6764219820Sjeff p_path->comp.dgid.unicast.prefix = 6765219820Sjeff 0xFFFFFFFFFFFFFFFFULL; 6766219820Sjeff p_path->comp.dgid.unicast.interface_id = 6767219820Sjeff 0xFFFFFFFFFFFFFFFFULL; 6768219820Sjeff 6769219820Sjeff str_skip_white(line, &offset); 6770219820Sjeff p_path->rec.dgid.unicast.prefix = 6771219820Sjeff cl_hton64(strtoull(&line[offset], NULL, 0)); 6772219820Sjeff str_skip_token(line, &offset); 6773219820Sjeff p_path->rec.dgid.unicast.interface_id = 6774219820Sjeff cl_hton64(strtoull(&line[offset], NULL, 0)); 6775219820Sjeff 6776219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, 6777219820Sjeff "dgid = 0x%016" PRIx64 " 0x%016" PRIx64 "\n", 6778219820Sjeff cl_ntoh64(p_path->rec.dgid.unicast.prefix), 6779219820Sjeff cl_ntoh64(p_path->rec.dgid.unicast.interface_id)); 6780219820Sjeff break; 6781219820Sjeff 6782219820Sjeff case OSMTEST_TOKEN_SGID: 6783219820Sjeff p_path->comp.sgid.unicast.prefix = 6784219820Sjeff 0xFFFFFFFFFFFFFFFFULL; 6785219820Sjeff p_path->comp.sgid.unicast.interface_id = 6786219820Sjeff 0xFFFFFFFFFFFFFFFFULL; 6787219820Sjeff 6788219820Sjeff str_skip_white(line, &offset); 6789219820Sjeff p_path->rec.sgid.unicast.prefix = 6790219820Sjeff cl_hton64(strtoull(&line[offset], NULL, 0)); 6791219820Sjeff str_skip_token(line, &offset); 6792219820Sjeff p_path->rec.sgid.unicast.interface_id = 6793219820Sjeff cl_hton64(strtoull(&line[offset], NULL, 0)); 6794219820Sjeff 6795219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, 6796219820Sjeff "sgid = 0x%016" PRIx64 " 0x%016" PRIx64 "\n", 6797219820Sjeff cl_ntoh64(p_path->rec.sgid.unicast.prefix), 6798219820Sjeff cl_ntoh64(p_path->rec.sgid.unicast.interface_id)); 6799219820Sjeff break; 6800219820Sjeff 6801219820Sjeff case OSMTEST_TOKEN_DLID: 6802219820Sjeff p_path->comp.dlid = 0xFFFF; 6803219820Sjeff p_path->rec.dlid = 6804219820Sjeff cl_hton16((uint16_t) 6805219820Sjeff strtoul(&line[offset], NULL, 0)); 6806219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, "dlid = 0x%X\n", 6807219820Sjeff cl_ntoh16(p_path->rec.dlid)); 6808219820Sjeff break; 6809219820Sjeff 6810219820Sjeff case OSMTEST_TOKEN_SLID: 6811219820Sjeff p_path->comp.slid = 0xFFFF; 6812219820Sjeff p_path->rec.slid = 6813219820Sjeff cl_hton16((uint16_t) 6814219820Sjeff strtoul(&line[offset], NULL, 0)); 6815219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, "slid = 0x%X\n", 6816219820Sjeff cl_ntoh16(p_path->rec.slid)); 6817219820Sjeff break; 6818219820Sjeff 6819219820Sjeff case OSMTEST_TOKEN_PKEY: 6820219820Sjeff p_path->comp.pkey = 0xFFFF; 6821219820Sjeff p_path->rec.pkey = 6822219820Sjeff cl_hton16((uint16_t) 6823219820Sjeff strtoul(&line[offset], NULL, 0)); 6824219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, "pkey = 0x%X\n", 6825219820Sjeff cl_ntoh16(p_path->rec.pkey)); 6826219820Sjeff break; 6827219820Sjeff 6828219820Sjeff case OSMTEST_TOKEN_END: 6829219820Sjeff done = TRUE; 6830219820Sjeff break; 6831219820Sjeff 6832219820Sjeff default: 6833219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0129: " 6834219820Sjeff "Ignoring line %u with unknown token: %s\n", 6835219820Sjeff *p_line_num, &line[offset]); 6836219820Sjeff got_error = TRUE; 6837219820Sjeff break; 6838219820Sjeff } 6839219820Sjeff } 6840219820Sjeff 6841219820Sjeff if (got_error) { 6842219820Sjeff status = IB_ERROR; 6843219820Sjeff goto Exit; 6844219820Sjeff } 6845219820Sjeff /* 6846219820Sjeff * Make sure the user specified enough information, then 6847219820Sjeff * add this object to the database. 6848219820Sjeff */ 6849219820Sjeff if (osmtest_path_rec_kay_is_valid(p_osmt, p_path) == FALSE) { 6850219820Sjeff path_delete(p_path); 6851219820Sjeff status = IB_ERROR; 6852219820Sjeff goto Exit; 6853219820Sjeff } 6854219820Sjeff 6855219820Sjeff cl_qmap_insert(&p_osmt->exp_subn.path_tbl, 6856219820Sjeff osmtest_path_rec_key_get(&p_path->rec), 6857219820Sjeff &p_path->map_item); 6858219820Sjeff 6859219820SjeffExit: 6860219820Sjeff OSM_LOG_EXIT(&p_osmt->log); 6861219820Sjeff return (status); 6862219820Sjeff} 6863219820Sjeff 6864219820Sjeff/********************************************************************** 6865219820Sjeff **********************************************************************/ 6866219820Sjeffstatic ib_api_status_t 6867219820Sjeffosmtest_parse_link(IN osmtest_t * const p_osmt, 6868219820Sjeff IN FILE * const fh, IN OUT uint32_t * const p_line_num) 6869219820Sjeff{ 6870219820Sjeff ib_api_status_t status = IB_SUCCESS; 6871219820Sjeff uint32_t offset; 6872219820Sjeff char line[OSMTEST_MAX_LINE_LEN]; 6873219820Sjeff boolean_t done = FALSE; 6874219820Sjeff const osmtest_token_t *p_tok; 6875219820Sjeff boolean_t got_error = FALSE; 6876219820Sjeff 6877219820Sjeff OSM_LOG_ENTER(&p_osmt->log); 6878219820Sjeff 6879219820Sjeff /* 6880219820Sjeff * Parse the inventory file and create the database. 6881219820Sjeff */ 6882219820Sjeff while (!done) { 6883219820Sjeff if (fgets(line, OSMTEST_MAX_LINE_LEN, fh) == NULL) { 6884219820Sjeff /* 6885219820Sjeff * End of file in the middle of a definition. 6886219820Sjeff */ 6887219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 012A: " 6888219820Sjeff "Unexpected end of file\n"); 6889219820Sjeff status = IB_ERROR; 6890219820Sjeff goto Exit; 6891219820Sjeff } 6892219820Sjeff 6893219820Sjeff ++*p_line_num; 6894219820Sjeff 6895219820Sjeff /* 6896219820Sjeff * Skip whitespace 6897219820Sjeff */ 6898219820Sjeff offset = 0; 6899219820Sjeff if (!str_skip_white(line, &offset)) 6900219820Sjeff continue; /* whole line was whitespace */ 6901219820Sjeff 6902219820Sjeff p_tok = str_get_token(&line[offset]); 6903219820Sjeff if (p_tok == NULL) { 6904219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 012B: " 6905219820Sjeff "Ignoring line %u with unknown token: %s\n", 6906219820Sjeff *p_line_num, &line[offset]); 6907219820Sjeff got_error = TRUE; 6908219820Sjeff continue; 6909219820Sjeff } 6910219820Sjeff 6911219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, 6912219820Sjeff "Found '%s' (line %u)\n", p_tok->str, *p_line_num); 6913219820Sjeff 6914219820Sjeff str_skip_token(line, &offset); 6915219820Sjeff 6916219820Sjeff switch (p_tok->val) { 6917219820Sjeff case OSMTEST_TOKEN_FROMLID: 6918219820Sjeff case OSMTEST_TOKEN_FROMPORTNUM: 6919219820Sjeff case OSMTEST_TOKEN_TOPORTNUM: 6920219820Sjeff case OSMTEST_TOKEN_TOLID: 6921219820Sjeff /* For now */ 6922219820Sjeff break; 6923219820Sjeff 6924219820Sjeff case OSMTEST_TOKEN_END: 6925219820Sjeff done = TRUE; 6926219820Sjeff break; 6927219820Sjeff 6928219820Sjeff default: 6929219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 012C: " 6930219820Sjeff "Ignoring line %u with unknown token: %s\n", 6931219820Sjeff *p_line_num, &line[offset]); 6932219820Sjeff got_error = TRUE; 6933219820Sjeff break; 6934219820Sjeff } 6935219820Sjeff } 6936219820Sjeff 6937219820Sjeff if (got_error) 6938219820Sjeff status = IB_ERROR; 6939219820Sjeff 6940219820SjeffExit: 6941219820Sjeff OSM_LOG_EXIT(&p_osmt->log); 6942219820Sjeff return (status); 6943219820Sjeff} 6944219820Sjeff 6945219820Sjeff/********************************************************************** 6946219820Sjeff **********************************************************************/ 6947219820Sjeffstatic ib_api_status_t osmtest_create_db(IN osmtest_t * const p_osmt) 6948219820Sjeff{ 6949219820Sjeff FILE *fh; 6950219820Sjeff ib_api_status_t status = IB_SUCCESS; 6951219820Sjeff uint32_t offset; 6952219820Sjeff char line[OSMTEST_MAX_LINE_LEN]; 6953219820Sjeff uint32_t line_num = 0; 6954219820Sjeff const osmtest_token_t *p_tok; 6955219820Sjeff boolean_t got_error = FALSE; 6956219820Sjeff 6957219820Sjeff OSM_LOG_ENTER(&p_osmt->log); 6958219820Sjeff 6959219820Sjeff fh = fopen(p_osmt->opt.file_name, "r"); 6960219820Sjeff if (fh == NULL) { 6961219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0130: " 6962219820Sjeff "Unable to open inventory file (%s)\n", 6963219820Sjeff p_osmt->opt.file_name); 6964219820Sjeff status = IB_ERROR; 6965219820Sjeff goto Exit; 6966219820Sjeff } 6967219820Sjeff 6968219820Sjeff /* 6969219820Sjeff * Parse the inventory file and create the database. 6970219820Sjeff */ 6971219820Sjeff while (fgets(line, OSMTEST_MAX_LINE_LEN, fh) != NULL) { 6972219820Sjeff line_num++; 6973219820Sjeff 6974219820Sjeff /* 6975219820Sjeff * Skip whitespace 6976219820Sjeff */ 6977219820Sjeff offset = 0; 6978219820Sjeff if (!str_skip_white(line, &offset)) 6979219820Sjeff continue; /* whole line was whitespace */ 6980219820Sjeff 6981219820Sjeff p_tok = str_get_token(&line[offset]); 6982219820Sjeff if (p_tok == NULL) { 6983219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0131: " 6984219820Sjeff "Ignoring line %u: %s\n", line_num, 6985219820Sjeff &line[offset]); 6986219820Sjeff got_error = TRUE; 6987219820Sjeff continue; 6988219820Sjeff } 6989219820Sjeff 6990219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, 6991219820Sjeff "Found '%s' (line %u)\n", p_tok->str, line_num); 6992219820Sjeff 6993219820Sjeff switch (p_tok->val) { 6994219820Sjeff case OSMTEST_TOKEN_COMMENT: 6995219820Sjeff break; 6996219820Sjeff 6997219820Sjeff case OSMTEST_TOKEN_DEFINE_NODE: 6998219820Sjeff status = osmtest_parse_node(p_osmt, fh, &line_num); 6999219820Sjeff break; 7000219820Sjeff 7001219820Sjeff case OSMTEST_TOKEN_DEFINE_PORT: 7002219820Sjeff status = osmtest_parse_port(p_osmt, fh, &line_num); 7003219820Sjeff break; 7004219820Sjeff 7005219820Sjeff case OSMTEST_TOKEN_DEFINE_PATH: 7006219820Sjeff status = osmtest_parse_path(p_osmt, fh, &line_num); 7007219820Sjeff break; 7008219820Sjeff 7009219820Sjeff case OSMTEST_TOKEN_DEFINE_LINK: 7010219820Sjeff status = osmtest_parse_link(p_osmt, fh, &line_num); 7011219820Sjeff break; 7012219820Sjeff 7013219820Sjeff default: 7014219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0132: " 7015219820Sjeff "Ignoring line %u: %s\n", line_num, 7016219820Sjeff &line[offset]); 7017219820Sjeff got_error = TRUE; 7018219820Sjeff break; 7019219820Sjeff } 7020219820Sjeff 7021219820Sjeff if (got_error) 7022219820Sjeff status = IB_ERROR; 7023219820Sjeff 7024219820Sjeff if (status != IB_SUCCESS) { 7025219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0133: " 7026219820Sjeff "Bad status received during parsing (%s)\n", 7027219820Sjeff ib_get_err_str(status)); 7028219820Sjeff fclose(fh); 7029219820Sjeff goto Exit; 7030219820Sjeff } 7031219820Sjeff } 7032219820Sjeff 7033219820Sjeff fclose(fh); 7034219820Sjeff 7035219820SjeffExit: 7036219820Sjeff OSM_LOG_EXIT(&p_osmt->log); 7037219820Sjeff return (status); 7038219820Sjeff} 7039219820Sjeff 7040219820Sjeff/********************************************************************** 7041219820Sjeff Returns the index in the local port attribute array for the 7042219820Sjeff user's selection. 7043219820Sjeff**********************************************************************/ 7044219820Sjeffstatic uint32_t 7045219820Sjeffosmtest_get_user_port(IN osmtest_t * const p_osmt, 7046219820Sjeff IN const ib_port_attr_t p_attr_array[], 7047219820Sjeff IN uint32_t const num_ports) 7048219820Sjeff{ 7049219820Sjeff uint32_t i; 7050219820Sjeff uint32_t choice = 0; 7051219820Sjeff boolean_t done_flag = FALSE; 7052219820Sjeff 7053219820Sjeff OSM_LOG_ENTER(&p_osmt->log); 7054219820Sjeff 7055219820Sjeff /* 7056219820Sjeff * User needs prompting for the local port GUID with which 7057219820Sjeff * to bind. 7058219820Sjeff */ 7059219820Sjeff 7060219820Sjeff while (done_flag == FALSE) { 7061219820Sjeff printf("\nChoose a local port number with which to bind:\n\n"); 7062219820Sjeff for (i = 0; i < num_ports; i++) { 7063219820Sjeff /* 7064219820Sjeff * Print the index + 1 since by convention, port numbers 7065219820Sjeff * start with 1 on host channel adapters. 7066219820Sjeff */ 7067219820Sjeff 7068219820Sjeff printf("\t%u: GUID = 0x%8" PRIx64 7069219820Sjeff ", lid = 0x%04X, state = %s\n", i + 1, 7070219820Sjeff cl_ntoh64(p_attr_array[i].port_guid), 7071219820Sjeff p_attr_array[i].lid, 7072219820Sjeff ib_get_port_state_str(p_attr_array[i]. 7073219820Sjeff link_state)); 7074219820Sjeff } 7075219820Sjeff 7076219820Sjeff printf("\nEnter choice (1-%u): ", i); 7077219820Sjeff scanf("%u", &choice); 7078219820Sjeff if (choice > num_ports) 7079219820Sjeff printf("\nError: Lame choice!\n"); 7080219820Sjeff else 7081219820Sjeff done_flag = TRUE; 7082219820Sjeff 7083219820Sjeff } 7084219820Sjeff printf("\n"); 7085219820Sjeff OSM_LOG_EXIT(&p_osmt->log); 7086219820Sjeff return (choice - 1); 7087219820Sjeff} 7088219820Sjeff 7089219820Sjeff/********************************************************************** 7090219820Sjeff **********************************************************************/ 7091219820Sjeffib_api_status_t 7092219820Sjeffosmtest_bind(IN osmtest_t * p_osmt, 7093219820Sjeff IN uint16_t max_lid, IN ib_net64_t guid OPTIONAL) 7094219820Sjeff{ 7095219820Sjeff uint32_t port_index; 7096219820Sjeff ib_api_status_t status; 7097219820Sjeff uint32_t num_ports = GUID_ARRAY_SIZE; 7098219820Sjeff ib_port_attr_t attr_array[GUID_ARRAY_SIZE]; 7099219820Sjeff 7100219820Sjeff OSM_LOG_ENTER(&p_osmt->log); 7101219820Sjeff 7102219820Sjeff /* 7103219820Sjeff * Call the transport layer for a list of local port 7104219820Sjeff * GUID values. 7105219820Sjeff */ 7106219820Sjeff status = osm_vendor_get_all_port_attr(p_osmt->p_vendor, 7107219820Sjeff attr_array, &num_ports); 7108219820Sjeff if (status != IB_SUCCESS) { 7109219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0134: " 7110219820Sjeff "Failure getting local port attributes (%s)\n", 7111219820Sjeff ib_get_err_str(status)); 7112219820Sjeff goto Exit; 7113219820Sjeff } 7114219820Sjeff 7115219820Sjeff if (guid == 0) { 7116219820Sjeff /* 7117219820Sjeff * User needs prompting for the local port GUID with which 7118219820Sjeff * to bind. 7119219820Sjeff */ 7120219820Sjeff port_index = 7121219820Sjeff osmtest_get_user_port(p_osmt, attr_array, num_ports); 7122219820Sjeff 7123219820Sjeff if (num_ports == 0) { 7124219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0135: " 7125219820Sjeff "No local ports. Unable to proceed\n"); 7126219820Sjeff goto Exit; 7127219820Sjeff } 7128219820Sjeff guid = attr_array[port_index].port_guid; 7129219820Sjeff } else { 7130219820Sjeff for (port_index = 0; port_index < num_ports; port_index++) { 7131219820Sjeff if (attr_array[port_index].port_guid == guid) 7132219820Sjeff break; 7133219820Sjeff } 7134219820Sjeff 7135219820Sjeff if (port_index == num_ports) { 7136219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0136: " 7137219820Sjeff "No local port with guid 0x%016" PRIx64 "\n", 7138219820Sjeff cl_ntoh64(guid)); 7139219820Sjeff status = IB_NOT_FOUND; 7140219820Sjeff goto Exit; 7141219820Sjeff } 7142219820Sjeff } 7143219820Sjeff 7144219820Sjeff /* 7145219820Sjeff * Copy the port info for the selected port. 7146219820Sjeff */ 7147219820Sjeff memcpy(&p_osmt->local_port, &attr_array[port_index], 7148219820Sjeff sizeof(p_osmt->local_port)); 7149219820Sjeff 7150219820Sjeff /* bind to the SA */ 7151219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, 7152219820Sjeff "Using port with SM LID:0x%04X\n", p_osmt->local_port.sm_lid); 7153219820Sjeff p_osmt->max_lid = max_lid; 7154219820Sjeff 7155219820Sjeff p_osmt->h_bind = 7156219820Sjeff osmv_bind_sa(p_osmt->p_vendor, &p_osmt->mad_pool, guid); 7157219820Sjeff 7158219820Sjeff if (p_osmt->h_bind == OSM_BIND_INVALID_HANDLE) { 7159219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0137: " 7160219820Sjeff "Unable to bind to SA\n"); 7161219820Sjeff status = IB_ERROR; 7162219820Sjeff goto Exit; 7163219820Sjeff } 7164219820Sjeff 7165219820SjeffExit: 7166219820Sjeff OSM_LOG_EXIT(&p_osmt->log); 7167219820Sjeff return (status); 7168219820Sjeff} 7169219820Sjeff 7170219820Sjeff/********************************************************************** 7171219820Sjeff **********************************************************************/ 7172219820Sjeffib_api_status_t osmtest_run(IN osmtest_t * const p_osmt) 7173219820Sjeff{ 7174219820Sjeff ib_api_status_t status = IB_SUCCESS; 7175219820Sjeff 7176219820Sjeff OSM_LOG_ENTER(&p_osmt->log); 7177219820Sjeff 7178219820Sjeff status = osmtest_validate_sa_class_port_info(p_osmt); 7179219820Sjeff if (status != IB_SUCCESS) { 7180219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0138: " 7181219820Sjeff "Could not obtain SA ClassPortInfo (%s)\n", 7182219820Sjeff ib_get_err_str(status)); 7183219820Sjeff goto Exit; 7184219820Sjeff } 7185219820Sjeff 7186219820Sjeff if (p_osmt->opt.flow == OSMT_FLOW_CREATE_INVENTORY) { 7187219820Sjeff /* 7188219820Sjeff * Creating an inventory file with all nodes, ports and paths 7189219820Sjeff */ 7190219820Sjeff status = osmtest_create_inventory_file(p_osmt); 7191219820Sjeff if (status != IB_SUCCESS) { 7192219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0139: " 7193219820Sjeff "Inventory file create failed (%s)\n", 7194219820Sjeff ib_get_err_str(status)); 7195219820Sjeff goto Exit; 7196219820Sjeff } 7197219820Sjeff } else { 7198219820Sjeff if (p_osmt->opt.flow == OSMT_FLOW_STRESS_SA) { 7199219820Sjeff /* 7200219820Sjeff * Stress SA - flood the SA with queries 7201219820Sjeff */ 7202219820Sjeff switch (p_osmt->opt.stress) { 7203219820Sjeff case 0: 7204219820Sjeff case 1: /* small response SA query stress */ 7205219820Sjeff status = osmtest_stress_small_rmpp(p_osmt); 7206219820Sjeff if (status != IB_SUCCESS) { 7207219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, 7208219820Sjeff "ERR 0140: " 7209219820Sjeff "Small RMPP stress test failed (%s)\n", 7210219820Sjeff ib_get_err_str(status)); 7211219820Sjeff goto Exit; 7212219820Sjeff } 7213219820Sjeff break; 7214219820Sjeff case 2: /* large response SA query stress */ 7215219820Sjeff status = osmtest_stress_large_rmpp(p_osmt); 7216219820Sjeff if (status != IB_SUCCESS) { 7217219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, 7218219820Sjeff "ERR 0141: " 7219219820Sjeff "Large RMPP stress test failed (%s)\n", 7220219820Sjeff ib_get_err_str(status)); 7221219820Sjeff goto Exit; 7222219820Sjeff } 7223219820Sjeff break; 7224219820Sjeff case 3: /* large response Path Record SA query stress */ 7225219820Sjeff status = osmtest_create_db(p_osmt); 7226219820Sjeff if (status != IB_SUCCESS) { 7227219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, 7228219820Sjeff "ERR 0142: " 7229219820Sjeff "Database creation failed (%s)\n", 7230219820Sjeff ib_get_err_str(status)); 7231219820Sjeff goto Exit; 7232219820Sjeff } 7233219820Sjeff 7234219820Sjeff status = osmtest_stress_large_rmpp_pr(p_osmt); 7235219820Sjeff if (status != IB_SUCCESS) { 7236219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, 7237219820Sjeff "ERR 0143: " 7238219820Sjeff "Large RMPP stress test failed (%s)\n", 7239219820Sjeff ib_get_err_str(status)); 7240219820Sjeff goto Exit; 7241219820Sjeff } 7242219820Sjeff break; 7243219820Sjeff default: 7244219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, 7245219820Sjeff "ERR 0144: " 7246219820Sjeff "Unknown stress test value %u\n", 7247219820Sjeff p_osmt->opt.stress); 7248219820Sjeff break; 7249219820Sjeff } 7250219820Sjeff } else { 7251219820Sjeff 7252219820Sjeff /* 7253219820Sjeff * Run normal validation tests. 7254219820Sjeff */ 7255219820Sjeff if (p_osmt->opt.flow == OSMT_FLOW_ALL || 7256219820Sjeff p_osmt->opt.flow == OSMT_FLOW_VALIDATE_INVENTORY) { 7257219820Sjeff /* 7258219820Sjeff * Only validate the given inventory file 7259219820Sjeff */ 7260219820Sjeff status = osmtest_create_db(p_osmt); 7261219820Sjeff if (status != IB_SUCCESS) { 7262219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, 7263219820Sjeff "ERR 0145: " 7264219820Sjeff "Database creation failed (%s)\n", 7265219820Sjeff ib_get_err_str(status)); 7266219820Sjeff goto Exit; 7267219820Sjeff } 7268219820Sjeff 7269219820Sjeff status = osmtest_validate_against_db(p_osmt); 7270219820Sjeff if (status != IB_SUCCESS) { 7271219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, 7272219820Sjeff "ERR 0146: " 7273219820Sjeff "SA validation database failure (%s)\n", 7274219820Sjeff ib_get_err_str(status)); 7275219820Sjeff goto Exit; 7276219820Sjeff } 7277219820Sjeff } 7278219820Sjeff 7279219820Sjeff if (p_osmt->opt.flow == OSMT_FLOW_ALL) { 7280219820Sjeff status = osmtest_wrong_sm_key_ignored(p_osmt); 7281219820Sjeff if (status != IB_SUCCESS) { 7282219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, 7283219820Sjeff "ERR 0147: " 7284219820Sjeff "Try wrong SM_Key failed (%s)\n", 7285219820Sjeff ib_get_err_str(status)); 7286219820Sjeff goto Exit; 7287219820Sjeff } 7288219820Sjeff } 7289219820Sjeff 7290219820Sjeff if (p_osmt->opt.flow == OSMT_FLOW_ALL || 7291219820Sjeff p_osmt->opt.flow == OSMT_FLOW_SERVICE_REGISTRATION) 7292219820Sjeff { 7293219820Sjeff /* 7294219820Sjeff * run service registration, deregistration, and lease test 7295219820Sjeff */ 7296219820Sjeff status = osmt_run_service_records_flow(p_osmt); 7297219820Sjeff if (status != IB_SUCCESS) { 7298219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, 7299219820Sjeff "ERR 0148: " 7300219820Sjeff "Service Flow failed (%s)\n", 7301219820Sjeff ib_get_err_str(status)); 7302219820Sjeff goto Exit; 7303219820Sjeff } 7304219820Sjeff } 7305219820Sjeff 7306219820Sjeff if (p_osmt->opt.flow == OSMT_FLOW_ALL || 7307219820Sjeff p_osmt->opt.flow == OSMT_FLOW_EVENT_FORWARDING) { 7308219820Sjeff /* 7309219820Sjeff * Run event forwarding test 7310219820Sjeff */ 7311219820Sjeff#ifdef OSM_VENDOR_INTF_MTL 7312219820Sjeff status = osmt_run_inform_info_flow(p_osmt); 7313219820Sjeff 7314219820Sjeff if (status != IB_SUCCESS) { 7315219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, 7316219820Sjeff "ERR 0149: " 7317219820Sjeff "Inform Info Flow failed: (%s)\n", 7318219820Sjeff ib_get_err_str(status)); 7319219820Sjeff goto Exit; 7320219820Sjeff } 7321219820Sjeff#else 7322219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_INFO, 7323219820Sjeff "The event forwarding flow " 7324219820Sjeff "is not implemented yet!\n"); 7325219820Sjeff status = IB_SUCCESS; 7326219820Sjeff goto Exit; 7327219820Sjeff#endif 7328219820Sjeff } 7329219820Sjeff 7330219820Sjeff if (p_osmt->opt.flow == OSMT_FLOW_QOS) { 7331219820Sjeff /* 7332219820Sjeff * QoS info: dump VLArb and SLtoVL tables. 7333219820Sjeff * Since it generates a huge file, we run it only 7334219820Sjeff * if explicitly required to 7335219820Sjeff */ 7336219820Sjeff status = osmtest_create_db(p_osmt); 7337219820Sjeff if (status != IB_SUCCESS) { 7338219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, 7339219820Sjeff "ERR 014A: " 7340219820Sjeff "Database creation failed (%s)\n", 7341219820Sjeff ib_get_err_str(status)); 7342219820Sjeff goto Exit; 7343219820Sjeff } 7344219820Sjeff 7345219820Sjeff status = 7346219820Sjeff osmt_run_slvl_and_vlarb_records_flow 7347219820Sjeff (p_osmt); 7348219820Sjeff if (status != IB_SUCCESS) { 7349219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, 7350219820Sjeff "ERR 0150: " 7351219820Sjeff "Failed to get SLtoVL and VL Arbitration Tables (%s)\n", 7352219820Sjeff ib_get_err_str(status)); 7353219820Sjeff goto Exit; 7354219820Sjeff } 7355219820Sjeff } 7356219820Sjeff 7357219820Sjeff if (p_osmt->opt.flow == OSMT_FLOW_TRAP) { 7358219820Sjeff /* 7359219820Sjeff * Run trap 64/65 flow (this flow requires running of external tool) 7360219820Sjeff */ 7361219820Sjeff#ifdef OSM_VENDOR_INTF_MTL 7362219820Sjeff status = osmt_run_trap64_65_flow(p_osmt); 7363219820Sjeff if (status != IB_SUCCESS) { 7364219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, 7365219820Sjeff "ERR 0151: " 7366219820Sjeff "Trap 64/65 Flow failed: (%s)\n", 7367219820Sjeff ib_get_err_str(status)); 7368219820Sjeff goto Exit; 7369219820Sjeff } 7370219820Sjeff#else 7371219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_INFO, 7372219820Sjeff "The event forwarding flow " 7373219820Sjeff "is not implemented yet!\n"); 7374219820Sjeff status = IB_SUCCESS; 7375219820Sjeff goto Exit; 7376219820Sjeff#endif 7377219820Sjeff } 7378219820Sjeff 7379219820Sjeff if (p_osmt->opt.flow == OSMT_FLOW_ALL || 7380219820Sjeff p_osmt->opt.flow == OSMT_FLOW_MULTICAST) { 7381219820Sjeff /* 7382219820Sjeff * Multicast flow 7383219820Sjeff */ 7384219820Sjeff status = osmt_run_mcast_flow(p_osmt); 7385219820Sjeff if (status != IB_SUCCESS) { 7386219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, 7387219820Sjeff "ERR 0152: " 7388219820Sjeff "Multicast Flow failed: (%s)\n", 7389219820Sjeff ib_get_err_str(status)); 7390219820Sjeff goto Exit; 7391219820Sjeff } 7392219820Sjeff } 7393219820Sjeff 7394219820Sjeff OSM_LOG(&p_osmt->log, OSM_LOG_INFO, 7395219820Sjeff "\n\n***************** ALL TESTS PASS *****************\n\n"); 7396219820Sjeff 7397219820Sjeff } 7398219820Sjeff } 7399219820Sjeff 7400219820SjeffExit: 7401219820Sjeff OSM_LOG_EXIT(&p_osmt->log); 7402219820Sjeff return (status); 7403219820Sjeff} 7404