/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*/
#ifndef _SYS_IB_IBTL_IBTL_TYPES_H
#define _SYS_IB_IBTL_IBTL_TYPES_H
/*
*
* All common IBTL defined types. These are common data types
* that are shared by the IBTI and IBCI interfaces, it is only included
*/
#include <sys/byteorder.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* Endian Macros
* h2b - host endian to big endian protocol
* b2h - big endian protocol to host endian
* h2l - host endian to little endian protocol
* l2h - little endian protocol to host endian
*/
#if defined(_LITTLE_ENDIAN)
#define h2l16(x) (x)
#define h2l32(x) (x)
#define h2l64(x) (x)
#define l2h16(x) (x)
#define l2h32(x) (x)
#define l2h64(x) (x)
#elif defined(_BIG_ENDIAN)
#define h2b16(x) (x)
#define h2b32(x) (x)
#define h2b64(x) (x)
#define b2h16(x) (x)
#define b2h32(x) (x)
#define b2h64(x) (x)
#else
#error "what endian is this machine?"
#endif
/*
* Define Internal IBTL handles
*/
/* Future use */
/*
* Some General Types.
*/
/*
* IBT selector type, used when looking up/requesting either an
* MTU, Pkt lifetime, or Static rate.
* The interpretation of IBT_BEST depends on the attribute being selected.
*/
typedef enum ibt_selector_e {
/*
* Static rate definitions.
*/
typedef enum ibt_srate_e {
} ibt_srate_t;
/* retain old definition to be compatible with older bits. */
/*
* Static rate request type.
*/
typedef struct ibt_srate_req_s {
/*
* Packet Life Time Request Type.
*/
typedef struct ibt_pkt_lt_req_s {
/*
* Queue size struct.
*/
typedef struct ibt_queue_sizes_s {
/*
* channels.
*/
typedef struct ibt_chan_sizes_s {
/*
* Shared Queue size struct.
*/
typedef struct ibt_srq_sizes_s {
/*
* SRQ Modify Flags
*/
typedef enum ibt_srq_modify_flags_e {
IBT_SRQ_SET_NOTHING = 0,
/*
* Execution flags, indicates if the function should block or not.
* Note: in some cases, e.g., a NULL rc_cm_handler, IBT_NONBLOCKING
* will not have an effect, and the thread will block.
* IBT_NOCALLBACKS is valid for ibt_close_rc_channel only.
*/
typedef enum ibt_execution_mode_e {
/* ibt_close_rc_channel returns */
/*
* Memory window alloc flags
*/
typedef enum ibt_mw_flags_e {
/*
* PD alloc flags
*/
typedef enum ibt_pd_flags_e {
IBT_PD_NO_FLAGS = 0,
/*
* UD Dest alloc flags
*/
typedef enum ibt_ud_dest_flags_e {
IBT_UD_DEST_NO_FLAGS = 0,
/*
* SRQ alloc flags
*/
typedef enum ibt_srq_flags_e {
IBT_SRQ_NO_FLAGS = 0,
/*
* ibt_alloc_lkey() alloc flags
*/
typedef enum ibt_lkey_flags_e {
IBT_KEY_SLEEP = 0,
/*
* RNR NAK retry counts.
*/
typedef enum ibt_rnr_retry_cnt_e {
/*
* Valid values for RNR NAK timer fields, part of a channel's context.
*/
typedef enum ibt_rnr_nak_time_e {
/*
* The definition of HCA capabilities etc as a bitfield.
*/
typedef enum ibt_hca_flags_e {
IBT_HCA_NO_FLAGS = 0,
/* on transit from SQD to SQD */
/* in UD WRs */
/* supported */
/* checking of current state? */
/* sizes per memory region? */
/* lists supported? */
/* Addresses supported? */
typedef enum ibt_hca_flags2_e {
IBT_HCA2_NO_FLAGS = 0,
/*
* The definition of HCA page size capabilities as a bitfield
*/
typedef enum ibt_page_sizes_e {
/*
* Memory Window Type.
*/
typedef enum ibt_mem_win_type_e {
/*
* HCA attributes.
* Contains all HCA static attributes.
*/
typedef struct ibt_hca_attr_s {
/* channel */
/* mem that can be registered */
/* with this HCA as target. */
/* chan this HCA as target. */
/* per channel by this HCA */
/* that can join multicast */
/* groups */
/* Multicast group in HCA */
/* SRQ */
/* detailed WQE size info */
/* FC Support */
/*
* HCA Port link states.
*/
typedef enum ibt_port_state_e {
/*
* HCA Port capabilities as a bitfield.
*/
typedef enum ibt_port_caps_e {
/* LinkWidth fields from PortInfo */
/*
* When reading LinkWidthSupported and LinkWidthEnabled, these
* values will be OR-ed together. See IB spec 14.2.5.6 for allowed
* combinations. For LinkWidthActive, only one will be returned.
*/
/* LinkSpeed fields from PortInfo */
/*
* When reading LinkSpeedSupported and LinkSpeedEnabled, these
* values will be OR-ed together. See IB spec 14.2.5.6 for allowed
* combinations. For LinkSpeedActive, only one will be returned.
*/
/* PortPhysicalState field from PortInfo */
/*
* HCA port attributes structure definition. The number of ports per HCA
* can be found from the "ibt_hca_attr_t" structure.
*
* p_pkey_tbl is a pointer to an array of ib_pkey_t, members are
* accessed as:
* hca_portinfo->p_pkey_tbl[i]
*
* Where 0 <= i < hca_portinfo.p_pkey_tbl_sz
*
* Similarly p_sgid_tbl is a pointer to an array of ib_gid_t.
*
* The Query Port function - ibt_query_hca_ports() allocates the memory
* required for the ibt_hca_portinfo_t struct as well as the memory
* required for the SGID and P_Key tables. The memory is freed by calling
* ibt_free_portinfo().
*/
typedef struct ibt_hca_portinfo_s {
/*
* Modify HCA port attributes flags, specifies which HCA port
* attributes to modify.
*/
typedef enum ibt_port_modify_flags_e {
IBT_PORT_NO_FLAGS = 0,
/* counter */
/*
* Modify HCA port InitType bit definitions, applicable only if
* IBT_PORT_SET_INIT_TYPE modify flag (ibt_port_modify_flags_t) is set.
*/
/*
* Address vector definition.
*/
typedef struct ibt_adds_vect_s {
typedef struct ibt_cep_path_s {
/* channels. A value of 0 */
/* indicates an invalid path */
/*
* Define Receive Side Scaling types for IP over IB.
*/
typedef enum ibt_rss_flags_e {
typedef struct ibt_rss_attr_s {
/*
* Channel Migration State.
*/
typedef enum ibt_cep_cmstate_e {
/*
* Transport service type
*
* NOTE: this was converted from an enum to a uint8_t to save space.
*/
#define IBT_RC_SRV 0
/*
*/
typedef enum ibt_cep_state_e {
/*
* Channel Attribute flags.
*/
typedef enum ibt_attr_flags_e {
/*
* Channel End Point (CEP) Control Flags.
*/
typedef enum ibt_cep_flags_e {
/* RC & RD only */
/* RC & RD only */
/* RC & RD only */
/*
* Channel Modify Flags
*/
typedef enum ibt_cep_modify_flags_e {
IBT_CEP_SET_NOTHING = 0,
/*
* CQ notify types.
*/
typedef enum ibt_cq_notify_flags_e {
/*
* CQ types shared across TI and CI.
*/
typedef enum ibt_cq_flags_e {
IBT_CQ_NO_FLAGS = 0,
/* CQ handler */
typedef enum ibt_cq_sched_flags_e {
IBT_CQS_NO_FLAGS = 0,
/*
* Attributes when creating a Completion Queue Scheduling Handle.
*/
typedef struct ibt_cq_sched_attr_s {
char *cqs_pool_name;
typedef void *ibt_intr_handle_t;
typedef struct ibt_cq_handler_attr_s {
/*
* Attributes when creating a Completion Queue.
*
* Note:
* The IBT_CQ_HANDLER_IN_THREAD cq_flags bit should be ignored by the CI.
*/
typedef struct ibt_cq_attr_s {
/* other = cq_sched value */
/*
* Memory Management
*/
/* Memory management flags */
typedef enum ibt_mr_flags_e {
IBT_MR_SLEEP = 0,
/* Access control flags */
/* Reregister flags */
/* Additional registration flags */
/* Additional physical registration flags */
/* portion of keys */
/* Memory Region attribute flags */
typedef enum ibt_mr_attr_flags_e {
/* Access control flags */
/* Memory region physical descriptor. */
typedef struct ibt_phys_buf_s {
union {
} _phys_buf;
/* version of above for uniform buffer size */
typedef struct ib_phys_addr_t {
union {
} _phys_buf;
#ifdef _LONG_LONG_HTOL
#else
#endif
/* Memory region descriptor. */
typedef struct ibt_mr_desc_s {
/* Physical Memory region descriptor. */
typedef struct ibt_pmr_desc_s {
/* Memory region protection bounds. */
typedef struct ibt_mr_prot_bounds_s {
/* Memory Region (Re)Register attributes */
typedef struct ibt_mr_attr_s {
/* structure. This parameter should */
/* be set to NULL, which implies */
/* kernel address space. */
/* Physical Memory Region (Re)Register */
typedef struct ibt_pmr_attr_s {
/* client for the first byte of the */
/* region */
/* IOVA within the 1st physical */
/* buffer */
/* pmr_buf_list */
/* as an array */
/* DMA Memory Region */
typedef struct ibt_dmr_attr_s {
typedef struct ibt_iov_s {
} ibt_iov_t;
/* Map memory IOV */
typedef enum ibt_iov_flags_e {
IBT_IOV_SLEEP = 0,
typedef struct ibt_iov_attr_s {
/*
* Memory Region (Re)Register attributes - used by ibt_register_shared_mr(),
* ibt_register_buf() and ibt_reregister_buf().
*/
typedef struct ibt_smr_attr_s {
/* ibt_(Re)register_buf() */
/*
* key states.
*/
typedef enum ibt_key_state_e {
IBT_KEY_INVALID = 0,
/* Memory region query attributes */
typedef struct ibt_mr_query_attr_s {
/* bounds */
/* protection bounds */
/* Memory window query attributes */
typedef struct ibt_mw_query_attr_s {
/* Memory Region Sync Flags. */
/* RDMA reads */
/* visible to the consumer */
/* Memory region sync args */
typedef struct ibt_mr_sync_s {
/*
* Flags for Virtual Address to HCA Physical Address translation.
*/
typedef enum ibt_va_flags_e {
IBT_VA_SLEEP = 0,
/* Address Translation parameters */
typedef struct ibt_va_attr_s {
/* structure. */
/*
* Fast Memory Registration (FMR) support.
*/
/* FMR flush function handler. */
void *fmr_func_arg);
/* FMR Pool create attributes. */
typedef struct ibt_fmr_pool_attr_s {
void *fmr_func_arg;
/*
* Define types for Fibre Channel over IB (fcoib)
*/
typedef enum ibt_fexch_query_flags_e {
IBT_FEXCH_NO_FLAGS = 0,
typedef struct ibt_fexch_query_attr_s {
typedef struct ibt_fc_attr_s {
/* FCMD, FEXCH: matching RFCI QP = RFCI base + idx */
/*
* WORK REQUEST AND WORK REQUEST COMPLETION DEFINITIONS.
*/
/*
* Work Request and Work Request Completion types - These types are used
* to indicate the type of work requests posted to a work queue
* or the type of completion received. Immediate Data is indicated via
* ibt_wr_flags_t or ibt_wc_flags_t.
*
* IBT_WRC_RECV and IBT_WRC_RECV_RDMAWI are only used as opcodes in the
* work completions.
*
* NOTE: this was converted from an enum to a uint8_t to save space.
*/
/*
* Work Request Completion flags - These flags indicate what type
* of data is present in the Work Request Completion structure
*/
#define IBT_WC_NO_FLAGS 0
/* IPoIB flags for wc_detail field */
/* FEXCH flags for wc_detail field */
/*
* Work Request Completion - This structure encapsulates the information
* necessary to define a work request completion.
*/
typedef struct ibt_wc_s {
/* Transferred */
} ibt_wc_t;
/* FC format alternative field names */
/*
* WR Flags. Common for both RC and UD
*
* NOTE: this was converted from an enum to a uint8_t to save space.
*/
#define IBT_WR_NO_FLAGS 0
/*
* Access control flags for Bind Memory Window operation,
*
* If IBT_WR_BIND_WRITE or IBT_WR_BIND_ATOMIC is desired then
* it is required that Memory Region should have Local Write Access.
*/
typedef enum ibt_bind_flags_e {
/*
* Data Segment for scatter-gather list
*
* SGL consists of an array of data segments and the length of the SGL.
*/
typedef struct ibt_wr_ds_s {
} ibt_wr_ds_t;
/*
* Bind Memory Window WR
*
* WR ID from ibt_send_wr_t applies here too, SWG_0038 errata.
*/
typedef struct ibt_wr_bind_s {
/*
* Atomic WR
*
* Operation type (compare & swap or fetch & add) in ibt_wrc_opcode_t.
*
* A copy of the original contents of the remote memory will be stored
* in the local data segment described by wr_sgl within ibt_send_wr_t,
* and wr_nds should be set to 1.
*
* Atomic operation operands:
* Compare & Swap Operation:
* atom_arg1 - Compare Operand
* atom_arg2 - Swap Operand
*
* Fetch & Add Operation:
* atom_arg1 - Add Operand
* atom_arg2 - ignored
*/
typedef struct ibt_wr_atomic_s {
/*
* RDMA WR
* Immediate Data indicator in ibt_wr_flags_t.
*/
typedef struct ibt_wr_rdma_s {
/*
* Fast Register Physical Memory Region Work Request.
*/
typedef struct ibt_wr_reg_pmr_s {
/* client for the first byte of the */
/* region */
/* IOVA within the 1st physical */
/* buffer */
/* as an array */
/* phys reg function or WR */
typedef union ibt_reg_req_u {
/*
* Local Invalidate.
*/
typedef struct ibt_wr_li_s {
} ibt_wr_li_t;
/*
* Reserved For Future Use.
* Raw IPv6 Send WR
*/
typedef struct ibt_wr_ripv6_s {
/*
* Reserved For Future Use.
* Raw Ethertype Send WR
*/
typedef struct ibt_wr_reth_s {
/*
* Reserved For future Use.
* RD Send WR, Operation type in ibt_wrc_opcode_t.
*/
typedef struct ibt_wr_rd_s {
union {
/* IBT_WRC_RDMAW */
/* IBT_WRC_CSWAP */
} rdwr;
} ibt_wr_rd_t;
/*
* Reserved For Future Use.
* UC Send WR, Operation type in ibt_wrc_opcode_t, the only valid
* ones are:
* IBT_WRC_SEND
* IBT_WRC_RDMAW
* IBT_WRC_BIND
*/
typedef struct ibt_wr_uc_s {
union {
} ucwr;
} ibt_wr_uc_t;
/*
* RC Send WR, Operation type in ibt_wrc_opcode_t.
*/
typedef struct ibt_wr_rc_s {
union {
/* IBT_WRC_RDMAW */
/* IBT_WRC_FADD */
} rcwr;
} ibt_wr_rc_t;
/*
* UD Send WR, the only valid Operation is IBT_WRC_SEND.
*/
typedef struct ibt_wr_ud_s {
} ibt_wr_ud_t;
/* LSO variant */
typedef struct ibt_wr_lso_s {
} ibt_wr_lso_t;
/* FC WR definitions */
IBT_FCTL_NO_FLAGS = 0,
/* InitAndSend WR: Exchange Originator, set = initiator, off = tgt */
/* FC information category value, low 4 bits of routing control */
typedef struct ibt_fc_ctl_s {
/* FC R_CTL containing information category */
} ibt_fc_ctl_t;
/* RFCI version of send */
typedef struct ibt_wr_rfci_send_s {
/* Init and Send for FCMD initiator and also Init for FEXCH target */
typedef struct ibt_wr_init_send_s {
typedef union ibt_wr_fc_u {
} ibt_wr_fc_t;
/*
* Send Work Request (WR) attributes structure.
*
* Operation type in ibt_wrc_opcode_t.
* Immediate Data indicator in ibt_wr_flags_t.
*
* RFCI initiator QP: send (FCP_CONF)
* FCMD initiator QP: init & send (FCP_CMND), FRWR
* FEXCH target QP: init, FRWR, RDMA-R (FCP_XFER_RDY), RDMA-W (FCP_DATA),
* Send (FCP_RSP)
*/
typedef struct ibt_send_wr_s {
/* pointed to by wr_sgl */
union {
/*
* Receive Work Request (WR) attributes structure.
*
* also used by these FC QP types:
* RFCI initiator QP
* FEXCH initiator QP (FCP_RSP)
* RFCI target QP (FCP_CMND)
*/
typedef struct ibt_recv_wr_s {
/* pointed to by wr_sgl */
typedef union ibt_all_wr_u {
} ibt_all_wr_t;
/*
* Asynchronous Events and Errors.
*
* The following codes are not used in calls to ibc_async_handler, but
* are used by IBTL to inform IBT clients of a significant event.
*
* IBT_HCA_ATTACH_EVENT - New HCA available.
* IBT_HCA_DETACH_EVENT - HCA is requesting not to be used.
*
* ERRORs on a channel indicate that the channel has entered error state.
* EVENTs on a channel indicate that the channel has not changed state.
*
*/
typedef enum ibt_async_code_e {
typedef enum ibt_port_change_e {
/*
* ibt_ci_data_in() and ibt_ci_data_out() flags.
*/
typedef enum ibt_ci_data_flags_e {
IBT_CI_NO_FLAGS = 0,
/*
* Used by ibt_ci_data_in() and ibt_ci_data_out() identifies the type of handle
* mapping data is being obtained for.
*/
typedef enum ibt_object_type_e {
/*
* Standard information for ibt_ci_data_in() for memory regions.
*
* IBT_MR_DATA_IN_IF_VERSION is the value used in the mr_rev member.
* mr_func is the callback handler. mr_arg1 and mr_arg2 are its arguments.
*/
typedef struct ibt_mr_data_in_s {
void (*mr_func)(void *, void *);
void *mr_arg1;
void *mr_arg2;
/*
* Memory error handler data structures; code, and payload data.
*/
typedef enum ibt_mem_code_s {
typedef struct ibt_mem_data_s {
/*
* Special case failure type.
*/
typedef enum ibt_failure_type_e {
IBT_FAILURE_STANDARD = 0,
/*
* RDMA IP CM service Annex definitions
*/
typedef struct ibt_ip_addr_s {
union {
} un;
#ifdef __cplusplus
}
#endif
#endif /* _SYS_IB_IBTL_IBTL_TYPES_H */