1*0Sstevel@tonic-gate /* 2*0Sstevel@tonic-gate * CDDL HEADER START 3*0Sstevel@tonic-gate * 4*0Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*0Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*0Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*0Sstevel@tonic-gate * with the License. 8*0Sstevel@tonic-gate * 9*0Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*0Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*0Sstevel@tonic-gate * See the License for the specific language governing permissions 12*0Sstevel@tonic-gate * and limitations under the License. 13*0Sstevel@tonic-gate * 14*0Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*0Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*0Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*0Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*0Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*0Sstevel@tonic-gate * 20*0Sstevel@tonic-gate * CDDL HEADER END 21*0Sstevel@tonic-gate */ 22*0Sstevel@tonic-gate /* 23*0Sstevel@tonic-gate * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 24*0Sstevel@tonic-gate * Use is subject to license terms. 25*0Sstevel@tonic-gate */ 26*0Sstevel@tonic-gate 27*0Sstevel@tonic-gate #ifndef _SYS_IB_IBTL_IBCI_H 28*0Sstevel@tonic-gate #define _SYS_IB_IBTL_IBCI_H 29*0Sstevel@tonic-gate 30*0Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 31*0Sstevel@tonic-gate 32*0Sstevel@tonic-gate /* 33*0Sstevel@tonic-gate * ibci.h 34*0Sstevel@tonic-gate * 35*0Sstevel@tonic-gate * Define the data structures and function prototypes that comprise 36*0Sstevel@tonic-gate * the IB Channel API (API for HCA drivers). All CI handles are opaque 37*0Sstevel@tonic-gate * to the IBTF here, real data is accessed in the HCA driver by a 38*0Sstevel@tonic-gate * typecast to a driver specific struct. 39*0Sstevel@tonic-gate */ 40*0Sstevel@tonic-gate 41*0Sstevel@tonic-gate #include <sys/ib/ibtl/ibtl_types.h> 42*0Sstevel@tonic-gate #include <sys/ib/ibtl/ibtl_ci_types.h> 43*0Sstevel@tonic-gate #include <sys/modctl.h> 44*0Sstevel@tonic-gate 45*0Sstevel@tonic-gate 46*0Sstevel@tonic-gate #ifdef __cplusplus 47*0Sstevel@tonic-gate extern "C" { 48*0Sstevel@tonic-gate #endif 49*0Sstevel@tonic-gate 50*0Sstevel@tonic-gate /* 51*0Sstevel@tonic-gate * Define CI opaque IBTF handles. 52*0Sstevel@tonic-gate */ 53*0Sstevel@tonic-gate typedef struct ibtl_qp_s *ibtl_qp_hdl_t; /* ibt_alloc_qp() */ 54*0Sstevel@tonic-gate typedef struct ibtl_eec_s *ibtl_eec_hdl_t; /* ibt_alloc_eec() */ 55*0Sstevel@tonic-gate 56*0Sstevel@tonic-gate /* 57*0Sstevel@tonic-gate * Define IBTF opaque CI handles. 58*0Sstevel@tonic-gate */ 59*0Sstevel@tonic-gate typedef struct ibc_hca_s *ibc_hca_hdl_t; /* HCA/CI Handle */ 60*0Sstevel@tonic-gate typedef struct ibc_pd_s *ibc_pd_hdl_t; /* Protection Domain Handle */ 61*0Sstevel@tonic-gate typedef struct ibc_rdd_s *ibc_rdd_hdl_t; /* Reliable Datagram Domain */ 62*0Sstevel@tonic-gate typedef struct ibc_ah_s *ibc_ah_hdl_t; /* Address Handle */ 63*0Sstevel@tonic-gate typedef struct ibc_qp_s *ibc_qp_hdl_t; /* Queue Pair Handle */ 64*0Sstevel@tonic-gate typedef struct ibc_srq_s *ibc_srq_hdl_t; /* Shared Receive Queue Hdl */ 65*0Sstevel@tonic-gate typedef struct ibc_qpn_s *ibc_qpn_hdl_t; /* Queue Pair Number Handle */ 66*0Sstevel@tonic-gate typedef struct ibc_cq_s *ibc_cq_hdl_t; /* Completion Queue Handle */ 67*0Sstevel@tonic-gate typedef struct ibc_eec_s *ibc_eec_hdl_t; /* End-to-End Context Handle */ 68*0Sstevel@tonic-gate 69*0Sstevel@tonic-gate #define ibc_mr_hdl_t ibt_mr_hdl_t /* Memory Region Handle */ 70*0Sstevel@tonic-gate #define ibc_mw_hdl_t ibt_mw_hdl_t /* Memory Window Handle */ 71*0Sstevel@tonic-gate #define ibc_ma_hdl_t ibt_ma_hdl_t /* Memory Area Handle */ 72*0Sstevel@tonic-gate 73*0Sstevel@tonic-gate /* Handle used by CI for up calls to IBTF */ 74*0Sstevel@tonic-gate typedef struct ibtl_hca_devinfo_s *ibc_clnt_hdl_t; /* ibc_attach() */ 75*0Sstevel@tonic-gate 76*0Sstevel@tonic-gate /* 77*0Sstevel@tonic-gate * Fields opaque to TI, but visible to CI 78*0Sstevel@tonic-gate */ 79*0Sstevel@tonic-gate 80*0Sstevel@tonic-gate /* 81*0Sstevel@tonic-gate * ibt_qp_alloc_attr_t 82*0Sstevel@tonic-gate */ 83*0Sstevel@tonic-gate #define qp_ibc_scq_hdl qp_opaque1 84*0Sstevel@tonic-gate #define qp_ibc_rcq_hdl qp_opaque2 85*0Sstevel@tonic-gate #define qp_ibc_srq_hdl qp_opaque3 86*0Sstevel@tonic-gate 87*0Sstevel@tonic-gate 88*0Sstevel@tonic-gate /* 89*0Sstevel@tonic-gate * ibt_status_t 90*0Sstevel@tonic-gate */ 91*0Sstevel@tonic-gate #define IBT_HCA_RAWD_CHAN_EXCEEDED IBT_ERR_OPAQUE1 /* Requested raw QP */ 92*0Sstevel@tonic-gate /* exceeds HCA max */ 93*0Sstevel@tonic-gate /* limit */ 94*0Sstevel@tonic-gate #define IBT_CHAN_RAWD_NOT_SUPPORTED IBT_ERR_OPAQUE2 /* Raw datagram QPs */ 95*0Sstevel@tonic-gate /* not supported */ 96*0Sstevel@tonic-gate #define IBT_CHAN_RD_NOT_SUPPORTED IBT_ERR_OPAQUE3 /* RD not supported */ 97*0Sstevel@tonic-gate #define IBT_EEC_HDL_INVALID IBT_ERR_OPAQUE4 /* Invalid EEC handle */ 98*0Sstevel@tonic-gate #define IBT_EEC_STATE_INVALID IBT_ERR_OPAQUE5 /* Invalid EEC State */ 99*0Sstevel@tonic-gate #define IBT_EEC_ATTR_RO IBT_ERR_OPAQUE6 /* Can't Change EEC */ 100*0Sstevel@tonic-gate /* Attribute */ 101*0Sstevel@tonic-gate #define IBT_RDD_IN_USE IBT_ERR_OPAQUE7 /* RDD in Use */ 102*0Sstevel@tonic-gate #define IBT_RDD_HDL_INVALID IBT_ERR_OPAQUE8 /* Invalid RDD */ 103*0Sstevel@tonic-gate #define IBT_RNR_NAK_TIMER_INVALID IBT_ERR_OPAQUE9 /* Invalid RNR NAK */ 104*0Sstevel@tonic-gate /* Timer Value */ 105*0Sstevel@tonic-gate #define IBT_RDD_NOT_SUPPORTED IBT_ERR_OPAQUE10 106*0Sstevel@tonic-gate 107*0Sstevel@tonic-gate 108*0Sstevel@tonic-gate /* 109*0Sstevel@tonic-gate * ibt_wc_status_t 110*0Sstevel@tonic-gate */ 111*0Sstevel@tonic-gate #define IBT_WC_LOCAL_EEC_OP_ERR 12 /* Internal consistency error */ 112*0Sstevel@tonic-gate #define IBT_WC_LOCAL_RDD_VIOLATION_ERR 30 /* The RDD associated with */ 113*0Sstevel@tonic-gate /* the QP does not match */ 114*0Sstevel@tonic-gate /* the RDD associated with */ 115*0Sstevel@tonic-gate /* the EE Context */ 116*0Sstevel@tonic-gate #define IBT_WC_REMOTE_RD_REQ_INVALID 31 /* Detected an invalid */ 117*0Sstevel@tonic-gate /* incoming RD message */ 118*0Sstevel@tonic-gate #define IBT_WC_EEC_REMOTE_ABORTED 32 /* Requester aborted the */ 119*0Sstevel@tonic-gate /* operation */ 120*0Sstevel@tonic-gate #define IBT_WC_EEC_NUM_INVALID 33 /* Invalid EEC Number */ 121*0Sstevel@tonic-gate /* detected */ 122*0Sstevel@tonic-gate #define IBT_WC_EEC_STATE_INVALID 34 /* Invalid EEC state */ 123*0Sstevel@tonic-gate 124*0Sstevel@tonic-gate /* 125*0Sstevel@tonic-gate * ibt_async_code_t 126*0Sstevel@tonic-gate */ 127*0Sstevel@tonic-gate #define IBT_EVENT_PATH_MIGRATED_EEC IBT_ASYNC_OPAQUE1 128*0Sstevel@tonic-gate #define IBT_ERROR_CATASTROPHIC_EEC IBT_ASYNC_OPAQUE3 129*0Sstevel@tonic-gate #define IBT_ERROR_PATH_MIGRATE_REQ_EEC IBT_ASYNC_OPAQUE4 130*0Sstevel@tonic-gate 131*0Sstevel@tonic-gate /* 132*0Sstevel@tonic-gate * ibt_object_type_t 133*0Sstevel@tonic-gate */ 134*0Sstevel@tonic-gate #define IBT_HDL_EEC IBT_HDL_OPAQUE1 135*0Sstevel@tonic-gate #define IBT_HDL_RDD IBT_HDL_OPAQUE2 136*0Sstevel@tonic-gate 137*0Sstevel@tonic-gate 138*0Sstevel@tonic-gate /* 139*0Sstevel@tonic-gate * ibt_hca_attr_t 140*0Sstevel@tonic-gate */ 141*0Sstevel@tonic-gate #define hca_max_rdd hca_opaque2 /* Max RDDs in HCA */ 142*0Sstevel@tonic-gate #define hca_max_eec hca_opaque3 /* Max EEContexts in HCA */ 143*0Sstevel@tonic-gate #define hca_max_rd_sgl hca_opaque4 /* Max SGL entries per RD WR */ 144*0Sstevel@tonic-gate #define hca_max_rdma_in_ee hca_opaque5 /* Max RDMA Reads/Atomics in */ 145*0Sstevel@tonic-gate /* per EEC with HCA as target */ 146*0Sstevel@tonic-gate #define hca_max_rdma_out_ee hca_opaque6 /* Max RDMA Reads/Atomics out */ 147*0Sstevel@tonic-gate /* per EE by this HCA */ 148*0Sstevel@tonic-gate #define hca_max_ipv6_qp hca_max_ipv6_chan 149*0Sstevel@tonic-gate #define hca_max_ether_qp hca_max_ether_chan 150*0Sstevel@tonic-gate #define hca_eec_max_ci_priv_sz hca_opaque7 151*0Sstevel@tonic-gate #define hca_rdd_max_ci_priv_sz hca_opaque8 152*0Sstevel@tonic-gate 153*0Sstevel@tonic-gate 154*0Sstevel@tonic-gate /* 155*0Sstevel@tonic-gate * ibt_wc_t 156*0Sstevel@tonic-gate */ 157*0Sstevel@tonic-gate #define wc_eecn wc_opaque3 /* End-to-End Context RD's only */ 158*0Sstevel@tonic-gate 159*0Sstevel@tonic-gate 160*0Sstevel@tonic-gate /* Channel Interface version */ 161*0Sstevel@tonic-gate typedef enum ibc_version_e { 162*0Sstevel@tonic-gate IBCI_V1 = 1 163*0Sstevel@tonic-gate } ibc_version_t; 164*0Sstevel@tonic-gate 165*0Sstevel@tonic-gate 166*0Sstevel@tonic-gate typedef enum ibc_free_qp_flags_e { 167*0Sstevel@tonic-gate IBC_FREE_QP_AND_QPN = 0, /* free all qp resources */ 168*0Sstevel@tonic-gate IBC_FREE_QP_ONLY = 1 /* OK to free the QP, but the QPN */ 169*0Sstevel@tonic-gate /* cannot be reused until a future */ 170*0Sstevel@tonic-gate /* call to ibc_release_qpn(qpn_hdl), */ 171*0Sstevel@tonic-gate /* where qpn_hdl is a return value */ 172*0Sstevel@tonic-gate /* of ibc_free_qp() */ 173*0Sstevel@tonic-gate } ibc_free_qp_flags_t; 174*0Sstevel@tonic-gate 175*0Sstevel@tonic-gate /* 176*0Sstevel@tonic-gate * RDD alloc flags 177*0Sstevel@tonic-gate */ 178*0Sstevel@tonic-gate typedef enum ibc_rdd_flags_e { 179*0Sstevel@tonic-gate IBT_RDD_NO_FLAGS = 0, 180*0Sstevel@tonic-gate IBT_RDD_USER_MAP = (1 << 0), 181*0Sstevel@tonic-gate IBT_RDD_DEFER_ALLOC = (1 << 1) 182*0Sstevel@tonic-gate } ibc_rdd_flags_t; 183*0Sstevel@tonic-gate 184*0Sstevel@tonic-gate /* 185*0Sstevel@tonic-gate * EEC alloc flags 186*0Sstevel@tonic-gate */ 187*0Sstevel@tonic-gate typedef enum ibc_eec_flags_e { 188*0Sstevel@tonic-gate IBT_EEC_NO_FLAGS = 0, 189*0Sstevel@tonic-gate IBT_EEC_USER_MAP = (1 << 0), 190*0Sstevel@tonic-gate IBT_EEC_DEFER_ALLOC = (1 << 1) 191*0Sstevel@tonic-gate } ibc_eec_flags_t; 192*0Sstevel@tonic-gate 193*0Sstevel@tonic-gate 194*0Sstevel@tonic-gate /* 195*0Sstevel@tonic-gate * Completion Queues 196*0Sstevel@tonic-gate * 197*0Sstevel@tonic-gate */ 198*0Sstevel@tonic-gate 199*0Sstevel@tonic-gate /* 200*0Sstevel@tonic-gate * CQ handler attribute structure. 201*0Sstevel@tonic-gate */ 202*0Sstevel@tonic-gate typedef struct ibc_cq_handler_attr_s { 203*0Sstevel@tonic-gate ibt_cq_handler_id_t h_id; /* Valid ID != NULL */ 204*0Sstevel@tonic-gate int h_flags; /* Flags of ddi_intr_get_cap */ 205*0Sstevel@tonic-gate int h_pri; /* priority from */ 206*0Sstevel@tonic-gate /* ddi_intr_get_pri */ 207*0Sstevel@tonic-gate void *h_bind; /* unknown intrd stuff */ 208*0Sstevel@tonic-gate } ibc_cq_handler_attr_t; 209*0Sstevel@tonic-gate 210*0Sstevel@tonic-gate 211*0Sstevel@tonic-gate /* 212*0Sstevel@tonic-gate * Event data for asynchronous events and errors. The QP/EEC/CQ/SRQ handle, 213*0Sstevel@tonic-gate * or port number associated with the Event/Error is passed as an argument 214*0Sstevel@tonic-gate * to the async handler. 215*0Sstevel@tonic-gate * 216*0Sstevel@tonic-gate * Here is the table that describes which async_event struct members need 217*0Sstevel@tonic-gate * to be defined when ibc_async_handler is called. 218*0Sstevel@tonic-gate * 219*0Sstevel@tonic-gate * async_code async_event fields 220*0Sstevel@tonic-gate * IBT_EVENT_PATH_MIGRATED_QP ev_qp_hdl 221*0Sstevel@tonic-gate * IBT_EVENT_SQD ev_qp_hdl 222*0Sstevel@tonic-gate * IBT_EVENT_COM_EST_QP ev_qp_hdl 223*0Sstevel@tonic-gate * IBT_ERROR_CATASTROPHIC_QP ev_qp_hdl 224*0Sstevel@tonic-gate * IBT_ERROR_INVALID_REQUEST_QP ev_qp_hdl 225*0Sstevel@tonic-gate * IBT_ERROR_ACCESS_VIOLATION_QP ev_qp_hdl 226*0Sstevel@tonic-gate * IBT_ERROR_PATH_MIGRATE_REQ_QP ev_qp_hdl 227*0Sstevel@tonic-gate * 228*0Sstevel@tonic-gate * IBT_EVENT_PATH_MIGRATED_EEC ev_eec_hdl 229*0Sstevel@tonic-gate * IBT_EVENT_COM_EST_EEC ev_eec_hdl 230*0Sstevel@tonic-gate * IBT_ERROR_PATH_MIGRATE_REQ_EEC ev_eec_hdl 231*0Sstevel@tonic-gate * IBT_ERROR_CATASTROPHIC_EEC ev_eec_hdl 232*0Sstevel@tonic-gate * 233*0Sstevel@tonic-gate * IBT_ERROR_CQ ev_cq_hdl 234*0Sstevel@tonic-gate * IBT_ERROR_LOCAL_CATASTROPHIC none 235*0Sstevel@tonic-gate * IBT_ERROR_PORT_DOWN ev_port 236*0Sstevel@tonic-gate * IBT_EVENT_PORT_UP ev_port 237*0Sstevel@tonic-gate * IBT_EVENT_LIMIT_REACHED_SRQ ev_srq_hdl 238*0Sstevel@tonic-gate * IBT_EVENT_EMPTY_QP ev_qp_hdl 239*0Sstevel@tonic-gate * IBT_ERROR_CATASTROPHIC_SRQ ev_srq_hdl 240*0Sstevel@tonic-gate */ 241*0Sstevel@tonic-gate typedef struct ibc_async_event_s { 242*0Sstevel@tonic-gate uint64_t ev_fma_ena; /* fault management error data */ 243*0Sstevel@tonic-gate ibtl_qp_hdl_t ev_qp_hdl; /* IBTF QP handle. */ 244*0Sstevel@tonic-gate ibtl_eec_hdl_t ev_eec_hdl; /* IBTF EEC handle. */ 245*0Sstevel@tonic-gate ibt_cq_hdl_t ev_cq_hdl; /* IBT CQ handle. */ 246*0Sstevel@tonic-gate uint8_t ev_port; /* Valid for PORT UP/DOWN events */ 247*0Sstevel@tonic-gate ibt_srq_hdl_t ev_srq_hdl; /* SRQ handle */ 248*0Sstevel@tonic-gate } ibc_async_event_t; 249*0Sstevel@tonic-gate 250*0Sstevel@tonic-gate 251*0Sstevel@tonic-gate typedef struct ibc_operations_s { 252*0Sstevel@tonic-gate /* HCA */ 253*0Sstevel@tonic-gate ibt_status_t (*ibc_query_hca_ports)(ibc_hca_hdl_t hca, uint8_t port, 254*0Sstevel@tonic-gate ibt_hca_portinfo_t *info_p); 255*0Sstevel@tonic-gate ibt_status_t (*ibc_modify_ports)(ibc_hca_hdl_t hca, uint8_t port, 256*0Sstevel@tonic-gate ibt_port_modify_flags_t flags, uint8_t init_type); 257*0Sstevel@tonic-gate ibt_status_t (*ibc_modify_system_image)(ibc_hca_hdl_t hca, 258*0Sstevel@tonic-gate ib_guid_t sys_guid); 259*0Sstevel@tonic-gate 260*0Sstevel@tonic-gate /* Protection Domain */ 261*0Sstevel@tonic-gate ibt_status_t (*ibc_alloc_pd)(ibc_hca_hdl_t hca, ibt_pd_flags_t flags, 262*0Sstevel@tonic-gate ibc_pd_hdl_t *pd_p); 263*0Sstevel@tonic-gate ibt_status_t (*ibc_free_pd)(ibc_hca_hdl_t hca, ibc_pd_hdl_t pd); 264*0Sstevel@tonic-gate 265*0Sstevel@tonic-gate /* Reliable Datagram Domain */ 266*0Sstevel@tonic-gate ibt_status_t (*ibc_alloc_rdd)(ibc_hca_hdl_t hca, ibc_rdd_flags_t flags, 267*0Sstevel@tonic-gate ibc_rdd_hdl_t *rdd_p); 268*0Sstevel@tonic-gate ibt_status_t (*ibc_free_rdd)(ibc_hca_hdl_t hca, ibc_rdd_hdl_t rdd); 269*0Sstevel@tonic-gate 270*0Sstevel@tonic-gate /* Address Handle */ 271*0Sstevel@tonic-gate ibt_status_t (*ibc_alloc_ah)(ibc_hca_hdl_t hca, ibt_ah_flags_t flags, 272*0Sstevel@tonic-gate ibc_pd_hdl_t pd, ibt_adds_vect_t *attr_p, ibc_ah_hdl_t *ah_p); 273*0Sstevel@tonic-gate ibt_status_t (*ibc_free_ah)(ibc_hca_hdl_t hca, ibc_ah_hdl_t ah); 274*0Sstevel@tonic-gate ibt_status_t (*ibc_query_ah)(ibc_hca_hdl_t hca, ibc_ah_hdl_t ah, 275*0Sstevel@tonic-gate ibc_pd_hdl_t *pd_p, ibt_adds_vect_t *attr_p); 276*0Sstevel@tonic-gate ibt_status_t (*ibc_modify_ah)(ibc_hca_hdl_t hca, ibc_ah_hdl_t ah, 277*0Sstevel@tonic-gate ibt_adds_vect_t *attr_p); 278*0Sstevel@tonic-gate 279*0Sstevel@tonic-gate /* Queue Pair */ 280*0Sstevel@tonic-gate ibt_status_t (*ibc_alloc_qp)(ibc_hca_hdl_t hca, ibtl_qp_hdl_t ibtl_qp, 281*0Sstevel@tonic-gate ibt_qp_type_t type, ibt_qp_alloc_attr_t *attr_p, 282*0Sstevel@tonic-gate ibt_chan_sizes_t *queue_sizes_p, ib_qpn_t *qpn, ibc_qp_hdl_t *qp_p); 283*0Sstevel@tonic-gate ibt_status_t (*ibc_alloc_special_qp)(ibc_hca_hdl_t hca, uint8_t port, 284*0Sstevel@tonic-gate ibtl_qp_hdl_t ibt_qp, ibt_sqp_type_t type, 285*0Sstevel@tonic-gate ibt_qp_alloc_attr_t *attr_p, ibt_chan_sizes_t *queue_sizes_p, 286*0Sstevel@tonic-gate ibc_qp_hdl_t *qp_p); 287*0Sstevel@tonic-gate ibt_status_t (*ibc_free_qp)(ibc_hca_hdl_t hca, ibc_qp_hdl_t qp, 288*0Sstevel@tonic-gate ibc_free_qp_flags_t free_qp_flags, ibc_qpn_hdl_t *qpnh_p); 289*0Sstevel@tonic-gate ibt_status_t (*ibc_release_qpn)(ibc_hca_hdl_t hca, ibc_qpn_hdl_t qpnh); 290*0Sstevel@tonic-gate ibt_status_t (*ibc_query_qp)(ibc_hca_hdl_t hca, ibc_qp_hdl_t qp, 291*0Sstevel@tonic-gate ibt_qp_query_attr_t *attr_p); 292*0Sstevel@tonic-gate ibt_status_t (*ibc_modify_qp)(ibc_hca_hdl_t hca, ibc_qp_hdl_t qp, 293*0Sstevel@tonic-gate ibt_cep_modify_flags_t flags, ibt_qp_info_t *info_p, 294*0Sstevel@tonic-gate ibt_queue_sizes_t *actual_sz); 295*0Sstevel@tonic-gate 296*0Sstevel@tonic-gate /* Completion Queues */ 297*0Sstevel@tonic-gate ibt_status_t (*ibc_alloc_cq)(ibc_hca_hdl_t hca, ibt_cq_hdl_t ibt_cq, 298*0Sstevel@tonic-gate ibt_cq_attr_t *attr_p, ibc_cq_hdl_t *cq_p, uint_t *actual_size); 299*0Sstevel@tonic-gate ibt_status_t (*ibc_free_cq)(ibc_hca_hdl_t hca, ibc_cq_hdl_t cq); 300*0Sstevel@tonic-gate ibt_status_t (*ibc_query_cq)(ibc_hca_hdl_t hca, ibc_cq_hdl_t cq, 301*0Sstevel@tonic-gate uint_t *entries); 302*0Sstevel@tonic-gate ibt_status_t (*ibc_resize_cq)(ibc_hca_hdl_t hca, ibc_cq_hdl_t cq, 303*0Sstevel@tonic-gate uint_t size, uint_t *actual_size); 304*0Sstevel@tonic-gate ibt_status_t (*ibc_alloc_cq_sched)(ibc_hca_hdl_t hca, 305*0Sstevel@tonic-gate ibt_cq_sched_flags_t flags, ibc_cq_handler_attr_t *handler_attrs_p); 306*0Sstevel@tonic-gate ibt_status_t (*ibc_free_cq_sched)(ibc_hca_hdl_t hca, 307*0Sstevel@tonic-gate ibt_cq_handler_id_t id); 308*0Sstevel@tonic-gate 309*0Sstevel@tonic-gate /* EE Context */ 310*0Sstevel@tonic-gate ibt_status_t (*ibc_alloc_eec)(ibc_hca_hdl_t hca, ibc_eec_flags_t flags, 311*0Sstevel@tonic-gate ibtl_eec_hdl_t ibtl_eec, ibc_rdd_hdl_t rdd, ibc_eec_hdl_t *eec_p); 312*0Sstevel@tonic-gate ibt_status_t (*ibc_free_eec)(ibc_hca_hdl_t hca, ibc_eec_hdl_t eec); 313*0Sstevel@tonic-gate ibt_status_t (*ibc_query_eec)(ibc_hca_hdl_t hca, ibc_eec_hdl_t eec, 314*0Sstevel@tonic-gate ibt_eec_query_attr_t *attr_p); 315*0Sstevel@tonic-gate ibt_status_t (*ibc_modify_eec)(ibc_hca_hdl_t hca, ibc_eec_hdl_t eec, 316*0Sstevel@tonic-gate ibt_cep_modify_flags_t flags, ibt_eec_info_t *info_p); 317*0Sstevel@tonic-gate 318*0Sstevel@tonic-gate /* Memory Registration */ 319*0Sstevel@tonic-gate ibt_status_t (*ibc_register_mr)(ibc_hca_hdl_t hca, ibc_pd_hdl_t pd, 320*0Sstevel@tonic-gate ibt_mr_attr_t *attr_p, void *ibtl_reserved, ibc_mr_hdl_t *mr_p, 321*0Sstevel@tonic-gate ibt_mr_desc_t *mem_desc); 322*0Sstevel@tonic-gate ibt_status_t (*ibc_register_buf)(ibc_hca_hdl_t hca, ibc_pd_hdl_t pd, 323*0Sstevel@tonic-gate ibt_smr_attr_t *attrp, struct buf *buf, void *ibtl_reserved, 324*0Sstevel@tonic-gate ibc_mr_hdl_t *mr_hdl_p, ibt_mr_desc_t *mem_desc); 325*0Sstevel@tonic-gate ibt_status_t (*ibc_register_shared_mr)(ibc_hca_hdl_t hca, 326*0Sstevel@tonic-gate ibc_mr_hdl_t mr, ibc_pd_hdl_t pd, ibt_smr_attr_t *attr_p, 327*0Sstevel@tonic-gate void *ibtl_reserved, ibc_mr_hdl_t *mr_p, ibt_mr_desc_t *mem_desc); 328*0Sstevel@tonic-gate ibt_status_t (*ibc_deregister_mr)(ibc_hca_hdl_t hca, ibc_mr_hdl_t mr); 329*0Sstevel@tonic-gate ibt_status_t (*ibc_query_mr)(ibc_hca_hdl_t hca, ibc_mr_hdl_t mr, 330*0Sstevel@tonic-gate ibt_mr_query_attr_t *info_p); 331*0Sstevel@tonic-gate ibt_status_t (*ibc_reregister_mr)(ibc_hca_hdl_t hca, ibc_mr_hdl_t mr, 332*0Sstevel@tonic-gate ibc_pd_hdl_t pd, ibt_mr_attr_t *attr_p, void *ibtl_reserved, 333*0Sstevel@tonic-gate ibc_mr_hdl_t *mr_p, ibt_mr_desc_t *mem_desc); 334*0Sstevel@tonic-gate ibt_status_t (*ibc_reregister_buf)(ibc_hca_hdl_t hca, ibc_mr_hdl_t mr, 335*0Sstevel@tonic-gate ibc_pd_hdl_t pd, ibt_smr_attr_t *attrp, struct buf *buf, 336*0Sstevel@tonic-gate void *ibtl_reserved, ibc_mr_hdl_t *mr_p, ibt_mr_desc_t *mem_desc); 337*0Sstevel@tonic-gate ibt_status_t (*ibc_sync_mr)(ibc_hca_hdl_t hca, 338*0Sstevel@tonic-gate ibt_mr_sync_t *mr_segments, size_t num_segments); 339*0Sstevel@tonic-gate 340*0Sstevel@tonic-gate /* Memory Window */ 341*0Sstevel@tonic-gate ibt_status_t (*ibc_alloc_mw)(ibc_hca_hdl_t hca, ibc_pd_hdl_t pd, 342*0Sstevel@tonic-gate ibt_mw_flags_t flags, ibc_mw_hdl_t *mw_p, ibt_rkey_t *rkey_p); 343*0Sstevel@tonic-gate ibt_status_t (*ibc_free_mw)(ibc_hca_hdl_t hca, ibc_mw_hdl_t mw); 344*0Sstevel@tonic-gate ibt_status_t (*ibc_query_mw)(ibc_hca_hdl_t hca, ibc_mw_hdl_t mw, 345*0Sstevel@tonic-gate ibt_mw_query_attr_t *mw_attr_p); 346*0Sstevel@tonic-gate 347*0Sstevel@tonic-gate /* Multicast Group */ 348*0Sstevel@tonic-gate ibt_status_t (*ibc_attach_mcg)(ibc_hca_hdl_t hca, ibc_qp_hdl_t qp, 349*0Sstevel@tonic-gate ib_gid_t gid, ib_lid_t lid); 350*0Sstevel@tonic-gate ibt_status_t (*ibc_detach_mcg)(ibc_hca_hdl_t hca, ibc_qp_hdl_t qp, 351*0Sstevel@tonic-gate ib_gid_t gid, ib_lid_t lid); 352*0Sstevel@tonic-gate 353*0Sstevel@tonic-gate /* WR processing */ 354*0Sstevel@tonic-gate ibt_status_t (*ibc_post_send)(ibc_hca_hdl_t hca, ibc_qp_hdl_t qp, 355*0Sstevel@tonic-gate ibt_send_wr_t *wr_p, uint_t num_wr, uint_t *num_posted); 356*0Sstevel@tonic-gate ibt_status_t (*ibc_post_recv)(ibc_hca_hdl_t hca, ibc_qp_hdl_t qp, 357*0Sstevel@tonic-gate ibt_recv_wr_t *wr_p, uint_t num_wr, uint_t *num_posted); 358*0Sstevel@tonic-gate ibt_status_t (*ibc_poll_cq)(ibc_hca_hdl_t hca, ibc_cq_hdl_t cq, 359*0Sstevel@tonic-gate ibt_wc_t *wc_p, uint_t num_wc, uint_t *num_polled); 360*0Sstevel@tonic-gate ibt_status_t (*ibc_notify_cq)(ibc_hca_hdl_t hca, ibc_cq_hdl_t cq, 361*0Sstevel@tonic-gate ibt_cq_notify_flags_t flags); 362*0Sstevel@tonic-gate 363*0Sstevel@tonic-gate /* CI Object Private Data */ 364*0Sstevel@tonic-gate ibt_status_t (*ibc_ci_data_in)(ibc_hca_hdl_t hca, 365*0Sstevel@tonic-gate ibt_ci_data_flags_t flags, ibt_object_type_t object, 366*0Sstevel@tonic-gate void *ibc_object_handle, void *data_p, size_t data_sz); 367*0Sstevel@tonic-gate ibt_status_t (*ibc_ci_data_out)(ibc_hca_hdl_t hca, 368*0Sstevel@tonic-gate ibt_ci_data_flags_t flags, ibt_object_type_t object, 369*0Sstevel@tonic-gate void *ibc_object_handle, void *data_p, size_t data_sz); 370*0Sstevel@tonic-gate 371*0Sstevel@tonic-gate /* Shared Receive Queues */ 372*0Sstevel@tonic-gate ibt_status_t (*ibc_alloc_srq)(ibc_hca_hdl_t hca, ibt_srq_flags_t flags, 373*0Sstevel@tonic-gate ibt_srq_hdl_t ibt_srq, ibc_pd_hdl_t pd, ibt_srq_sizes_t *sizes, 374*0Sstevel@tonic-gate ibc_srq_hdl_t *ibc_srq_p, ibt_srq_sizes_t *real_size_p); 375*0Sstevel@tonic-gate ibt_status_t (*ibc_free_srq)(ibc_hca_hdl_t hca, ibc_srq_hdl_t srq); 376*0Sstevel@tonic-gate ibt_status_t (*ibc_query_srq)(ibc_hca_hdl_t hca, ibc_srq_hdl_t srq, 377*0Sstevel@tonic-gate ibc_pd_hdl_t *pd_p, ibt_srq_sizes_t *sizes_p, uint_t *limit); 378*0Sstevel@tonic-gate ibt_status_t (*ibc_modify_srq)(ibc_hca_hdl_t hca, ibc_srq_hdl_t srq, 379*0Sstevel@tonic-gate ibt_srq_modify_flags_t flags, uint_t size, uint_t limit, 380*0Sstevel@tonic-gate uint_t *real_size_p); 381*0Sstevel@tonic-gate ibt_status_t (*ibc_post_srq)(ibc_hca_hdl_t hca, ibc_srq_hdl_t srq, 382*0Sstevel@tonic-gate ibt_recv_wr_t *wr, uint_t num_wr, uint_t *num_posted_p); 383*0Sstevel@tonic-gate 384*0Sstevel@tonic-gate /* Address translation */ 385*0Sstevel@tonic-gate ibt_status_t (*ibc_map_mem_area)(ibc_hca_hdl_t hca_hdl, 386*0Sstevel@tonic-gate ibt_va_attr_t *va_attrs, void *ibtl_reserved, 387*0Sstevel@tonic-gate uint_t paddr_list_len, ibt_phys_buf_t *paddr_list_p, 388*0Sstevel@tonic-gate uint_t *num_paddr_p, ibc_ma_hdl_t *ibc_ma_hdl_p); 389*0Sstevel@tonic-gate ibt_status_t (*ibc_unmap_mem_area)(ibc_hca_hdl_t hca_hdl, 390*0Sstevel@tonic-gate ibc_ma_hdl_t ma_hdl); 391*0Sstevel@tonic-gate 392*0Sstevel@tonic-gate /* Allocate L_Key */ 393*0Sstevel@tonic-gate ibt_status_t (*ibc_alloc_lkey)(ibc_hca_hdl_t hca_hdl, ibc_pd_hdl_t pd, 394*0Sstevel@tonic-gate ibt_lkey_flags_t flags, uint_t phys_buf_list_sz, 395*0Sstevel@tonic-gate ibc_mr_hdl_t *mr_p, ibt_pmr_desc_t *mem_desc_p); 396*0Sstevel@tonic-gate 397*0Sstevel@tonic-gate /* Physical Register Memory Region */ 398*0Sstevel@tonic-gate ibt_status_t (*ibc_register_physical_mr)(ibc_hca_hdl_t hca, 399*0Sstevel@tonic-gate ibc_pd_hdl_t pd, ibt_pmr_attr_t *mem_pattr, void *ibtl_reserved, 400*0Sstevel@tonic-gate ibc_mr_hdl_t *mr_p, ibt_pmr_desc_t *mem_desc_p); 401*0Sstevel@tonic-gate ibt_status_t (*ibc_reregister_physical_mr)(ibc_hca_hdl_t hca, 402*0Sstevel@tonic-gate ibc_mr_hdl_t mr, ibc_pd_hdl_t pd, ibt_pmr_attr_t *mem_pattr, 403*0Sstevel@tonic-gate void *ibtl_reserved, ibc_mr_hdl_t *mr_p, 404*0Sstevel@tonic-gate ibt_pmr_desc_t *mem_desc_p); 405*0Sstevel@tonic-gate } ibc_operations_t; 406*0Sstevel@tonic-gate 407*0Sstevel@tonic-gate 408*0Sstevel@tonic-gate /* 409*0Sstevel@tonic-gate * The ibc_hca_info_s structure is used for HCA drivers to communicate its 410*0Sstevel@tonic-gate * HCA specific information to IBTF when it attaches a device via ibc_attach(). 411*0Sstevel@tonic-gate * 412*0Sstevel@tonic-gate * IBTF assumes that the structures pointed to by the hca_ops and hca_attr 413*0Sstevel@tonic-gate * structure members are persistent. 414*0Sstevel@tonic-gate */ 415*0Sstevel@tonic-gate 416*0Sstevel@tonic-gate typedef struct ibc_hca_info_s { 417*0Sstevel@tonic-gate ibc_version_t hca_ci_vers; /* CI Version */ 418*0Sstevel@tonic-gate dev_info_t *hca_dip; /* HCA dev_info */ 419*0Sstevel@tonic-gate ibc_hca_hdl_t hca_handle; /* used for call through */ 420*0Sstevel@tonic-gate /* "hca_ops" */ 421*0Sstevel@tonic-gate ibc_operations_t *hca_ops; 422*0Sstevel@tonic-gate ibt_hca_attr_t *hca_attr; 423*0Sstevel@tonic-gate ibc_cq_handler_attr_t hca_def_cq_handler_attr; 424*0Sstevel@tonic-gate } ibc_hca_info_t; 425*0Sstevel@tonic-gate 426*0Sstevel@tonic-gate 427*0Sstevel@tonic-gate /* Channel Interface return status */ 428*0Sstevel@tonic-gate typedef enum ibc_status_e { 429*0Sstevel@tonic-gate IBC_SUCCESS = 0, 430*0Sstevel@tonic-gate IBC_FAILURE = 1 431*0Sstevel@tonic-gate } ibc_status_t; 432*0Sstevel@tonic-gate 433*0Sstevel@tonic-gate /* 434*0Sstevel@tonic-gate * CI up-calls to IBTF. 435*0Sstevel@tonic-gate */ 436*0Sstevel@tonic-gate 437*0Sstevel@tonic-gate /* 438*0Sstevel@tonic-gate * ibc_init 439*0Sstevel@tonic-gate * Registers CI clients with the Solaris I/O framework 440*0Sstevel@tonic-gate * 441*0Sstevel@tonic-gate * ibc_fini 442*0Sstevel@tonic-gate * Un-Registers CI clients with the Solaris I/O framework 443*0Sstevel@tonic-gate * 444*0Sstevel@tonic-gate * modlp - Pointer to IBC client module linkage structure 445*0Sstevel@tonic-gate */ 446*0Sstevel@tonic-gate 447*0Sstevel@tonic-gate int ibc_init(struct modlinkage *modlp); 448*0Sstevel@tonic-gate void ibc_fini(struct modlinkage *modlp); 449*0Sstevel@tonic-gate 450*0Sstevel@tonic-gate /* 451*0Sstevel@tonic-gate * ibc_attach 452*0Sstevel@tonic-gate * Register HCA device with IBTF. 453*0Sstevel@tonic-gate * 454*0Sstevel@tonic-gate * ibc_hdl_p An IBTF HCA device info handle, assigned by IBTF. 455*0Sstevel@tonic-gate * To be used by the HCA driver in all its kernel 456*0Sstevel@tonic-gate * function calls to IBTF. 457*0Sstevel@tonic-gate * 458*0Sstevel@tonic-gate * info_p Pointer to ibc_hca_info_t() struct, which contains 459*0Sstevel@tonic-gate * HCA driver's information needed by IBTF. 460*0Sstevel@tonic-gate * 461*0Sstevel@tonic-gate * ibc_post_attach 462*0Sstevel@tonic-gate * After a successful ibc_attach, this must be called. 463*0Sstevel@tonic-gate * 464*0Sstevel@tonic-gate * ibc_hdl The IBTF HCA device info handle that was returned 465*0Sstevel@tonic-gate * as the result of a previously successful call to 466*0Sstevel@tonic-gate * ibc_attach. 467*0Sstevel@tonic-gate * 468*0Sstevel@tonic-gate * ibc_pre_detach 469*0Sstevel@tonic-gate * Attempt to De-Register HCA Device from IBTF. 470*0Sstevel@tonic-gate * This requires the cooperation of IBTF clients to 471*0Sstevel@tonic-gate * stop using this HCA. Upon success, the HCA driver 472*0Sstevel@tonic-gate * is committed to calling ibc_detach. 473*0Sstevel@tonic-gate * 474*0Sstevel@tonic-gate * ibc_hdl An IBTF HCA device info handle. 475*0Sstevel@tonic-gate * Obtained by ibc_attach(). 476*0Sstevel@tonic-gate * 477*0Sstevel@tonic-gate * cmd Type of detach command - DDI_DETACH. 478*0Sstevel@tonic-gate * 479*0Sstevel@tonic-gate * ibc_detach 480*0Sstevel@tonic-gate * De-Register HCA Device from IBTF. 481*0Sstevel@tonic-gate * This function will succeed if ibc_pre_detach has previously 482*0Sstevel@tonic-gate * succeeded for this device. 483*0Sstevel@tonic-gate * 484*0Sstevel@tonic-gate * ibc_hdl An IBTF HCA device info handle. 485*0Sstevel@tonic-gate */ 486*0Sstevel@tonic-gate 487*0Sstevel@tonic-gate ibc_status_t ibc_attach(ibc_clnt_hdl_t *ibc_hdl_p, ibc_hca_info_t *info_p); 488*0Sstevel@tonic-gate void ibc_post_attach(ibc_clnt_hdl_t ibc_hdl); 489*0Sstevel@tonic-gate ibc_status_t ibc_pre_detach(ibc_clnt_hdl_t ibc_hdl, ddi_detach_cmd_t cmd); 490*0Sstevel@tonic-gate void ibc_detach(ibc_clnt_hdl_t ibc_hdl); 491*0Sstevel@tonic-gate 492*0Sstevel@tonic-gate /* 493*0Sstevel@tonic-gate * ibc_cq_handler 494*0Sstevel@tonic-gate * IBTF Completion Queue Notification Handler. 495*0Sstevel@tonic-gate * 496*0Sstevel@tonic-gate * ibc_hdl An IBTF HCA device info handle. 497*0Sstevel@tonic-gate * Obtained by ibc_attach(). 498*0Sstevel@tonic-gate * 499*0Sstevel@tonic-gate * ibt_cq An IBT CQ handle, on which completion notification 500*0Sstevel@tonic-gate * has occurred. This is passed to HCA driver during 501*0Sstevel@tonic-gate * ibc_alloc_cq(). 502*0Sstevel@tonic-gate */ 503*0Sstevel@tonic-gate void ibc_cq_handler(ibc_clnt_hdl_t ibc_hdl, ibt_cq_hdl_t ibt_cq); 504*0Sstevel@tonic-gate 505*0Sstevel@tonic-gate /* 506*0Sstevel@tonic-gate * ibc_async_handler 507*0Sstevel@tonic-gate * IBTF Asynchronous event/error handler. 508*0Sstevel@tonic-gate * 509*0Sstevel@tonic-gate * ibc_hdl An IBTF HCA device info handle. 510*0Sstevel@tonic-gate * Obtained by ibc_attach(). 511*0Sstevel@tonic-gate * 512*0Sstevel@tonic-gate * code Asynchronous event code. 513*0Sstevel@tonic-gate * 514*0Sstevel@tonic-gate * event_p Pointer to ibc_async_event_t struct, to return event 515*0Sstevel@tonic-gate * information. 516*0Sstevel@tonic-gate */ 517*0Sstevel@tonic-gate void ibc_async_handler(ibc_clnt_hdl_t ibc_hdl, ibt_async_code_t code, 518*0Sstevel@tonic-gate ibc_async_event_t *event_p); 519*0Sstevel@tonic-gate /* 520*0Sstevel@tonic-gate * ibc_memory_handler 521*0Sstevel@tonic-gate * IBTF memory event/error handler. 522*0Sstevel@tonic-gate * 523*0Sstevel@tonic-gate * ibc_hdl An IBTF HCA device info handle. 524*0Sstevel@tonic-gate * Obtained by ibc_attach(). 525*0Sstevel@tonic-gate * 526*0Sstevel@tonic-gate * code Indicates if the Event/Error is with an Memory Area or 527*0Sstevel@tonic-gate * Memory Region. 528*0Sstevel@tonic-gate * 529*0Sstevel@tonic-gate * data_p Pointer to ibt_mem_data_t struct. 530*0Sstevel@tonic-gate * 531*0Sstevel@tonic-gate * ibtl_reserved The private data associated with either the MR or MA 532*0Sstevel@tonic-gate * handle contained in the ibt_mem_data_t struct, that 533*0Sstevel@tonic-gate * was passed to the CI on a memory registration or memory 534*0Sstevel@tonic-gate * map operation. 535*0Sstevel@tonic-gate */ 536*0Sstevel@tonic-gate void ibc_memory_handler(ibc_clnt_hdl_t ibc_hdl, ibt_mem_code_t code, 537*0Sstevel@tonic-gate ibt_mem_data_t *data_p, void *ibtl_reserved); 538*0Sstevel@tonic-gate 539*0Sstevel@tonic-gate /* 540*0Sstevel@tonic-gate * ibc_get_ci_failure() 541*0Sstevel@tonic-gate * 542*0Sstevel@tonic-gate * Used to obtain a special IBTF failure code for CI specific failures, 543*0Sstevel@tonic-gate * failures other than those defined in ibt_status_t. 544*0Sstevel@tonic-gate * 545*0Sstevel@tonic-gate * ena '0' or the ENA the CI intends to use in an ereport for this 546*0Sstevel@tonic-gate * failure. 547*0Sstevel@tonic-gate */ 548*0Sstevel@tonic-gate ibt_status_t ibc_get_ci_failure(uint64_t ena); 549*0Sstevel@tonic-gate 550*0Sstevel@tonic-gate #ifdef __cplusplus 551*0Sstevel@tonic-gate } 552*0Sstevel@tonic-gate #endif 553*0Sstevel@tonic-gate 554*0Sstevel@tonic-gate #endif /* _SYS_IB_IBTL_IBCI_H */ 555