|
Packit |
857059 |
/* BEGIN_ICS_COPYRIGHT6 ****************************************
|
|
Packit |
857059 |
|
|
Packit |
857059 |
Copyright (c) 2015-2017, Intel Corporation
|
|
Packit |
857059 |
|
|
Packit |
857059 |
Redistribution and use in source and binary forms, with or without
|
|
Packit |
857059 |
modification, are permitted provided that the following conditions are met:
|
|
Packit |
857059 |
|
|
Packit |
857059 |
* Redistributions of source code must retain the above copyright notice,
|
|
Packit |
857059 |
this list of conditions and the following disclaimer.
|
|
Packit |
857059 |
* Redistributions in binary form must reproduce the above copyright
|
|
Packit |
857059 |
notice, this list of conditions and the following disclaimer in the
|
|
Packit |
857059 |
documentation and/or other materials provided with the distribution.
|
|
Packit |
857059 |
* Neither the name of Intel Corporation nor the names of its contributors
|
|
Packit |
857059 |
may be used to endorse or promote products derived from this software
|
|
Packit |
857059 |
without specific prior written permission.
|
|
Packit |
857059 |
|
|
Packit |
857059 |
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
Packit |
857059 |
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
Packit |
857059 |
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
Packit |
857059 |
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
|
Packit |
857059 |
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
Packit |
857059 |
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
Packit |
857059 |
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
Packit |
857059 |
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
Packit |
857059 |
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
Packit |
857059 |
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
Packit |
857059 |
|
|
Packit |
857059 |
** END_ICS_COPYRIGHT6 ****************************************/
|
|
Packit |
857059 |
|
|
Packit |
857059 |
#include "stl_sd.h"
|
|
Packit |
857059 |
|
|
Packit |
857059 |
static const char* const SdQueryInputTypeText[] = {
|
|
Packit |
857059 |
"InputTypeNoInput",
|
|
Packit |
857059 |
"InputTypeNodeType",
|
|
Packit |
857059 |
"InputTypeSystemImageGuid",
|
|
Packit |
857059 |
"InputTypeNodeGuid",
|
|
Packit |
857059 |
"InputTypePortGuid",
|
|
Packit |
857059 |
"InputTypePortGid",
|
|
Packit |
857059 |
"InputTypeMcGid",
|
|
Packit |
857059 |
"InputTypePortGuidPair",
|
|
Packit |
857059 |
"InputTypeGidPair",
|
|
Packit |
857059 |
"InputTypePathRecord",
|
|
Packit |
857059 |
#ifdef IB_STACK_OPENIB
|
|
Packit |
857059 |
"InputTypePathRecordNetworkOrder",
|
|
Packit |
857059 |
#endif
|
|
Packit |
857059 |
"InputTypeLid",
|
|
Packit |
857059 |
"InputTypePKey",
|
|
Packit |
857059 |
"InputTypeSL",
|
|
Packit |
857059 |
"InputTypeIndex",
|
|
Packit |
857059 |
"InputTypeServiceId",
|
|
Packit |
857059 |
"InputTypeNodeDesc",
|
|
Packit |
857059 |
"InputTypeServiceRecord",
|
|
Packit |
857059 |
"InputTypeMcMemberRecord",
|
|
Packit |
857059 |
"InputTypePortGuidList",
|
|
Packit |
857059 |
"InputTypeGidList",
|
|
Packit |
857059 |
"InputTypeMultiPathRecord",
|
|
Packit |
857059 |
};
|
|
Packit |
857059 |
|
|
Packit |
857059 |
const char* iba_sd_query_input_type_msg(QUERY_INPUT_TYPE code)
|
|
Packit |
857059 |
{
|
|
Packit |
857059 |
if (code < 0 || code >= (int)(sizeof(SdQueryInputTypeText)/sizeof(char*)))
|
|
Packit |
857059 |
return "Unknown SD Query Input Type";
|
|
Packit |
857059 |
else
|
|
Packit |
857059 |
return SdQueryInputTypeText[code];
|
|
Packit |
857059 |
}
|
|
Packit |
857059 |
|
|
Packit |
857059 |
static const char* const SdQueryResultTypeText[] = {
|
|
Packit |
857059 |
"OutputTypeSystemImageGuid",
|
|
Packit |
857059 |
"OutputTypeNodeGuid",
|
|
Packit |
857059 |
"OutputTypePortGuid",
|
|
Packit |
857059 |
"OutputTypeLid",
|
|
Packit |
857059 |
"OutputTypeGid",
|
|
Packit |
857059 |
"OutputTypeNodeDesc",
|
|
Packit |
857059 |
"OutputTypePathRecord",
|
|
Packit |
857059 |
#ifdef IB_STACK_OPENIB
|
|
Packit |
857059 |
"OutputTypePathRecordNetworkOrder",
|
|
Packit |
857059 |
#endif
|
|
Packit |
857059 |
"OutputTypeNodeRecord",
|
|
Packit |
857059 |
"OutputTypePortInfoRecord",
|
|
Packit |
857059 |
"OutputTypeSMInfoRecord",
|
|
Packit |
857059 |
"OutputTypeLinkRecord",
|
|
Packit |
857059 |
"OutputTypeServiceRecord",
|
|
Packit |
857059 |
"OutputTypeMcMemberRecord",
|
|
Packit |
857059 |
"OutputTypeInformInfoRecord",
|
|
Packit |
857059 |
"OutputTypeTraceRecord",
|
|
Packit |
857059 |
"OutputTypeSwitchInfoRecord",
|
|
Packit |
857059 |
"OutputTypeLinearFDBRecord",
|
|
Packit |
857059 |
"OutputTypeRandomFDBRecord",
|
|
Packit |
857059 |
"OutputTypeMCastFDBRecord",
|
|
Packit |
857059 |
"OutputTypeVLArbTableRecord",
|
|
Packit |
857059 |
"OutputTypePKeyTableRecord",
|
|
Packit |
857059 |
"OutputTypeVfInfoRecord", /* VF_RECORD_RESULTS is set of VF info records */
|
|
Packit |
857059 |
// PM query results
|
|
Packit |
857059 |
"OutputTypePaRecord", /* PA_PACKET_RESULTS complete PA SinglePacketRespRecords */
|
|
Packit |
857059 |
"OutputTypePaTableRecord", /* PA_TABLE_PACKET_RESULTS complete PA MultiPacketRespRecords */
|
|
Packit |
857059 |
};
|
|
Packit |
857059 |
|
|
Packit |
857059 |
const char* iba_sd_query_result_type_msg(QUERY_RESULT_TYPE code)
|
|
Packit |
857059 |
{
|
|
Packit |
857059 |
if (code < 0 || code >= (int)(sizeof(SdQueryResultTypeText)/sizeof(char*)))
|
|
Packit |
857059 |
return "Unknown SD Query Result Type";
|
|
Packit |
857059 |
else
|
|
Packit |
857059 |
return SdQueryResultTypeText[code];
|
|
Packit |
857059 |
}
|
|
Packit |
857059 |
|
|
Packit |
857059 |
static const char* const SdFabricOpTypeText[] = {
|
|
Packit |
857059 |
"FabOpSetServiceRecord",
|
|
Packit |
857059 |
"FabOpDeleteServiceRecord",
|
|
Packit |
857059 |
"FabOpSetMcMemberRecord",
|
|
Packit |
857059 |
"FabOpJoinMcGroup",
|
|
Packit |
857059 |
"FabOpLeaveMcGroup",
|
|
Packit |
857059 |
"FabOpDeleteMcMemberRecord",
|
|
Packit |
857059 |
"FabOpSetInformInfo",
|
|
Packit |
857059 |
};
|
|
Packit |
857059 |
|
|
Packit |
857059 |
const char* iba_sd_fabric_op_type_msg(FABRIC_OPERATION_TYPE code)
|
|
Packit |
857059 |
{
|
|
Packit |
857059 |
if (code < 0 || code >= (int)(sizeof(SdFabricOpTypeText)/sizeof(char*)))
|
|
Packit |
857059 |
return "Unknown SD Fabric Op Type";
|
|
Packit |
857059 |
else
|
|
Packit |
857059 |
return SdFabricOpTypeText[code];
|
|
Packit |
857059 |
}
|
|
Packit |
857059 |
|
|
Packit |
857059 |
// upper 8 bits of MAD_STATUS_SA_* fields from ib_sa_records.h
|
|
Packit |
857059 |
static const char* const SdSAStatusText[] = {
|
|
Packit |
857059 |
"Success", // not used by code below
|
|
Packit |
857059 |
"Insufficient SA Resources",
|
|
Packit |
857059 |
"Invalid SA Request",
|
|
Packit |
857059 |
"No SA Records",
|
|
Packit |
857059 |
"Too Many SA Records",
|
|
Packit |
857059 |
"Invalid GID in SA Request",
|
|
Packit |
857059 |
"Insufficient Components in SA Request"
|
|
Packit |
857059 |
};
|
|
Packit |
857059 |
|
|
Packit |
857059 |
const char* iba_sd_mad_status_msg(uint32 code)
|
|
Packit |
857059 |
{
|
|
Packit |
857059 |
// this is a little more complex than most due to bitfields and reserved
|
|
Packit |
857059 |
// values
|
|
Packit |
857059 |
MAD_STATUS madStatus;
|
|
Packit |
857059 |
|
|
Packit |
857059 |
madStatus.AsReg16 = code; // ignore reserved bits in Sd MadStatus
|
|
Packit |
857059 |
if (code == MAD_STATUS_SUCCESS || (code & 0xff))
|
|
Packit |
857059 |
return iba_mad_status_msg(madStatus); // standard mad status fields
|
|
Packit |
857059 |
else {
|
|
Packit |
857059 |
code = madStatus.S.ClassSpecific; // SA specific status code field
|
|
Packit |
857059 |
if (code >= (unsigned)(sizeof(SdSAStatusText)/sizeof(char*)))
|
|
Packit |
857059 |
return "Unknown SA Mad Status";
|
|
Packit |
857059 |
else
|
|
Packit |
857059 |
return SdSAStatusText[code];
|
|
Packit |
857059 |
}
|
|
Packit |
857059 |
}
|