ibtl_types.h revision 43ed929a6988c3778f00123f4a4a8541e515ec16
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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
*/
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_IB_IBTL_IBTL_TYPES_H
#define _SYS_IB_IBTL_IBTL_TYPES_H
#pragma ident "%Z%%M% %I% %E% SMI"
/*
*
* All common IBTL defined types. These are common data types
* that are shared by the IBTI and IBCI interfaces, it is only included
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
* Define Internal IBTL handles
*/
typedef struct ibtl_eec_s *ibt_eec_hdl_t;
/* 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 {
IBT_GT = 0, /* Greater than */
/*
* Static rate definitions.
*/
typedef enum ibt_srate_e {
IBT_SRATE_1X = 2,
IBT_SRATE_4X = 3,
IBT_SRATE_12X = 4
} ibt_srate_t;
/*
* 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_BLOCKING = 0, /* Block */
/* ibt_close_rc_channel returns */
/*
* Memory window alloc flags
*/
typedef enum ibt_mw_flags_e {
IBT_MW_SLEEP = 0, /* Can block */
/*
* PD alloc flags
*/
typedef enum ibt_pd_flags_e {
IBT_PD_NO_FLAGS = 0,
IBT_PD_USER_MAP = (1 << 0),
/*
* UD Dest alloc flags
*/
typedef enum ibt_ud_dest_flags_e {
IBT_UD_DEST_NO_FLAGS = 0,
IBT_UD_DEST_USER_MAP = (1 << 0),
/*
* SRQ alloc flags
*/
typedef enum ibt_srq_flags_e {
IBT_SRQ_NO_FLAGS = 0,
IBT_SRQ_USER_MAP = (1 << 0),
/*
* ibt_alloc_lkey() alloc flags
*/
typedef enum ibt_lkey_flags_e {
IBT_KEY_NO_FLAGS = 0,
IBT_KEY_REMOTE = (1 << 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 {
IBT_RNR_NAK_655ms = 0x0,
IBT_RNR_NAK_10us = 0x1,
IBT_RNR_NAK_20us = 0x2,
IBT_RNR_NAK_30us = 0x3,
IBT_RNR_NAK_40us = 0x4,
IBT_RNR_NAK_60us = 0x5,
IBT_RNR_NAK_80us = 0x6,
IBT_RNR_NAK_120us = 0x7,
IBT_RNR_NAK_160us = 0x8,
IBT_RNR_NAK_240us = 0x9,
IBT_RNR_NAK_320us = 0xA,
IBT_RNR_NAK_480us = 0xB,
IBT_RNR_NAK_640us = 0xC,
IBT_RNR_NAK_960us = 0xD,
IBT_RNR_NAK_1280us = 0xE,
IBT_RNR_NAK_1920us = 0xF,
IBT_RNR_NAK_2560us = 0x10,
IBT_RNR_NAK_3840us = 0x11,
IBT_RNR_NAK_5120us = 0x12,
IBT_RNR_NAK_7680us = 0x13,
IBT_RNR_NAK_10ms = 0x14,
IBT_RNR_NAK_15ms = 0x15,
IBT_RNR_NAK_20ms = 0x16,
IBT_RNR_NAK_31ms = 0x17,
IBT_RNR_NAK_41ms = 0x18,
IBT_RNR_NAK_61ms = 0x19,
IBT_RNR_NAK_82ms = 0x1A,
IBT_RNR_NAK_123ms = 0x1B,
IBT_RNR_NAK_164ms = 0x1C,
IBT_RNR_NAK_246ms = 0x1D,
IBT_RNR_NAK_328ms = 0x1E,
IBT_RNR_NAK_492ms = 0x1F
/*
* The definition of HCA capabilities etc as a bitfield.
*/
typedef enum ibt_hca_flags_e {
IBT_HCA_NO_FLAGS = 0,
IBT_HCA_RD = 1 << 0,
/* on transit from SQD to SQD */
/* in UD WRs */
/* supported */
/* checking of current state? */
/* sizes per memory region? */
/* lists supported? */
/* Addresses supported? */
/*
* 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 {
IBT_MEM_WIN_TYPE_1 = (1 << 0),
/*
* 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 */
/*
* HCA Port link states.
*/
typedef enum ibt_port_state_e {
IBT_PORT_DOWN = 1,
/*
* HCA Port capabilities as a bitfield.
*/
typedef enum ibt_port_caps_e {
/*
* 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.
*/
#define IBT_PINIT_NO_LOAD 0x1
#define IBT_PINIT_PRESERVE_CONTENT 0x2
#define IBT_PINIT_PRESERVE_PRESENCE 0x4
#define IBT_PINIT_NO_RESUSCITATE 0x8
/*
* Address vector definition.
*/
typedef struct ibt_adds_vect_s {
typedef struct ibt_cep_path_s {
/* channels. A value of 0 */
/* indicates an invalid path */
/*
* Channel Migration State.
*/
typedef enum ibt_cep_cmstate_e {
IBT_STATE_MIGRATED = 1,
IBT_STATE_REARMED = 2,
IBT_STATE_ARMED = 3
/*
* Transport service type
*
* NOTE: this was converted from an enum to a uint8_t to save space.
*/
typedef uint8_t ibt_tran_srv_t;
#define IBT_RC_SRV 0
#define IBT_UC_SRV 1
#define IBT_RD_SRV 2
#define IBT_UD_SRV 3
#define IBT_RAWIP_SRV 4
#define IBT_RAWETHER_SRV 5
/*
*/
typedef enum ibt_cep_state_e {
IBT_STATE_RESET = 0, /* Reset */
IBT_STATE_INIT, /* Initialized */
IBT_STATE_RTR, /* Ready to Receive */
IBT_STATE_RTS, /* Ready to Send */
IBT_STATE_SQD, /* Send Queue Drained */
IBT_STATE_SQE, /* Send Queue Error */
IBT_STATE_ERROR, /* Error */
IBT_STATE_SQDRAIN, /* Send Queue Draining */
IBT_STATE_NUM /* Number of states */
/*
* Channel Attribute flags.
*/
typedef enum ibt_attr_flags_e {
IBT_ALL_SIGNALED = 0, /* All sends signaled */
/*
* Channel End Point (CEP) Control Flags.
*/
typedef enum ibt_cep_flags_e {
IBT_CEP_NO_FLAGS = 0, /* Enable Nothing */
/* 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 {
IBT_NEXT_COMPLETION = 1,
/*
* CQ types shared across TI and CI.
*/
typedef enum ibt_cq_flags_e {
IBT_CQ_NO_FLAGS = 0,
/* CQ handler */
/*
* CQ types shared across TI and CI.
*/
typedef enum ibt_cq_sched_flags_e {
IBT_CQS_NO_FLAGS = 0,
/*
* 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 */
IBT_MR_WINDOW_BIND = (1 << 0),
/* Memory region physical descriptor. */
typedef struct ibt_phys_buf_s {
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 */
/* as an array */
/* pmr_buf_list */
/*
* 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,
IBT_VA_NOSLEEP = (1 << 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;
/*
* 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.
*/
typedef uint8_t ibt_wrc_opcode_t;
#define IBT_WRC_LOCAL_INVALIDATE 10
/*
* Work Request Completion flags - These flags indicate what type
* of data is present in the Work Request Completion structure
*/
typedef uint8_t ibt_wc_flags_t;
#define IBT_WC_NO_FLAGS 0
#define IBT_WC_GRH_PRESENT (1 << 0)
/*
* Work Request Completion - This structure encapsulates the information
* necessary to define a work request completion.
*/
typedef struct ibt_wc_s {
/* Transferred */
} ibt_wc_t;
/*
* WR Flags. Common for both RC and UD
*
* NOTE: this was converted from an enum to a uint8_t to save space.
*/
typedef uint8_t ibt_wr_flags_t;
#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 */
/*
* 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;
/*
* Send Work Request (WR) attributes structure.
*
* Operation type in ibt_wrc_opcode_t.
* Immediate Data indicator in ibt_wr_flags_t.
*/
typedef struct ibt_send_wr_s {
/* pointed to by wr_sgl */
union {
} wr; /* operation specific */
/*
* Receive Work Request (WR) attributes structure.
*/
typedef struct ibt_recv_wr_s {
/* pointed to by wr_sgl */
/*
* 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 {
IBT_EVENT_PATH_MIGRATED = 0x000001,
IBT_EVENT_SQD = 0x000002,
IBT_EVENT_COM_EST = 0x000004,
IBT_ERROR_CATASTROPHIC_CHAN = 0x000008,
IBT_ERROR_INVALID_REQUEST_CHAN = 0x000010,
IBT_ERROR_ACCESS_VIOLATION_CHAN = 0x000020,
IBT_ERROR_PATH_MIGRATE_REQ = 0x000040,
IBT_ERROR_CQ = 0x000080,
IBT_EVENT_PORT_UP = 0x000100,
IBT_ERROR_PORT_DOWN = 0x000200,
IBT_ERROR_LOCAL_CATASTROPHIC = 0x000400,
IBT_HCA_ATTACH_EVENT = 0x000800,
IBT_HCA_DETACH_EVENT = 0x001000,
IBT_ASYNC_OPAQUE1 = 0x002000,
IBT_ASYNC_OPAQUE2 = 0x004000,
IBT_ASYNC_OPAQUE3 = 0x008000,
IBT_ASYNC_OPAQUE4 = 0x010000,
IBT_EVENT_LIMIT_REACHED_SRQ = 0x020000,
IBT_EVENT_EMPTY_CHAN = 0x040000,
IBT_ERROR_CATASTROPHIC_SRQ = 0x080000
/*
* ibt_ci_data_in() and ibt_ci_data_out() flags.
*/
typedef enum ibt_ci_data_flags_e {
IBT_CI_NO_FLAGS = 0,
IBT_CI_COMPLETE_ALLOC = (1 << 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 {
IBT_HDL_HCA = 1,
/*
* Memory error handler data structures; code, and payload data.
*/
typedef enum ibt_mem_code_s {
IBT_MEM_AREA = 0x1,
IBT_MEM_REGION = 0x2
typedef struct ibt_mem_data_s {
/*
* Special case failure type.
*/
typedef enum ibt_failure_type_e {
IBT_FAILURE_STANDARD = 0,
#ifdef __cplusplus
}
#endif
#endif /* _SYS_IB_IBTL_IBTL_TYPES_H */