[openib-general] Unknown SMP Recv
Michael Arndt
michael.arndt at informatik.tu-chemnitz.de
Fri Feb 9 15:14:35 PST 2007
Hi,
below the two files missing, sender.h and helper.c.
Thanks Michael
############################# Sender. h
##############################################
// ---- Includes --------------------------------
#include <infiniband/umad.h>
#include <string.h>
#include <errno.h>
#include <sys/select.h>
#include <netinet/in.h>
#include <bits/endian.h>
// ---- Defines ---------------------------------
#define IB_MAD_SIZE 256
#define UMAD_DEV_NAME_SZ 32
#define UMAD_DEV_FILE_SZ 256
#define DIRECTION (uint16_t)htons(0x8000)
#define BUF_SIZE 4096
#define MCLASS_SUBN_DIR 0x81
#define MCLASS_SUBN_LID 0x01
#define MCLASS_SUBN_ADM 0x03
#define SMP_STATUS_MASK_HO 0x7FFF
#define SMP_STATUS_MASK (uint16_t)htons(SMP_STATUS_MASK_HO)
#define PRIx64 "lx"
#define SM_METHOD_STR_UNKNOWN_VAL 0x21
#define NODE_INFO_PORT_NUM_MASK (ntohl(0xFF000000))
#define NODE_INFO_VEND_ID_MASK (ntohl(0x00FFFFFF))
#define MAD_ATTR_PORT_INFO 0x0015
#define MAD_ATTR_NODE_INFO 0x0011
#define MAD_ATTR_NODE_DESC 0x0010
#define IB_NOTICE_NODE_TYPE_ROUTER (ntohl(0x000003))
#define SM_ATTR_STR_UNKNOWN_VAL 0x21
#define PORT_LINK_SPEED_SHIFT 4
#define PORT_LINK_SPEED_SUPPORTED_MASK 0xF0
#define PORT_LINK_SPEED_ACTIVE_MASK 0xF0
#define PORT_LINK_SPEED_ENABLED_MASK 0x0F
#define LINK_NO_CHANGE 0
#define LINK_DOWN 1
#define LINK_INIT 2
#define LINK_ARMED 3
#define LINK_ACTIVE 4
#define LINK_ACT_DEFER 5
#define PORT_STATE_MASK 0x0F
#define PORT_LMC_MASK 0x07
#define PORT_LMC_MAX 0x07
#define PORT_MPB_MASK 0xC0
#define PORT_MPB_SHIFT 6
#define PORT_LINK_SPEED_SHIFT 4
#define PORT_LINK_SPEED_SUPPORTED_MASK 0xF0
#define PORT_LINK_SPEED_ACTIVE_MASK 0xF0
#define PORT_LINK_SPEED_ENABLED_MASK 0x0F
#define PORT_PHYS_STATE_MASK 0xF0
#define PORT_PHYS_STATE_SHIFT 4
#define PORT_LNKDWNDFTSTATE_MASK 0x0F
#ifndef __BYTE_ORDER
#error "__BYTE_ORDER macro undefined. Missing in endian.h?"
#endif
#if __BYTE_ORDER == __LITTLE_ENDIAN
#define CPU_LE 1
#define CPU_BE 0
#else
#define CPU_LE 0
#define CPU_BE 1
#endif
#if CPU_LE
#define NODE_INFO_PORT_NUM_SHIFT 0
#else
#define NODE_INFO_PORT_NUM_SHIFT 24
#endif
#define own_ntoh64( x ) (uint64_t)( \
(((uint64_t)(x) & 0x00000000000000FFULL) << 56) | \
(((uint64_t)(x) & 0x000000000000FF00ULL) << 40) | \
(((uint64_t)(x) & 0x0000000000FF0000ULL) << 24) | \
(((uint64_t)(x) & 0x00000000FF000000ULL) << 8 ) | \
(((uint64_t)(x) & 0x000000FF00000000ULL) >> 8 ) | \
(((uint64_t)(x) & 0x0000FF0000000000ULL) >> 24) | \
(((uint64_t)(x) & 0x00FF000000000000ULL) >> 40) | \
(((uint64_t)(x) & 0xFF00000000000000ULL) >> 56) )
#define own_ntoh64_2( x ) (uint64_t)( \
(((uint64_t)(x) & 0x00000000000000FFULL) << 24) | \
(((uint64_t)(x) & 0x000000000000FF00ULL) << 8) | \
(((uint64_t)(x) & 0x0000000000FF0000ULL) >> 8) | \
(((uint64_t)(x) & 0x00000000FF000000ULL) >> 24 ) | \
(((uint64_t)(x) & 0x000000FF00000000ULL) << 24 ) | \
(((uint64_t)(x) & 0x0000FF0000000000ULL) << 8) | \
(((uint64_t)(x) & 0x00FF000000000000ULL) >> 8) | \
(((uint64_t)(x) & 0xFF00000000000000ULL) >> 24) )
// ---- Deklarationen ---------------------------
struct Port {
char dev_file[UMAD_DEV_FILE_SZ];
char dev_name[UMAD_DEV_NAME_SZ];
int dev_port;
int dev_fd;
int id;
};
struct _register_info{
int Management_Class;
int Management_Version;
uint8_t RMPP_Version;
uint32_t Method_Mask[4];
} Register_Info;
typedef struct {
char path[64];
int hop_cnt;
} DRPath;
struct drsmp {
uint8_t base_version;
uint8_t mgmt_class;
uint8_t class_version;
uint8_t method;
uint16_t status;
uint8_t hop_ptr;
uint8_t hop_cnt;
uint64_t tid;
uint16_t attr_id;
uint16_t resv;
uint32_t attr_mod;
uint64_t mkey;
uint16_t dr_slid;
uint16_t dr_dlid;
uint32_t reserved[7];
uint8_t data[64];
uint8_t initial_path[64];
uint8_t return_path[64];
};
struct node_info
{
uint8_t base_version;
uint8_t class_version;
uint8_t node_type;
uint8_t num_ports;
uint64_t sys_guid;
uint64_t node_guid;
uint64_t port_guid;
uint16_t partition_cap;
uint16_t device_id;
uint32_t revision;
uint32_t port_num_vendor_id;
};
struct port_info
{
uint64_t m_key;
uint64_t subnet_prefix;
uint16_t base_lid;
uint16_t master_sm_base_lid;
uint32_t capability_mask;
uint16_t diag_code;
uint16_t m_key_lease_period;
uint8_t local_port_num;
uint8_t link_width_enabled;
uint8_t link_width_supported;
uint8_t link_width_active;
uint8_t state_info1; /* LinkSpeedSupported and PortState */
uint8_t state_info2; /* PortPhysState and LinkDownDefaultState
*/
uint8_t mkey_lmc;
uint8_t link_speed; /* LinkSpeedEnabled and LinkSpeedActive */
uint8_t mtu_smsl;
uint8_t vl_cap; /* VLCap and InitType */
uint8_t vl_high_limit;
uint8_t vl_arb_high_cap;
uint8_t vl_arb_low_cap;
uint8_t mtu_cap;
uint8_t vl_stall_life;
uint8_t vl_enforce;
uint16_t m_key_violations;
uint16_t p_key_violations;
uint16_t q_key_violations;
uint8_t guid_cap;
uint8_t subnet_timeout; /* cli_rereg(1b), resrv(2b),
timeout(5b) */
uint8_t resp_time_value;
uint8_t error_threshold;
};
// ---- Prototypes
int routing(struct drsmp* smp, struct umad_ca* Devices_Info , int
Devices_cnt);
int set_bit(int nr, void *method_mask);
char *drmad_status_str(struct drsmp *drsmp);
void dump_dr_smp(const struct drsmp* const p_smp);
############################################## helper.c
##########################################################
// ---- Include ---------------------------------
#include "sender.h"
// ---- Hilfe Funktionen ------------------------
const char* sm_method_str[] =
{
"RESERVED0", /* 0 */
"SubnGet", /* 1 */
"SubnSet", /* 2 */
"RESERVED3", /* 3 */
"RESERVED4", /* 4 */
"SubnTrap", /* 5 */
"RESERVED6", /* 6 */
"SubnTrapRepress", /* 7 */
"RESERVED8", /* 8 */
"RESERVED9", /* 9 */
"RESERVEDA", /* A */
"RESERVEDB", /* B */
"RESERVEDC", /* C */
"RESERVEDD", /* D */
"RESERVEDE", /* E */
"RESERVEDF", /* F */
"RESERVED10", /* 10 */
"SubnGetResp", /* 11 */
"RESERVED12", /* 12 */
"RESERVED13", /* 13 */
"RESERVED14", /* 14 */
"RESERVED15", /* 15 */
"RESERVED16", /* 16 */
"RESERVED17", /* 17 */
"RESERVED18", /* 18 */
"RESERVED19", /* 19 */
"RESERVED1A", /* 1A */
"RESERVED1B", /* 1B */
"RESERVED1C", /* 1C */
"RESERVED1D", /* 1D */
"RESERVED1E", /* 1E */
"RESERVED1F", /* 1F */
"UNKNOWN" /* 20 */
};
const char* node_type_str[] =
{
"UNKNOWN",
"Channel Adapter",
"Switch",
"Router",
"Subnet Management"
};
const char* sm_attr_str[] =
{
"RESERVED", /* 0 */
"ClassPortInfo", /* 1 */
"Notice", /* 2 */
"InformInfo", /* 3 */
"RESERVED", /* 4 */
"RESERVED", /* 5 */
"RESERVED", /* 6 */
"RESERVED", /* 7 */
"RESERVED", /* 8 */
"RESERVED", /* 9 */
"RESERVED", /* A */
"RESERVED", /* B */
"RESERVED", /* C */
"RESERVED", /* D */
"RESERVED", /* E */
"RESERVED", /* F */
"NodeDescription", /* 10 */
"NodeInfo", /* 11 */
"SwitchInfo", /* 12 */
"UNKNOWN", /* 13 */
"GUIDInfo", /* 14 */
"PortInfo", /* 15 */
"P_KeyTable", /* 16 */
"SLtoVLMappingTable", /* 17 */
"VLArbitrationTable", /* 18 */
"LinearForwardingTable", /* 19 */
"RandomForwardingTable", /* 1A */
"MulticastForwardingTable", /* 1B */
"UNKNOWN", /* 1C */
"UNKNOWN", /* 1D */
"UNKNOWN", /* 1E */
"UNKNOWN", /* 1F */
"SMInfo", /* 20 */
"UNKNOWN" /* 21 - always highest value */
};
const char* sa_attr_str[] =
{
"RESERVED", /* 0 */
"ClassPortInfo", /* 1 */
"Notice", /* 2 */
"InformInfo", /* 3 */
"RESERVED", /* 4 */
"RESERVED", /* 5 */
"RESERVED", /* 6 */
"RESERVED", /* 7 */
"RESERVED", /* 8 */
"RESERVED", /* 9 */
"RESERVED", /* A */
"RESERVED", /* B */
"RESERVED", /* C */
"RESERVED", /* D */
"RESERVED", /* E */
"RESERVED", /* F */
"RESERVED", /* 10 */
"NodeRecord", /* 11 */
"PortInfoRecord", /* 12 */
"SLtoVLMappingTableRecord", /* 13 */
"SwitchInfoRecord", /* 14 */
"LinearForwardingTableRecord", /* 15 */
"RandomForwardingTableRecord", /* 16 */
"MulticastForwardingTableRecord", /* 17 */
"SMInfoRecord", /* 18 */
"RESERVED", /* 19 */
"RandomForwardingTable", /* 1A */
"MulticastForwardingTable", /* 1B */
"UNKNOWN", /* 1C */
"UNKNOWN", /* 1D */
"UNKNOWN", /* 1E */
"UNKNOWN", /* 1F */
"LinkRecord", /* 20 */
"UNKNOWN", /* 21 */
"UNKNOWN", /* 22 */
"UNKNOWN", /* 23 */
"UNKNOWN", /* 24 */
"UNKNOWN", /* 25 */
"UNKNOWN", /* 26 */
"UNKNOWN", /* 27 */
"UNKNOWN", /* 28 */
"UNKNOWN", /* 29 */
"UNKNOWN", /* 2A */
"UNKNOWN", /* 2B */
"UNKNOWN", /* 2C */
"UNKNOWN", /* 2D */
"UNKNOWN", /* 2E */
"UNKNOWN", /* 2F */
"GuidInfoRecord", /* 30 */
"ServiceRecord", /* 31 */
"UNKNOWN", /* 32 */
"P_KeyTableRecord", /* 33 */
"UNKNOWN", /* 34 */
"PathRecord", /* 35 */
"VLArbitrationTableRecord", /* 36 */
"UNKNOWN", /* 37 */
"MCMemberRecord", /* 38 */
"TraceRecord", /* 39 */
"MultiPathRecord", /* 3A */
"ServiceAssociationRecord", /* 3B */
"UNKNOWN", /* 3C */
"UNKNOWN", /* 3D */
"UNKNOWN", /* 3E */
"UNKNOWN", /* 3F */
"UNKNOWN", /* 40 */
"UNKNOWN", /* 41 */
"UNKNOWN", /* 42 */
"UNKNOWN", /* 43 */
"UNKNOWN", /* 44 */
"UNKNOWN", /* 45 */
"UNKNOWN", /* 46 */
"UNKNOWN", /* 47 */
"UNKNOWN", /* 48 */
"UNKNOWN", /* 49 */
"UNKNOWN", /* 4A */
"UNKNOWN", /* 4B */
"UNKNOWN", /* 4C */
"UNKNOWN", /* 4D */
"UNKNOWN", /* 4E */
"UNKNOWN", /* 4F */
"UNKNOWN", /* 50 */
"UNKNOWN", /* 51 */
"UNKNOWN", /* 52 */
"UNKNOWN", /* 53 */
"UNKNOWN", /* 54 */
"UNKNOWN", /* 55 */
"UNKNOWN", /* 56 */
"UNKNOWN", /* 57 */
"UNKNOWN", /* 58 */
"UNKNOWN", /* 59 */
"UNKNOWN", /* 5A */
"UNKNOWN", /* 5B */
"UNKNOWN", /* 5C */
"UNKNOWN", /* 5D */
"UNKNOWN", /* 5E */
"UNKNOWN", /* 5F */
"UNKNOWN", /* 60 */
"UNKNOWN", /* 61 */
"UNKNOWN", /* 62 */
"UNKNOWN", /* 63 */
"UNKNOWN", /* 64 */
"UNKNOWN", /* 65 */
"UNKNOWN", /* 66 */
"UNKNOWN", /* 67 */
"UNKNOWN", /* 68 */
"UNKNOWN", /* 69 */
"UNKNOWN", /* 6A */
"UNKNOWN", /* 6B */
"UNKNOWN", /* 6C */
"UNKNOWN", /* 6D */
"UNKNOWN", /* 6E */
"UNKNOWN", /* 6F */
"UNKNOWN", /* 70 */
"UNKNOWN", /* 71 */
"UNKNOWN", /* 72 */
"UNKNOWN", /* 73 */
"UNKNOWN", /* 74 */
"UNKNOWN", /* 75 */
"UNKNOWN", /* 76 */
"UNKNOWN", /* 77 */
"UNKNOWN", /* 78 */
"UNKNOWN", /* 79 */
"UNKNOWN", /* 7A */
"UNKNOWN", /* 7B */
"UNKNOWN", /* 7C */
"UNKNOWN", /* 7D */
"UNKNOWN", /* 7E */
"UNKNOWN", /* 7F */
"UNKNOWN", /* 80 */
"UNKNOWN", /* 81 */
"UNKNOWN", /* 82 */
"UNKNOWN", /* 83 */
"UNKNOWN", /* 84 */
"UNKNOWN", /* 85 */
"UNKNOWN", /* 86 */
"UNKNOWN", /* 87 */
"UNKNOWN", /* 88 */
"UNKNOWN", /* 89 */
"UNKNOWN", /* 8A */
"UNKNOWN", /* 8B */
"UNKNOWN", /* 8C */
"UNKNOWN", /* 8D */
"UNKNOWN", /* 8E */
"UNKNOWN", /* 8F */
"UNKNOWN", /* 90 */
"UNKNOWN", /* 91 */
"UNKNOWN", /* 92 */
"UNKNOWN", /* 93 */
"UNKNOWN", /* 94 */
"UNKNOWN", /* 95 */
"UNKNOWN", /* 96 */
"UNKNOWN", /* 97 */
"UNKNOWN", /* 98 */
"UNKNOWN", /* 99 */
"UNKNOWN", /* 9A */
"UNKNOWN", /* 9B */
"UNKNOWN", /* 9C */
"UNKNOWN", /* 9D */
"UNKNOWN", /* 9E */
"UNKNOWN", /* 9F */
"UNKNOWN", /* A0 */
"UNKNOWN", /* A1 */
"UNKNOWN", /* A2 */
"UNKNOWN", /* A3 */
"UNKNOWN", /* A4 */
"UNKNOWN", /* A5 */
"UNKNOWN", /* A6 */
"UNKNOWN", /* A7 */
"UNKNOWN", /* A8 */
"UNKNOWN", /* A9 */
"UNKNOWN", /* AA */
"UNKNOWN", /* AB */
"UNKNOWN", /* AC */
"UNKNOWN", /* AD */
"UNKNOWN", /* AE */
"UNKNOWN", /* AF */
"UNKNOWN", /* B0 */
"UNKNOWN", /* B1 */
"UNKNOWN", /* B2 */
"UNKNOWN", /* B3 */
"UNKNOWN", /* B4 */
"UNKNOWN", /* B5 */
"UNKNOWN", /* B6 */
"UNKNOWN", /* B7 */
"UNKNOWN", /* B8 */
"UNKNOWN", /* B9 */
"UNKNOWN", /* BA */
"UNKNOWN", /* BB */
"UNKNOWN", /* BC */
"UNKNOWN", /* BD */
"UNKNOWN", /* BE */
"UNKNOWN", /* BF */
"UNKNOWN", /* C0 */
"UNKNOWN", /* C1 */
"UNKNOWN", /* C2 */
"UNKNOWN", /* C3 */
"UNKNOWN", /* C4 */
"UNKNOWN", /* C5 */
"UNKNOWN", /* C6 */
"UNKNOWN", /* C7 */
"UNKNOWN", /* C8 */
"UNKNOWN", /* C9 */
"UNKNOWN", /* CA */
"UNKNOWN", /* CB */
"UNKNOWN", /* CC */
"UNKNOWN", /* CD */
"UNKNOWN", /* CE */
"UNKNOWN", /* CF */
"UNKNOWN", /* D0 */
"UNKNOWN", /* D1 */
"UNKNOWN", /* D2 */
"UNKNOWN", /* D3 */
"UNKNOWN", /* D4 */
"UNKNOWN", /* D5 */
"UNKNOWN", /* D6 */
"UNKNOWN", /* D7 */
"UNKNOWN", /* D8 */
"UNKNOWN", /* D9 */
"UNKNOWN", /* DA */
"UNKNOWN", /* DB */
"UNKNOWN", /* DC */
"UNKNOWN", /* DD */
"UNKNOWN", /* DE */
"UNKNOWN", /* DF */
"UNKNOWN", /* E0 */
"UNKNOWN", /* E1 */
"UNKNOWN", /* E2 */
"UNKNOWN", /* E3 */
"UNKNOWN", /* E4 */
"UNKNOWN", /* E5 */
"UNKNOWN", /* E6 */
"UNKNOWN", /* E7 */
"UNKNOWN", /* E8 */
"UNKNOWN", /* E9 */
"UNKNOWN", /* EA */
"UNKNOWN", /* EB */
"UNKNOWN", /* EC */
"UNKNOWN", /* ED */
"UNKNOWN", /* EE */
"UNKNOWN", /* EF */
"UNKNOWN", /* F0 */
"UNKNOWN", /* F1 */
"UNKNOWN", /* F2 */
"InformInfoRecord", /* F3 */
"UNKNOWN" /* F4 - always highest value */
};
const char* port_state_str[] =
{
"No State Change (NOP)",
"DOWN",
"INIT",
"ARMED",
"ACTIVE",
"ACTDEFER",
"UNKNOWN"
};
int set_bit(int nr, void *method_mask)
{
int mask, retval;
long *addr = method_mask;
addr += nr >> 5;
mask = 1 << (nr & 0x1f);
retval = (mask & *addr) != 0;
*addr |= mask;
return retval;
}
char * drmad_status_str(struct drsmp *drsmp)
{
switch (drsmp->status) {
case 0:
return "success";
case ETIMEDOUT:
return "timeout";
}
return "unknown error";
}
const char* get_sm_method_str(uint8_t method )
{
if (method & 0x80) method = (method & 0x0F) | 0x10;
if( method >= SM_METHOD_STR_UNKNOWN_VAL )
method = SM_METHOD_STR_UNKNOWN_VAL;
return( sm_method_str[method] );
}
uint16_t smp_get_status(uint16_t status )
{
return( (uint16_t)(status & SMP_STATUS_MASK) );
}
uint8_t node_info_get_local_port_num(const struct node_info* const p_ni)
{
return( (uint8_t)(( p_ni->port_num_vendor_id & NODE_INFO_PORT_NUM_MASK )
>> NODE_INFO_PORT_NUM_SHIFT ));
}
const char* get_node_type_str(uint32_t node_type)
{
if( node_type >= IB_NOTICE_NODE_TYPE_ROUTER )
node_type = 0;
return( node_type_str[node_type] );
}
uint32_t node_info_get_vendor_id(const struct node_info* const p_ni )
{
return( (uint32_t)( p_ni->port_num_vendor_id &
NODE_INFO_VEND_ID_MASK ) );
}
const char* get_sm_attr_str(uint16_t attr )
{
uint16_t host_attr;
host_attr = ntohs( attr );
if( host_attr >= SM_ATTR_STR_UNKNOWN_VAL )
host_attr = SM_ATTR_STR_UNKNOWN_VAL;
return( sm_attr_str[host_attr] );
}
uint8_t port_info_get_link_speed_sup(const struct port_info* const p_pi )
{
return( (uint8_t)((p_pi->state_info1 & PORT_LINK_SPEED_SUPPORTED_MASK) >>
PORT_LINK_SPEED_SHIFT) );
}
const char* get_port_state_str(uint8_t port_state )
{
if( port_state > LINK_ACTIVE ) port_state = LINK_ACTIVE + 1;
return( port_state_str[port_state] );
}
uint8_t port_info_get_mpb(const struct port_info* const p_pi )
{
return( (uint8_t)((p_pi->mkey_lmc & PORT_MPB_MASK) >> PORT_MPB_SHIFT) );
}
uint8_t port_info_get_lmc(const struct port_info* const p_pi )
{
return( (uint8_t)(p_pi->mkey_lmc & PORT_LMC_MASK) );
}
uint8_t port_info_get_client_rereg(struct port_info const* p_pi )
{
return ( (p_pi->subnet_timeout & 0x80 ) >> 7);
}
uint8_t port_info_get_timeout(struct port_info const* p_pi )
{
return(p_pi->subnet_timeout & 0x1F );
}
uint8_t port_info_get_port_state(const struct port_info* const p_pi )
{
return( (uint8_t)(p_pi->state_info1 & PORT_STATE_MASK) );
}
void dump_dr_smp( const struct drsmp * const p_smp)
{
uint32_t i;
char buf[BUF_SIZE];
char line[BUF_SIZE];
sprintf( buf,
"SMP dump:\n"
"\t\t\t\tbase_ver................0x%X\n"
"\t\t\t\tmgmt_class..............0x%X\n"
"\t\t\t\tclass_ver...............0x%X\n"
"\t\t\t\tmethod..................0x%X (%s)\n",
p_smp->base_version,
p_smp->mgmt_class,
p_smp->class_version,
p_smp->method, get_sm_method_str(p_smp->method));
if (p_smp->mgmt_class == MCLASS_SUBN_DIR)
{
sprintf( line,
"\t\t\t\tD bit...................0x%X\n"
"\t\t\t\tstatus..................0x%X\n",
(p_smp->status & DIRECTION) == DIRECTION,
smp_get_status(p_smp->status) );
}
else
{
sprintf( line,"\t\t\t\tstatus..................0x%X\n",
ntohs(p_smp->status));
}
strcat( buf, line );
sprintf( line,
"\t\t\t\thop_ptr.................0x%X\n"
"\t\t\t\thop_count...............0x%X\n"
"\t\t\t\ttrans_id................0x%" PRIx64 "\n"
"\t\t\t\tattr_id.................0x%X (%s)\n"
"\t\t\t\tresv....................0x%X\n"
"\t\t\t\tattr_mod................0x%X\n"
"\t\t\t\tm_key...................0x%016" PRIx64 "\n",
p_smp->hop_ptr,
p_smp->hop_cnt,
own_ntoh64(p_smp->tid),
ntohs(p_smp->attr_id),
get_sm_attr_str(p_smp->attr_id),
ntohs(p_smp->resv),
ntohl(p_smp->attr_mod),
ntohl(p_smp->mkey)
);
strcat( buf, line );
if (p_smp->mgmt_class == MCLASS_SUBN_DIR)
{
sprintf( line,
"\t\t\t\tdr_slid.................0x%X\n"
"\t\t\t\tdr_dlid.................0x%X\n",
ntohs(p_smp->dr_slid),
ntohs(p_smp->dr_dlid)
);
strcat( buf, line );
strcat( buf, "\n\t\t\t\tInitial path: " );
for( i = 0; i <= p_smp->hop_cnt; i++ )
{
sprintf( line, "[%X]", p_smp->initial_path[i] );
strcat( buf, line );
}
strcat( buf, "\n\t\t\t\tReturn path: " );
for( i = 0; i <= p_smp->hop_cnt; i++ )
{
sprintf( line, "[%X]", p_smp->return_path[i] );
strcat( buf, line );
}
strcat( buf, "\n\t\t\t\tReserved: " );
for( i = 0; i < 7; i++ )
{
sprintf( line, "[%0X]", p_smp->reserved[i] );
strcat( buf, line );
}
strcat( buf, "\n" );
for( i = 0; i < 64; i += 16 )
{
sprintf( line, "\n\t\t\t\t%02X %02X %02X %02X "
"%02X %02X %02X %02X"
" %02X %02X %02X %02X %02X %02X %02X %02X\n",
p_smp->data[i],
p_smp->data[i+1],
p_smp->data[i+2],
p_smp->data[i+3],
p_smp->data[i+4],
p_smp->data[i+5],
p_smp->data[i+6],
p_smp->data[i+7],
p_smp->data[i+8],
p_smp->data[i+9],
p_smp->data[i+10],
p_smp->data[i+11],
p_smp->data[i+12],
p_smp->data[i+13],
p_smp->data[i+14],
p_smp->data[i+15] );
strcat( buf, line );
}
}
else
{
// not a Direct Route so provide source and destination lids
strcat(buf, "\t\t\t\tMAD IS LID ROUTED\n");
}
printf("%s",buf);
}
void dump_node_info(const struct node_info* const p_ni)
{
printf( "NodeInfo dump:\n"
"\t\t\t\tbase_version............0x%X\n"
"\t\t\t\tclass_version...........0x%X\n"
"\t\t\t\tnode_type...............%s\n"
"\t\t\t\tnum_ports...............0x%X\n"
"\t\t\t\tsys_guid................0x%016" PRIx64 "\n"
"\t\t\t\tnode_guid...............0x%016" PRIx64 "\n"
"\t\t\t\tport_guid...............0x%016" PRIx64 "\n"
"\t\t\t\tpartition_cap...........0x%X\n"
"\t\t\t\tdevice_id...............0x%X\n"
"\t\t\t\trevision................0x%X\n"
"\t\t\t\tport_num................0x%X\n"
"\t\t\t\tvendor_id...............0x%X\n"
"",
p_ni->base_version,
p_ni->class_version,
get_node_type_str( p_ni->node_type ),
p_ni->num_ports,
own_ntoh64_2(p_ni->sys_guid),
own_ntoh64_2( p_ni->node_guid ),
own_ntoh64_2( p_ni->port_guid ),
ntohs( p_ni->partition_cap ),
ntohs( p_ni->device_id ),
ntohl( p_ni->revision ),
node_info_get_local_port_num( p_ni ),
ntohl( node_info_get_vendor_id( p_ni ) )
);
}
void dump_port_info(const uint64_t node_guid, const uint64_t port_guid,
const uint8_t port_num, const struct port_info* const p_pi)
{
char buf[BUF_SIZE];
printf(
"PortInfo dump:\n"
"\t\t\t\tport number.............0x%X\n"
"\t\t\t\tnode_guid...............0x%016" PRIx64 "\n"
"\t\t\t\tport_guid...............0x%016" PRIx64 "\n"
"\t\t\t\tm_key...................0x%016" PRIx64 "\n"
"\t\t\t\tsubnet_prefix...........0x%016" PRIx64 "\n"
"\t\t\t\tbase_lid................0x%X\n"
"\t\t\t\tmaster_sm_base_lid......0x%X\n"
"\t\t\t\tcapability_mask.........0x%X\n"
"\t\t\t\tdiag_code...............0x%X\n"
"\t\t\t\tm_key_lease_period......0x%X\n"
"\t\t\t\tlocal_port_num..........0x%X\n"
"\t\t\t\tlink_width_enabled......0x%X\n"
"\t\t\t\tlink_width_supported....0x%X\n"
"\t\t\t\tlink_width_active.......0x%X\n"
"\t\t\t\tlink_speed_supported....0x%X\n"
"\t\t\t\tport_state..............%s\n"
"\t\t\t\tstate_info2.............0x%X\n"
"\t\t\t\tm_key_protect_bits......0x%X\n"
"\t\t\t\tlmc.....................0x%X\n"
"\t\t\t\tlink_speed..............0x%X\n"
"\t\t\t\tmtu_smsl................0x%X\n"
"\t\t\t\tvl_cap_init_type........0x%X\n"
"\t\t\t\tvl_high_limit...........0x%X\n"
"\t\t\t\tvl_arb_high_cap.........0x%X\n"
"\t\t\t\tvl_arb_low_cap..........0x%X\n"
"\t\t\t\tinit_rep_mtu_cap........0x%X\n"
"\t\t\t\tvl_stall_life...........0x%X\n"
"\t\t\t\tvl_enforce..............0x%X\n"
"\t\t\t\tm_key_violations........0x%X\n"
"\t\t\t\tp_key_violations........0x%X\n"
"\t\t\t\tq_key_violations........0x%X\n"
"\t\t\t\tguid_cap................0x%X\n"
"\t\t\t\tclient_reregister.......0x%X\n"
"\t\t\t\tsubnet_timeout..........0x%X\n"
"\t\t\t\tresp_time_value.........0x%X\n"
"\t\t\t\terror_threshold.........0x%X\n"
"",
port_num,
own_ntoh64( node_guid ),
own_ntoh64( port_guid ),
own_ntoh64( p_pi->m_key ),
own_ntoh64( p_pi->subnet_prefix ),
ntohs( p_pi->base_lid ),
ntohs( p_pi->master_sm_base_lid ),
ntohl( p_pi->capability_mask ),
ntohs( p_pi->diag_code ),
ntohs( p_pi->m_key_lease_period ),
p_pi->local_port_num,
p_pi->link_width_enabled,
p_pi->link_width_supported,
p_pi->link_width_active,
port_info_get_link_speed_sup( p_pi ),
get_port_state_str( port_info_get_port_state( p_pi ) ),
p_pi->state_info2,
port_info_get_mpb( p_pi ),
port_info_get_lmc( p_pi ),
p_pi->link_speed,
p_pi->mtu_smsl,
p_pi->vl_cap,
p_pi->vl_high_limit,
p_pi->vl_arb_high_cap,
p_pi->vl_arb_low_cap,
p_pi->mtu_cap,
p_pi->vl_stall_life,
p_pi->vl_enforce,
ntohs( p_pi->m_key_violations ),
ntohs( p_pi->p_key_violations ),
ntohs( p_pi->q_key_violations ),
p_pi->guid_cap,
port_info_get_client_rereg( p_pi ),
port_info_get_timeout( p_pi ),
p_pi->resp_time_value,
p_pi->error_threshold
);
}
More information about the general
mailing list