10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*8580SBill.Taylor@Sun.COM * Common Development and Distribution License (the "License"). 6*8580SBill.Taylor@Sun.COM * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 210Sstevel@tonic-gate /* 22*8580SBill.Taylor@Sun.COM * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 230Sstevel@tonic-gate * Use is subject to license terms. 240Sstevel@tonic-gate */ 250Sstevel@tonic-gate 260Sstevel@tonic-gate #ifndef _SYS_IB_IBTL_IBCI_H 270Sstevel@tonic-gate #define _SYS_IB_IBTL_IBCI_H 280Sstevel@tonic-gate 290Sstevel@tonic-gate /* 300Sstevel@tonic-gate * ibci.h 310Sstevel@tonic-gate * 320Sstevel@tonic-gate * Define the data structures and function prototypes that comprise 330Sstevel@tonic-gate * the IB Channel API (API for HCA drivers). All CI handles are opaque 340Sstevel@tonic-gate * to the IBTF here, real data is accessed in the HCA driver by a 350Sstevel@tonic-gate * typecast to a driver specific struct. 360Sstevel@tonic-gate */ 370Sstevel@tonic-gate 380Sstevel@tonic-gate #include <sys/ib/ibtl/ibtl_types.h> 390Sstevel@tonic-gate #include <sys/ib/ibtl/ibtl_ci_types.h> 400Sstevel@tonic-gate #include <sys/modctl.h> 410Sstevel@tonic-gate 420Sstevel@tonic-gate 430Sstevel@tonic-gate #ifdef __cplusplus 440Sstevel@tonic-gate extern "C" { 450Sstevel@tonic-gate #endif 460Sstevel@tonic-gate 470Sstevel@tonic-gate /* 480Sstevel@tonic-gate * Define CI opaque IBTF handles. 490Sstevel@tonic-gate */ 500Sstevel@tonic-gate typedef struct ibtl_qp_s *ibtl_qp_hdl_t; /* ibt_alloc_qp() */ 510Sstevel@tonic-gate typedef struct ibtl_eec_s *ibtl_eec_hdl_t; /* ibt_alloc_eec() */ 520Sstevel@tonic-gate 530Sstevel@tonic-gate /* 540Sstevel@tonic-gate * Define IBTF opaque CI handles. 550Sstevel@tonic-gate */ 560Sstevel@tonic-gate typedef struct ibc_hca_s *ibc_hca_hdl_t; /* HCA/CI Handle */ 570Sstevel@tonic-gate typedef struct ibc_pd_s *ibc_pd_hdl_t; /* Protection Domain Handle */ 580Sstevel@tonic-gate typedef struct ibc_rdd_s *ibc_rdd_hdl_t; /* Reliable Datagram Domain */ 590Sstevel@tonic-gate typedef struct ibc_ah_s *ibc_ah_hdl_t; /* Address Handle */ 600Sstevel@tonic-gate typedef struct ibc_qp_s *ibc_qp_hdl_t; /* Queue Pair Handle */ 610Sstevel@tonic-gate typedef struct ibc_srq_s *ibc_srq_hdl_t; /* Shared Receive Queue Hdl */ 620Sstevel@tonic-gate typedef struct ibc_qpn_s *ibc_qpn_hdl_t; /* Queue Pair Number Handle */ 630Sstevel@tonic-gate typedef struct ibc_cq_s *ibc_cq_hdl_t; /* Completion Queue Handle */ 640Sstevel@tonic-gate typedef struct ibc_eec_s *ibc_eec_hdl_t; /* End-to-End Context Handle */ 65*8580SBill.Taylor@Sun.COM typedef struct ibc_mem_alloc_s *ibc_mem_alloc_hdl_t; /* Memory Handle */ 660Sstevel@tonic-gate 67929Ssrust #define ibc_fmr_pool_hdl_t ibt_fmr_pool_hdl_t /* FMR Pool Handle */ 680Sstevel@tonic-gate #define ibc_mr_hdl_t ibt_mr_hdl_t /* Memory Region Handle */ 690Sstevel@tonic-gate #define ibc_mw_hdl_t ibt_mw_hdl_t /* Memory Window Handle */ 700Sstevel@tonic-gate #define ibc_ma_hdl_t ibt_ma_hdl_t /* Memory Area Handle */ 71*8580SBill.Taylor@Sun.COM #define ibc_mi_hdl_t ibt_mi_hdl_t /* Memory IOV Handle */ 720Sstevel@tonic-gate 730Sstevel@tonic-gate /* Handle used by CI for up calls to IBTF */ 740Sstevel@tonic-gate typedef struct ibtl_hca_devinfo_s *ibc_clnt_hdl_t; /* ibc_attach() */ 750Sstevel@tonic-gate 760Sstevel@tonic-gate /* 770Sstevel@tonic-gate * Fields opaque to TI, but visible to CI 780Sstevel@tonic-gate */ 790Sstevel@tonic-gate 800Sstevel@tonic-gate /* 810Sstevel@tonic-gate * ibt_qp_alloc_attr_t 820Sstevel@tonic-gate */ 830Sstevel@tonic-gate #define qp_ibc_scq_hdl qp_opaque1 840Sstevel@tonic-gate #define qp_ibc_rcq_hdl qp_opaque2 850Sstevel@tonic-gate #define qp_ibc_srq_hdl qp_opaque3 860Sstevel@tonic-gate 870Sstevel@tonic-gate 880Sstevel@tonic-gate /* 890Sstevel@tonic-gate * ibt_status_t 900Sstevel@tonic-gate */ 910Sstevel@tonic-gate #define IBT_HCA_RAWD_CHAN_EXCEEDED IBT_ERR_OPAQUE1 /* Requested raw QP */ 920Sstevel@tonic-gate /* exceeds HCA max */ 930Sstevel@tonic-gate /* limit */ 940Sstevel@tonic-gate #define IBT_CHAN_RAWD_NOT_SUPPORTED IBT_ERR_OPAQUE2 /* Raw datagram QPs */ 950Sstevel@tonic-gate /* not supported */ 960Sstevel@tonic-gate #define IBT_CHAN_RD_NOT_SUPPORTED IBT_ERR_OPAQUE3 /* RD not supported */ 970Sstevel@tonic-gate #define IBT_EEC_HDL_INVALID IBT_ERR_OPAQUE4 /* Invalid EEC handle */ 980Sstevel@tonic-gate #define IBT_EEC_STATE_INVALID IBT_ERR_OPAQUE5 /* Invalid EEC State */ 990Sstevel@tonic-gate #define IBT_EEC_ATTR_RO IBT_ERR_OPAQUE6 /* Can't Change EEC */ 1000Sstevel@tonic-gate /* Attribute */ 1010Sstevel@tonic-gate #define IBT_RDD_IN_USE IBT_ERR_OPAQUE7 /* RDD in Use */ 1020Sstevel@tonic-gate #define IBT_RDD_HDL_INVALID IBT_ERR_OPAQUE8 /* Invalid RDD */ 1030Sstevel@tonic-gate #define IBT_RNR_NAK_TIMER_INVALID IBT_ERR_OPAQUE9 /* Invalid RNR NAK */ 1040Sstevel@tonic-gate /* Timer Value */ 1050Sstevel@tonic-gate #define IBT_RDD_NOT_SUPPORTED IBT_ERR_OPAQUE10 1060Sstevel@tonic-gate 1070Sstevel@tonic-gate 1080Sstevel@tonic-gate /* 1090Sstevel@tonic-gate * ibt_wc_status_t 1100Sstevel@tonic-gate */ 1110Sstevel@tonic-gate #define IBT_WC_LOCAL_EEC_OP_ERR 12 /* Internal consistency error */ 1120Sstevel@tonic-gate #define IBT_WC_LOCAL_RDD_VIOLATION_ERR 30 /* The RDD associated with */ 1130Sstevel@tonic-gate /* the QP does not match */ 1140Sstevel@tonic-gate /* the RDD associated with */ 1150Sstevel@tonic-gate /* the EE Context */ 1160Sstevel@tonic-gate #define IBT_WC_REMOTE_RD_REQ_INVALID 31 /* Detected an invalid */ 1170Sstevel@tonic-gate /* incoming RD message */ 1180Sstevel@tonic-gate #define IBT_WC_EEC_REMOTE_ABORTED 32 /* Requester aborted the */ 1190Sstevel@tonic-gate /* operation */ 1200Sstevel@tonic-gate #define IBT_WC_EEC_NUM_INVALID 33 /* Invalid EEC Number */ 1210Sstevel@tonic-gate /* detected */ 1220Sstevel@tonic-gate #define IBT_WC_EEC_STATE_INVALID 34 /* Invalid EEC state */ 1230Sstevel@tonic-gate 1240Sstevel@tonic-gate /* 1250Sstevel@tonic-gate * ibt_async_code_t 1260Sstevel@tonic-gate */ 1270Sstevel@tonic-gate #define IBT_EVENT_PATH_MIGRATED_EEC IBT_ASYNC_OPAQUE1 1280Sstevel@tonic-gate #define IBT_ERROR_CATASTROPHIC_EEC IBT_ASYNC_OPAQUE3 1290Sstevel@tonic-gate #define IBT_ERROR_PATH_MIGRATE_REQ_EEC IBT_ASYNC_OPAQUE4 1300Sstevel@tonic-gate 1310Sstevel@tonic-gate /* 1320Sstevel@tonic-gate * ibt_object_type_t 1330Sstevel@tonic-gate */ 1340Sstevel@tonic-gate #define IBT_HDL_EEC IBT_HDL_OPAQUE1 1350Sstevel@tonic-gate #define IBT_HDL_RDD IBT_HDL_OPAQUE2 1360Sstevel@tonic-gate 1370Sstevel@tonic-gate 1380Sstevel@tonic-gate /* 1390Sstevel@tonic-gate * ibt_hca_attr_t 1400Sstevel@tonic-gate */ 1410Sstevel@tonic-gate #define hca_max_rdd hca_opaque2 /* Max RDDs in HCA */ 1420Sstevel@tonic-gate #define hca_max_eec hca_opaque3 /* Max EEContexts in HCA */ 1430Sstevel@tonic-gate #define hca_max_rd_sgl hca_opaque4 /* Max SGL entries per RD WR */ 1440Sstevel@tonic-gate #define hca_max_rdma_in_ee hca_opaque5 /* Max RDMA Reads/Atomics in */ 1450Sstevel@tonic-gate /* per EEC with HCA as target */ 1460Sstevel@tonic-gate #define hca_max_rdma_out_ee hca_opaque6 /* Max RDMA Reads/Atomics out */ 1470Sstevel@tonic-gate /* per EE by this HCA */ 1480Sstevel@tonic-gate #define hca_max_ipv6_qp hca_max_ipv6_chan 1490Sstevel@tonic-gate #define hca_max_ether_qp hca_max_ether_chan 1500Sstevel@tonic-gate #define hca_eec_max_ci_priv_sz hca_opaque7 1510Sstevel@tonic-gate #define hca_rdd_max_ci_priv_sz hca_opaque8 152929Ssrust #define hca_max_map_per_fmr hca_opaque9 1530Sstevel@tonic-gate 1540Sstevel@tonic-gate 1550Sstevel@tonic-gate /* 1560Sstevel@tonic-gate * ibt_wc_t 1570Sstevel@tonic-gate */ 158*8580SBill.Taylor@Sun.COM #define wc_eecn wc_detail /* End-to-End Context RD's only */ 1590Sstevel@tonic-gate 1600Sstevel@tonic-gate 1610Sstevel@tonic-gate /* Channel Interface version */ 1620Sstevel@tonic-gate typedef enum ibc_version_e { 163929Ssrust IBCI_V1 = 1, 164*8580SBill.Taylor@Sun.COM IBCI_V2 = 2, /* FMR Support */ 165*8580SBill.Taylor@Sun.COM IBCI_V3 = 3 1660Sstevel@tonic-gate } ibc_version_t; 1670Sstevel@tonic-gate 1680Sstevel@tonic-gate 1690Sstevel@tonic-gate typedef enum ibc_free_qp_flags_e { 1700Sstevel@tonic-gate IBC_FREE_QP_AND_QPN = 0, /* free all qp resources */ 1710Sstevel@tonic-gate IBC_FREE_QP_ONLY = 1 /* OK to free the QP, but the QPN */ 1720Sstevel@tonic-gate /* cannot be reused until a future */ 1730Sstevel@tonic-gate /* call to ibc_release_qpn(qpn_hdl), */ 1740Sstevel@tonic-gate /* where qpn_hdl is a return value */ 1750Sstevel@tonic-gate /* of ibc_free_qp() */ 1760Sstevel@tonic-gate } ibc_free_qp_flags_t; 1770Sstevel@tonic-gate 1780Sstevel@tonic-gate /* 1790Sstevel@tonic-gate * RDD alloc flags 1800Sstevel@tonic-gate */ 1810Sstevel@tonic-gate typedef enum ibc_rdd_flags_e { 1820Sstevel@tonic-gate IBT_RDD_NO_FLAGS = 0, 1830Sstevel@tonic-gate IBT_RDD_USER_MAP = (1 << 0), 1840Sstevel@tonic-gate IBT_RDD_DEFER_ALLOC = (1 << 1) 1850Sstevel@tonic-gate } ibc_rdd_flags_t; 1860Sstevel@tonic-gate 1870Sstevel@tonic-gate /* 1880Sstevel@tonic-gate * EEC alloc flags 1890Sstevel@tonic-gate */ 1900Sstevel@tonic-gate typedef enum ibc_eec_flags_e { 1910Sstevel@tonic-gate IBT_EEC_NO_FLAGS = 0, 1920Sstevel@tonic-gate IBT_EEC_USER_MAP = (1 << 0), 1930Sstevel@tonic-gate IBT_EEC_DEFER_ALLOC = (1 << 1) 1940Sstevel@tonic-gate } ibc_eec_flags_t; 1950Sstevel@tonic-gate 1960Sstevel@tonic-gate 1970Sstevel@tonic-gate /* 1980Sstevel@tonic-gate * Completion Queues 1990Sstevel@tonic-gate * 2000Sstevel@tonic-gate */ 2010Sstevel@tonic-gate 2020Sstevel@tonic-gate /* 2030Sstevel@tonic-gate * CQ handler attribute structure. 2040Sstevel@tonic-gate */ 2050Sstevel@tonic-gate typedef struct ibc_cq_handler_attr_s { 2060Sstevel@tonic-gate ibt_cq_handler_id_t h_id; /* Valid ID != NULL */ 2070Sstevel@tonic-gate int h_flags; /* Flags of ddi_intr_get_cap */ 2080Sstevel@tonic-gate int h_pri; /* priority from */ 2090Sstevel@tonic-gate /* ddi_intr_get_pri */ 2100Sstevel@tonic-gate void *h_bind; /* unknown intrd stuff */ 2110Sstevel@tonic-gate } ibc_cq_handler_attr_t; 2120Sstevel@tonic-gate 2130Sstevel@tonic-gate 2140Sstevel@tonic-gate /* 2150Sstevel@tonic-gate * Event data for asynchronous events and errors. The QP/EEC/CQ/SRQ handle, 2160Sstevel@tonic-gate * or port number associated with the Event/Error is passed as an argument 2170Sstevel@tonic-gate * to the async handler. 2180Sstevel@tonic-gate */ 2190Sstevel@tonic-gate typedef struct ibc_async_event_s { 2200Sstevel@tonic-gate uint64_t ev_fma_ena; /* fault management error data */ 2210Sstevel@tonic-gate ibtl_qp_hdl_t ev_qp_hdl; /* IBTF QP handle. */ 2220Sstevel@tonic-gate ibtl_eec_hdl_t ev_eec_hdl; /* IBTF EEC handle. */ 2230Sstevel@tonic-gate ibt_cq_hdl_t ev_cq_hdl; /* IBT CQ handle. */ 2240Sstevel@tonic-gate ibt_srq_hdl_t ev_srq_hdl; /* SRQ handle */ 225*8580SBill.Taylor@Sun.COM ibt_port_change_t ev_port_flags; /* Port Change flags */ 226*8580SBill.Taylor@Sun.COM uint8_t ev_port; /* For PORT UP/DOWN/CHANGE events */ 2270Sstevel@tonic-gate } ibc_async_event_t; 2280Sstevel@tonic-gate 2290Sstevel@tonic-gate 2300Sstevel@tonic-gate typedef struct ibc_operations_s { 2310Sstevel@tonic-gate /* HCA */ 2320Sstevel@tonic-gate ibt_status_t (*ibc_query_hca_ports)(ibc_hca_hdl_t hca, uint8_t port, 2330Sstevel@tonic-gate ibt_hca_portinfo_t *info_p); 2340Sstevel@tonic-gate ibt_status_t (*ibc_modify_ports)(ibc_hca_hdl_t hca, uint8_t port, 2350Sstevel@tonic-gate ibt_port_modify_flags_t flags, uint8_t init_type); 2360Sstevel@tonic-gate ibt_status_t (*ibc_modify_system_image)(ibc_hca_hdl_t hca, 2370Sstevel@tonic-gate ib_guid_t sys_guid); 2380Sstevel@tonic-gate 2390Sstevel@tonic-gate /* Protection Domain */ 2400Sstevel@tonic-gate ibt_status_t (*ibc_alloc_pd)(ibc_hca_hdl_t hca, ibt_pd_flags_t flags, 2410Sstevel@tonic-gate ibc_pd_hdl_t *pd_p); 2420Sstevel@tonic-gate ibt_status_t (*ibc_free_pd)(ibc_hca_hdl_t hca, ibc_pd_hdl_t pd); 2430Sstevel@tonic-gate 2440Sstevel@tonic-gate /* Reliable Datagram Domain */ 2450Sstevel@tonic-gate ibt_status_t (*ibc_alloc_rdd)(ibc_hca_hdl_t hca, ibc_rdd_flags_t flags, 2460Sstevel@tonic-gate ibc_rdd_hdl_t *rdd_p); 2470Sstevel@tonic-gate ibt_status_t (*ibc_free_rdd)(ibc_hca_hdl_t hca, ibc_rdd_hdl_t rdd); 2480Sstevel@tonic-gate 2490Sstevel@tonic-gate /* Address Handle */ 2500Sstevel@tonic-gate ibt_status_t (*ibc_alloc_ah)(ibc_hca_hdl_t hca, ibt_ah_flags_t flags, 2510Sstevel@tonic-gate ibc_pd_hdl_t pd, ibt_adds_vect_t *attr_p, ibc_ah_hdl_t *ah_p); 2520Sstevel@tonic-gate ibt_status_t (*ibc_free_ah)(ibc_hca_hdl_t hca, ibc_ah_hdl_t ah); 2530Sstevel@tonic-gate ibt_status_t (*ibc_query_ah)(ibc_hca_hdl_t hca, ibc_ah_hdl_t ah, 2540Sstevel@tonic-gate ibc_pd_hdl_t *pd_p, ibt_adds_vect_t *attr_p); 2550Sstevel@tonic-gate ibt_status_t (*ibc_modify_ah)(ibc_hca_hdl_t hca, ibc_ah_hdl_t ah, 2560Sstevel@tonic-gate ibt_adds_vect_t *attr_p); 2570Sstevel@tonic-gate 2580Sstevel@tonic-gate /* Queue Pair */ 2590Sstevel@tonic-gate ibt_status_t (*ibc_alloc_qp)(ibc_hca_hdl_t hca, ibtl_qp_hdl_t ibtl_qp, 2600Sstevel@tonic-gate ibt_qp_type_t type, ibt_qp_alloc_attr_t *attr_p, 2610Sstevel@tonic-gate ibt_chan_sizes_t *queue_sizes_p, ib_qpn_t *qpn, ibc_qp_hdl_t *qp_p); 2620Sstevel@tonic-gate ibt_status_t (*ibc_alloc_special_qp)(ibc_hca_hdl_t hca, uint8_t port, 2630Sstevel@tonic-gate ibtl_qp_hdl_t ibt_qp, ibt_sqp_type_t type, 2640Sstevel@tonic-gate ibt_qp_alloc_attr_t *attr_p, ibt_chan_sizes_t *queue_sizes_p, 2650Sstevel@tonic-gate ibc_qp_hdl_t *qp_p); 266*8580SBill.Taylor@Sun.COM ibt_status_t (*ibc_alloc_qp_range)(ibc_hca_hdl_t hca, uint_t log2, 267*8580SBill.Taylor@Sun.COM ibtl_qp_hdl_t *ibtl_qp_p, ibt_qp_type_t type, 268*8580SBill.Taylor@Sun.COM ibt_qp_alloc_attr_t *attr_p, ibt_chan_sizes_t *queue_sizes_p, 269*8580SBill.Taylor@Sun.COM ibc_cq_hdl_t *send_cq_p, ibc_cq_hdl_t *recv_cq_p, 270*8580SBill.Taylor@Sun.COM ib_qpn_t *qpn_p, ibc_qp_hdl_t *qp_p); 2710Sstevel@tonic-gate ibt_status_t (*ibc_free_qp)(ibc_hca_hdl_t hca, ibc_qp_hdl_t qp, 2720Sstevel@tonic-gate ibc_free_qp_flags_t free_qp_flags, ibc_qpn_hdl_t *qpnh_p); 2730Sstevel@tonic-gate ibt_status_t (*ibc_release_qpn)(ibc_hca_hdl_t hca, ibc_qpn_hdl_t qpnh); 2740Sstevel@tonic-gate ibt_status_t (*ibc_query_qp)(ibc_hca_hdl_t hca, ibc_qp_hdl_t qp, 2750Sstevel@tonic-gate ibt_qp_query_attr_t *attr_p); 2760Sstevel@tonic-gate ibt_status_t (*ibc_modify_qp)(ibc_hca_hdl_t hca, ibc_qp_hdl_t qp, 2770Sstevel@tonic-gate ibt_cep_modify_flags_t flags, ibt_qp_info_t *info_p, 2780Sstevel@tonic-gate ibt_queue_sizes_t *actual_sz); 2790Sstevel@tonic-gate 2800Sstevel@tonic-gate /* Completion Queues */ 2810Sstevel@tonic-gate ibt_status_t (*ibc_alloc_cq)(ibc_hca_hdl_t hca, ibt_cq_hdl_t ibt_cq, 2820Sstevel@tonic-gate ibt_cq_attr_t *attr_p, ibc_cq_hdl_t *cq_p, uint_t *actual_size); 2830Sstevel@tonic-gate ibt_status_t (*ibc_free_cq)(ibc_hca_hdl_t hca, ibc_cq_hdl_t cq); 2840Sstevel@tonic-gate ibt_status_t (*ibc_query_cq)(ibc_hca_hdl_t hca, ibc_cq_hdl_t cq, 285*8580SBill.Taylor@Sun.COM uint_t *entries, uint_t *count_p, uint_t *usec_p, 286*8580SBill.Taylor@Sun.COM ibt_cq_handler_id_t *hid_p); 2870Sstevel@tonic-gate ibt_status_t (*ibc_resize_cq)(ibc_hca_hdl_t hca, ibc_cq_hdl_t cq, 2880Sstevel@tonic-gate uint_t size, uint_t *actual_size); 289*8580SBill.Taylor@Sun.COM ibt_status_t (*ibc_modify_cq)(ibc_hca_hdl_t hca, ibc_cq_hdl_t cq, 290*8580SBill.Taylor@Sun.COM uint_t count, uint_t usec, ibt_cq_handler_id_t hid); 2910Sstevel@tonic-gate ibt_status_t (*ibc_alloc_cq_sched)(ibc_hca_hdl_t hca, 2920Sstevel@tonic-gate ibt_cq_sched_flags_t flags, ibc_cq_handler_attr_t *handler_attrs_p); 2930Sstevel@tonic-gate ibt_status_t (*ibc_free_cq_sched)(ibc_hca_hdl_t hca, 2940Sstevel@tonic-gate ibt_cq_handler_id_t id); 2950Sstevel@tonic-gate 2960Sstevel@tonic-gate /* EE Context */ 2970Sstevel@tonic-gate ibt_status_t (*ibc_alloc_eec)(ibc_hca_hdl_t hca, ibc_eec_flags_t flags, 2980Sstevel@tonic-gate ibtl_eec_hdl_t ibtl_eec, ibc_rdd_hdl_t rdd, ibc_eec_hdl_t *eec_p); 2990Sstevel@tonic-gate ibt_status_t (*ibc_free_eec)(ibc_hca_hdl_t hca, ibc_eec_hdl_t eec); 3000Sstevel@tonic-gate ibt_status_t (*ibc_query_eec)(ibc_hca_hdl_t hca, ibc_eec_hdl_t eec, 3010Sstevel@tonic-gate ibt_eec_query_attr_t *attr_p); 3020Sstevel@tonic-gate ibt_status_t (*ibc_modify_eec)(ibc_hca_hdl_t hca, ibc_eec_hdl_t eec, 3030Sstevel@tonic-gate ibt_cep_modify_flags_t flags, ibt_eec_info_t *info_p); 3040Sstevel@tonic-gate 3050Sstevel@tonic-gate /* Memory Registration */ 3060Sstevel@tonic-gate ibt_status_t (*ibc_register_mr)(ibc_hca_hdl_t hca, ibc_pd_hdl_t pd, 3070Sstevel@tonic-gate ibt_mr_attr_t *attr_p, void *ibtl_reserved, ibc_mr_hdl_t *mr_p, 3080Sstevel@tonic-gate ibt_mr_desc_t *mem_desc); 3090Sstevel@tonic-gate ibt_status_t (*ibc_register_buf)(ibc_hca_hdl_t hca, ibc_pd_hdl_t pd, 3100Sstevel@tonic-gate ibt_smr_attr_t *attrp, struct buf *buf, void *ibtl_reserved, 3110Sstevel@tonic-gate ibc_mr_hdl_t *mr_hdl_p, ibt_mr_desc_t *mem_desc); 3120Sstevel@tonic-gate ibt_status_t (*ibc_register_shared_mr)(ibc_hca_hdl_t hca, 3130Sstevel@tonic-gate ibc_mr_hdl_t mr, ibc_pd_hdl_t pd, ibt_smr_attr_t *attr_p, 3140Sstevel@tonic-gate void *ibtl_reserved, ibc_mr_hdl_t *mr_p, ibt_mr_desc_t *mem_desc); 3150Sstevel@tonic-gate ibt_status_t (*ibc_deregister_mr)(ibc_hca_hdl_t hca, ibc_mr_hdl_t mr); 3160Sstevel@tonic-gate ibt_status_t (*ibc_query_mr)(ibc_hca_hdl_t hca, ibc_mr_hdl_t mr, 3170Sstevel@tonic-gate ibt_mr_query_attr_t *info_p); 3180Sstevel@tonic-gate ibt_status_t (*ibc_reregister_mr)(ibc_hca_hdl_t hca, ibc_mr_hdl_t mr, 3190Sstevel@tonic-gate ibc_pd_hdl_t pd, ibt_mr_attr_t *attr_p, void *ibtl_reserved, 3200Sstevel@tonic-gate ibc_mr_hdl_t *mr_p, ibt_mr_desc_t *mem_desc); 3210Sstevel@tonic-gate ibt_status_t (*ibc_reregister_buf)(ibc_hca_hdl_t hca, ibc_mr_hdl_t mr, 3220Sstevel@tonic-gate ibc_pd_hdl_t pd, ibt_smr_attr_t *attrp, struct buf *buf, 3230Sstevel@tonic-gate void *ibtl_reserved, ibc_mr_hdl_t *mr_p, ibt_mr_desc_t *mem_desc); 3240Sstevel@tonic-gate ibt_status_t (*ibc_sync_mr)(ibc_hca_hdl_t hca, 3250Sstevel@tonic-gate ibt_mr_sync_t *mr_segments, size_t num_segments); 3260Sstevel@tonic-gate 3270Sstevel@tonic-gate /* Memory Window */ 3280Sstevel@tonic-gate ibt_status_t (*ibc_alloc_mw)(ibc_hca_hdl_t hca, ibc_pd_hdl_t pd, 3290Sstevel@tonic-gate ibt_mw_flags_t flags, ibc_mw_hdl_t *mw_p, ibt_rkey_t *rkey_p); 3300Sstevel@tonic-gate ibt_status_t (*ibc_free_mw)(ibc_hca_hdl_t hca, ibc_mw_hdl_t mw); 3310Sstevel@tonic-gate ibt_status_t (*ibc_query_mw)(ibc_hca_hdl_t hca, ibc_mw_hdl_t mw, 3320Sstevel@tonic-gate ibt_mw_query_attr_t *mw_attr_p); 3330Sstevel@tonic-gate 3340Sstevel@tonic-gate /* Multicast Group */ 3350Sstevel@tonic-gate ibt_status_t (*ibc_attach_mcg)(ibc_hca_hdl_t hca, ibc_qp_hdl_t qp, 3360Sstevel@tonic-gate ib_gid_t gid, ib_lid_t lid); 3370Sstevel@tonic-gate ibt_status_t (*ibc_detach_mcg)(ibc_hca_hdl_t hca, ibc_qp_hdl_t qp, 3380Sstevel@tonic-gate ib_gid_t gid, ib_lid_t lid); 3390Sstevel@tonic-gate 3400Sstevel@tonic-gate /* WR processing */ 3410Sstevel@tonic-gate ibt_status_t (*ibc_post_send)(ibc_hca_hdl_t hca, ibc_qp_hdl_t qp, 3420Sstevel@tonic-gate ibt_send_wr_t *wr_p, uint_t num_wr, uint_t *num_posted); 3430Sstevel@tonic-gate ibt_status_t (*ibc_post_recv)(ibc_hca_hdl_t hca, ibc_qp_hdl_t qp, 3440Sstevel@tonic-gate ibt_recv_wr_t *wr_p, uint_t num_wr, uint_t *num_posted); 3450Sstevel@tonic-gate ibt_status_t (*ibc_poll_cq)(ibc_hca_hdl_t hca, ibc_cq_hdl_t cq, 3460Sstevel@tonic-gate ibt_wc_t *wc_p, uint_t num_wc, uint_t *num_polled); 3470Sstevel@tonic-gate ibt_status_t (*ibc_notify_cq)(ibc_hca_hdl_t hca, ibc_cq_hdl_t cq, 3480Sstevel@tonic-gate ibt_cq_notify_flags_t flags); 3490Sstevel@tonic-gate 3500Sstevel@tonic-gate /* CI Object Private Data */ 3510Sstevel@tonic-gate ibt_status_t (*ibc_ci_data_in)(ibc_hca_hdl_t hca, 3520Sstevel@tonic-gate ibt_ci_data_flags_t flags, ibt_object_type_t object, 3530Sstevel@tonic-gate void *ibc_object_handle, void *data_p, size_t data_sz); 3540Sstevel@tonic-gate ibt_status_t (*ibc_ci_data_out)(ibc_hca_hdl_t hca, 3550Sstevel@tonic-gate ibt_ci_data_flags_t flags, ibt_object_type_t object, 3560Sstevel@tonic-gate void *ibc_object_handle, void *data_p, size_t data_sz); 3570Sstevel@tonic-gate 3580Sstevel@tonic-gate /* Shared Receive Queues */ 3590Sstevel@tonic-gate ibt_status_t (*ibc_alloc_srq)(ibc_hca_hdl_t hca, ibt_srq_flags_t flags, 3600Sstevel@tonic-gate ibt_srq_hdl_t ibt_srq, ibc_pd_hdl_t pd, ibt_srq_sizes_t *sizes, 3610Sstevel@tonic-gate ibc_srq_hdl_t *ibc_srq_p, ibt_srq_sizes_t *real_size_p); 3620Sstevel@tonic-gate ibt_status_t (*ibc_free_srq)(ibc_hca_hdl_t hca, ibc_srq_hdl_t srq); 3630Sstevel@tonic-gate ibt_status_t (*ibc_query_srq)(ibc_hca_hdl_t hca, ibc_srq_hdl_t srq, 3640Sstevel@tonic-gate ibc_pd_hdl_t *pd_p, ibt_srq_sizes_t *sizes_p, uint_t *limit); 3650Sstevel@tonic-gate ibt_status_t (*ibc_modify_srq)(ibc_hca_hdl_t hca, ibc_srq_hdl_t srq, 3660Sstevel@tonic-gate ibt_srq_modify_flags_t flags, uint_t size, uint_t limit, 3670Sstevel@tonic-gate uint_t *real_size_p); 3680Sstevel@tonic-gate ibt_status_t (*ibc_post_srq)(ibc_hca_hdl_t hca, ibc_srq_hdl_t srq, 3690Sstevel@tonic-gate ibt_recv_wr_t *wr, uint_t num_wr, uint_t *num_posted_p); 3700Sstevel@tonic-gate 3710Sstevel@tonic-gate /* Address translation */ 3720Sstevel@tonic-gate ibt_status_t (*ibc_map_mem_area)(ibc_hca_hdl_t hca_hdl, 3730Sstevel@tonic-gate ibt_va_attr_t *va_attrs, void *ibtl_reserved, 3740Sstevel@tonic-gate uint_t paddr_list_len, ibt_phys_buf_t *paddr_list_p, 375929Ssrust uint_t *num_paddr_p, size_t *paddr_bufsz_p, 376929Ssrust ib_memlen_t *paddr_offset_p, ibc_ma_hdl_t *ma_hdl_p); 3770Sstevel@tonic-gate ibt_status_t (*ibc_unmap_mem_area)(ibc_hca_hdl_t hca_hdl, 3780Sstevel@tonic-gate ibc_ma_hdl_t ma_hdl); 379*8580SBill.Taylor@Sun.COM ibt_status_t (*ibc_map_mem_iov)(ibc_hca_hdl_t hca_hdl, 380*8580SBill.Taylor@Sun.COM ibt_iov_attr_t *iov_attr, ibt_all_wr_t *wr, 381*8580SBill.Taylor@Sun.COM ibc_mi_hdl_t *mi_hdl); 382*8580SBill.Taylor@Sun.COM ibt_status_t (*ibc_unmap_mem_iov)(ibc_hca_hdl_t hca_hdl, 383*8580SBill.Taylor@Sun.COM ibc_mi_hdl_t mi_hdl); 3840Sstevel@tonic-gate 3850Sstevel@tonic-gate /* Allocate L_Key */ 3860Sstevel@tonic-gate ibt_status_t (*ibc_alloc_lkey)(ibc_hca_hdl_t hca_hdl, ibc_pd_hdl_t pd, 3870Sstevel@tonic-gate ibt_lkey_flags_t flags, uint_t phys_buf_list_sz, 3880Sstevel@tonic-gate ibc_mr_hdl_t *mr_p, ibt_pmr_desc_t *mem_desc_p); 3890Sstevel@tonic-gate 3900Sstevel@tonic-gate /* Physical Register Memory Region */ 3910Sstevel@tonic-gate ibt_status_t (*ibc_register_physical_mr)(ibc_hca_hdl_t hca, 3920Sstevel@tonic-gate ibc_pd_hdl_t pd, ibt_pmr_attr_t *mem_pattr, void *ibtl_reserved, 3930Sstevel@tonic-gate ibc_mr_hdl_t *mr_p, ibt_pmr_desc_t *mem_desc_p); 3940Sstevel@tonic-gate ibt_status_t (*ibc_reregister_physical_mr)(ibc_hca_hdl_t hca, 3950Sstevel@tonic-gate ibc_mr_hdl_t mr, ibc_pd_hdl_t pd, ibt_pmr_attr_t *mem_pattr, 3960Sstevel@tonic-gate void *ibtl_reserved, ibc_mr_hdl_t *mr_p, 3970Sstevel@tonic-gate ibt_pmr_desc_t *mem_desc_p); 398929Ssrust 399929Ssrust /* Fast Memory Registration (FMR) */ 400929Ssrust ibt_status_t (*ibc_create_fmr_pool)(ibc_hca_hdl_t hca, ibc_pd_hdl_t pd, 401929Ssrust ibt_fmr_pool_attr_t *fmr_params, ibc_fmr_pool_hdl_t *fmr_pool_p); 402929Ssrust ibt_status_t (*ibc_destroy_fmr_pool)(ibc_hca_hdl_t hca, 403929Ssrust ibc_fmr_pool_hdl_t fmr_pool); 404929Ssrust ibt_status_t (*ibc_flush_fmr_pool)(ibc_hca_hdl_t hca, 405929Ssrust ibc_fmr_pool_hdl_t fmr_pool); 406929Ssrust ibt_status_t (*ibc_register_physical_fmr)(ibc_hca_hdl_t hca, 407929Ssrust ibc_fmr_pool_hdl_t fmr_pool, ibt_pmr_attr_t *mem_pattr, 408929Ssrust void *ibtl_reserved, ibc_mr_hdl_t *mr_hdl_p, 409929Ssrust ibt_pmr_desc_t *mem_desc_p); 410929Ssrust ibt_status_t (*ibc_deregister_fmr)(ibc_hca_hdl_t hca, ibc_mr_hdl_t mr); 411*8580SBill.Taylor@Sun.COM 412*8580SBill.Taylor@Sun.COM /* IO memory management */ 413*8580SBill.Taylor@Sun.COM ibt_status_t (*ibc_alloc_io_mem)(ibc_hca_hdl_t hca_hdl, size_t size, 414*8580SBill.Taylor@Sun.COM ibt_mr_flags_t mr_flag, caddr_t *kaddrp, 415*8580SBill.Taylor@Sun.COM ibc_mem_alloc_hdl_t *mem_alloc_hdl); 416*8580SBill.Taylor@Sun.COM ibt_status_t (*ibc_free_io_mem)(ibc_hca_hdl_t hca_hdl, 417*8580SBill.Taylor@Sun.COM ibc_mem_alloc_hdl_t mem_alloc_hdl); 418*8580SBill.Taylor@Sun.COM 419*8580SBill.Taylor@Sun.COM /* Extended RC (XRC) */ 420*8580SBill.Taylor@Sun.COM ibt_status_t (*ibc_alloc_xrc_domain)(); 421*8580SBill.Taylor@Sun.COM ibt_status_t (*ibc_free_xrc_domain)(); 422*8580SBill.Taylor@Sun.COM ibt_status_t (*ibc_alloc_xrc_srq)(); 423*8580SBill.Taylor@Sun.COM ibt_status_t (*ibc_free_xrc_srq)(); 424*8580SBill.Taylor@Sun.COM ibt_status_t (*ibc_query_xrc_srq)(); 425*8580SBill.Taylor@Sun.COM ibt_status_t (*ibc_modify_xrc_srq)(); 426*8580SBill.Taylor@Sun.COM ibt_status_t (*ibc_alloc_xrc_tgt_qp)(); 427*8580SBill.Taylor@Sun.COM ibt_status_t (*ibc_free_xrc_tgt_qp)(); 428*8580SBill.Taylor@Sun.COM ibt_status_t (*ibc_query_xrc_tgt_qp)(); 429*8580SBill.Taylor@Sun.COM ibt_status_t (*ibc_modify_xrc_tgt_qp)(); 4300Sstevel@tonic-gate } ibc_operations_t; 4310Sstevel@tonic-gate 4320Sstevel@tonic-gate 4330Sstevel@tonic-gate /* 4340Sstevel@tonic-gate * The ibc_hca_info_s structure is used for HCA drivers to communicate its 4350Sstevel@tonic-gate * HCA specific information to IBTF when it attaches a device via ibc_attach(). 4360Sstevel@tonic-gate * 4370Sstevel@tonic-gate * IBTF assumes that the structures pointed to by the hca_ops and hca_attr 4380Sstevel@tonic-gate * structure members are persistent. 4390Sstevel@tonic-gate */ 4400Sstevel@tonic-gate typedef struct ibc_hca_info_s { 4410Sstevel@tonic-gate ibc_version_t hca_ci_vers; /* CI Version */ 4420Sstevel@tonic-gate dev_info_t *hca_dip; /* HCA dev_info */ 4430Sstevel@tonic-gate ibc_hca_hdl_t hca_handle; /* used for call through */ 4440Sstevel@tonic-gate /* "hca_ops" */ 4450Sstevel@tonic-gate ibc_operations_t *hca_ops; 4460Sstevel@tonic-gate ibt_hca_attr_t *hca_attr; 4470Sstevel@tonic-gate ibc_cq_handler_attr_t hca_def_cq_handler_attr; 4480Sstevel@tonic-gate } ibc_hca_info_t; 4490Sstevel@tonic-gate 4500Sstevel@tonic-gate 4510Sstevel@tonic-gate /* Channel Interface return status */ 4520Sstevel@tonic-gate typedef enum ibc_status_e { 4530Sstevel@tonic-gate IBC_SUCCESS = 0, 4540Sstevel@tonic-gate IBC_FAILURE = 1 4550Sstevel@tonic-gate } ibc_status_t; 4560Sstevel@tonic-gate 4570Sstevel@tonic-gate /* 4580Sstevel@tonic-gate * CI up-calls to IBTF. 4590Sstevel@tonic-gate */ 4600Sstevel@tonic-gate 4610Sstevel@tonic-gate /* 4620Sstevel@tonic-gate * ibc_init 4630Sstevel@tonic-gate * Registers CI clients with the Solaris I/O framework 4640Sstevel@tonic-gate * 4650Sstevel@tonic-gate * ibc_fini 4660Sstevel@tonic-gate * Un-Registers CI clients with the Solaris I/O framework 4670Sstevel@tonic-gate */ 4680Sstevel@tonic-gate int ibc_init(struct modlinkage *modlp); 4690Sstevel@tonic-gate void ibc_fini(struct modlinkage *modlp); 4700Sstevel@tonic-gate 4710Sstevel@tonic-gate /* 4720Sstevel@tonic-gate * ibc_attach 473401Shiremath * Register HCA device with IBTF. During this call HCA driver provides 474401Shiremath * driver's information neededby IBTF. 4750Sstevel@tonic-gate * 4760Sstevel@tonic-gate * ibc_post_attach 4770Sstevel@tonic-gate * After a successful ibc_attach, this must be called. 4780Sstevel@tonic-gate * 4790Sstevel@tonic-gate * ibc_pre_detach 4800Sstevel@tonic-gate * Attempt to De-Register HCA Device from IBTF. 4810Sstevel@tonic-gate * This requires the cooperation of IBTF clients to 4820Sstevel@tonic-gate * stop using this HCA. Upon success, the HCA driver 4830Sstevel@tonic-gate * is committed to calling ibc_detach. 4840Sstevel@tonic-gate * 4850Sstevel@tonic-gate * ibc_detach 4860Sstevel@tonic-gate * De-Register HCA Device from IBTF. 4870Sstevel@tonic-gate * This function will succeed if ibc_pre_detach has previously 4880Sstevel@tonic-gate * succeeded for this device. 4890Sstevel@tonic-gate */ 4900Sstevel@tonic-gate ibc_status_t ibc_attach(ibc_clnt_hdl_t *ibc_hdl_p, ibc_hca_info_t *info_p); 4910Sstevel@tonic-gate void ibc_post_attach(ibc_clnt_hdl_t ibc_hdl); 4920Sstevel@tonic-gate ibc_status_t ibc_pre_detach(ibc_clnt_hdl_t ibc_hdl, ddi_detach_cmd_t cmd); 4930Sstevel@tonic-gate void ibc_detach(ibc_clnt_hdl_t ibc_hdl); 4940Sstevel@tonic-gate 4950Sstevel@tonic-gate /* 4960Sstevel@tonic-gate * ibc_cq_handler 4970Sstevel@tonic-gate * IBTF Completion Queue Notification Handler. 4980Sstevel@tonic-gate */ 4990Sstevel@tonic-gate void ibc_cq_handler(ibc_clnt_hdl_t ibc_hdl, ibt_cq_hdl_t ibt_cq); 5000Sstevel@tonic-gate 5010Sstevel@tonic-gate /* 5020Sstevel@tonic-gate * ibc_async_handler 5030Sstevel@tonic-gate * IBTF Asynchronous event/error handler. 5040Sstevel@tonic-gate */ 5050Sstevel@tonic-gate void ibc_async_handler(ibc_clnt_hdl_t ibc_hdl, ibt_async_code_t code, 5060Sstevel@tonic-gate ibc_async_event_t *event_p); 507401Shiremath 5080Sstevel@tonic-gate /* 5090Sstevel@tonic-gate * ibc_memory_handler 5100Sstevel@tonic-gate * IBTF memory event/error handler. 5110Sstevel@tonic-gate */ 5120Sstevel@tonic-gate void ibc_memory_handler(ibc_clnt_hdl_t ibc_hdl, ibt_mem_code_t code, 5130Sstevel@tonic-gate ibt_mem_data_t *data_p, void *ibtl_reserved); 5140Sstevel@tonic-gate 5150Sstevel@tonic-gate /* 5160Sstevel@tonic-gate * ibc_get_ci_failure() 5170Sstevel@tonic-gate * 5180Sstevel@tonic-gate * Used to obtain a special IBTF failure code for CI specific failures, 5190Sstevel@tonic-gate * failures other than those defined in ibt_status_t. 5200Sstevel@tonic-gate */ 5210Sstevel@tonic-gate ibt_status_t ibc_get_ci_failure(uint64_t ena); 5220Sstevel@tonic-gate 5230Sstevel@tonic-gate #ifdef __cplusplus 5240Sstevel@tonic-gate } 5250Sstevel@tonic-gate #endif 5260Sstevel@tonic-gate 5270Sstevel@tonic-gate #endif /* _SYS_IB_IBTL_IBCI_H */ 528