Exemplo n.º 1
0
FSTATUS getDestPath(struct oib_port *port, EUI64 destPortGuid, char *cmd, IB_PATH_RECORD *pathp)
{
	FSTATUS					fstatus;
	EUI64					portGuid		= -1;
	QUERY					query;
	PQUERY_RESULT_VALUES	pq				= NULL;

	portGuid = oib_get_port_guid(port);

	memset(&query, 0, sizeof(query));		// initialize reserved fields
	query.InputType = InputTypePortGuidPair;
	query.InputValue.PortGuidPair.SourcePortGuid = portGuid;
	query.InputValue.PortGuidPair.DestPortGuid = destPortGuid;
	query.OutputType = OutputTypePathRecord;

	DBGPRINT("Query: Input=%s, Output=%s\n",
						iba_sd_query_input_type_msg(query.InputType),
						iba_sd_query_result_type_msg(query.OutputType));

	// this call is synchronous
	fstatus = oib_query_sa(port, &query, &pq);

	if (! pq)
	{
		fprintf(stderr, "%*sSA PathRecord query Failed: %s\n", 0, "", FSTATUS_MSG(fstatus));
		goto fail;
	} else if (pq->Status != FSUCCESS)
	{
		fprintf(stderr, "%*sSA PathRecord query Failed: %s MadStatus 0x%x: %s\n", 0, "",
				FSTATUS_MSG(pq->Status),
				pq->MadStatus, iba_sd_mad_status_msg(pq->MadStatus));
		free(pq);
		goto fail;
	} else if (pq->ResultDataSize == 0)
	{
		fprintf(stderr, "%*sNo Path Records Returned\n", 0, "");
		fstatus = FNOT_FOUND;
		free(pq);
		goto fail;
	} else
	{
		PATH_RESULTS *p = (PATH_RESULTS*)pq->QueryResult;

		DBGPRINT("MadStatus 0x%x: %s\n", pq->MadStatus,
									iba_sd_mad_status_msg(pq->MadStatus));
		DBGPRINT("%d Bytes Returned\n", pq->ResultDataSize);
		if (p->NumPathRecords == 0)
		{
			fprintf(stderr, "%*sNo Path Records Returned\n", 0, "");
			fstatus = FNOT_FOUND;
			goto fail;
		}
		*pathp = p->PathRecords[0];
		return(FSUCCESS);

	}

fail:
	return(FERROR);
}
Exemplo n.º 2
0
// perform the given query and display the results
// if portGuid is -1, 1st active port is used to issue query
//void do_query(EUI64 portGuid, QUERY *pQuery)
void do_query(struct oib_port *port, QUERY *pQuery)
{
	FSTATUS status;
	PQUERY_RESULT_VALUES pQueryResults = NULL;
	DBGPRINT("Query: Input=%s (0x%x), Output=%s (0x%x)\n",
				   		iba_sd_query_input_type_msg(pQuery->InputType),
						pQuery->InputType,
					   	iba_sd_query_result_type_msg(pQuery->OutputType),
						pQuery->OutputType);

	// this call is synchronous
	status = oib_query_sa(port, pQuery, &pQueryResults);

	g_exitstatus = PrintQueryResult(&g_dest, 0, &g_dbgDest,
			   		pQuery->OutputType, g_CSV, status, pQueryResults);

	// iba_sd_query_port_fabric_info will have allocated a result buffer
	// we must free the buffer when we are done with it
	if (pQueryResults)
		oib_free_query_result_buffer(pQueryResults);
}
Exemplo n.º 3
0
Arquivo: sd.c Projeto: 01org/opa-ff
// display the results from a query
// Note: csv is ignored for all but OutputTypeVfInfoRecord
void PrintQueryResultValue(PrintDest_t *dest, int indent, PrintDest_t *dbgDest,
			   QUERY_RESULT_TYPE OutputType, int csv,
			   const QUERY_RESULT_VALUES *pResult)
{
	uint32 i;

	if (dbgDest) {
		PrintFunc(dbgDest, "OutputType (0x%x): %s\n", OutputType, 
				  iba_sd_query_result_type_msg(OutputType));
		PrintFunc(dbgDest, "MadStatus 0x%x: %s\n", pResult->MadStatus,
				   				iba_sd_mad_status_msg(pResult->MadStatus));
		PrintFunc(dbgDest, "%d Bytes Returned\n", pResult->ResultDataSize);
	}
	switch ((int)OutputType)
	{
	case OutputTypeSystemImageGuid:
	case OutputTypeNodeGuid:
	case OutputTypePortGuid:
	case OutputTypeStlSystemImageGuid:
	case OutputTypeStlNodeGuid:
	case OutputTypeStlPortGuid:
		{
		GUID_RESULTS *p = (GUID_RESULTS*)pResult->QueryResult;
		for (i=0; i<p->NumGuids; ++i)
		{
			PrintGuid(dest, indent, p->Guids[i]);
		}
		break;
		}
	case OutputTypeClassPortInfo:
		{
		IB_CLASS_PORT_INFO_RESULTS *p = (IB_CLASS_PORT_INFO_RESULTS*)pResult->QueryResult;
		
		/* There should never be more than 1 ClassPortInfo in the results. */
		if (p->NumClassPortInfo)
			PrintClassPortInfo(dest, indent, &(p->ClassPortInfo[0]));
		break;
		}
	case OutputTypeStlClassPortInfo:
		{
		STL_CLASS_PORT_INFO_RESULT *p = (STL_CLASS_PORT_INFO_RESULT*)pResult->QueryResult;
		
		/* There should never be more than 1 ClassPortInfo in the results. */
		if (p->NumClassPortInfo)
			PrintStlClassPortInfo(dest, indent, &p->ClassPortInfo, MCLASS_SUBN_ADM);
		break;
		}
	case OutputTypeStlFabricInfoRecord:
		{
		STL_FABRICINFO_RECORD_RESULT *p = (STL_FABRICINFO_RECORD_RESULT*)pResult->QueryResult;
		
		/* There should never be more than 1 FaricInfoRecord in the results. */
		if (p->NumFabricInfoRecords)
			PrintStlFabricInfoRecord(dest, indent, &p->FabricInfoRecord);
		break;
		}
	case OutputTypeStlLid:
		{
		STL_LID_RESULTS *p = (STL_LID_RESULTS*)pResult->QueryResult;
		for (i=0; i<p->NumLids; ++i)
		{
			PrintStlLid(dest, indent, p->Lids[i], 0);
		}
		break;
		}
	case OutputTypeGid:
		{
		GID_RESULTS *p = (GID_RESULTS*)pResult->QueryResult;
		for (i=0; i<p->NumGids; ++i)
		{
			PrintGid(dest, indent, &p->Gids[i]);
		}
		break;
		}
	case OutputTypeNodeDesc:
		{
		NODEDESC_RESULTS *p = (NODEDESC_RESULTS*)pResult->QueryResult;
		for (i=0; i<p->NumDescs; ++i)
		{
			PrintNodeDesc(dest, indent, &p->NodeDescs[i]);
		}
		break;
		}
	case OutputTypeStlNodeDesc:
		{
		STL_NODEDESC_RESULTS *p = (STL_NODEDESC_RESULTS*)pResult->QueryResult;
		for (i=0; i<p->NumDescs; ++i)
		{
			PrintStlNodeDesc(dest, indent, &p->NodeDescs[i], 0);
		}
		break;
		}
	case OutputTypePathRecord:
		{
		PATH_RESULTS *p = (PATH_RESULTS*)pResult->QueryResult;
		for (i=0; i<p->NumPathRecords; ++i)
		{
			if (i) PrintSeparator(dest);
			PrintPathRecord(dest, indent, &p->PathRecords[i]);
		}
		break;
		}
	case OutputTypeNodeRecord:
		{
		NODE_RECORD_RESULTS *p = (NODE_RECORD_RESULTS*)pResult->QueryResult;
		for (i=0; i<p->NumNodeRecords; ++i)
		{
			if (i) PrintSeparator(dest);
			PrintNodeRecord(dest, indent, &p->NodeRecords[i]);
		}
		break;
		}
	case OutputTypeStlNodeRecord:
		{
		STL_NODE_RECORD_RESULTS *p = (STL_NODE_RECORD_RESULTS*)pResult->QueryResult;
		for (i=0; i<p->NumNodeRecords; ++i)
		{
			if (i) PrintSeparator(dest);
			PrintStlNodeRecord(dest, indent, &p->NodeRecords[i]);
		}
		break;
		}
	case OutputTypePortInfoRecord:
		{
		PORTINFO_RECORD_RESULTS *p = (PORTINFO_RECORD_RESULTS*)pResult->QueryResult;
		for (i=0; i<p->NumPortInfoRecords; ++i)
		{
			if (i) PrintSeparator(dest);
			PrintPortInfoRecord(dest, indent, &p->PortInfoRecords[i]);
		}
		break;
		}
	case OutputTypeStlPortInfoRecord:
		{
		STL_PORTINFO_RECORD_RESULTS *p = (STL_PORTINFO_RECORD_RESULTS*)pResult->QueryResult;
		for (i=0; i<p->NumPortInfoRecords; ++i)
		{
			if (i) PrintSeparator(dest);
			PrintStlPortInfoRecord(dest, indent, &p->PortInfoRecords[i]);
		}
		break;
		}
	case OutputTypeSMInfoRecord:
		{
		SMINFO_RECORD_RESULTS *p = (SMINFO_RECORD_RESULTS*)pResult->QueryResult;
		for (i=0; i<p->NumSMInfoRecords; ++i)
		{
			if (i) PrintSeparator(dest);
			PrintSMInfoRecord(dest, indent, &p->SMInfoRecords[i]);
		}
		break;
		}
	case OutputTypeStlSMInfoRecord:
		{
		STL_SMINFO_RECORD_RESULTS *p = (STL_SMINFO_RECORD_RESULTS*)pResult->QueryResult;
		for (i=0; i<p->NumSMInfoRecords; ++i)
		{
			if (i) PrintSeparator(dest);
			PrintStlSMInfo(dest, indent, &(p->SMInfoRecords[i].SMInfo), 
							p->SMInfoRecords[i].RID.LID, 0);
		}
		break;
		}
	case OutputTypeLinkRecord:
		{
		LINK_RECORD_RESULTS *p = (LINK_RECORD_RESULTS*)pResult->QueryResult;
		for (i=0; i<p->NumLinkRecords; ++i)
		{
			PrintLinkRecord(dest, indent, &p->LinkRecords[i]);
		}
		break;
		}
	case OutputTypeStlLinkRecord:
		{
		STL_LINK_RECORD_RESULTS *p = (STL_LINK_RECORD_RESULTS*)pResult->QueryResult;
		for (i=0; i<p->NumLinkRecords; ++i)
		{
			PrintStlLinkRecord(dest, indent, &p->LinkRecords[i]);
		}
		break;
		}
	case OutputTypeServiceRecord:
		{
		SERVICE_RECORD_RESULTS *p = (SERVICE_RECORD_RESULTS*)pResult->QueryResult;
		for (i=0; i<p->NumServiceRecords; ++i)
		{
			if (i) PrintSeparator(dest);
			PrintServiceRecord(dest, indent, &p->ServiceRecords[i]);
		}
		break;
		}
#ifndef NO_STL_SERVICE_OUTPUT       // Don't output STL Service if defined
	case OutputTypeStlServiceRecord:
		{
		STL_SERVICE_RECORD_RESULTS *p = (STL_SERVICE_RECORD_RESULTS*)pResult->QueryResult;
		for (i=0; i<p->NumServiceRecords; ++i)
		{
			if (i) PrintSeparator(dest);
			PrintStlServiceRecord(dest, indent, &p->ServiceRecords[i]);
		}
		break;
		}
#endif
#ifndef NO_STL_MCMEMBER_OUTPUT       // Don't output STL McMember if defined
	case OutputTypeStlMcMemberRecord:
		{
		STL_MCMEMBER_RECORD_RESULTS *p = (STL_MCMEMBER_RECORD_RESULTS*)pResult->QueryResult;
		for (i=0; i<p->NumMcMemberRecords; ++i)
		{
			if (i) PrintSeparator(dest);
			PrintStlMcMemberRecord(dest, indent, &p->McMemberRecords[i]);
		}
		break;
		}
#endif
	case OutputTypeMcMemberRecord:
		{
		MCMEMBER_RECORD_RESULTS *p = (MCMEMBER_RECORD_RESULTS*)pResult->QueryResult;
		for (i=0; i<p->NumMcMemberRecords; ++i)
		{
			if (i) PrintSeparator(dest);
			PrintMcMemberRecord(dest, indent, &p->McMemberRecords[i]);
		}
		break;
		}
	case OutputTypeInformInfoRecord:
		{
		INFORM_INFO_RECORD_RESULTS *p = (INFORM_INFO_RECORD_RESULTS*)pResult->QueryResult;
		for (i=0; i<p->NumInformInfoRecords; ++i)
		{
			if (i) PrintSeparator(dest);
			PrintInformInfoRecord(dest, indent, &p->InformInfoRecords[i]);
		}
		break;
		}
	case OutputTypeStlInformInfoRecord:
		{
		STL_INFORM_INFO_RECORD_RESULTS *p = (STL_INFORM_INFO_RECORD_RESULTS*)pResult->QueryResult;
		for (i=0; i<p->NumInformInfoRecords; ++i)
		{
			if (i) PrintSeparator(dest);
			PrintStlInformInfoRecord(dest, indent, &p->InformInfoRecords[i]);
		}
		break;
		}
	case OutputTypeStlTraceRecord:
		{
		STL_TRACE_RECORD_RESULTS *p = (STL_TRACE_RECORD_RESULTS*)pResult->QueryResult;
		for (i=0; i<p->NumTraceRecords; ++i)
		{
			if (i) PrintSeparator(dest);
			PrintStlTraceRecord(dest, indent, &p->TraceRecords[i]);
		}
		break;
		}
	case OutputTypeSLVLMapRecord:
		{
		SLVLMAP_RECORD_RESULTS *p = (SLVLMAP_RECORD_RESULTS*)pResult->QueryResult;
		for (i=0; i<p->NumSLVLMapRecords; ++i)
		{
			PrintSLVLMapRecord(dest, indent, &p->SLVLMapRecords[i]);
		}
		break;
		}
	case OutputTypeStlSCSCTableRecord:
		{
		STL_SC_MAPPING_TABLE_RECORD_RESULTS *p = (STL_SC_MAPPING_TABLE_RECORD_RESULTS*)pResult->QueryResult;
        uint32_t lid = p->SCSCRecords[0].RID.LID;
		for (i=0; i<p->NumSCSCTableRecords; ++i)
		{
            if (lid!=p->SCSCRecords[i].RID.LID) {
                PrintSeparator(dest);
                lid=p->SCSCRecords[i].RID.LID;
            }
			PrintStlSCSCTableRecord(dest, indent, &p->SCSCRecords[i]);
        }
		break;
		}
	case OutputTypeStlSLSCTableRecord:
		{
		STL_SL2SC_MAPPING_TABLE_RECORD_RESULTS *p = (STL_SL2SC_MAPPING_TABLE_RECORD_RESULTS*)pResult->QueryResult;
        uint32_t lid = p->SLSCRecords[0].RID.LID;
		for (i=0; i<p->NumSLSCTableRecords; ++i)
		{
            if (lid!=p->SLSCRecords[i].RID.LID) {
                PrintSeparator(dest);
                lid=p->SLSCRecords[i].RID.LID;
            }
			PrintStlSLSCTableRecord(dest, indent, &p->SLSCRecords[i]);
        }
		break;
		}
	case OutputTypeStlSCSLTableRecord:
		{
		STL_SC2SL_MAPPING_TABLE_RECORD_RESULTS *p = (STL_SC2SL_MAPPING_TABLE_RECORD_RESULTS*)pResult->QueryResult;
		uint32_t lid = p->SCSLRecords[0].RID.LID;
		for (i=0; i<p->NumSCSLTableRecords; i++) {
			if (lid!=p->SCSLRecords[i].RID.LID) {
				PrintSeparator(dest);
				lid=p->SCSLRecords[i].RID.LID;
			}
			PrintStlSCSLTableRecord(dest, indent, &p->SCSLRecords[i]);
		}
		break;
		}
	case OutputTypeStlSCVLtTableRecord:
		{
		STL_SC2PVL_T_MAPPING_TABLE_RECORD_RESULTS *p = (STL_SC2PVL_T_MAPPING_TABLE_RECORD_RESULTS*)pResult->QueryResult;
		uint32_t lid = p->SCVLtRecords[0].RID.LID;
		for (i=0; i<p->NumSCVLtTableRecords; i++) {
			if (lid!=p->SCVLtRecords[i].RID.LID) {
				PrintSeparator(dest);
				lid=p->SCVLtRecords[i].RID.LID;
			}
			PrintStlSCVLxTableRecord(dest, indent, &p->SCVLtRecords[i], STL_MCLASS_ATTRIB_ID_SC_VLT_MAPPING_TABLE);
		}
		break;
		}
	case OutputTypeStlSCVLntTableRecord:
		{
		STL_SC2PVL_NT_MAPPING_TABLE_RECORD_RESULTS *p = (STL_SC2PVL_NT_MAPPING_TABLE_RECORD_RESULTS*)pResult->QueryResult;
		uint32_t lid=p->SCVLntRecords[0].RID.LID;
		for (i=0; i<p->NumSCVLntTableRecords; i++) {
			if (lid!=p->SCVLntRecords[i].RID.LID) {
				PrintSeparator(dest);
				lid=p->SCVLntRecords[i].RID.LID;
			}
			PrintStlSCVLxTableRecord(dest, indent, &p->SCVLntRecords[i], STL_MCLASS_ATTRIB_ID_SC_VLNT_MAPPING_TABLE);
		}
		break;
		}
	case OutputTypeSwitchInfoRecord:
		{
		SWITCHINFO_RECORD_RESULTS *p = (SWITCHINFO_RECORD_RESULTS*)pResult->QueryResult;
		for (i=0; i<p->NumSwitchInfoRecords; ++i)
		{
			if (i) PrintSeparator(dest);
			PrintSwitchInfoRecord(dest, indent, &p->SwitchInfoRecords[i]);
		}
		break;
		}
	case OutputTypeStlSwitchInfoRecord:
		{
		STL_SWITCHINFO_RECORD_RESULTS *p = (STL_SWITCHINFO_RECORD_RESULTS*)pResult->QueryResult;
		for (i=0; i<p->NumSwitchInfoRecords; ++i)
		{
			if (i) PrintSeparator(dest);
			PrintStlSwitchInfoRecord(dest, indent, &p->SwitchInfoRecords[i]);
		}
		break;
		}
	case OutputTypeStlLinearFDBRecord:
		{
		STL_LINEAR_FDB_RECORD_RESULTS *p = (STL_LINEAR_FDB_RECORD_RESULTS*)pResult->QueryResult;
		
		for (i=0; i<p->NumLinearFDBRecords; ++i)
		{
			if (i) PrintSeparator(dest);
			PrintStlLinearFDBRecord(dest, indent, &p->LinearFDBRecords[i]);
		}
		break;
		}
	case OutputTypeRandomFDBRecord:
		{
		RANDOM_FDB_RECORD_RESULTS *p = (RANDOM_FDB_RECORD_RESULTS*)pResult->QueryResult;
		for (i=0; i<p->NumRandomFDBRecords; ++i)
		{
			if (i) PrintSeparator(dest);
			PrintRandomFDBRecord(dest, indent, &p->RandomFDBRecords[i]);
		}
		break;
		}
	case OutputTypeStlMCastFDBRecord:
		{
		STL_MCAST_FDB_RECORD_RESULTS *p = (STL_MCAST_FDB_RECORD_RESULTS*)pResult->QueryResult;
		for (i=0; i<p->NumMCastFDBRecords; ++i)
		{
			if (i) PrintSeparator(dest);
			PrintStlMCastFDBRecord(dest, indent, &p->MCastFDBRecords[i]);
		}
		break;
		}
	case OutputTypeStlVLArbTableRecord:
		{
		STL_VLARBTABLE_RECORD_RESULTS *p = (STL_VLARBTABLE_RECORD_RESULTS*)pResult->QueryResult;
		for (i=0; i<p->NumVLArbTableRecords; ++i)
		{
			if (i) PrintSeparator(dest);
			PrintStlVLArbTableRecord(dest, indent, &p->VLArbTableRecords[i]);
		}
		break;
		}
	case OutputTypeStlPKeyTableRecord:
		{
		STL_PKEYTABLE_RECORD_RESULTS *p = (STL_PKEYTABLE_RECORD_RESULTS*)pResult->QueryResult;
		for (i=0; i<p->NumPKeyTableRecords; ++i)
		{
			if (i) PrintSeparator(dest);
			PrintStlPKeyTableRecord(dest, indent, &p->PKeyTableRecords[i]);
		}
		break;
		}
	case OutputTypeStlVfInfoRecord:
		{
		STL_VFINFO_RECORD_RESULTS *p = (STL_VFINFO_RECORD_RESULTS*)pResult->QueryResult;

		for (i=0; i<p->NumVfInfoRecords; ++i) {
			if (csv == 1) {
				PrintStlVfInfoRecordCSV(dest, indent, &p->VfInfoRecords[i]);
			} else if (csv == 2) {
				PrintStlVfInfoRecordCSV2(dest, indent, &p->VfInfoRecords[i]);
			} else {
				if (i) PrintSeparator(dest);
				PrintStlVfInfoRecord(dest, indent, &p->VfInfoRecords[i]);
			}
		}
		break;
		}
	case OutputTypeStlQuarantinedNodeRecord:
		{
		STL_QUARANTINED_NODE_RECORD_RESULTS *p = (STL_QUARANTINED_NODE_RECORD_RESULTS*)pResult->QueryResult;
		int hasPrinted = 0;
		// Loop through and print out spoofing violations first
		PrintSeparator(dest);
		PrintFunc(dest, "%*sNodes Quarantined Due To Spoofing:\n", indent, "");
		PrintSeparator(dest);
		for(i = 0; i < p->NumQuarantinedNodeRecords; ++i)
		{
			if (i && hasPrinted) PrintSeparator(dest);

			if(p->QuarantinedNodeRecords[i].quarantineReasons & STL_QUARANTINE_REASON_SPOOF_GENERIC) {
				PrintQuarantinedNodeRecord(dest, indent, &p->QuarantinedNodeRecords[i]);
				hasPrinted = 1;
			}
		}

		if(!hasPrinted) {
			PrintFunc(dest, "%*s    None.\n\n", indent, "");
		} else {
			hasPrinted = 0;
		}

		// Then loop through and print out all other violations
		PrintSeparator(dest);
		PrintFunc(dest, "%*sNodes Quarantined Due To Other Violations:\n", indent, "");
		PrintSeparator(dest);
		for(i = 0; i < p->NumQuarantinedNodeRecords; ++i)
		{
			if (i && hasPrinted) PrintSeparator(dest);
			if(!(p->QuarantinedNodeRecords[i].quarantineReasons & STL_QUARANTINE_REASON_SPOOF_GENERIC)) {
				PrintQuarantinedNodeRecord(dest, indent, &p->QuarantinedNodeRecords[i]);
				hasPrinted = 1;
			}
		}

		if(!hasPrinted) {
			PrintFunc(dest, "%*s    None.\n\n", indent, "");
		}

		break;
		}
	case OutputTypeStlCongInfoRecord:
		{
		STL_CONGESTION_INFO_RECORD_RESULTS *p = (STL_CONGESTION_INFO_RECORD_RESULTS*)pResult->QueryResult;
		for(i = 0; i < p->NumRecords; ++i)
		{
			if (i) PrintSeparator(dest);
			PrintStlCongestionInfoRecord(dest, indent, &p->Records[i]);
		}
		break;
		}
	case OutputTypeStlSwitchCongRecord:
		{
        STL_SWITCH_CONGESTION_SETTING_RECORD_RESULTS *p = (STL_SWITCH_CONGESTION_SETTING_RECORD_RESULTS*)pResult->QueryResult;
        for(i = 0; i < p->NumRecords; ++i)
        {
            if (i) PrintSeparator(dest);
            PrintStlSwitchCongestionSettingRecord(dest, indent, &p->Records[i]);
        }
		break;
		}
	case OutputTypeStlSwitchPortCongRecord:
		{
        STL_SWITCH_PORT_CONGESTION_SETTING_RECORD_RESULTS *p = (STL_SWITCH_PORT_CONGESTION_SETTING_RECORD_RESULTS*)pResult->QueryResult;
        for(i = 0; i < p->NumRecords; ++i)
        {
            if (i) PrintSeparator(dest);
            PrintStlSwitchPortCongestionSettingRecord(dest, indent, &p->Records[i]);
        }
		break;
		}
	case OutputTypeStlHFICongRecord:
		{
        STL_HFI_CONGESTION_SETTING_RECORD_RESULTS *p = (STL_HFI_CONGESTION_SETTING_RECORD_RESULTS*)pResult->QueryResult;
        for(i = 0; i < p->NumRecords; ++i)
        {
            if (i) PrintSeparator(dest);
            PrintStlHfiCongestionSettingRecord(dest, indent, &p->Records[i]);
        }
		break;
		}
	case OutputTypeStlHFICongCtrlRecord:
		{
        STL_HFI_CONGESTION_CONTROL_TABLE_RECORD_RESULTS *p = (STL_HFI_CONGESTION_CONTROL_TABLE_RECORD_RESULTS*)pResult->QueryResult;
        for(i = 0; i < p->NumRecords; ++i)
        {
            if (i) PrintSeparator(dest);
            PrintStlHfiCongestionControlTabRecord(dest, indent, &p->Records[i]);
        }
		break;
		}
	case OutputTypeStlBufCtrlTabRecord:
		{
		STL_BUFFER_CONTROL_TABLE_RECORD_RESULTS *p = (STL_BUFFER_CONTROL_TABLE_RECORD_RESULTS*)pResult->QueryResult;
		for(i = 0; i < p->NumBufferControlRecords; ++i)
		{
			if (i) PrintSeparator(dest);
			PrintBfrCtlTableRecord(dest, indent, &p->BufferControlRecords[i]);
		}
		break;
		}
	case OutputTypeStlCableInfoRecord:
		{
		const uint32	max_records = 2;	// Max number of grouped records
											//  NOTE that CIR.Length is 7 bits (<= 127)
		STL_CABLE_INFO_RECORD_RESULTS *p = (STL_CABLE_INFO_RECORD_RESULTS*)pResult->QueryResult;
		STL_CABLE_INFO_RECORD *p_rec;
		uint32	ct_records = 0;			// Count of grouped records
		uint8	first_addr = 0;			// First CableInfo addr in bf_cable_info
		uint8	last_addr = 0;			// Last CableInfo addr in bf_cable_info
		uint32	prev_lid;
		uint8	prev_port;
		uint8	prev_addr;
		uint8	bf_cable_info[sizeof(STL_CABLE_INFO_RECORD) * max_records];
		for(i = 0; i < p->NumCableInfoRecords; ++i)
		{
			p_rec = &p->CableInfoRecords[i];
			// Skip unaligned or partial records
			if ( ( (p_rec->u1.s.Address != STL_CIB_STD_START_ADDR) &&
					(p_rec->u1.s.Address != STL_CIB_STD_START_ADDR + STL_CABLE_INFO_MAXLEN + 1) ) ||
					(p_rec->Length != STL_CABLE_INFO_MAXLEN) )
				continue;
			// Group multiple records for same LID and port into one
			if (! ct_records) {
				// First record for LID/Port
				memset(bf_cable_info, 0, sizeof(bf_cable_info));
				memcpy(bf_cable_info, p_rec, sizeof(STL_CABLE_INFO_RECORD));
				last_addr = 0;
			}
			else {
				if ((p_rec->LID == prev_lid) && (p_rec->Port == prev_port) &&
						(p_rec->u1.s.Address != prev_addr) && (ct_records < max_records)) {
					// Subsequent record for same LID/Port
					if (p_rec->u1.s.Address < first_addr) {
						memmove( ((STL_CABLE_INFO_RECORD *)bf_cable_info)->Data + first_addr - p_rec->u1.s.Address,
							((STL_CABLE_INFO_RECORD *)bf_cable_info)->Data,
							STL_CIR_DATA_SIZE * max_records - (first_addr - p_rec->u1.s.Address) );
						memcpy(bf_cable_info, p_rec, sizeof(STL_CABLE_INFO_RECORD));
					}
					else {
						memcpy( ((STL_CABLE_INFO_RECORD *)bf_cable_info)->Data + p_rec->u1.s.Address - first_addr,
							p_rec->Data, STL_CIR_DATA_SIZE );
					}
				}
				else {
					// Print grouped record
					if (i - ct_records) PrintSeparator(dest);
					PrintStlCableInfoRecord(dest, indent, (STL_CABLE_INFO_RECORD *)bf_cable_info);
					memset(bf_cable_info, 0, sizeof(bf_cable_info));
					memcpy(bf_cable_info, p_rec, sizeof(STL_CABLE_INFO_RECORD));
					last_addr = 0;
					ct_records = 0;
				}
			}
			prev_lid = p_rec->LID;
			prev_port = p_rec->Port;
			prev_addr = p_rec->u1.s.Address;
			if (prev_addr > last_addr)
				last_addr = prev_addr;
			ct_records += 1;
			first_addr = ((STL_CABLE_INFO_RECORD *)bf_cable_info)->u1.s.Address;
			((STL_CABLE_INFO_RECORD *)bf_cable_info)->Length = last_addr - first_addr + STL_CIR_DATA_SIZE - 1;
		}
		if (ct_records) {
			if (i - ct_records) PrintSeparator(dest);
			PrintStlCableInfoRecord(dest, indent, (STL_CABLE_INFO_RECORD *)bf_cable_info);
		}
		break;
		}
	case OutputTypeStlPortGroupRecord:
		{
        STL_PORT_GROUP_TABLE_RECORD_RESULTS *p = (STL_PORT_GROUP_TABLE_RECORD_RESULTS*)pResult->QueryResult;
        for(i = 0; i < p->NumRecords; ++i)
        {
            if (i) PrintSeparator(dest);
            PrintStlPortGroupTabRecord(dest, indent, &p->Records[i]);
        }
		break;
		}
	case OutputTypeStlPortGroupFwdRecord:
		{
        STL_PORT_GROUP_FORWARDING_TABLE_RECORD_RESULTS *p = (STL_PORT_GROUP_FORWARDING_TABLE_RECORD_RESULTS*)pResult->QueryResult;
        for(i = 0; i < p->NumRecords; ++i)
        {
            if (i) PrintSeparator(dest);
            PrintStlPortGroupFwdTabRecord(dest, indent, &p->Records[i]);
        }
		break;
		}
	default:
		PrintFunc(dest, "Unsupported OutputType\n");
	}
}