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 (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 * or http://www.opensolaris.org/os/licensing. 10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21 /* 22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 23 * Use is subject to license terms. 24 */ 25 26 #ifndef _SYS_IB_IBTL_IBTL_TYPES_H 27 #define _SYS_IB_IBTL_IBTL_TYPES_H 28 29 /* 30 * ibtl_types.h 31 * 32 * All common IBTL defined types. These are common data types 33 * that are shared by the IBTI and IBCI interfaces, it is only included 34 * by ibti.h and ibci.h 35 */ 36 #include <sys/ddi.h> 37 #include <sys/sunddi.h> 38 #include <sys/ib/ib_types.h> 39 #include <sys/ib/ibtl/ibtl_status.h> 40 #include <sys/socket.h> 41 #include <sys/byteorder.h> 42 43 44 #ifdef __cplusplus 45 extern "C" { 46 #endif 47 48 /* 49 * Endian Macros 50 * h2b - host endian to big endian protocol 51 * b2h - big endian protocol to host endian 52 * h2l - host endian to little endian protocol 53 * l2h - little endian protocol to host endian 54 */ 55 #if defined(_LITTLE_ENDIAN) 56 #define h2b16(x) (htons(x)) 57 #define h2b32(x) (htonl(x)) 58 #define h2b64(x) (htonll(x)) 59 #define b2h16(x) (ntohs(x)) 60 #define b2h32(x) (ntohl(x)) 61 #define b2h64(x) (htonll(x)) 62 63 #define h2l16(x) (x) 64 #define h2l32(x) (x) 65 #define h2l64(x) (x) 66 #define l2h16(x) (x) 67 #define l2h32(x) (x) 68 #define l2h64(x) (x) 69 70 #elif defined(_BIG_ENDIAN) 71 #define h2b16(x) (x) 72 #define h2b32(x) (x) 73 #define h2b64(x) (x) 74 #define b2h16(x) (x) 75 #define b2h32(x) (x) 76 #define b2h64(x) (x) 77 78 #define h2l16(x) (ddi_swap16(x)) 79 #define h2l32(x) (ddi_swap32(x)) 80 #define h2l64(x) (ddi_swap64(x)) 81 #define l2h16(x) (ddi_swap16(x)) 82 #define l2h32(x) (ddi_swap32(x)) 83 #define l2h64(x) (ddi_swap64(x)) 84 85 #else 86 #error "what endian is this machine?" 87 #endif 88 89 /* 90 * Define Internal IBTL handles 91 */ 92 typedef struct ibtl_clnt_s *ibt_clnt_hdl_t; /* ibt_attach() */ 93 typedef struct ibtl_hca_s *ibt_hca_hdl_t; /* ibt_open_hca() */ 94 typedef struct ibtl_channel_s *ibt_channel_hdl_t; /* alloc_rc|ud_channel() */ 95 typedef struct ibtl_srq_s *ibt_srq_hdl_t; /* ibt_alloc_srq() */ 96 typedef struct ibtl_cq_s *ibt_cq_hdl_t; /* ibt_alloc_cq() */ 97 typedef struct ibcm_svc_info_s *ibt_srv_hdl_t; /* ibt_register_service() */ 98 typedef struct ibcm_svc_bind_s *ibt_sbind_hdl_t; /* ibt_bind_service() */ 99 100 typedef struct ibc_fmr_pool_s *ibt_fmr_pool_hdl_t; /* ibt_create_fmr_pool() */ 101 typedef struct ibc_ma_s *ibt_ma_hdl_t; /* ibt_map_mem_area() */ 102 typedef struct ibc_pd_s *ibt_pd_hdl_t; /* ibt_alloc_pd() */ 103 typedef struct ibc_sched_s *ibt_sched_hdl_t; /* ibt_alloc_cq_sched() */ 104 typedef struct ibc_mr_s *ibt_mr_hdl_t; /* ibt_register_mr() */ 105 typedef struct ibc_mw_s *ibt_mw_hdl_t; /* ibt_alloc_mw() */ 106 typedef struct ibt_ud_dest_s *ibt_ud_dest_hdl_t; /* UD dest handle */ 107 typedef struct ibc_ah_s *ibt_ah_hdl_t; /* ibt_alloc_ah() */ 108 typedef struct ibtl_eec_s *ibt_eec_hdl_t; 109 typedef struct ibt_rd_dest_s *ibt_rd_dest_hdl_t; /* Reserved for */ 110 /* Future use */ 111 typedef struct ibc_mem_alloc_s *ibt_mem_alloc_hdl_t; /* ibt_alloc_io_mem() */ 112 typedef struct ibc_mi_s *ibt_mi_hdl_t; /* ibt_map_mem_iov() */ 113 114 /* 115 * Some General Types. 116 */ 117 typedef uint32_t ibt_lkey_t; /* L_Key */ 118 typedef uint32_t ibt_rkey_t; /* R_Key */ 119 typedef uint64_t ibt_wrid_t; /* Client assigned WR ID */ 120 typedef uint32_t ibt_immed_t; /* WR Immediate Data */ 121 typedef uint64_t ibt_atom_arg_t; /* WR Atomic Operation arg */ 122 typedef uint_t ibt_cq_handler_id_t; /* Event handler ID */ 123 124 /* 125 * IBT selector type, used when looking up/requesting either an 126 * MTU, Pkt lifetime, or Static rate. 127 * The interpretation of IBT_BEST depends on the attribute being selected. 128 */ 129 typedef enum ibt_selector_e { 130 IBT_GT = 0, /* Greater than */ 131 IBT_LT = 1, /* Less than */ 132 IBT_EQU = 2, /* Equal to */ 133 IBT_BEST = 3 /* Best */ 134 } ibt_selector_t; 135 136 137 /* 138 * Static rate definitions. 139 */ 140 typedef enum ibt_srate_e { 141 IBT_SRATE_NOT_SPECIFIED = 0, 142 IBT_SRATE_2 = 2, /* 1X SDR i.e 2.5 Gbps */ 143 IBT_SRATE_10 = 3, /* 4X SDR or 1X QDR i.e 10 Gbps */ 144 IBT_SRATE_30 = 4, /* 12X SDR i.e 30 Gbps */ 145 146 IBT_SRATE_5 = 5, /* 1X DDR i.e 5 Gbps */ 147 IBT_SRATE_20 = 6, /* 4X DDR or 8X SDR i.e 20 Gbps */ 148 IBT_SRATE_40 = 7, /* 8X DDR or 4X QDR i.e 40 Gbps */ 149 150 IBT_SRATE_60 = 8, /* 12X DDR i.e 60 Gbps */ 151 IBT_SRATE_80 = 9, /* 8X QDR i.e 80 Gbps */ 152 IBT_SRATE_120 = 10 /* 12X QDR i.e 120 Gbps */ 153 } ibt_srate_t; 154 155 /* retain old definition to be compatible with older bits. */ 156 #define IBT_SRATE_1X IBT_SRATE_2 157 #define IBT_SRATE_4X IBT_SRATE_10 158 #define IBT_SRATE_12X IBT_SRATE_30 159 160 /* 161 * Static rate request type. 162 */ 163 typedef struct ibt_srate_req_s { 164 ibt_srate_t r_srate; /* Requested srate */ 165 ibt_selector_t r_selector; /* Qualifier for r_srate */ 166 } ibt_srate_req_t; 167 168 /* 169 * Packet Life Time Request Type. 170 */ 171 typedef struct ibt_pkt_lt_req_s { 172 clock_t p_pkt_lt; /* Requested Packet Life Time */ 173 ibt_selector_t p_selector; /* Qualifier for p_pkt_lt */ 174 } ibt_pkt_lt_req_t; 175 176 /* 177 * Queue size struct. 178 */ 179 typedef struct ibt_queue_sizes_s { 180 uint_t qs_sq; /* SendQ size. */ 181 uint_t qs_rq; /* RecvQ size. */ 182 } ibt_queue_sizes_t; 183 184 /* 185 * Channel sizes struct, used by functions that allocate/query RC or UD 186 * channels. 187 */ 188 typedef struct ibt_chan_sizes_s { 189 uint_t cs_sq; /* SendQ size. */ 190 uint_t cs_rq; /* ReceiveQ size. */ 191 uint_t cs_sq_sgl; /* Max SGL elements in a SQ WR. */ 192 uint_t cs_rq_sgl; /* Max SGL elements in a RQ Wr. */ 193 uint_t cs_inline; /* max inline payload size */ 194 } ibt_chan_sizes_t; 195 196 /* 197 * Shared Queue size struct. 198 */ 199 typedef struct ibt_srq_sizes_s { 200 uint_t srq_wr_sz; 201 uint_t srq_sgl_sz; 202 } ibt_srq_sizes_t; 203 204 /* 205 * SRQ Modify Flags 206 */ 207 typedef enum ibt_srq_modify_flags_e { 208 IBT_SRQ_SET_NOTHING = 0, 209 IBT_SRQ_SET_SIZE = (1 << 1), 210 IBT_SRQ_SET_LIMIT = (1 << 2) 211 } ibt_srq_modify_flags_t; 212 213 214 /* 215 * Execution flags, indicates if the function should block or not. 216 * Note: in some cases, e.g., a NULL rc_cm_handler, IBT_NONBLOCKING 217 * will not have an effect, and the thread will block. 218 * IBT_NOCALLBACKS is valid for ibt_close_rc_channel only. 219 */ 220 typedef enum ibt_execution_mode_e { 221 IBT_BLOCKING = 0, /* Block */ 222 IBT_NONBLOCKING = 1, /* Return as soon as possible */ 223 IBT_NOCALLBACKS = 2 /* cm_handler is not invoked after */ 224 /* ibt_close_rc_channel returns */ 225 } ibt_execution_mode_t; 226 227 /* 228 * Memory window alloc flags 229 */ 230 typedef enum ibt_mw_flags_e { 231 IBT_MW_SLEEP = 0, /* Can block */ 232 IBT_MW_NOSLEEP = (1 << 0), /* Can't block */ 233 IBT_MW_USER_MAP = (1 << 1), 234 IBT_MW_DEFER_ALLOC = (1 << 2), 235 IBT_MW_TYPE_1 = (1 << 3), 236 IBT_MW_TYPE_2 = (1 << 4) 237 } ibt_mw_flags_t; 238 239 /* 240 * PD alloc flags 241 */ 242 typedef enum ibt_pd_flags_e { 243 IBT_PD_NO_FLAGS = 0, 244 IBT_PD_USER_MAP = (1 << 0), 245 IBT_PD_DEFER_ALLOC = (1 << 1) 246 } ibt_pd_flags_t; 247 248 /* 249 * UD Dest alloc flags 250 */ 251 typedef enum ibt_ud_dest_flags_e { 252 IBT_UD_DEST_NO_FLAGS = 0, 253 IBT_UD_DEST_USER_MAP = (1 << 0), 254 IBT_UD_DEST_DEFER_ALLOC = (1 << 1) 255 } ibt_ud_dest_flags_t; 256 257 /* 258 * SRQ alloc flags 259 */ 260 typedef enum ibt_srq_flags_e { 261 IBT_SRQ_NO_FLAGS = 0, 262 IBT_SRQ_USER_MAP = (1 << 0), 263 IBT_SRQ_DEFER_ALLOC = (1 << 1) 264 } ibt_srq_flags_t; 265 266 /* 267 * ibt_alloc_lkey() alloc flags 268 */ 269 typedef enum ibt_lkey_flags_e { 270 IBT_KEY_NO_FLAGS = 0, 271 IBT_KEY_REMOTE = (1 << 0) 272 } ibt_lkey_flags_t; 273 274 /* 275 * RNR NAK retry counts. 276 */ 277 typedef enum ibt_rnr_retry_cnt_e { 278 IBT_RNR_NO_RETRY = 0x0, /* Don't retry, fail on first timeout */ 279 IBT_RNR_RETRY_1 = 0x1, /* Retry once */ 280 IBT_RNR_RETRY_2 = 0x2, /* Retry twice */ 281 IBT_RNR_RETRY_3 = 0x3, /* Retry three times */ 282 IBT_RNR_RETRY_4 = 0x4, /* Retry four times */ 283 IBT_RNR_RETRY_5 = 0x5, /* Retry five times */ 284 IBT_RNR_RETRY_6 = 0x6, /* Retry six times */ 285 IBT_RNR_INFINITE_RETRY = 0x7 /* Retry forever */ 286 } ibt_rnr_retry_cnt_t; 287 288 /* 289 * Valid values for RNR NAK timer fields, part of a channel's context. 290 */ 291 typedef enum ibt_rnr_nak_time_e { 292 IBT_RNR_NAK_655ms = 0x0, 293 IBT_RNR_NAK_10us = 0x1, 294 IBT_RNR_NAK_20us = 0x2, 295 IBT_RNR_NAK_30us = 0x3, 296 IBT_RNR_NAK_40us = 0x4, 297 IBT_RNR_NAK_60us = 0x5, 298 IBT_RNR_NAK_80us = 0x6, 299 IBT_RNR_NAK_120us = 0x7, 300 IBT_RNR_NAK_160us = 0x8, 301 IBT_RNR_NAK_240us = 0x9, 302 IBT_RNR_NAK_320us = 0xA, 303 IBT_RNR_NAK_480us = 0xB, 304 IBT_RNR_NAK_640us = 0xC, 305 IBT_RNR_NAK_960us = 0xD, 306 IBT_RNR_NAK_1280us = 0xE, 307 IBT_RNR_NAK_1920us = 0xF, 308 IBT_RNR_NAK_2560us = 0x10, 309 IBT_RNR_NAK_3840us = 0x11, 310 IBT_RNR_NAK_5120us = 0x12, 311 IBT_RNR_NAK_7680us = 0x13, 312 IBT_RNR_NAK_10ms = 0x14, 313 IBT_RNR_NAK_15ms = 0x15, 314 IBT_RNR_NAK_20ms = 0x16, 315 IBT_RNR_NAK_31ms = 0x17, 316 IBT_RNR_NAK_41ms = 0x18, 317 IBT_RNR_NAK_61ms = 0x19, 318 IBT_RNR_NAK_82ms = 0x1A, 319 IBT_RNR_NAK_123ms = 0x1B, 320 IBT_RNR_NAK_164ms = 0x1C, 321 IBT_RNR_NAK_246ms = 0x1D, 322 IBT_RNR_NAK_328ms = 0x1E, 323 IBT_RNR_NAK_492ms = 0x1F 324 } ibt_rnr_nak_time_t; 325 326 /* 327 * The definition of HCA capabilities etc as a bitfield. 328 */ 329 typedef enum ibt_hca_flags_e { 330 IBT_HCA_NO_FLAGS = 0, 331 332 IBT_HCA_RD = 1 << 0, 333 IBT_HCA_UD_MULTICAST = 1 << 1, 334 IBT_HCA_RAW_MULTICAST = 1 << 2, 335 336 IBT_HCA_ATOMICS_HCA = 1 << 3, 337 IBT_HCA_ATOMICS_GLOBAL = 1 << 4, 338 339 IBT_HCA_RESIZE_CHAN = 1 << 5, /* Is resize supported? */ 340 IBT_HCA_AUTO_PATH_MIG = 1 << 6, /* Is APM supported? */ 341 IBT_HCA_SQD_SQD_PORT = 1 << 7, /* Can change physical port */ 342 /* on transit from SQD to SQD */ 343 IBT_HCA_PKEY_CNTR = 1 << 8, 344 IBT_HCA_QKEY_CNTR = 1 << 9, 345 IBT_HCA_AH_PORT_CHECK = 1 << 10, /* HCA checks AH port match */ 346 /* in UD WRs */ 347 IBT_HCA_PORT_UP = 1 << 11, /* PortActive event supported */ 348 IBT_HCA_INIT_TYPE = 1 << 12, /* InitType supported */ 349 IBT_HCA_SI_GUID = 1 << 13, /* System Image GUID */ 350 /* supported */ 351 IBT_HCA_SHUTDOWN_PORT = 1 << 14, /* ShutdownPort supported */ 352 IBT_HCA_RNR_NAK = 1 << 15, /* RNR-NAK supported for RC */ 353 IBT_HCA_CURRENT_QP_STATE = 1 << 16, /* Does modify_qp support */ 354 /* checking of current state? */ 355 IBT_HCA_SRQ = 1 << 17, /* Shared Receive Queue (RC) */ 356 IBT_HCA_RC_SRQ = IBT_HCA_SRQ, 357 IBT_HCA_RESIZE_SRQ = 1 << 18, /* Is resize SRQ supported? */ 358 IBT_HCA_UD_SRQ = 1 << 19, /* UD with SRQ */ 359 360 IBT_HCA_MULT_PAGE_SZ_MR = 1 << 20, /* Support of multiple page */ 361 /* sizes per memory region? */ 362 IBT_HCA_BLOCK_LIST = 1 << 21, /* Block list physical buffer */ 363 /* lists supported? */ 364 IBT_HCA_ZERO_BASED_VA = 1 << 22, /* Zero Based Virtual */ 365 /* Addresses supported? */ 366 IBT_HCA_LOCAL_INVAL_FENCE = 1 << 23, /* Local invalidate fencing? */ 367 IBT_HCA_BASE_QUEUE_MGT = 1 << 24, /* Base Queue Mgt supported? */ 368 IBT_HCA_CKSUM_FULL = 1 << 25, /* Checksum offload supported */ 369 IBT_HCA_MEM_WIN_TYPE_2B = 1 << 26, /* Type 2B memory windows */ 370 IBT_HCA_PHYS_BUF_BLOCK = 1 << 27, /* Block mode phys buf lists */ 371 IBT_HCA_FMR = 1 << 28, /* FMR Support */ 372 IBT_HCA_WQE_SIZE_INFO = 1 << 29, /* detailed WQE size info */ 373 IBT_HCA_SQD_STATE = 1 << 30 /* SQD QP state */ 374 } ibt_hca_flags_t; 375 376 typedef enum ibt_hca_flags2_e { 377 IBT_HCA2_NO_FLAGS = 0, 378 379 IBT_HCA2_UC = 1 << 1, /* Unreliable Connected */ 380 IBT_HCA2_UC_SRQ = 1 << 2, /* UC with SRQ */ 381 IBT_HCA2_RES_LKEY = 1 << 3, /* Reserved L_Key */ 382 IBT_HCA2_PORT_CHANGE = 1 << 4, /* Port Change event */ 383 IBT_HCA2_IP_CLASS = 1 << 5, /* IP Classification flags */ 384 IBT_HCA2_RSS_TPL_ALG = 1 << 6, /* RSS: Toeplitz algorithm */ 385 IBT_HCA2_RSS_XOR_ALG = 1 << 7, /* RSS: XOR algorithm */ 386 IBT_HCA2_XRC = 1 << 8, /* Extended RC (XRC) */ 387 IBT_HCA2_XRC_SRQ_RESIZE = 1 << 9, /* resize XRC SRQ */ 388 IBT_HCA2_MEM_MGT_EXT = 1 << 10 /* FMR-WR, send-inv, local-inv */ 389 } ibt_hca_flags2_t; 390 391 /* 392 * The definition of HCA page size capabilities as a bitfield 393 */ 394 typedef enum ibt_page_sizes_e { 395 IBT_PAGE_4K = 0x1 << 2, 396 IBT_PAGE_8K = 0x1 << 3, 397 IBT_PAGE_16K = 0x1 << 4, 398 IBT_PAGE_32K = 0x1 << 5, 399 IBT_PAGE_64K = 0x1 << 6, 400 IBT_PAGE_128K = 0x1 << 7, 401 IBT_PAGE_256K = 0x1 << 8, 402 IBT_PAGE_512K = 0x1 << 9, 403 IBT_PAGE_1M = 0x1 << 10, 404 IBT_PAGE_2M = 0x1 << 11, 405 IBT_PAGE_4M = 0x1 << 12, 406 IBT_PAGE_8M = 0x1 << 13, 407 IBT_PAGE_16M = 0x1 << 14, 408 IBT_PAGE_32M = 0x1 << 15, 409 IBT_PAGE_64M = 0x1 << 16, 410 IBT_PAGE_128M = 0x1 << 17, 411 IBT_PAGE_256M = 0x1 << 18, 412 IBT_PAGE_512M = 0x1 << 19, 413 IBT_PAGE_1G = 0x1 << 20, 414 IBT_PAGE_2G = 0x1 << 21, 415 IBT_PAGE_4G = 0x1 << 22, 416 IBT_PAGE_8G = 0x1 << 23, 417 IBT_PAGE_16G = 0x1 << 24 418 } ibt_page_sizes_t; 419 420 /* 421 * Memory Window Type. 422 */ 423 typedef enum ibt_mem_win_type_e { 424 IBT_MEM_WIN_TYPE_NOT_DEFINED = 0, 425 IBT_MEM_WIN_TYPE_1 = (1 << 0), 426 IBT_MEM_WIN_TYPE_2 = (1 << 1) 427 } ibt_mem_win_type_t; 428 429 /* 430 * HCA attributes. 431 * Contains all HCA static attributes. 432 */ 433 typedef struct ibt_hca_attr_s { 434 ibt_hca_flags_t hca_flags; /* HCA capabilities etc */ 435 ibt_hca_flags2_t hca_flags2; 436 437 /* device/version inconsistency w/ NodeInfo and IOControllerProfile */ 438 uint32_t hca_vendor_id:24; /* 24 bit Vendor ID */ 439 uint16_t hca_device_id; 440 uint32_t hca_version_id; 441 442 uint_t hca_max_chans; /* Max Chans supported */ 443 uint_t hca_max_chan_sz; /* Max outstanding WRs on any */ 444 /* channel */ 445 446 uint_t hca_max_sgl; /* Max SGL entries per WR */ 447 448 uint_t hca_max_cq; /* Max num of CQs supported */ 449 uint_t hca_max_cq_sz; /* Max capacity of each CQ */ 450 451 ibt_page_sizes_t hca_page_sz; /* Bit mask of page sizes */ 452 453 uint_t hca_max_memr; /* Max num of HCA mem regions */ 454 ib_memlen_t hca_max_memr_len; /* Largest block, in bytes of */ 455 /* mem that can be registered */ 456 uint_t hca_max_mem_win; /* Max Memory windows in HCA */ 457 458 uint_t hca_max_rsc; /* Max Responder Resources of */ 459 /* this HCA for RDMAR/Atomics */ 460 /* with this HCA as target. */ 461 uint8_t hca_max_rdma_in_chan; /* Max RDMAR/Atomics in per */ 462 /* chan this HCA as target. */ 463 uint8_t hca_max_rdma_out_chan; /* Max RDMA Reads/Atomics out */ 464 /* per channel by this HCA */ 465 uint_t hca_max_ipv6_chan; /* Max IPV6 channels in HCA */ 466 uint_t hca_max_ether_chan; /* Max Ether channels in HCA */ 467 468 uint_t hca_max_mcg_chans; /* Max number of channels */ 469 /* that can join multicast */ 470 /* groups */ 471 uint_t hca_max_mcg; /* Max multicast groups */ 472 uint_t hca_max_chan_per_mcg; /* Max number of channels per */ 473 /* Multicast group in HCA */ 474 475 uint16_t hca_max_partitions; /* Max partitions in HCA */ 476 uint8_t hca_nports; /* Number of physical ports */ 477 ib_guid_t hca_node_guid; /* Node GUID */ 478 479 ib_time_t hca_local_ack_delay; 480 481 uint_t hca_max_port_sgid_tbl_sz; 482 uint16_t hca_max_port_pkey_tbl_sz; 483 uint_t hca_max_pd; /* Max# of Protection Domains */ 484 ib_guid_t hca_si_guid; /* Optional System Image GUID */ 485 uint_t hca_hca_max_ci_priv_sz; 486 uint_t hca_chan_max_ci_priv_sz; 487 uint_t hca_cq_max_ci_priv_sz; 488 uint_t hca_pd_max_ci_priv_sz; 489 uint_t hca_mr_max_ci_priv_sz; 490 uint_t hca_mw_max_ci_priv_sz; 491 uint_t hca_ud_dest_max_ci_priv_sz; 492 uint_t hca_cq_sched_max_ci_priv_sz; 493 uint_t hca_max_ud_dest; 494 uint_t hca_opaque2; 495 uint_t hca_opaque3; 496 uint_t hca_opaque4; 497 uint8_t hca_opaque5; 498 uint8_t hca_opaque6; 499 uint8_t hca_rss_max_log2_table; /* max RSS log2 table size */ 500 uint_t hca_opaque7; 501 uint_t hca_opaque8; 502 uint_t hca_max_srqs; /* Max SRQs supported */ 503 uint_t hca_max_srqs_sz; /* Max outstanding WRs on any */ 504 /* SRQ */ 505 uint_t hca_max_srq_sgl; /* Max SGL entries per SRQ WR */ 506 uint_t hca_max_phys_buf_list_sz; 507 size_t hca_block_sz_lo; /* Range of block sizes */ 508 size_t hca_block_sz_hi; /* supported by the HCA */ 509 uint_t hca_max_cq_handlers; 510 ibt_lkey_t hca_reserved_lkey; /* Reserved L_Key value */ 511 uint_t hca_max_fmrs; /* Max FMR Supported */ 512 uint_t hca_opaque9; 513 514 uint_t hca_max_lso_size; 515 uint_t hca_max_lso_hdr_size; 516 uint_t hca_max_inline_size; 517 518 uint_t hca_max_cq_mod_count; /* CQ notify moderation */ 519 uint_t hca_max_cq_mod_usec; 520 521 uint32_t hca_fw_major_version; /* firmware version */ 522 uint16_t hca_fw_minor_version; 523 uint16_t hca_fw_micro_version; 524 525 uint_t hca_max_xrc_domains; /* XRC items */ 526 uint_t hca_max_xrc_srqs; 527 uint_t hca_max_xrc_srq_size; 528 uint_t hca_max_xrc_srq_sgl; 529 530 /* detailed WQE size info */ 531 uint_t hca_ud_send_inline_sz; /* inline size in bytes */ 532 uint_t hca_conn_send_inline_sz; 533 uint_t hca_conn_rdmaw_inline_overhead; 534 uint_t hca_recv_sgl_sz; /* detailed SGL sizes */ 535 uint_t hca_ud_send_sgl_sz; 536 uint_t hca_conn_send_sgl_sz; 537 uint_t hca_conn_rdma_sgl_overhead; 538 } ibt_hca_attr_t; 539 540 /* 541 * HCA Port link states. 542 */ 543 typedef enum ibt_port_state_e { 544 IBT_PORT_DOWN = 1, 545 IBT_PORT_INIT, 546 IBT_PORT_ARM, 547 IBT_PORT_ACTIVE 548 } ibt_port_state_t; 549 550 /* 551 * HCA Port capabilities as a bitfield. 552 */ 553 typedef enum ibt_port_caps_e { 554 IBT_PORT_CAP_NO_FLAGS = 0, 555 IBT_PORT_CAP_SM = 1 << 0, /* SM port */ 556 IBT_PORT_CAP_SM_DISABLED = 1 << 1, 557 IBT_PORT_CAP_SNMP_TUNNEL = 1 << 2, /* SNMP Tunneling */ 558 IBT_PORT_CAP_DM = 1 << 3, /* DM supported */ 559 IBT_PORT_CAP_VENDOR = 1 << 4, /* Vendor Class */ 560 IBT_PORT_CAP_CLNT_REREG = 1 << 5 /* Client Rereg */ 561 } ibt_port_caps_t; 562 563 564 /* 565 * HCA port attributes structure definition. The number of ports per HCA 566 * can be found from the "ibt_hca_attr_t" structure. 567 * 568 * p_pkey_tbl is a pointer to an array of ib_pkey_t, members are 569 * accessed as: 570 * hca_portinfo->p_pkey_tbl[i] 571 * 572 * Where 0 <= i < hca_portinfo.p_pkey_tbl_sz 573 * 574 * Similarly p_sgid_tbl is a pointer to an array of ib_gid_t. 575 * 576 * The Query Port function - ibt_query_hca_ports() allocates the memory 577 * required for the ibt_hca_portinfo_t struct as well as the memory 578 * required for the SGID and P_Key tables. The memory is freed by calling 579 * ibt_free_portinfo(). 580 */ 581 typedef struct ibt_hca_portinfo_s { 582 ib_lid_t p_opaque1; /* Base LID of port */ 583 ib_qkey_cntr_t p_qkey_violations; /* Bad Q_Key cnt */ 584 ib_pkey_cntr_t p_pkey_violations; /* Optional bad P_Key cnt */ 585 uint8_t p_sm_sl:4; /* SM Service level */ 586 ib_lid_t p_sm_lid; /* SM LID */ 587 ibt_port_state_t p_linkstate; /* Port state */ 588 uint8_t p_port_num; 589 ib_mtu_t p_mtu; /* Max transfer unit - pkt */ 590 uint8_t p_lmc:3; /* Local mask control */ 591 ib_gid_t *p_sgid_tbl; /* SGID Table */ 592 uint_t p_sgid_tbl_sz; /* Size of SGID table */ 593 uint16_t p_pkey_tbl_sz; /* Size of P_Key table */ 594 uint16_t p_def_pkey_ix; /* default pkey index for TI */ 595 ib_pkey_t *p_pkey_tbl; /* P_Key table */ 596 uint8_t p_max_vl; /* Max num of virtual lanes */ 597 uint8_t p_init_type_reply; /* Optional InitTypeReply */ 598 ib_time_t p_subnet_timeout; /* Max Subnet Timeout */ 599 ibt_port_caps_t p_capabilities; /* Port Capabilities */ 600 uint32_t p_msg_sz; /* Max message size */ 601 } ibt_hca_portinfo_t; 602 603 /* 604 * Modify HCA port attributes flags, specifies which HCA port 605 * attributes to modify. 606 */ 607 typedef enum ibt_port_modify_flags_e { 608 IBT_PORT_NO_FLAGS = 0, 609 610 IBT_PORT_RESET_QKEY = 1 << 0, /* Reset Q_Key violation */ 611 /* counter */ 612 IBT_PORT_RESET_SM = 1 << 1, /* SM */ 613 IBT_PORT_SET_SM = 1 << 2, 614 IBT_PORT_RESET_SNMP = 1 << 3, /* SNMP Tunneling */ 615 IBT_PORT_SET_SNMP = 1 << 4, 616 IBT_PORT_RESET_DEVMGT = 1 << 5, /* Device Management */ 617 IBT_PORT_SET_DEVMGT = 1 << 6, 618 IBT_PORT_RESET_VENDOR = 1 << 7, /* Vendor Class */ 619 IBT_PORT_SET_VENDOR = 1 << 8, 620 IBT_PORT_SHUTDOWN = 1 << 9, /* Shut down the port */ 621 IBT_PORT_SET_INIT_TYPE = 1 << 10 /* InitTypeReply value */ 622 } ibt_port_modify_flags_t; 623 624 /* 625 * Modify HCA port InitType bit definitions, applicable only if 626 * IBT_PORT_SET_INIT_TYPE modify flag (ibt_port_modify_flags_t) is set. 627 */ 628 #define IBT_PINIT_NO_LOAD 0x1 629 #define IBT_PINIT_PRESERVE_CONTENT 0x2 630 #define IBT_PINIT_PRESERVE_PRESENCE 0x4 631 #define IBT_PINIT_NO_RESUSCITATE 0x8 632 633 634 /* 635 * Address vector definition. 636 */ 637 typedef struct ibt_adds_vect_s { 638 ib_gid_t av_dgid; /* IPV6 dest GID in GRH */ 639 ib_gid_t av_sgid; /* SGID */ 640 ibt_srate_t av_srate; /* Max static rate */ 641 uint8_t av_srvl:4; /* Service level in LRH */ 642 uint_t av_flow:20; /* 20 bit Flow Label */ 643 uint8_t av_tclass; /* Traffic Class */ 644 uint8_t av_hop; /* Hop Limit */ 645 uint8_t av_port_num; /* Port number for UD */ 646 boolean_t av_opaque1; 647 ib_lid_t av_opaque2; 648 ib_path_bits_t av_opaque3; 649 uint32_t av_opaque4; 650 } ibt_adds_vect_t; 651 652 typedef struct ibt_cep_path_s { 653 ibt_adds_vect_t cep_adds_vect; /* Address Vector */ 654 uint16_t cep_pkey_ix; /* P_Key Index */ 655 uint8_t cep_hca_port_num; /* Port number for connected */ 656 /* channels. A value of 0 */ 657 /* indicates an invalid path */ 658 ib_time_t cep_cm_opaque1; 659 } ibt_cep_path_t; 660 661 /* 662 * Define Receive Side Scaling types for IP over IB. 663 */ 664 typedef enum ibt_rss_flags_e { 665 IBT_RSS_ALG_TPL = (1 << 0), /* RSS: Toeplitz hash */ 666 IBT_RSS_ALG_XOR = (1 << 1), /* RSS: XOR hash */ 667 IBT_RSS_HASH_IPV4 = (1 << 2), /* RSS: hash IPv4 headers */ 668 IBT_RSS_HASH_IPV6 = (1 << 3), /* RSS: hash IPv6 headers */ 669 IBT_RSS_HASH_TCP_IPV4 = (1 << 4), /* RSS: hash TCP/IPv4 hdrs */ 670 IBT_RSS_HASH_TCP_IPV6 = (1 << 5) /* RSS: hash TCP/IPv6 hdrs */ 671 } ibt_rss_flags_t; 672 673 typedef struct ibt_rss_attr_s { 674 ibt_rss_flags_t rss_flags; /* RSS: flags */ 675 uint_t rss_log2_table; /* RSS: log2 table size */ 676 ib_qpn_t rss_base_qpn; /* RSS: base QPN */ 677 ib_qpn_t rss_def_qpn; /* RSS: default QPN */ 678 uint8_t rss_toe_key[40]; /* RSS: Toeplitz hash key */ 679 } ibt_rss_attr_t; 680 681 /* 682 * Channel Migration State. 683 */ 684 typedef enum ibt_cep_cmstate_e { 685 IBT_STATE_NOT_SUPPORTED = 0, 686 IBT_STATE_MIGRATED = 1, 687 IBT_STATE_REARMED = 2, 688 IBT_STATE_ARMED = 3 689 } ibt_cep_cmstate_t; 690 691 /* 692 * Transport service type 693 * 694 * NOTE: this was converted from an enum to a uint8_t to save space. 695 */ 696 typedef uint8_t ibt_tran_srv_t; 697 698 #define IBT_RC_SRV 0 699 #define IBT_UC_SRV 1 700 #define IBT_RD_SRV 2 701 #define IBT_UD_SRV 3 702 #define IBT_RAWIP_SRV 4 703 #define IBT_RAWETHER_SRV 5 704 705 /* 706 * Channel (QP/EEC) state definitions. 707 */ 708 typedef enum ibt_cep_state_e { 709 IBT_STATE_RESET = 0, /* Reset */ 710 IBT_STATE_INIT, /* Initialized */ 711 IBT_STATE_RTR, /* Ready to Receive */ 712 IBT_STATE_RTS, /* Ready to Send */ 713 IBT_STATE_SQD, /* Send Queue Drained */ 714 IBT_STATE_SQE, /* Send Queue Error */ 715 IBT_STATE_ERROR, /* Error */ 716 IBT_STATE_SQDRAIN, /* Send Queue Draining */ 717 IBT_STATE_NUM /* Number of states */ 718 } ibt_cep_state_t; 719 720 721 /* 722 * Channel Attribute flags. 723 */ 724 typedef enum ibt_attr_flags_e { 725 IBT_ALL_SIGNALED = 0, /* All sends signaled */ 726 IBT_WR_SIGNALED = 1, /* Signaled on a WR basis */ 727 IBT_FAST_REG_RES_LKEY = (1 << 1), 728 IBT_USES_LSO = (1 << 2) 729 } ibt_attr_flags_t; 730 731 /* 732 * Channel End Point (CEP) Control Flags. 733 */ 734 typedef enum ibt_cep_flags_e { 735 IBT_CEP_NO_FLAGS = 0, /* Enable Nothing */ 736 IBT_CEP_RDMA_RD = (1 << 0), /* Enable incoming RDMA RD's */ 737 /* RC & RD only */ 738 IBT_CEP_RDMA_WR = (1 << 1), /* Enable incoming RDMA WR's */ 739 /* RC & RD only */ 740 IBT_CEP_ATOMIC = (1 << 2) /* Enable incoming Atomics, */ 741 /* RC & RD only */ 742 } ibt_cep_flags_t; 743 744 /* 745 * Channel Modify Flags 746 */ 747 typedef enum ibt_cep_modify_flags_e { 748 IBT_CEP_SET_NOTHING = 0, 749 IBT_CEP_SET_SQ_SIZE = (1 << 1), 750 IBT_CEP_SET_RQ_SIZE = (1 << 2), 751 752 IBT_CEP_SET_RDMA_R = (1 << 3), 753 IBT_CEP_SET_RDMA_W = (1 << 4), 754 IBT_CEP_SET_ATOMIC = (1 << 5), 755 756 IBT_CEP_SET_ALT_PATH = (1 << 6), /* Alternate Path */ 757 758 IBT_CEP_SET_ADDS_VECT = (1 << 7), 759 IBT_CEP_SET_PORT = (1 << 8), 760 IBT_CEP_SET_OPAQUE5 = (1 << 9), 761 IBT_CEP_SET_RETRY = (1 << 10), 762 IBT_CEP_SET_RNR_NAK_RETRY = (1 << 11), 763 IBT_CEP_SET_MIN_RNR_NAK = (1 << 12), 764 765 IBT_CEP_SET_QKEY = (1 << 13), 766 IBT_CEP_SET_RDMARA_OUT = (1 << 14), 767 IBT_CEP_SET_RDMARA_IN = (1 << 15), 768 769 IBT_CEP_SET_OPAQUE1 = (1 << 16), 770 IBT_CEP_SET_OPAQUE2 = (1 << 17), 771 IBT_CEP_SET_OPAQUE3 = (1 << 18), 772 IBT_CEP_SET_OPAQUE4 = (1 << 19), 773 IBT_CEP_SET_SQD_EVENT = (1 << 20), 774 IBT_CEP_SET_OPAQUE6 = (1 << 21), 775 IBT_CEP_SET_OPAQUE7 = (1 << 22), 776 IBT_CEP_SET_OPAQUE8 = (1 << 23), 777 IBT_CEP_SET_RSS = (1 << 24) 778 } ibt_cep_modify_flags_t; 779 780 /* 781 * CQ notify types. 782 */ 783 typedef enum ibt_cq_notify_flags_e { 784 IBT_NEXT_COMPLETION = 1, 785 IBT_NEXT_SOLICITED = 2 786 } ibt_cq_notify_flags_t; 787 788 /* 789 * CQ types shared across TI and CI. 790 */ 791 typedef enum ibt_cq_flags_e { 792 IBT_CQ_NO_FLAGS = 0, 793 IBT_CQ_HANDLER_IN_THREAD = 1 << 0, /* A thread calls the */ 794 /* CQ handler */ 795 IBT_CQ_USER_MAP = 1 << 1, 796 IBT_CQ_DEFER_ALLOC = 1 << 2 797 } ibt_cq_flags_t; 798 799 /* 800 * CQ types shared across TI and CI. 801 */ 802 typedef enum ibt_cq_sched_flags_e { 803 IBT_CQS_NO_FLAGS = 0, 804 IBT_CQS_WARM_CACHE = 1 << 0, /* run on same CPU */ 805 IBT_CQS_AFFINITY = 1 << 1, 806 IBT_CQS_SCHED_GROUP = 1 << 2, 807 IBT_CQS_USER_MAP = 1 << 3, 808 IBT_CQS_DEFER_ALLOC = 1 << 4 809 } ibt_cq_sched_flags_t; 810 811 /* 812 * Attributes when creating a Completion Queue. 813 * 814 * Note: 815 * The IBT_CQ_HANDLER_IN_THREAD cq_flags bit should be ignored by the CI. 816 */ 817 typedef struct ibt_cq_attr_s { 818 uint_t cq_size; 819 ibt_sched_hdl_t cq_sched; /* 0 = no hint, */ 820 /* other = cq_sched value */ 821 ibt_cq_flags_t cq_flags; 822 } ibt_cq_attr_t; 823 824 /* 825 * Memory Management 826 */ 827 828 /* Memory management flags */ 829 typedef enum ibt_mr_flags_e { 830 IBT_MR_SLEEP = 0, 831 IBT_MR_NOSLEEP = (1 << 1), 832 IBT_MR_NONCOHERENT = (1 << 2), 833 IBT_MR_PHYS_IOVA = (1 << 3), /* ibt_(re)register_buf */ 834 835 /* Access control flags */ 836 IBT_MR_ENABLE_WINDOW_BIND = (1 << 4), 837 IBT_MR_ENABLE_LOCAL_WRITE = (1 << 5), 838 IBT_MR_ENABLE_REMOTE_READ = (1 << 6), 839 IBT_MR_ENABLE_REMOTE_WRITE = (1 << 7), 840 IBT_MR_ENABLE_REMOTE_ATOMIC = (1 << 8), 841 842 /* Reregister flags */ 843 IBT_MR_CHANGE_TRANSLATION = (1 << 9), 844 IBT_MR_CHANGE_ACCESS = (1 << 10), 845 IBT_MR_CHANGE_PD = (1 << 11), 846 847 /* Additional registration flags */ 848 IBT_MR_ZBVA = (1 << 12), 849 850 /* Additional physical registration flags */ 851 IBT_MR_CONSUMER_KEY = (1 << 13), /* Consumer owns key */ 852 /* portion of keys */ 853 IBT_MR_DISABLE_RO = (1 << 14) 854 } ibt_mr_flags_t; 855 856 857 /* Memory Region attribute flags */ 858 typedef enum ibt_mr_attr_flags_e { 859 /* Access control flags */ 860 IBT_MR_WINDOW_BIND = (1 << 0), 861 IBT_MR_LOCAL_WRITE = (1 << 1), 862 IBT_MR_REMOTE_READ = (1 << 2), 863 IBT_MR_REMOTE_WRITE = (1 << 3), 864 IBT_MR_REMOTE_ATOMIC = (1 << 4), 865 IBT_MR_ZERO_BASED_VA = (1 << 5), 866 IBT_MR_CONSUMER_OWNED_KEY = (1 << 6), 867 IBT_MR_SHARED = (1 << 7), 868 IBT_MR_FMR = (1 << 8), 869 IBT_MR_RO_DISABLED = (1 << 9) 870 } ibt_mr_attr_flags_t; 871 872 /* Memory region physical descriptor. */ 873 typedef struct ibt_phys_buf_s { 874 union { 875 uint64_t _p_ll; /* 64 bit DMA address */ 876 uint32_t _p_la[2]; /* 2 x 32 bit address */ 877 } _phys_buf; 878 size_t p_size; 879 } ibt_phys_buf_t; 880 881 /* version of above for uniform buffer size */ 882 typedef struct ib_phys_addr_t { 883 union { 884 uint64_t _p_ll; /* 64 bit DMA address */ 885 uint32_t _p_la[2]; /* 2 x 32 bit address */ 886 } _phys_buf; 887 } ibt_phys_addr_t; 888 889 #define p_laddr _phys_buf._p_ll 890 #ifdef _LONG_LONG_HTOL 891 #define p_notused _phys_buf._p_la[0] 892 #define p_addr _phys_buf._p_la[1] 893 #else 894 #define p_addr _phys_buf._p_la[0] 895 #define p_notused _phys_buf._p_la[1] 896 #endif 897 898 899 /* Memory region descriptor. */ 900 typedef struct ibt_mr_desc_s { 901 ib_vaddr_t md_vaddr; /* IB virtual adds of memory */ 902 ibt_lkey_t md_lkey; 903 ibt_rkey_t md_rkey; 904 boolean_t md_sync_required; 905 } ibt_mr_desc_t; 906 907 /* Physical Memory region descriptor. */ 908 typedef struct ibt_pmr_desc_s { 909 ib_vaddr_t pmd_iova; /* Returned I/O Virtual Address */ 910 ibt_lkey_t pmd_lkey; 911 ibt_rkey_t pmd_rkey; 912 uint_t pmd_phys_buf_list_sz; /* Allocated Phys buf sz */ 913 boolean_t pmd_sync_required; 914 } ibt_pmr_desc_t; 915 916 /* Memory region protection bounds. */ 917 typedef struct ibt_mr_prot_bounds_s { 918 ib_vaddr_t pb_addr; /* Beginning address */ 919 size_t pb_len; /* Length of protected region */ 920 } ibt_mr_prot_bounds_t; 921 922 /* Memory Region (Re)Register attributes */ 923 typedef struct ibt_mr_attr_s { 924 ib_vaddr_t mr_vaddr; /* Virtual address to register */ 925 ib_memlen_t mr_len; /* Length of region to register */ 926 struct as *mr_as; /* A pointer to an address space */ 927 /* structure. This parameter should */ 928 /* be set to NULL, which implies */ 929 /* kernel address space. */ 930 ibt_mr_flags_t mr_flags; 931 } ibt_mr_attr_t; 932 933 /* Physical Memory Region (Re)Register */ 934 typedef struct ibt_pmr_attr_s { 935 ib_vaddr_t pmr_iova; /* I/O virtual address requested by */ 936 /* client for the first byte of the */ 937 /* region */ 938 ib_memlen_t pmr_len; /* Length of region to register */ 939 ib_memlen_t pmr_offset; /* Offset of the regions starting */ 940 /* IOVA within the 1st physical */ 941 /* buffer */ 942 ibt_ma_hdl_t pmr_ma; /* Memory handle used to obtain the */ 943 /* pmr_buf_list */ 944 ibt_phys_addr_t *pmr_addr_list; /* List of physical buffers accessed */ 945 /* as an array */ 946 size_t pmr_buf_sz; 947 uint_t pmr_num_buf; /* Num of entries in the pmr_buf_list */ 948 ibt_lkey_t pmr_lkey; /* Reregister only */ 949 ibt_rkey_t pmr_rkey; /* Reregister only */ 950 ibt_mr_flags_t pmr_flags; 951 uint8_t pmr_key; /* Key to use on new Lkey & Rkey */ 952 } ibt_pmr_attr_t; 953 954 /* addr/length pair */ 955 typedef struct ibt_iov_s { 956 caddr_t iov_addr; /* Beginning address */ 957 size_t iov_len; /* Length */ 958 } ibt_iov_t; 959 960 /* Map memory IOV */ 961 typedef enum ibt_iov_flags_e { 962 IBT_IOV_SLEEP = 0, 963 IBT_IOV_NOSLEEP = (1 << 0), 964 IBT_IOV_BUF = (1 << 1), 965 IBT_IOV_RECV = (1 << 2) 966 } ibt_iov_flags_t; 967 968 typedef struct ibt_iov_attr_s { 969 struct as *iov_as; 970 ibt_iov_t *iov; 971 struct buf *iov_buf; 972 uint32_t iov_list_len; 973 uint32_t iov_wr_nds; 974 ib_msglen_t iov_lso_hdr_sz; 975 ibt_iov_flags_t iov_flags; 976 } ibt_iov_attr_t; 977 978 /* 979 * Memory Region (Re)Register attributes - used by ibt_register_shared_mr(), 980 * ibt_register_buf() and ibt_reregister_buf(). 981 */ 982 typedef struct ibt_smr_attr_s { 983 ib_vaddr_t mr_vaddr; 984 ibt_mr_flags_t mr_flags; 985 uint8_t mr_key; /* Only for physical */ 986 /* ibt_(Re)register_buf() */ 987 ibt_lkey_t mr_lkey; /* Only for physical */ 988 ibt_rkey_t mr_rkey; /* ibt_Reregister_buf() */ 989 } ibt_smr_attr_t; 990 991 /* 992 * key states. 993 */ 994 typedef enum ibt_key_state_e { 995 IBT_KEY_INVALID = 0, 996 IBT_KEY_FREE, 997 IBT_KEY_VALID 998 } ibt_key_state_t; 999 1000 /* Memory region query attributes */ 1001 typedef struct ibt_mr_query_attr_s { 1002 ibt_lkey_t mr_lkey; 1003 ibt_rkey_t mr_rkey; 1004 ibt_mr_prot_bounds_t mr_lbounds; /* Actual local CI protection */ 1005 /* bounds */ 1006 ibt_mr_prot_bounds_t mr_rbounds; /* Actual remote CI */ 1007 /* protection bounds */ 1008 ibt_mr_attr_flags_t mr_attr_flags; /* Access rights etc. */ 1009 ibt_pd_hdl_t mr_pd; /* Protection domain */ 1010 boolean_t mr_sync_required; 1011 ibt_key_state_t mr_lkey_state; 1012 uint_t mr_phys_buf_list_sz; 1013 } ibt_mr_query_attr_t; 1014 1015 /* Memory window query attributes */ 1016 typedef struct ibt_mw_query_attr_s { 1017 ibt_pd_hdl_t mw_pd; 1018 ibt_mem_win_type_t mw_type; 1019 ibt_rkey_t mw_rkey; 1020 ibt_key_state_t mw_state; 1021 } ibt_mw_query_attr_t; 1022 1023 1024 /* Memory Region Sync Flags. */ 1025 #define IBT_SYNC_READ 0x1 /* Make memory changes visible to incoming */ 1026 /* RDMA reads */ 1027 1028 #define IBT_SYNC_WRITE 0x2 /* Make the affects of an incoming RDMA write */ 1029 /* visible to the consumer */ 1030 1031 /* Memory region sync args */ 1032 typedef struct ibt_mr_sync_s { 1033 ibt_mr_hdl_t ms_handle; 1034 ib_vaddr_t ms_vaddr; 1035 ib_memlen_t ms_len; 1036 uint32_t ms_flags; /* IBT_SYNC_READ or IBT_SYNC_WRITE */ 1037 } ibt_mr_sync_t; 1038 1039 /* 1040 * Flags for Virtual Address to HCA Physical Address translation. 1041 */ 1042 typedef enum ibt_va_flags_e { 1043 IBT_VA_SLEEP = 0, 1044 IBT_VA_NOSLEEP = (1 << 0), 1045 IBT_VA_NONCOHERENT = (1 << 1), 1046 IBT_VA_FMR = (1 << 2), 1047 IBT_VA_BLOCK_MODE = (1 << 3), 1048 IBT_VA_BUF = (1 << 4) 1049 } ibt_va_flags_t; 1050 1051 1052 /* Address Translation parameters */ 1053 typedef struct ibt_va_attr_s { 1054 ib_vaddr_t va_vaddr; /* Virtual address to register */ 1055 ib_memlen_t va_len; /* Length of region to register */ 1056 struct as *va_as; /* A pointer to an address space */ 1057 /* structure. */ 1058 size_t va_phys_buf_min; /* block mode only */ 1059 size_t va_phys_buf_max; /* block mode only */ 1060 ibt_va_flags_t va_flags; 1061 struct buf *va_buf; 1062 } ibt_va_attr_t; 1063 1064 1065 /* 1066 * Fast Memory Registration (FMR) support. 1067 */ 1068 1069 /* FMR flush function handler. */ 1070 typedef void (*ibt_fmr_flush_handler_t)(ibt_fmr_pool_hdl_t fmr_pool, 1071 void *fmr_func_arg); 1072 1073 /* FMR Pool create attributes. */ 1074 typedef struct ibt_fmr_pool_attr_s { 1075 uint_t fmr_max_pages_per_fmr; 1076 uint_t fmr_pool_size; 1077 uint_t fmr_dirty_watermark; 1078 size_t fmr_page_sz; 1079 boolean_t fmr_cache; 1080 ibt_mr_flags_t fmr_flags; 1081 ibt_fmr_flush_handler_t fmr_func_hdlr; 1082 void *fmr_func_arg; 1083 } ibt_fmr_pool_attr_t; 1084 1085 1086 /* 1087 * WORK REQUEST AND WORK REQUEST COMPLETION DEFINITIONS. 1088 */ 1089 1090 /* 1091 * Work Request and Work Request Completion types - These types are used 1092 * to indicate the type of work requests posted to a work queue 1093 * or the type of completion received. Immediate Data is indicated via 1094 * ibt_wr_flags_t or ibt_wc_flags_t. 1095 * 1096 * IBT_WRC_RECV and IBT_WRC_RECV_RDMAWI are only used as opcodes in the 1097 * work completions. 1098 * 1099 * NOTE: this was converted from an enum to a uint8_t to save space. 1100 */ 1101 typedef uint8_t ibt_wrc_opcode_t; 1102 1103 #define IBT_WRC_SEND 1 /* Send */ 1104 #define IBT_WRC_RDMAR 2 /* RDMA Read */ 1105 #define IBT_WRC_RDMAW 3 /* RDMA Write */ 1106 #define IBT_WRC_CSWAP 4 /* Compare & Swap Atomic */ 1107 #define IBT_WRC_FADD 5 /* Fetch & Add Atomic */ 1108 #define IBT_WRC_BIND 6 /* Bind Memory Window */ 1109 #define IBT_WRC_RECV 7 /* Receive */ 1110 #define IBT_WRC_RECV_RDMAWI 8 /* Received RDMA Write w/ Immediate */ 1111 #define IBT_WRC_FAST_REG_PMR 9 /* Fast Register Physical mem region */ 1112 #define IBT_WRC_LOCAL_INVALIDATE 10 1113 #define IBT_WRC_SEND_LSO 11 1114 1115 1116 /* 1117 * Work Request Completion flags - These flags indicate what type 1118 * of data is present in the Work Request Completion structure 1119 */ 1120 typedef uint8_t ibt_wc_flags_t; 1121 1122 #define IBT_WC_NO_FLAGS 0 1123 #define IBT_WC_GRH_PRESENT (1 << 0) 1124 #define IBT_WC_IMMED_DATA_PRESENT (1 << 1) 1125 #define IBT_WC_RKEY_INVALIDATED (1 << 2) 1126 #define IBT_WC_CKSUM_OK (1 << 3) 1127 1128 /* IPoIB flags for wc_detail field */ 1129 #define IBT_WC_DETAIL_ALL_FLAGS_MASK (0x0FC00000) 1130 #define IBT_WC_DETAIL_IPV4 (1 << 22) 1131 #define IBT_WC_DETAIL_IPV4_FRAG (1 << 23) 1132 #define IBT_WC_DETAIL_IPV6 (1 << 24) 1133 #define IBT_WC_DETAIL_IPV4_OPT (1 << 25) 1134 #define IBT_WC_DETAIL_TCP (1 << 26) 1135 #define IBT_WC_DETAIL_UDP (1 << 27) 1136 1137 #define IBT_WC_DETAIL_RSS_MATCH_MASK (0x003F0000) 1138 #define IBT_WC_DETAIL_RSS_TCP_IPV6 (1 << 18) 1139 #define IBT_WC_DETAIL_RSS_IPV6 (1 << 19) 1140 #define IBT_WC_DETAIL_RSS_TCP_IPV4 (1 << 20) 1141 #define IBT_WC_DETAIL_RSS_IPV4 (1 << 21) 1142 1143 /* 1144 * Work Request Completion - This structure encapsulates the information 1145 * necessary to define a work request completion. 1146 */ 1147 typedef struct ibt_wc_s { 1148 ibt_wrid_t wc_id; /* Work Request Id */ 1149 uint64_t wc_fma_ena; /* fault management err data */ 1150 ib_msglen_t wc_bytes_xfer; /* Number of Bytes */ 1151 /* Transferred */ 1152 ibt_wc_flags_t wc_flags; /* WR Completion Flags */ 1153 ibt_wrc_opcode_t wc_type; /* Operation Type */ 1154 uint16_t wc_cksum; /* payload checksum */ 1155 ibt_immed_t wc_immed_data; /* Immediate Data */ 1156 uint32_t wc_res_hash; /* RD: Freed Res, RSS: hash */ 1157 ibt_wc_status_t wc_status; /* Completion Status */ 1158 uint8_t wc_sl:4; /* Remote SL */ 1159 uint16_t wc_ethertype; /* Ethertype Field - RE */ 1160 ib_lid_t wc_opaque1; 1161 uint16_t wc_opaque2; 1162 ib_qpn_t wc_qpn; /* Source QPN Datagram only */ 1163 uint32_t wc_detail; /* RD: EECN, UD: IPoIB flags */ 1164 ib_qpn_t wc_local_qpn; 1165 ibt_rkey_t wc_rkey; 1166 ib_path_bits_t wc_opaque4; 1167 } ibt_wc_t; 1168 1169 /* 1170 * WR Flags. Common for both RC and UD 1171 * 1172 * NOTE: this was converted from an enum to a uint8_t to save space. 1173 */ 1174 typedef uint8_t ibt_wr_flags_t; 1175 1176 #define IBT_WR_NO_FLAGS 0 1177 #define IBT_WR_SEND_IMMED (1 << 0) /* Immediate Data Indicator */ 1178 #define IBT_WR_SEND_SIGNAL (1 << 1) /* Signaled, if set */ 1179 #define IBT_WR_SEND_FENCE (1 << 2) /* Fence Indicator */ 1180 #define IBT_WR_SEND_SOLICIT (1 << 3) /* Solicited Event Indicator */ 1181 #define IBT_WR_SEND_REMOTE_INVAL (1 << 4) /* Remote Invalidate */ 1182 #define IBT_WR_SEND_CKSUM (1 << 5) /* Checksum offload Indicator */ 1183 #define IBT_WR_SEND_INLINE (1 << 6) /* INLINE required (no lkey) */ 1184 1185 /* 1186 * Access control flags for Bind Memory Window operation, 1187 * applicable for RC/UC/RD only. 1188 * 1189 * If IBT_WR_BIND_WRITE or IBT_WR_BIND_ATOMIC is desired then 1190 * it is required that Memory Region should have Local Write Access. 1191 */ 1192 typedef enum ibt_bind_flags_e { 1193 IBT_WR_BIND_READ = (1 << 0), /* enable remote read */ 1194 IBT_WR_BIND_WRITE = (1 << 1), /* enable remote write */ 1195 IBT_WR_BIND_ATOMIC = (1 << 2), /* enable remote atomics */ 1196 IBT_WR_BIND_ZBVA = (1 << 3) /* Zero Based Virtual Address */ 1197 } ibt_bind_flags_t; 1198 1199 /* 1200 * Data Segment for scatter-gather list 1201 * 1202 * SGL consists of an array of data segments and the length of the SGL. 1203 */ 1204 typedef struct ibt_wr_ds_s { 1205 ib_vaddr_t ds_va; /* Virtual Address */ 1206 ibt_lkey_t ds_key; /* L_Key */ 1207 ib_msglen_t ds_len; /* Length of DS */ 1208 } ibt_wr_ds_t; 1209 1210 /* 1211 * Bind Memory Window WR 1212 * 1213 * WR ID from ibt_send_wr_t applies here too, SWG_0038 errata. 1214 */ 1215 typedef struct ibt_wr_bind_s { 1216 ibt_bind_flags_t bind_flags; 1217 ibt_rkey_t bind_rkey; /* Mem Window's R_key */ 1218 ibt_lkey_t bind_lkey; /* Mem Region's L_Key */ 1219 ibt_rkey_t bind_rkey_out; /* OUT: new R_Key */ 1220 ibt_mr_hdl_t bind_ibt_mr_hdl; /* Mem Region handle */ 1221 ibt_mw_hdl_t bind_ibt_mw_hdl; /* Mem Window handle */ 1222 ib_vaddr_t bind_va; /* Virtual Address */ 1223 ib_memlen_t bind_len; /* Length of Window */ 1224 } ibt_wr_bind_t; 1225 1226 /* 1227 * Atomic WR 1228 * 1229 * Operation type (compare & swap or fetch & add) in ibt_wrc_opcode_t. 1230 * 1231 * A copy of the original contents of the remote memory will be stored 1232 * in the local data segment described by wr_sgl within ibt_send_wr_t, 1233 * and wr_nds should be set to 1. 1234 * 1235 * Atomic operation operands: 1236 * Compare & Swap Operation: 1237 * atom_arg1 - Compare Operand 1238 * atom_arg2 - Swap Operand 1239 * 1240 * Fetch & Add Operation: 1241 * atom_arg1 - Add Operand 1242 * atom_arg2 - ignored 1243 */ 1244 typedef struct ibt_wr_atomic_s { 1245 ib_vaddr_t atom_raddr; /* Remote address. */ 1246 ibt_atom_arg_t atom_arg1; /* operand #1 */ 1247 ibt_atom_arg_t atom_arg2; /* operand #2 */ 1248 ibt_rkey_t atom_rkey; /* R_Key. */ 1249 } ibt_wr_atomic_t; 1250 1251 /* 1252 * RDMA WR 1253 * Immediate Data indicator in ibt_wr_flags_t. 1254 */ 1255 typedef struct ibt_wr_rdma_s { 1256 ib_vaddr_t rdma_raddr; /* Remote address. */ 1257 ibt_rkey_t rdma_rkey; /* R_Key. */ 1258 ibt_immed_t rdma_immed; /* Immediate Data */ 1259 } ibt_wr_rdma_t; 1260 1261 /* 1262 * Fast Register Physical Memory Region Work Request. 1263 */ 1264 typedef struct ibt_wr_reg_pmr_s { 1265 ib_vaddr_t pmr_iova; /* I/O virtual address requested by */ 1266 /* client for the first byte of the */ 1267 /* region */ 1268 ib_memlen_t pmr_len; /* Length of region to register */ 1269 ib_memlen_t pmr_offset; /* Offset of the regions starting */ 1270 /* IOVA within the 1st physical */ 1271 /* buffer */ 1272 ibt_mr_hdl_t pmr_mr_hdl; 1273 ibt_phys_addr_t *pmr_addr_list; /* List of physical buffers accessed */ 1274 /* as an array */ 1275 size_t pmr_buf_sz; /* size of uniform size PBEs */ 1276 uint_t pmr_num_buf; /* Num of entries in the pmr_buf_list */ 1277 ibt_lkey_t pmr_lkey; 1278 ibt_rkey_t pmr_rkey; 1279 ibt_mr_flags_t pmr_flags; 1280 uint8_t pmr_key; /* Key to use on new Lkey & Rkey */ 1281 } ibt_wr_reg_pmr_t; 1282 1283 /* phys reg function or WR */ 1284 typedef union ibt_reg_req_u { 1285 ibt_pmr_attr_t fn_arg; 1286 ibt_wr_reg_pmr_t wr; 1287 } ibt_reg_req_t; 1288 1289 /* 1290 * Local Invalidate. 1291 */ 1292 typedef struct ibt_wr_li_s { 1293 ibt_mr_hdl_t li_mr_hdl; /* Null for MW invalidates */ 1294 ibt_mw_hdl_t li_mw_hdl; /* Null for MR invalidates */ 1295 ibt_lkey_t li_lkey; /* Ignore for MW invalidates */ 1296 ibt_rkey_t li_rkey; 1297 } ibt_wr_li_t; 1298 1299 /* 1300 * Reserved For Future Use. 1301 * Raw IPv6 Send WR 1302 */ 1303 typedef struct ibt_wr_ripv6_s { 1304 ib_lid_t rip_dlid; /* DLID */ 1305 ib_path_bits_t rip_slid_bits; /* SLID path bits, SWG_0033 errata */ 1306 uint8_t rip_sl:4; /* SL */ 1307 ibt_srate_t rip_rate; /* Max Static Rate, SWG_0007 errata */ 1308 } ibt_wr_ripv6_t; 1309 1310 /* 1311 * Reserved For Future Use. 1312 * Raw Ethertype Send WR 1313 */ 1314 typedef struct ibt_wr_reth_s { 1315 ib_ethertype_t reth_type; /* Ethertype */ 1316 ib_lid_t reth_dlid; /* DLID */ 1317 ib_path_bits_t reth_slid_bits; /* SLID path bits, SWG_0033 errata */ 1318 uint8_t reth_sl:4; /* SL */ 1319 ibt_srate_t reth_rate; /* Max Static Rate, SWG_0007 errata */ 1320 } ibt_wr_reth_t; 1321 1322 /* 1323 * Reserved For future Use. 1324 * RD Send WR, Operation type in ibt_wrc_opcode_t. 1325 */ 1326 typedef struct ibt_wr_rd_s { 1327 ibt_rd_dest_hdl_t rdwr_dest_hdl; 1328 union { 1329 ibt_immed_t send_immed; /* IBT_WRC_SEND */ 1330 ibt_wr_rdma_t rdma; /* IBT_WRC_RDMAR */ 1331 /* IBT_WRC_RDMAW */ 1332 ibt_wr_li_t *li; /* IBT_WRC_LOCAL_INVALIDATE */ 1333 ibt_wr_atomic_t *atomic; /* IBT_WRC_FADD */ 1334 /* IBT_WRC_CSWAP */ 1335 ibt_wr_bind_t *bind; /* IBT_WRC_BIND */ 1336 ibt_wr_reg_pmr_t *reg_pmr; /* IBT_WRC_FAST_REG_PMR */ 1337 } rdwr; 1338 } ibt_wr_rd_t; 1339 1340 /* 1341 * Reserved For Future Use. 1342 * UC Send WR, Operation type in ibt_wrc_opcode_t, the only valid 1343 * ones are: 1344 * IBT_WRC_SEND 1345 * IBT_WRC_RDMAW 1346 * IBT_WRC_BIND 1347 */ 1348 typedef struct ibt_wr_uc_s { 1349 union { 1350 ibt_immed_t send_immed; /* IBT_WRC_SEND */ 1351 ibt_wr_rdma_t rdma; /* IBT_WRC_RDMAW */ 1352 ibt_wr_li_t *li; /* IBT_WRC_LOCAL_INVALIDATE */ 1353 ibt_wr_bind_t *bind; /* IBT_WRC_BIND */ 1354 ibt_wr_reg_pmr_t *reg_pmr; /* IBT_WRC_FAST_REG_PMR */ 1355 } ucwr; 1356 } ibt_wr_uc_t; 1357 1358 /* 1359 * RC Send WR, Operation type in ibt_wrc_opcode_t. 1360 */ 1361 typedef struct ibt_wr_rc_s { 1362 union { 1363 ibt_immed_t send_immed; /* IBT_WRC_SEND w/ immediate */ 1364 ibt_rkey_t send_inval; /* IBT_WRC_SEND w/ invalidate */ 1365 ibt_wr_rdma_t rdma; /* IBT_WRC_RDMAR */ 1366 /* IBT_WRC_RDMAW */ 1367 ibt_wr_li_t *li; /* IBT_WRC_LOCAL_INVALIDATE */ 1368 ibt_wr_atomic_t *atomic; /* IBT_WRC_CSWAP */ 1369 /* IBT_WRC_FADD */ 1370 ibt_wr_bind_t *bind; /* IBT_WRC_BIND */ 1371 ibt_wr_reg_pmr_t *reg_pmr; /* IBT_WRC_FAST_REG_PMR */ 1372 } rcwr; 1373 } ibt_wr_rc_t; 1374 1375 /* 1376 * UD Send WR, the only valid Operation is IBT_WRC_SEND. 1377 */ 1378 typedef struct ibt_wr_ud_s { 1379 ibt_immed_t udwr_immed; 1380 ibt_ud_dest_hdl_t udwr_dest; 1381 } ibt_wr_ud_t; 1382 1383 /* LSO variant */ 1384 typedef struct ibt_wr_lso_s { 1385 ibt_ud_dest_hdl_t lso_ud_dest; 1386 uint8_t *lso_hdr; 1387 ib_msglen_t lso_hdr_sz; 1388 ib_msglen_t lso_mss; 1389 } ibt_wr_lso_t; 1390 1391 /* 1392 * Send Work Request (WR) attributes structure. 1393 * 1394 * Operation type in ibt_wrc_opcode_t. 1395 * Immediate Data indicator in ibt_wr_flags_t. 1396 */ 1397 typedef struct ibt_send_wr_s { 1398 ibt_wrid_t wr_id; /* WR ID */ 1399 ibt_wr_flags_t wr_flags; /* Work Request Flags. */ 1400 ibt_tran_srv_t wr_trans; /* Transport Type. */ 1401 ibt_wrc_opcode_t wr_opcode; /* Operation Type. */ 1402 uint8_t wr_rsvd; /* maybe later */ 1403 uint32_t wr_nds; /* Number of data segments */ 1404 /* pointed to by wr_sgl */ 1405 ibt_wr_ds_t *wr_sgl; /* SGL */ 1406 union { 1407 ibt_wr_ud_t ud; 1408 ibt_wr_rc_t rc; 1409 ibt_wr_rd_t rd; /* Reserved For Future Use */ 1410 ibt_wr_uc_t uc; /* Reserved For Future Use */ 1411 ibt_wr_reth_t reth; /* Reserved For Future Use */ 1412 ibt_wr_ripv6_t ripv6; /* Reserved For Future Use */ 1413 ibt_wr_lso_t ud_lso; 1414 } wr; /* operation specific */ 1415 } ibt_send_wr_t; 1416 1417 /* 1418 * Receive Work Request (WR) attributes structure. 1419 */ 1420 typedef struct ibt_recv_wr_s { 1421 ibt_wrid_t wr_id; /* WR ID */ 1422 uint32_t wr_nds; /* number of data segments */ 1423 /* pointed to by wr_sgl */ 1424 ibt_wr_ds_t *wr_sgl; /* SGL */ 1425 } ibt_recv_wr_t; 1426 1427 typedef union ibt_all_wr_u { 1428 ibt_send_wr_t send; 1429 ibt_recv_wr_t recv; 1430 } ibt_all_wr_t; 1431 1432 1433 /* 1434 * Asynchronous Events and Errors. 1435 * 1436 * The following codes are not used in calls to ibc_async_handler, but 1437 * are used by IBTL to inform IBT clients of a significant event. 1438 * 1439 * IBT_HCA_ATTACH_EVENT - New HCA available. 1440 * IBT_HCA_DETACH_EVENT - HCA is requesting not to be used. 1441 * 1442 * ERRORs on a channel indicate that the channel has entered error state. 1443 * EVENTs on a channel indicate that the channel has not changed state. 1444 * 1445 */ 1446 typedef enum ibt_async_code_e { 1447 IBT_EVENT_PATH_MIGRATED = 0x000001, 1448 IBT_EVENT_SQD = 0x000002, 1449 IBT_EVENT_COM_EST = 0x000004, 1450 IBT_ERROR_CATASTROPHIC_CHAN = 0x000008, 1451 IBT_ERROR_INVALID_REQUEST_CHAN = 0x000010, 1452 IBT_ERROR_ACCESS_VIOLATION_CHAN = 0x000020, 1453 IBT_ERROR_PATH_MIGRATE_REQ = 0x000040, 1454 1455 IBT_ERROR_CQ = 0x000080, 1456 1457 IBT_EVENT_PORT_UP = 0x000100, 1458 IBT_ERROR_PORT_DOWN = 0x000200, 1459 IBT_ERROR_LOCAL_CATASTROPHIC = 0x000400, 1460 1461 IBT_HCA_ATTACH_EVENT = 0x000800, 1462 IBT_HCA_DETACH_EVENT = 0x001000, 1463 IBT_ASYNC_OPAQUE1 = 0x002000, 1464 IBT_ASYNC_OPAQUE2 = 0x004000, 1465 IBT_ASYNC_OPAQUE3 = 0x008000, 1466 IBT_ASYNC_OPAQUE4 = 0x010000, 1467 IBT_EVENT_LIMIT_REACHED_SRQ = 0x020000, 1468 IBT_EVENT_EMPTY_CHAN = 0x040000, 1469 IBT_ERROR_CATASTROPHIC_SRQ = 0x080000, 1470 1471 IBT_PORT_CHANGE_EVENT = 0x100000, 1472 IBT_CLNT_REREG_EVENT = 0x200000 1473 } ibt_async_code_t; 1474 1475 typedef enum ibt_port_change_e { 1476 IBT_PORT_CHANGE_SGID = 0x000001, /* SGID table */ 1477 IBT_PORT_CHANGE_PKEY = 0x000002, /* P_Key table */ 1478 IBT_PORT_CHANGE_SM_LID = 0x000004, /* Master SM LID */ 1479 IBT_PORT_CHANGE_SM_SL = 0x000008, /* Master SM SL */ 1480 IBT_PORT_CHANGE_SUB_TIMEOUT = 0x000010, /* Subnet Timeout */ 1481 IBT_PORT_CHANGE_SM_FLAG = 0x000020, /* IsSMDisabled bit */ 1482 IBT_PORT_CHANGE_REREG = 0x000040 /* IsClientReregSupport */ 1483 } ibt_port_change_t; 1484 1485 /* 1486 * ibt_ci_data_in() and ibt_ci_data_out() flags. 1487 */ 1488 typedef enum ibt_ci_data_flags_e { 1489 IBT_CI_NO_FLAGS = 0, 1490 IBT_CI_COMPLETE_ALLOC = (1 << 0) 1491 } ibt_ci_data_flags_t; 1492 1493 /* 1494 * Used by ibt_ci_data_in() and ibt_ci_data_out() identifies the type of handle 1495 * mapping data is being obtained for. 1496 */ 1497 typedef enum ibt_object_type_e { 1498 IBT_HDL_HCA = 1, 1499 IBT_HDL_CHANNEL, 1500 IBT_HDL_CQ, 1501 IBT_HDL_PD, 1502 IBT_HDL_MR, 1503 IBT_HDL_MW, 1504 IBT_HDL_UD_DEST, 1505 IBT_HDL_SCHED, 1506 IBT_HDL_OPAQUE1, 1507 IBT_HDL_OPAQUE2, 1508 IBT_HDL_SRQ 1509 } ibt_object_type_t; 1510 1511 /* 1512 * Standard information for ibt_ci_data_in() for memory regions. 1513 * 1514 * IBT_MR_DATA_IN_IF_VERSION is the value used in the mr_rev member. 1515 * mr_func is the callback handler. mr_arg1 and mr_arg2 are its arguments. 1516 */ 1517 #define IBT_MR_DATA_IN_IF_VERSION 1 1518 typedef struct ibt_mr_data_in_s { 1519 uint_t mr_rev; 1520 void (*mr_func)(void *, void *); 1521 void *mr_arg1; 1522 void *mr_arg2; 1523 } ibt_mr_data_in_t; 1524 1525 /* 1526 * Memory error handler data structures; code, and payload data. 1527 */ 1528 typedef enum ibt_mem_code_s { 1529 IBT_MEM_AREA = 0x1, 1530 IBT_MEM_REGION = 0x2 1531 } ibt_mem_code_t; 1532 1533 typedef struct ibt_mem_data_s { 1534 uint64_t ev_fma_ena; /* FMA Error data */ 1535 ibt_mr_hdl_t ev_mr_hdl; /* MR handle */ 1536 ibt_ma_hdl_t ev_ma_hdl; /* MA handle */ 1537 } ibt_mem_data_t; 1538 1539 /* 1540 * Special case failure type. 1541 */ 1542 typedef enum ibt_failure_type_e { 1543 IBT_FAILURE_STANDARD = 0, 1544 IBT_FAILURE_CI, 1545 IBT_FAILURE_IBMF, 1546 IBT_FAILURE_IBTL, 1547 IBT_FAILURE_IBCM, 1548 IBT_FAILURE_IBDM, 1549 IBT_FAILURE_IBSM 1550 } ibt_failure_type_t; 1551 1552 /* 1553 * RDMA IP CM service Annex definitions 1554 */ 1555 typedef struct ibt_ip_addr_s { 1556 sa_family_t family; /* AF_INET or AF_INET6 */ 1557 union { 1558 in_addr_t ip4addr; 1559 in6_addr_t ip6addr; 1560 } un; 1561 uint32_t ip6_scope_id; /* Applicable only for AF_INET6 */ 1562 } ibt_ip_addr_t; 1563 1564 #ifdef __cplusplus 1565 } 1566 #endif 1567 1568 #endif /* _SYS_IB_IBTL_IBTL_TYPES_H */ 1569