0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef IB_SMI_H
0011 #define IB_SMI_H
0012
0013 #include <rdma/ib_mad.h>
0014
0015 #define IB_SMP_DATA_SIZE 64
0016 #define IB_SMP_MAX_PATH_HOPS 64
0017
0018 struct ib_smp {
0019 u8 base_version;
0020 u8 mgmt_class;
0021 u8 class_version;
0022 u8 method;
0023 __be16 status;
0024 u8 hop_ptr;
0025 u8 hop_cnt;
0026 __be64 tid;
0027 __be16 attr_id;
0028 __be16 resv;
0029 __be32 attr_mod;
0030 __be64 mkey;
0031 __be16 dr_slid;
0032 __be16 dr_dlid;
0033 u8 reserved[28];
0034 u8 data[IB_SMP_DATA_SIZE];
0035 u8 initial_path[IB_SMP_MAX_PATH_HOPS];
0036 u8 return_path[IB_SMP_MAX_PATH_HOPS];
0037 } __packed;
0038
0039 #define IB_SMP_DIRECTION cpu_to_be16(0x8000)
0040
0041
0042 #define IB_SMP_ATTR_NOTICE cpu_to_be16(0x0002)
0043 #define IB_SMP_ATTR_NODE_DESC cpu_to_be16(0x0010)
0044 #define IB_SMP_ATTR_NODE_INFO cpu_to_be16(0x0011)
0045 #define IB_SMP_ATTR_SWITCH_INFO cpu_to_be16(0x0012)
0046 #define IB_SMP_ATTR_GUID_INFO cpu_to_be16(0x0014)
0047 #define IB_SMP_ATTR_PORT_INFO cpu_to_be16(0x0015)
0048 #define IB_SMP_ATTR_PKEY_TABLE cpu_to_be16(0x0016)
0049 #define IB_SMP_ATTR_SL_TO_VL_TABLE cpu_to_be16(0x0017)
0050 #define IB_SMP_ATTR_VL_ARB_TABLE cpu_to_be16(0x0018)
0051 #define IB_SMP_ATTR_LINEAR_FORWARD_TABLE cpu_to_be16(0x0019)
0052 #define IB_SMP_ATTR_RANDOM_FORWARD_TABLE cpu_to_be16(0x001A)
0053 #define IB_SMP_ATTR_MCAST_FORWARD_TABLE cpu_to_be16(0x001B)
0054 #define IB_SMP_ATTR_SM_INFO cpu_to_be16(0x0020)
0055 #define IB_SMP_ATTR_VENDOR_DIAG cpu_to_be16(0x0030)
0056 #define IB_SMP_ATTR_LED_INFO cpu_to_be16(0x0031)
0057 #define IB_SMP_ATTR_VENDOR_MASK cpu_to_be16(0xFF00)
0058
0059 struct ib_port_info {
0060 __be64 mkey;
0061 __be64 gid_prefix;
0062 __be16 lid;
0063 __be16 sm_lid;
0064 __be32 cap_mask;
0065 __be16 diag_code;
0066 __be16 mkey_lease_period;
0067 u8 local_port_num;
0068 u8 link_width_enabled;
0069 u8 link_width_supported;
0070 u8 link_width_active;
0071 u8 linkspeed_portstate;
0072 u8 portphysstate_linkdown;
0073 u8 mkeyprot_resv_lmc;
0074 u8 linkspeedactive_enabled;
0075 u8 neighbormtu_mastersmsl;
0076 u8 vlcap_inittype;
0077 u8 vl_high_limit;
0078 u8 vl_arb_high_cap;
0079 u8 vl_arb_low_cap;
0080 u8 inittypereply_mtucap;
0081 u8 vlstallcnt_hoqlife;
0082 u8 operationalvl_pei_peo_fpi_fpo;
0083 __be16 mkey_violations;
0084 __be16 pkey_violations;
0085 __be16 qkey_violations;
0086 u8 guid_cap;
0087 u8 clientrereg_resv_subnetto;
0088 u8 resv_resptimevalue;
0089 u8 localphyerrors_overrunerrors;
0090 __be16 max_credit_hint;
0091 u8 resv;
0092 u8 link_roundtrip_latency[3];
0093 };
0094
0095 struct ib_node_info {
0096 u8 base_version;
0097 u8 class_version;
0098 u8 node_type;
0099 u8 num_ports;
0100 __be64 sys_guid;
0101 __be64 node_guid;
0102 __be64 port_guid;
0103 __be16 partition_cap;
0104 __be16 device_id;
0105 __be32 revision;
0106 u8 local_port_num;
0107 u8 vendor_id[3];
0108 } __packed;
0109
0110 struct ib_vl_weight_elem {
0111 u8 vl;
0112
0113 u8 weight;
0114 };
0115
0116 static inline u8
0117 ib_get_smp_direction(struct ib_smp *smp)
0118 {
0119 return ((smp->status & IB_SMP_DIRECTION) == IB_SMP_DIRECTION);
0120 }
0121
0122
0123
0124
0125 #define IB_NOTICE_TRAP_LLI_THRESH cpu_to_be16(129)
0126 #define IB_NOTICE_TRAP_EBO_THRESH cpu_to_be16(130)
0127 #define IB_NOTICE_TRAP_FLOW_UPDATE cpu_to_be16(131)
0128 #define IB_NOTICE_TRAP_CAP_MASK_CHG cpu_to_be16(144)
0129 #define IB_NOTICE_TRAP_SYS_GUID_CHG cpu_to_be16(145)
0130 #define IB_NOTICE_TRAP_BAD_MKEY cpu_to_be16(256)
0131 #define IB_NOTICE_TRAP_BAD_PKEY cpu_to_be16(257)
0132 #define IB_NOTICE_TRAP_BAD_QKEY cpu_to_be16(258)
0133
0134
0135
0136
0137 #define IB_NOTICE_TRAP_LSE_CHG 0x04
0138 #define IB_NOTICE_TRAP_LWE_CHG 0x02
0139 #define IB_NOTICE_TRAP_NODE_DESC_CHG 0x01
0140
0141
0142
0143
0144 #define IB_NOTICE_TRAP_DR_NOTICE 0x80
0145 #define IB_NOTICE_TRAP_DR_TRUNC 0x40
0146
0147
0148
0149
0150
0151 static inline void ib_init_query_mad(struct ib_smp *mad)
0152 {
0153 mad->base_version = IB_MGMT_BASE_VERSION;
0154 mad->mgmt_class = IB_MGMT_CLASS_SUBN_LID_ROUTED;
0155 mad->class_version = 1;
0156 mad->method = IB_MGMT_METHOD_GET;
0157 }
0158 #endif