1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License, Version 1.0 only 6 * (the "License"). You may not use this file except in compliance 7 * with the License. 8 * 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * or http://www.opensolaris.org/os/licensing. 11 * See the License for the specific language governing permissions 12 * and limitations under the License. 13 * 14 * When distributing Covered Code, include this CDDL HEADER in each 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 * If applicable, add the following below this CDDL HEADER, with the 17 * fields enclosed by brackets "[]" replaced with your own identifying 18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 */ 22 /* 23 * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27 #ifndef _SYS_IB_IBTL_IBTL_CI_TYPES_H 28 #define _SYS_IB_IBTL_IBTL_CI_TYPES_H 29 30 #pragma ident "%Z%%M% %I% %E% SMI" 31 32 /* 33 * ibtl_ci_types.h 34 * Definitions shared between the IBTL and CI interface. 35 */ 36 37 #ifdef __cplusplus 38 extern "C" { 39 #endif 40 41 typedef struct ibc_cq_s *ibt_opaque1_t; 42 typedef struct ibc_srq_s *ibt_opaque2_t; 43 typedef struct ibc_rdd_s *ibt_rdd_hdl_t; /* ibt_alloc_eec() */ 44 45 46 /* 47 * Channel Modify flags - ibt_cep_modify_flags_t 48 * 49 * Note: 50 * That the IBT_CEP_SET_RESET_INIT, IBT_CEP_SET_INIT_RTR 51 * IBT_CEP_SET_RTR_RTS flags are mutually exclusive. However if one of the 52 * optional attributes associated with these flags is to be modified then 53 * the corresponding modify flag must also be specified. For example if 54 * a client wishes to transit from the INIT to RTR state but additionally 55 * they want to disable atomics, then the modify flags should be: 56 * 57 * (IBT_CEP_SET_INIT_RTR | IBT_CEP_SET_ATOMIC) 58 * 59 * And the following attributes specified: 60 * 61 * - Number of responder resources for RDMA read/atomic ops. 62 * - Primary Path Address Vector Information. 63 * - Destination QPN. 64 * - PSN for ReceiveQ. 65 * - Minimum RNR NAK Timer field value. 66 * - ibt_cep_flags_t set to IBT_CEP_ATOMIC 67 * 68 */ 69 #define IBT_CEP_SET_RESET_INIT IBT_CEP_SET_OPAQUE1 70 #define IBT_CEP_SET_INIT_RTR IBT_CEP_SET_OPAQUE2 71 #define IBT_CEP_SET_RTR_RTS IBT_CEP_SET_OPAQUE3 72 73 #define IBT_CEP_SET_STATE IBT_CEP_SET_OPAQUE4 74 #define IBT_CEP_SET_MTU IBT_CEP_SET_OPAQUE5 75 76 #define IBT_CEP_SET_TIMEOUT IBT_CEP_SET_OPAQUE6 77 #define IBT_CEP_SET_PKEY_IX IBT_CEP_SET_OPAQUE7 78 #define IBT_CEP_SET_MIG IBT_CEP_SET_OPAQUE8 79 80 /* 81 * ibt_async_code_t 82 */ 83 #define IBT_EVENT_PATH_MIGRATED_QP IBT_EVENT_PATH_MIGRATED 84 #define IBT_EVENT_COM_EST_QP IBT_EVENT_COM_EST 85 #define IBT_EVENT_COM_EST_EEC IBT_ASYNC_OPAQUE2 86 #define IBT_ERROR_CATASTROPHIC_QP IBT_ERROR_CATASTROPHIC_CHAN 87 #define IBT_ERROR_INVALID_REQUEST_QP IBT_ERROR_INVALID_REQUEST_CHAN 88 #define IBT_ERROR_ACCESS_VIOLATION_QP IBT_ERROR_ACCESS_VIOLATION_CHAN 89 #define IBT_ERROR_PATH_MIGRATE_REQ_QP IBT_ERROR_PATH_MIGRATE_REQ 90 #define IBT_EVENT_EMPTY_QP IBT_EVENT_EMPTY_CHAN 91 92 93 /* 94 * ibt_adds_vect_t 95 */ 96 #define av_send_grh av_opaque1 /* flag to specify if GRH is there */ 97 #define av_dlid av_opaque2 /* destination LID, or router LID */ 98 #define av_src_path av_opaque3 /* Source path bits */ 99 #define av_sgid_ix av_opaque4 100 101 /* 102 * ibt_wc_t 103 */ 104 #define wc_slid wc_opaque1 /* source LID */ 105 #define wc_pkey_ix wc_opaque2 /* The P_Key index, GSI only */ 106 #define wc_path_bits wc_opaque4 /* DLID path bits, UD's, RawIPv6 & */ 107 /* RawEthr only */ 108 109 /* 110 * ibt_mcg_attr_t 111 */ 112 #define mc_mlid mc_opaque1 /* Multicast LID */ 113 114 /* 115 * ibt_mcg_info_t 116 */ 117 #define mc_pkt_lt mc_opaque2 118 119 /* 120 * ibt_hca_flags_t 121 */ 122 #define IBT_HCA_RESIZE_QP IBT_HCA_RESIZE_CHAN 123 124 /* 125 * ibt_object_type_t 126 */ 127 #define IBT_HDL_QP IBT_HDL_CHANNEL 128 #define IBT_HDL_AH IBT_HDL_UD_DEST 129 130 /* 131 * ibt_hca_attr_t 132 */ 133 #define hca_max_ah hca_max_ud_dest /* Max address handles in HCA */ 134 #define hca_ah_max_ci_priv_sz hca_ud_dest_max_ci_priv_sz 135 #define hca_qp_max_ci_priv_sz hca_chan_max_ci_priv_sz 136 #define hca_max_qp hca_max_chans /* Max Channels supported by the HCA */ 137 #define hca_max_qp_sz hca_max_chan_sz /* Max outstanding WRs on any channel */ 138 #define hca_max_rdma_out_qp hca_max_rdma_out_chan 139 #define hca_max_rdma_in_qp hca_max_rdma_in_chan 140 #define hca_max_mcg_qps hca_max_mcg_chans 141 #define hca_max_qp_per_mcg hca_max_chan_per_mcg 142 143 /* 144 * ibt_hca_portinfo_t 145 */ 146 #define p_base_lid p_opaque1 /* Base LID of the port */ 147 148 149 /* Mapping of Verbs defined return status to channel specific. */ 150 #define IBT_QP_FULL IBT_CHAN_FULL 151 #define IBT_QP_HDL_INVALID IBT_CHAN_HDL_INVALID 152 #define IBT_QP_ATTR_RO IBT_CHAN_ATTR_RO 153 #define IBT_QP_STATE_INVALID IBT_CHAN_STATE_INVALID 154 #define IBT_QP_SRV_TYPE_INVALID IBT_CHAN_SRV_TYPE_INVALID 155 #define IBT_QP_IN_USE IBT_CHAN_IN_USE 156 #define IBT_QP_ATOMICS_NOT_SUPPORTED IBT_CHAN_ATOMICS_NOT_SUPPORTED 157 #define IBT_QP_OP_TYPE_INVALID IBT_CHAN_OP_TYPE_INVALID 158 #define IBT_QP_SGL_FORMAT_INVALID IBT_CHAN_SGL_FORMAT_INVALID 159 #define IBT_QP_SGL_LEN_INVALID IBT_CHAN_SGL_LEN_INVALID 160 #define IBT_QP_APM_STATE_INVALID IBT_CHAN_APM_STATE_INVALID 161 #define IBT_QP_SZ_INSUFFICIENT IBT_CHAN_SZ_INSUFFICIENT 162 #define IBT_QP_SPECIAL_TYPE_INVALID IBT_CHAN_SPECIAL_TYPE_INVALID 163 #define IBT_WC_LOCAL_QP_OP_ERR IBT_WC_LOCAL_CHAN_OP_ERR 164 #define IBT_AH_HDL_INVALID IBT_UD_DEST_HDL_INVALID 165 #define IBT_HCA_MCG_QP_EXCEEDED IBT_HCA_MCG_CHAN_EXCEEDED 166 #define IBT_MC_MLID_INVALID IBT_MC_OPAQUE 167 #define IBT_QP_SRQ IBT_CHAN_SRQ 168 #define IBT_QP_TYPE_2A_MW_BOUND IBT_CHAN_TYPE_2A_MW_BOUND 169 170 171 /* 172 * ibt_cep_path_t 173 */ 174 #define cep_timeout cep_cm_opaque1 /* 6 bits of timeout exponent */ 175 /* Local ACK timeout for RC */ 176 177 /* 178 * Define an ibt UD Destination struct. This holds all the information 179 * needed to reach a UD destination. 180 * 181 * The ibt_ud_dest_s struct is known by the CI and IBTL. This structure is 182 * referenced by the CI during UD work request processing. It is defined here 183 * here so that IBTL does not need to do any data copying during ibt_post_send. 184 */ 185 typedef struct ibt_ud_dest_s { 186 ibt_ah_hdl_t ud_ah; /* Address handle */ 187 ib_qpn_t ud_dst_qpn; /* Destination QPN */ 188 ib_qkey_t ud_qkey; /* Q_Key */ 189 190 /* The following fields are IBTL-only, i.e., opaque to the CI */ 191 struct ibtl_hca_s *ud_dest_opaque1; 192 } ibt_ud_dest_t; 193 194 /* 195 * Reserved For Future Use 196 * RD destination address info. 197 */ 198 typedef struct ibt_rd_dest_s { 199 ibt_ah_hdl_t rd_ah; /* Address handle */ 200 ib_eecn_t rd_eecn; /* Local EEC Number */ 201 ib_qpn_t rd_dst_qpn; /* Destination QP Number */ 202 ib_qkey_t rd_dst_qkey; /* The Q_Key for the destination QP */ 203 } ibt_rd_dest_t; 204 205 /* 206 * QP Type. 207 */ 208 typedef enum ibt_qp_type_e { 209 IBT_RC_RQP = 0, 210 IBT_RD_RQP = 1, /* Reserved For Future Use */ 211 IBT_UC_RQP = 2, /* Reserved For Future Use */ 212 IBT_UD_RQP = 3 213 } ibt_qp_type_t; 214 215 /* 216 * Special QP Type. 217 */ 218 typedef enum ibt_sqp_type_e { 219 IBT_SMI_SQP = 0, 220 IBT_GSI_SQP = 1, 221 IBT_RAWIP_SQP = 2, /* Reserved For Future Use */ 222 IBT_RAWETHER_SQP = 3 /* Reserved For Future Use */ 223 } ibt_sqp_type_t; 224 225 /* 226 * QP alloc flags. 227 */ 228 typedef enum ibt_qp_alloc_flags_e { 229 IBT_QP_NO_FLAGS = 0, 230 IBT_QP_USER_MAP = (1 << 0), 231 IBT_QP_DEFER_ALLOC = (1 << 1), 232 IBT_QP_USES_SRQ = (1 << 2) 233 } ibt_qp_alloc_flags_t; 234 235 /* 236 * QP Alloc Attributes definition. 237 * 238 * Contains the QP attributes that are required to create a QP. 239 */ 240 typedef struct ibt_qp_alloc_attr_s { 241 ibt_qp_alloc_flags_t qp_alloc_flags; 242 ibt_cq_hdl_t qp_scq_hdl; /* SQ CQ IBT Hdl */ 243 ibt_cq_hdl_t qp_rcq_hdl; /* RQ CQ IBT Hdl */ 244 ibt_rdd_hdl_t qp_rdd_hdl; /* Reserved */ 245 ibt_pd_hdl_t qp_pd_hdl; /* PD handle. */ 246 ibt_chan_sizes_t qp_sizes; /* Queue and SGL */ 247 ibt_attr_flags_t qp_flags; /* SQ Signaling Type etc */ 248 ibt_opaque1_t qp_opaque1; 249 ibt_opaque1_t qp_opaque2; 250 ibt_srq_hdl_t qp_srq_hdl; /* SRQ ibt hdl */ 251 ibt_opaque2_t qp_opaque3; 252 } ibt_qp_alloc_attr_t; 253 254 255 /* 256 * QP query info 257 */ 258 /* RC transport specific */ 259 typedef struct ibt_qp_rc_attr_s { 260 uint32_t rc_sq_psn:24; /* SQ PSN */ 261 uint32_t rc_rq_psn:24; /* RQ PSN */ 262 ib_qpn_t rc_dst_qpn; /* Destination QPN */ 263 ibt_cep_cmstate_t rc_mig_state; /* Channel Migration State */ 264 ibt_rnr_retry_cnt_t rc_rnr_retry_cnt; 265 uint8_t rc_retry_cnt:3; 266 uint8_t rc_rdma_ra_out; /* max RDMA-R/Atomic sent */ 267 /* Number of RDMA RD's & */ 268 /* Atomics outstanding */ 269 uint8_t rc_rdma_ra_in; /* Incoming RDMA-R/Atomic */ 270 /* Responder resources for */ 271 /* handling incoming RDMA */ 272 /* RD's & Atomics */ 273 ibt_rnr_nak_time_t rc_min_rnr_nak; /* min RNR-NAK timer */ 274 ib_mtu_t rc_path_mtu; 275 ibt_cep_path_t rc_path; /* primary path */ 276 ibt_cep_path_t rc_alt_path; /* alternate path */ 277 } ibt_qp_rc_attr_t; 278 279 /* 280 * Reserved For Future Use. 281 * UC transport specific 282 */ 283 typedef struct ibt_qp_uc_attr_s { 284 uint32_t uc_sq_psn:24; /* SQ PSN */ 285 uint32_t uc_rq_psn:24; /* RQ PSN */ 286 ib_qpn_t uc_dst_qpn; /* destination QPN */ 287 ibt_cep_cmstate_t uc_mig_state; /* Channel Migration State */ 288 ib_mtu_t uc_path_mtu; 289 ibt_cep_path_t uc_path; /* primary path */ 290 ibt_cep_path_t uc_alt_path; /* alternate path */ 291 } ibt_qp_uc_attr_t; 292 293 /* 294 * Reserved For Future Use. 295 * RD transport specific 296 */ 297 typedef struct ibt_qp_rd_attr_s { 298 ib_qkey_t rd_qkey; 299 ibt_rnr_nak_time_t rd_min_rnr_nak; /* min RNR-NAK timer */ 300 } ibt_qp_rd_attr_t; 301 302 303 /* UD transport specific */ 304 typedef struct ibt_qp_ud_attr_s { 305 ib_qkey_t ud_qkey; /* Q_Key */ 306 uint32_t ud_sq_psn:24; /* SQ PSN */ 307 uint16_t ud_pkey_ix; /* P_Key Index */ 308 uint8_t ud_port; /* port */ 309 } ibt_qp_ud_attr_t; 310 311 /* 312 * Common QP Info 313 */ 314 typedef struct ibt_qp_info_s { 315 uint_t qp_sq_sz; /* SQ WQEs */ 316 uint_t qp_rq_sz; /* RQ WQEs */ 317 ibt_cep_state_t qp_state; /* QP state */ 318 ibt_cep_state_t qp_current_state; /* current state for */ 319 /* modify_qp to RTS state */ 320 ibt_cep_flags_t qp_flags; /* QP flags */ 321 ibt_tran_srv_t qp_trans; /* transport service type */ 322 union { /* transport specific */ 323 ibt_qp_rc_attr_t rc; 324 ibt_qp_rd_attr_t rd; /* Reserved For Future Use */ 325 ibt_qp_uc_attr_t uc; /* Reserved For Future Use */ 326 ibt_qp_ud_attr_t ud; 327 } qp_transport; 328 } ibt_qp_info_t; 329 330 331 /* 332 * QP Query Attributes definition. 333 */ 334 typedef struct ibt_qp_query_attr_s { 335 ibt_cq_hdl_t qp_sq_cq; /* SQ CQ */ 336 ibt_cq_hdl_t qp_rq_cq; /* RQ CQ */ 337 ibt_rdd_hdl_t qp_rdd_hdl; /* Reserved */ 338 ib_qpn_t qp_qpn; /* QPN */ 339 uint_t qp_sq_sgl; /* max SQ SGL */ 340 uint_t qp_rq_sgl; /* max RQ SGL */ 341 ibt_qp_info_t qp_info; /* Modifiable attributes */ 342 ibt_srq_hdl_t qp_srq; /* SRQ hdl or NULL */ 343 ibt_attr_flags_t qp_flags; 344 } ibt_qp_query_attr_t; 345 346 347 /* 348 * Reserved For Future Use. 349 * EEC Info. 350 */ 351 typedef struct ibt_eec_info_s { 352 uint32_t eec_sq_psn:24; /* SQ PSN */ 353 uint32_t eec_rq_psn:24; /* RQ PSN */ 354 ib_eecn_t eec_dst_eecn; /* destination EECN */ 355 ibt_cep_state_t eec_state; /* EEC state */ 356 ibt_cep_cmstate_t eec_mig; /* channel migration state */ 357 uint8_t eec_rdma_ra_out; /* RDMA-R/Atomics out */ 358 uint8_t eec_rdma_ra_in; /* RDMA-R/Atomics in */ 359 uint8_t eec_retry_cnt:3; 360 ibt_rnr_retry_cnt_t eec_rnr_retry_cnt; 361 ib_mtu_t eec_path_mtu; 362 ibt_cep_path_t eec_prim_path; /* primary path */ 363 ibt_cep_path_t eec_alt_path; /* alternate path */ 364 } ibt_eec_info_t; 365 366 /* 367 * Reserved For Future Use. 368 * EEC Query Attributes definition. 369 */ 370 typedef struct ibt_eec_query_attr_s { 371 ib_eecn_t eec_eecn; /* The EEC Number */ 372 ibt_rdd_hdl_t eec_rdd_hdl; 373 ibt_eec_info_t eec_info; /* Modifiable attributes */ 374 } ibt_eec_query_attr_t; 375 376 377 #define ibt_ah_flags_t ibt_ud_dest_flags_t 378 #define IBT_AH_NO_FLAGS IBT_UD_DEST_NO_FLAGS 379 #define IBT_AH_USER_MAP IBT_UD_DEST_USER_MAP 380 #define IBT_AH_DEFER_ALLOC IBT_UD_DEST_DEFER_ALLOC 381 382 #ifdef __cplusplus 383 } 384 #endif 385 386 #endif /* _SYS_IB_IBTL_IBTL_CI_TYPES_H */ 387