00001 #ifndef _GPXE_IB_MAD_H 00002 #define _GPXE_IB_MAD_H 00003 00004 /** @file 00005 * 00006 * Infiniband management datagrams 00007 * 00008 */ 00009 00010 FILE_LICENCE ( GPL2_OR_LATER ); 00011 00012 #include <stdint.h> 00013 #include <gpxe/ib_packet.h> 00014 00015 /***************************************************************************** 00016 * 00017 * Subnet management MADs 00018 * 00019 ***************************************************************************** 00020 */ 00021 00022 /** A subnet management header 00023 * 00024 * Defined in sections 14.2.1.1 and 14.2.1.2 of the IBA. 00025 */ 00026 struct ib_smp_hdr { 00027 uint64_t mkey; 00028 uint16_t slid; 00029 uint16_t dlid; 00030 uint8_t reserved[28]; 00031 } __attribute__ (( packed )); 00032 00033 /** Subnet management class version */ 00034 #define IB_SMP_CLASS_VERSION 1 00035 00036 /** Subnet management direction bit 00037 * 00038 * This bit resides in the "status" field in the MAD header. 00039 */ 00040 #define IB_SMP_STATUS_D_INBOUND 0x8000 00041 00042 /* Subnet management attributes */ 00043 #define IB_SMP_ATTR_NOTICE 0x0002 00044 #define IB_SMP_ATTR_NODE_DESC 0x0010 00045 #define IB_SMP_ATTR_NODE_INFO 0x0011 00046 #define IB_SMP_ATTR_SWITCH_INFO 0x0012 00047 #define IB_SMP_ATTR_GUID_INFO 0x0014 00048 #define IB_SMP_ATTR_PORT_INFO 0x0015 00049 #define IB_SMP_ATTR_PKEY_TABLE 0x0016 00050 #define IB_SMP_ATTR_SL_TO_VL_TABLE 0x0017 00051 #define IB_SMP_ATTR_VL_ARB_TABLE 0x0018 00052 #define IB_SMP_ATTR_LINEAR_FORWARD_TABLE 0x0019 00053 #define IB_SMP_ATTR_RANDOM_FORWARD_TABLE 0x001A 00054 #define IB_SMP_ATTR_MCAST_FORWARD_TABLE 0x001B 00055 #define IB_SMP_ATTR_SM_INFO 0x0020 00056 #define IB_SMP_ATTR_VENDOR_DIAG 0x0030 00057 #define IB_SMP_ATTR_LED_INFO 0x0031 00058 #define IB_SMP_ATTR_VENDOR_MASK 0xFF00 00059 00060 /** 00061 * A Node Description attribute 00062 * 00063 * Defined in section 14.2.5.2 of the IBA 00064 */ 00065 struct ib_node_desc { 00066 char node_string[64]; 00067 } __attribute__ (( packed )); 00068 00069 /** A Node Information attribute 00070 * 00071 * Defined in section 14.2.5.3 of the IBA. 00072 */ 00073 struct ib_node_info { 00074 uint8_t base_version; 00075 uint8_t class_version; 00076 uint8_t node_type; 00077 uint8_t num_ports; 00078 struct ib_gid_half sys_guid; 00079 struct ib_gid_half node_guid; 00080 struct ib_gid_half port_guid; 00081 uint16_t partition_cap; 00082 uint16_t device_id; 00083 uint32_t revision; 00084 uint8_t local_port_num; 00085 uint8_t vendor_id[3]; 00086 } __attribute__ ((packed)); 00087 00088 #define IB_NODE_TYPE_HCA 0x01 00089 #define IB_NODE_TYPE_SWITCH 0x02 00090 #define IB_NODE_TYPE_ROUTER 0x03 00091 00092 /** A GUID Information attribute 00093 * 00094 * Defined in section 14.2.5.5 of the IBA. 00095 */ 00096 struct ib_guid_info { 00097 uint8_t guid[8][8]; 00098 } __attribute__ (( packed )); 00099 00100 /** A Port Information attribute 00101 * 00102 * Defined in section 14.2.5.6 of the IBA. 00103 */ 00104 struct ib_port_info { 00105 uint64_t mkey; 00106 uint8_t gid_prefix[8]; 00107 uint16_t lid; 00108 uint16_t mastersm_lid; 00109 uint32_t cap_mask; 00110 uint16_t diag_code; 00111 uint16_t mkey_lease_period; 00112 uint8_t local_port_num; 00113 uint8_t link_width_enabled; 00114 uint8_t link_width_supported; 00115 uint8_t link_width_active; 00116 uint8_t link_speed_supported__port_state; 00117 uint8_t port_phys_state__link_down_def_state; 00118 uint8_t mkey_prot_bits__lmc; 00119 uint8_t link_speed_active__link_speed_enabled; 00120 uint8_t neighbour_mtu__mastersm_sl; 00121 uint8_t vl_cap__init_type; 00122 uint8_t vl_high_limit; 00123 uint8_t vl_arbitration_high_cap; 00124 uint8_t vl_arbitration_low_cap; 00125 uint8_t init_type_reply__mtu_cap; 00126 uint8_t vl_stall_count__hoq_life; 00127 uint8_t operational_vls__enforcement; 00128 uint16_t mkey_violations; 00129 uint16_t pkey_violations; 00130 uint16_t qkey_violations; 00131 uint8_t guid_cap; 00132 uint8_t client_reregister__subnet_timeout; 00133 uint8_t resp_time_value; 00134 uint8_t local_phy_errors__overrun_errors; 00135 uint16_t max_credit_hint; 00136 uint32_t link_round_trip_latency; 00137 } __attribute__ (( packed )); 00138 00139 #define IB_LINK_WIDTH_1X 0x01 00140 #define IB_LINK_WIDTH_4X 0x02 00141 #define IB_LINK_WIDTH_8X 0x04 00142 #define IB_LINK_WIDTH_12X 0x08 00143 00144 #define IB_LINK_SPEED_SDR 0x01 00145 #define IB_LINK_SPEED_DDR 0x02 00146 #define IB_LINK_SPEED_QDR 0x04 00147 00148 #define IB_PORT_STATE_DOWN 0x01 00149 #define IB_PORT_STATE_INIT 0x02 00150 #define IB_PORT_STATE_ARMED 0x03 00151 #define IB_PORT_STATE_ACTIVE 0x04 00152 00153 #define IB_PORT_PHYS_STATE_SLEEP 0x01 00154 #define IB_PORT_PHYS_STATE_POLLING 0x02 00155 00156 #define IB_MTU_256 0x01 00157 #define IB_MTU_512 0x02 00158 #define IB_MTU_1024 0x03 00159 #define IB_MTU_2048 0x04 00160 #define IB_MTU_4096 0x05 00161 00162 #define IB_VL_0 0x01 00163 #define IB_VL_0_1 0x02 00164 #define IB_VL_0_3 0x03 00165 #define IB_VL_0_7 0x04 00166 #define IB_VL_0_14 0x05 00167 00168 /** A Partition Key Table attribute 00169 * 00170 * Defined in section 14.2.5.7 of the IBA. 00171 */ 00172 struct ib_pkey_table { 00173 uint16_t pkey[32]; 00174 } __attribute__ (( packed )); 00175 00176 /** A subnet management attribute */ 00177 union ib_smp_data { 00178 struct ib_node_desc node_desc; 00179 struct ib_node_info node_info; 00180 struct ib_guid_info guid_info; 00181 struct ib_port_info port_info; 00182 struct ib_pkey_table pkey_table; 00183 uint8_t bytes[64]; 00184 } __attribute__ (( packed )); 00185 00186 /** A subnet management directed route path */ 00187 struct ib_smp_dr_path { 00188 uint8_t hops[64]; 00189 } __attribute__ (( packed )); 00190 00191 /** Subnet management MAD class-specific data */ 00192 struct ib_smp_class_specific { 00193 uint8_t hop_pointer; 00194 uint8_t hop_count; 00195 } __attribute__ (( packed )); 00196 00197 /***************************************************************************** 00198 * 00199 * Subnet administration MADs 00200 * 00201 ***************************************************************************** 00202 */ 00203 00204 #define IB_SA_CLASS_VERSION 2 00205 00206 #define IB_SA_METHOD_DELETE_RESP 0x95 00207 00208 struct ib_rmpp_hdr { 00209 uint32_t raw[3]; 00210 } __attribute__ (( packed )); 00211 00212 struct ib_sa_hdr { 00213 uint32_t sm_key[2]; 00214 uint16_t reserved; 00215 uint16_t attrib_offset; 00216 uint32_t comp_mask[2]; 00217 } __attribute__ (( packed )); 00218 00219 #define IB_SA_ATTR_MC_MEMBER_REC 0x38 00220 #define IB_SA_ATTR_PATH_REC 0x35 00221 00222 struct ib_path_record { 00223 uint32_t reserved0[2]; 00224 struct ib_gid dgid; 00225 struct ib_gid sgid; 00226 uint16_t dlid; 00227 uint16_t slid; 00228 uint32_t hop_limit__flow_label__raw_traffic; 00229 uint32_t pkey__numb_path__reversible__tclass; 00230 uint8_t reserved1; 00231 uint8_t reserved__sl; 00232 uint8_t mtu_selector__mtu; 00233 uint8_t rate_selector__rate; 00234 uint32_t preference__packet_lifetime__packet_lifetime_selector; 00235 uint32_t reserved2[35]; 00236 } __attribute__ (( packed )); 00237 00238 #define IB_SA_PATH_REC_DGID (1<<2) 00239 #define IB_SA_PATH_REC_SGID (1<<3) 00240 00241 struct ib_mc_member_record { 00242 struct ib_gid mgid; 00243 struct ib_gid port_gid; 00244 uint32_t qkey; 00245 uint16_t mlid; 00246 uint8_t mtu_selector__mtu; 00247 uint8_t tclass; 00248 uint16_t pkey; 00249 uint8_t rate_selector__rate; 00250 uint8_t packet_lifetime_selector__packet_lifetime; 00251 uint32_t sl__flow_label__hop_limit; 00252 uint8_t scope__join_state; 00253 uint8_t proxy_join__reserved; 00254 uint16_t reserved0; 00255 uint32_t reserved1[37]; 00256 } __attribute__ (( packed )); 00257 00258 #define IB_SA_MCMEMBER_REC_MGID (1<<0) 00259 #define IB_SA_MCMEMBER_REC_PORT_GID (1<<1) 00260 #define IB_SA_MCMEMBER_REC_QKEY (1<<2) 00261 #define IB_SA_MCMEMBER_REC_MLID (1<<3) 00262 #define IB_SA_MCMEMBER_REC_MTU_SELECTOR (1<<4) 00263 #define IB_SA_MCMEMBER_REC_MTU (1<<5) 00264 #define IB_SA_MCMEMBER_REC_TRAFFIC_CLASS (1<<6) 00265 #define IB_SA_MCMEMBER_REC_PKEY (1<<7) 00266 #define IB_SA_MCMEMBER_REC_RATE_SELECTOR (1<<8) 00267 #define IB_SA_MCMEMBER_REC_RATE (1<<9) 00268 #define IB_SA_MCMEMBER_REC_PACKET_LIFE_TIME_SELECTOR (1<<10) 00269 #define IB_SA_MCMEMBER_REC_PACKET_LIFE_TIME (1<<11) 00270 #define IB_SA_MCMEMBER_REC_SL (1<<12) 00271 #define IB_SA_MCMEMBER_REC_FLOW_LABEL (1<<13) 00272 #define IB_SA_MCMEMBER_REC_HOP_LIMIT (1<<14) 00273 #define IB_SA_MCMEMBER_REC_SCOPE (1<<15) 00274 #define IB_SA_MCMEMBER_REC_JOIN_STATE (1<<16) 00275 #define IB_SA_MCMEMBER_REC_PROXY_JOIN (1<<17) 00276 00277 union ib_sa_data { 00278 struct ib_path_record path_record; 00279 struct ib_mc_member_record mc_member_record; 00280 } __attribute__ (( packed )); 00281 00282 /***************************************************************************** 00283 * 00284 * Communication management MADs 00285 * 00286 ***************************************************************************** 00287 */ 00288 00289 /** Communication management class version */ 00290 #define IB_CM_CLASS_VERSION 2 00291 00292 /* Communication management attributes */ 00293 #define IB_CM_ATTR_CLASS_PORT_INFO 0x0001 00294 #define IB_CM_ATTR_CONNECT_REQUEST 0x0010 00295 #define IB_CM_ATTR_MSG_RCPT_ACK 0x0011 00296 #define IB_CM_ATTR_CONNECT_REJECT 0x0012 00297 #define IB_CM_ATTR_CONNECT_REPLY 0x0013 00298 #define IB_CM_ATTR_READY_TO_USE 0x0014 00299 #define IB_CM_ATTR_DISCONNECT_REQUEST 0x0015 00300 #define IB_CM_ATTR_DISCONNECT_REPLY 0x0016 00301 #define IB_CM_ATTR_SERVICE_ID_RES_REQ 0x0016 00302 #define IB_CM_ATTR_SERVICE_ID_RES_REQ_RESP 0x0018 00303 #define IB_CM_ATTR_LOAD_ALTERNATE_PATH 0x0019 00304 #define IB_CM_ATTR_ALTERNATE_PATH_RESPONSE 0x001a 00305 00306 /** Communication management common fields */ 00307 struct ib_cm_common { 00308 /** Local communication ID */ 00309 uint32_t local_id; 00310 /** Remote communication ID */ 00311 uint32_t remote_id; 00312 /** Reserved */ 00313 uint8_t reserved[224]; 00314 } __attribute__ (( packed )); 00315 00316 /** A communication management path */ 00317 struct ib_cm_path { 00318 /** Local port LID */ 00319 uint16_t local_lid; 00320 /** Remote port LID */ 00321 uint16_t remote_lid; 00322 /** Local port GID */ 00323 struct ib_gid local_gid; 00324 /** Remote port GID */ 00325 struct ib_gid remote_gid; 00326 /** Flow label and rate */ 00327 uint32_t flow_label__rate; 00328 /** Traffic class */ 00329 uint8_t tc; 00330 /** Hop limit */ 00331 uint8_t hop_limit; 00332 /** SL and subnet local*/ 00333 uint8_t sl__subnet_local; 00334 /** Local ACK timeout */ 00335 uint8_t local_ack_timeout; 00336 } __attribute__ (( packed )); 00337 00338 /** A communication management connection request 00339 * 00340 * Defined in section 12.6.5 of the IBA. 00341 */ 00342 struct ib_cm_connect_request { 00343 /** Local communication ID */ 00344 uint32_t local_id; 00345 /** Reserved */ 00346 uint32_t reserved0[1]; 00347 /** Service ID */ 00348 struct ib_gid_half service_id; 00349 /** Local CA GUID */ 00350 struct ib_gid_half local_ca; 00351 /** Reserved */ 00352 uint32_t reserved1[1]; 00353 /** Local queue key */ 00354 uint32_t local_qkey; 00355 /** Local QPN and responder resources*/ 00356 uint32_t local_qpn__responder_resources; 00357 /** Local EECN and initiator depth */ 00358 uint32_t local_eecn__initiator_depth; 00359 /** Remote EECN, remote CM response timeout, transport service 00360 * type, EE flow control 00361 */ 00362 uint32_t remote_eecn__remote_timeout__service_type__ee_flow_ctrl; 00363 /** Starting PSN, local CM response timeout and retry count */ 00364 uint32_t starting_psn__local_timeout__retry_count; 00365 /** Partition key */ 00366 uint16_t pkey; 00367 /** Path packet payload MTU, RDC exists, RNR retry count */ 00368 uint8_t payload_mtu__rdc_exists__rnr_retry; 00369 /** Max CM retries and SRQ */ 00370 uint8_t max_cm_retries__srq; 00371 /** Primary path */ 00372 struct ib_cm_path primary; 00373 /** Alternate path */ 00374 struct ib_cm_path alternate; 00375 /** Private data */ 00376 uint8_t private_data[92]; 00377 } __attribute__ (( packed )); 00378 00379 /** CM transport types */ 00380 #define IB_CM_TRANSPORT_RC 0 00381 #define IB_CM_TRANSPORT_UC 1 00382 #define IB_CM_TRANSPORT_RD 2 00383 00384 /** A communication management connection rejection 00385 * 00386 * Defined in section 12.6.7 of the IBA. 00387 */ 00388 struct ib_cm_connect_reject { 00389 /** Local communication ID */ 00390 uint32_t local_id; 00391 /** Remote communication ID */ 00392 uint32_t remote_id; 00393 /** Message rejected */ 00394 uint8_t message; 00395 /** Reject information length */ 00396 uint8_t info_len; 00397 /** Rejection reason */ 00398 uint16_t reason; 00399 /** Additional rejection information */ 00400 uint8_t info[72]; 00401 /** Private data */ 00402 uint8_t private_data[148]; 00403 } __attribute__ (( packed )); 00404 00405 /** CM rejection reasons */ 00406 #define IB_CM_REJECT_BAD_SERVICE_ID 8 00407 #define IB_CM_REJECT_STALE_CONN 10 00408 #define IB_CM_REJECT_CONSUMER 28 00409 00410 /** A communication management connection reply 00411 * 00412 * Defined in section 12.6.8 of the IBA. 00413 */ 00414 struct ib_cm_connect_reply { 00415 /** Local communication ID */ 00416 uint32_t local_id; 00417 /** Remote communication ID */ 00418 uint32_t remote_id; 00419 /** Local queue key */ 00420 uint32_t local_qkey; 00421 /** Local QPN */ 00422 uint32_t local_qpn; 00423 /** Local EECN */ 00424 uint32_t local_eecn; 00425 /** Starting PSN */ 00426 uint32_t starting_psn; 00427 /** Responder resources */ 00428 uint8_t responder_resources; 00429 /** Initiator depth */ 00430 uint8_t initiator_depth; 00431 /** Target ACK delay, failover accepted, and end-to-end flow control */ 00432 uint8_t target_ack_delay__failover_accepted__ee_flow_ctrl; 00433 /** RNR retry count, SRQ */ 00434 uint8_t rnr_retry__srq; 00435 /** Local CA GUID */ 00436 struct ib_gid_half local_ca; 00437 /** Private data */ 00438 uint8_t private_data[196]; 00439 } __attribute__ (( packed )); 00440 00441 /** A communication management ready to use reply 00442 * 00443 * Defined in section 12.6.9 of the IBA. 00444 */ 00445 struct ib_cm_ready_to_use { 00446 /** Local communication ID */ 00447 uint32_t local_id; 00448 /** Remote communication ID */ 00449 uint32_t remote_id; 00450 /** Private data */ 00451 uint8_t private_data[224]; 00452 } __attribute__ (( packed )); 00453 00454 /** A communication management attribute */ 00455 union ib_cm_data { 00456 struct ib_cm_common common; 00457 struct ib_cm_connect_request connect_request; 00458 struct ib_cm_connect_reject connect_reject; 00459 struct ib_cm_connect_reply connect_reply; 00460 struct ib_cm_ready_to_use ready_to_use; 00461 uint8_t bytes[232]; 00462 } __attribute__ (( packed )); 00463 00464 /***************************************************************************** 00465 * 00466 * MADs 00467 * 00468 ***************************************************************************** 00469 */ 00470 00471 /** Management datagram class_specific data */ 00472 union ib_mad_class_specific { 00473 uint16_t raw; 00474 struct ib_smp_class_specific smp; 00475 } __attribute__ (( packed )); 00476 00477 /** A management datagram common header 00478 * 00479 * Defined in section 13.4.2 of the IBA. 00480 */ 00481 struct ib_mad_hdr { 00482 uint8_t base_version; 00483 uint8_t mgmt_class; 00484 uint8_t class_version; 00485 uint8_t method; 00486 uint16_t status; 00487 union ib_mad_class_specific class_specific; 00488 uint32_t tid[2]; 00489 uint16_t attr_id; 00490 uint8_t reserved[2]; 00491 uint32_t attr_mod; 00492 } __attribute__ (( packed )); 00493 00494 /* Management base version */ 00495 #define IB_MGMT_BASE_VERSION 1 00496 00497 /* Management classes */ 00498 #define IB_MGMT_CLASS_SUBN_LID_ROUTED 0x01 00499 #define IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE 0x81 00500 #define IB_MGMT_CLASS_SUBN_ADM 0x03 00501 #define IB_MGMT_CLASS_PERF_MGMT 0x04 00502 #define IB_MGMT_CLASS_BM 0x05 00503 #define IB_MGMT_CLASS_DEVICE_MGMT 0x06 00504 #define IB_MGMT_CLASS_CM 0x07 00505 #define IB_MGMT_CLASS_SNMP 0x08 00506 #define IB_MGMT_CLASS_VENDOR_RANGE2_START 0x30 00507 #define IB_MGMT_CLASS_VENDOR_RANGE2_END 0x4f 00508 00509 #define IB_MGMT_CLASS_MASK 0x7f 00510 00511 /* Management methods */ 00512 #define IB_MGMT_METHOD_GET 0x01 00513 #define IB_MGMT_METHOD_SET 0x02 00514 #define IB_MGMT_METHOD_GET_RESP 0x81 00515 #define IB_MGMT_METHOD_SEND 0x03 00516 #define IB_MGMT_METHOD_TRAP 0x05 00517 #define IB_MGMT_METHOD_REPORT 0x06 00518 #define IB_MGMT_METHOD_REPORT_RESP 0x86 00519 #define IB_MGMT_METHOD_TRAP_REPRESS 0x07 00520 #define IB_MGMT_METHOD_DELETE 0x15 00521 00522 /* Status codes */ 00523 #define IB_MGMT_STATUS_OK 0x0000 00524 #define IB_MGMT_STATUS_BAD_VERSION 0x0001 00525 #define IB_MGMT_STATUS_UNSUPPORTED_METHOD 0x0002 00526 #define IB_MGMT_STATUS_UNSUPPORTED_METHOD_ATTR 0x0003 00527 #define IB_MGMT_STATUS_INVALID_VALUE 0x0004 00528 00529 /** A subnet management MAD */ 00530 struct ib_mad_smp { 00531 struct ib_mad_hdr mad_hdr; 00532 struct ib_smp_hdr smp_hdr; 00533 union ib_smp_data smp_data; 00534 struct ib_smp_dr_path initial_path; 00535 struct ib_smp_dr_path return_path; 00536 } __attribute__ (( packed )); 00537 00538 /** A subnet administration MAD */ 00539 struct ib_mad_sa { 00540 struct ib_mad_hdr mad_hdr; 00541 struct ib_rmpp_hdr rmpp_hdr; 00542 struct ib_sa_hdr sa_hdr; 00543 union ib_sa_data sa_data; 00544 } __attribute__ (( packed )); 00545 00546 /** A communication management MAD */ 00547 struct ib_mad_cm { 00548 struct ib_mad_hdr mad_hdr; 00549 union ib_cm_data cm_data; 00550 } __attribute__ (( packed )); 00551 00552 /** A management datagram */ 00553 union ib_mad { 00554 struct ib_mad_hdr hdr; 00555 struct ib_mad_smp smp; 00556 struct ib_mad_sa sa; 00557 struct ib_mad_cm cm; 00558 uint8_t bytes[256]; 00559 } __attribute__ (( packed )); 00560 00561 #endif /* _GPXE_IB_MAD_H */
1.5.7.1