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 50Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 60Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 70Sstevel@tonic-gate * with the License. 80Sstevel@tonic-gate * 90Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 100Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 110Sstevel@tonic-gate * See the License for the specific language governing permissions 120Sstevel@tonic-gate * and limitations under the License. 130Sstevel@tonic-gate * 140Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 150Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 160Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 170Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 180Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 190Sstevel@tonic-gate * 200Sstevel@tonic-gate * CDDL HEADER END 210Sstevel@tonic-gate */ 220Sstevel@tonic-gate /* 23401Shiremath * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 240Sstevel@tonic-gate * Use is subject to license terms. 250Sstevel@tonic-gate */ 260Sstevel@tonic-gate 270Sstevel@tonic-gate #ifndef _SYS_IB_IBTL_IBCI_H 280Sstevel@tonic-gate #define _SYS_IB_IBTL_IBCI_H 290Sstevel@tonic-gate 300Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 310Sstevel@tonic-gate 320Sstevel@tonic-gate /* 330Sstevel@tonic-gate * ibci.h 340Sstevel@tonic-gate * 350Sstevel@tonic-gate * Define the data structures and function prototypes that comprise 360Sstevel@tonic-gate * the IB Channel API (API for HCA drivers). All CI handles are opaque 370Sstevel@tonic-gate * to the IBTF here, real data is accessed in the HCA driver by a 380Sstevel@tonic-gate * typecast to a driver specific struct. 390Sstevel@tonic-gate */ 400Sstevel@tonic-gate 410Sstevel@tonic-gate #include <sys/ib/ibtl/ibtl_types.h> 420Sstevel@tonic-gate #include <sys/ib/ibtl/ibtl_ci_types.h> 430Sstevel@tonic-gate #include <sys/modctl.h> 440Sstevel@tonic-gate 450Sstevel@tonic-gate 460Sstevel@tonic-gate #ifdef __cplusplus 470Sstevel@tonic-gate extern "C" { 480Sstevel@tonic-gate #endif 490Sstevel@tonic-gate 500Sstevel@tonic-gate /* 510Sstevel@tonic-gate * Define CI opaque IBTF handles. 520Sstevel@tonic-gate */ 530Sstevel@tonic-gate typedef struct ibtl_qp_s *ibtl_qp_hdl_t; /* ibt_alloc_qp() */ 540Sstevel@tonic-gate typedef struct ibtl_eec_s *ibtl_eec_hdl_t; /* ibt_alloc_eec() */ 550Sstevel@tonic-gate 560Sstevel@tonic-gate /* 570Sstevel@tonic-gate * Define IBTF opaque CI handles. 580Sstevel@tonic-gate */ 590Sstevel@tonic-gate typedef struct ibc_hca_s *ibc_hca_hdl_t; /* HCA/CI Handle */ 600Sstevel@tonic-gate typedef struct ibc_pd_s *ibc_pd_hdl_t; /* Protection Domain Handle */ 610Sstevel@tonic-gate typedef struct ibc_rdd_s *ibc_rdd_hdl_t; /* Reliable Datagram Domain */ 620Sstevel@tonic-gate typedef struct ibc_ah_s *ibc_ah_hdl_t; /* Address Handle */ 630Sstevel@tonic-gate typedef struct ibc_qp_s *ibc_qp_hdl_t; /* Queue Pair Handle */ 640Sstevel@tonic-gate typedef struct ibc_srq_s *ibc_srq_hdl_t; /* Shared Receive Queue Hdl */ 650Sstevel@tonic-gate typedef struct ibc_qpn_s *ibc_qpn_hdl_t; /* Queue Pair Number Handle */ 660Sstevel@tonic-gate typedef struct ibc_cq_s *ibc_cq_hdl_t; /* Completion Queue Handle */ 670Sstevel@tonic-gate typedef struct ibc_eec_s *ibc_eec_hdl_t; /* End-to-End Context Handle */ 680Sstevel@tonic-gate 69*929Ssrust #define ibc_fmr_pool_hdl_t ibt_fmr_pool_hdl_t /* FMR Pool Handle */ 700Sstevel@tonic-gate #define ibc_mr_hdl_t ibt_mr_hdl_t /* Memory Region Handle */ 710Sstevel@tonic-gate #define ibc_mw_hdl_t ibt_mw_hdl_t /* Memory Window Handle */ 720Sstevel@tonic-gate #define ibc_ma_hdl_t ibt_ma_hdl_t /* Memory Area Handle */ 730Sstevel@tonic-gate 740Sstevel@tonic-gate /* Handle used by CI for up calls to IBTF */ 750Sstevel@tonic-gate typedef struct ibtl_hca_devinfo_s *ibc_clnt_hdl_t; /* ibc_attach() */ 760Sstevel@tonic-gate 770Sstevel@tonic-gate /* 780Sstevel@tonic-gate * Fields opaque to TI, but visible to CI 790Sstevel@tonic-gate */ 800Sstevel@tonic-gate 810Sstevel@tonic-gate /* 820Sstevel@tonic-gate * ibt_qp_alloc_attr_t 830Sstevel@tonic-gate */ 840Sstevel@tonic-gate #define qp_ibc_scq_hdl qp_opaque1 850Sstevel@tonic-gate #define qp_ibc_rcq_hdl qp_opaque2 860Sstevel@tonic-gate #define qp_ibc_srq_hdl qp_opaque3 870Sstevel@tonic-gate 880Sstevel@tonic-gate 890Sstevel@tonic-gate /* 900Sstevel@tonic-gate * ibt_status_t 910Sstevel@tonic-gate */ 920Sstevel@tonic-gate #define IBT_HCA_RAWD_CHAN_EXCEEDED IBT_ERR_OPAQUE1 /* Requested raw QP */ 930Sstevel@tonic-gate /* exceeds HCA max */ 940Sstevel@tonic-gate /* limit */ 950Sstevel@tonic-gate #define IBT_CHAN_RAWD_NOT_SUPPORTED IBT_ERR_OPAQUE2 /* Raw datagram QPs */ 960Sstevel@tonic-gate /* not supported */ 970Sstevel@tonic-gate #define IBT_CHAN_RD_NOT_SUPPORTED IBT_ERR_OPAQUE3 /* RD not supported */ 980Sstevel@tonic-gate #define IBT_EEC_HDL_INVALID IBT_ERR_OPAQUE4 /* Invalid EEC handle */ 990Sstevel@tonic-gate #define IBT_EEC_STATE_INVALID IBT_ERR_OPAQUE5 /* Invalid EEC State */ 1000Sstevel@tonic-gate #define IBT_EEC_ATTR_RO IBT_ERR_OPAQUE6 /* Can't Change EEC */ 1010Sstevel@tonic-gate /* Attribute */ 1020Sstevel@tonic-gate #define IBT_RDD_IN_USE IBT_ERR_OPAQUE7 /* RDD in Use */ 1030Sstevel@tonic-gate #define IBT_RDD_HDL_INVALID IBT_ERR_OPAQUE8 /* Invalid RDD */ 1040Sstevel@tonic-gate #define IBT_RNR_NAK_TIMER_INVALID IBT_ERR_OPAQUE9 /* Invalid RNR NAK */ 1050Sstevel@tonic-gate /* Timer Value */ 1060Sstevel@tonic-gate #define IBT_RDD_NOT_SUPPORTED IBT_ERR_OPAQUE10 1070Sstevel@tonic-gate 1080Sstevel@tonic-gate 1090Sstevel@tonic-gate /* 1100Sstevel@tonic-gate * ibt_wc_status_t 1110Sstevel@tonic-gate */ 1120Sstevel@tonic-gate #define IBT_WC_LOCAL_EEC_OP_ERR 12 /* Internal consistency error */ 1130Sstevel@tonic-gate #define IBT_WC_LOCAL_RDD_VIOLATION_ERR 30 /* The RDD associated with */ 1140Sstevel@tonic-gate /* the QP does not match */ 1150Sstevel@tonic-gate /* the RDD associated with */ 1160Sstevel@tonic-gate /* the EE Context */ 1170Sstevel@tonic-gate #define IBT_WC_REMOTE_RD_REQ_INVALID 31 /* Detected an invalid */ 1180Sstevel@tonic-gate /* incoming RD message */ 1190Sstevel@tonic-gate #define IBT_WC_EEC_REMOTE_ABORTED 32 /* Requester aborted the */ 1200Sstevel@tonic-gate /* operation */ 1210Sstevel@tonic-gate #define IBT_WC_EEC_NUM_INVALID 33 /* Invalid EEC Number */ 1220Sstevel@tonic-gate /* detected */ 1230Sstevel@tonic-gate #define IBT_WC_EEC_STATE_INVALID 34 /* Invalid EEC state */ 1240Sstevel@tonic-gate 1250Sstevel@tonic-gate /* 1260Sstevel@tonic-gate * ibt_async_code_t 1270Sstevel@tonic-gate */ 1280Sstevel@tonic-gate #define IBT_EVENT_PATH_MIGRATED_EEC IBT_ASYNC_OPAQUE1 1290Sstevel@tonic-gate #define IBT_ERROR_CATASTROPHIC_EEC IBT_ASYNC_OPAQUE3 1300Sstevel@tonic-gate #define IBT_ERROR_PATH_MIGRATE_REQ_EEC IBT_ASYNC_OPAQUE4 1310Sstevel@tonic-gate 1320Sstevel@tonic-gate /* 1330Sstevel@tonic-gate * ibt_object_type_t 1340Sstevel@tonic-gate */ 1350Sstevel@tonic-gate #define IBT_HDL_EEC IBT_HDL_OPAQUE1 1360Sstevel@tonic-gate #define IBT_HDL_RDD IBT_HDL_OPAQUE2 1370Sstevel@tonic-gate 1380Sstevel@tonic-gate 1390Sstevel@tonic-gate /* 1400Sstevel@tonic-gate * ibt_hca_attr_t 1410Sstevel@tonic-gate */ 1420Sstevel@tonic-gate #define hca_max_rdd hca_opaque2 /* Max RDDs in HCA */ 1430Sstevel@tonic-gate #define hca_max_eec hca_opaque3 /* Max EEContexts in HCA */ 1440Sstevel@tonic-gate #define hca_max_rd_sgl hca_opaque4 /* Max SGL entries per RD WR */ 1450Sstevel@tonic-gate #define hca_max_rdma_in_ee hca_opaque5 /* Max RDMA Reads/Atomics in */ 1460Sstevel@tonic-gate /* per EEC with HCA as target */ 1470Sstevel@tonic-gate #define hca_max_rdma_out_ee hca_opaque6 /* Max RDMA Reads/Atomics out */ 1480Sstevel@tonic-gate /* per EE by this HCA */ 1490Sstevel@tonic-gate #define hca_max_ipv6_qp hca_max_ipv6_chan 1500Sstevel@tonic-gate #define hca_max_ether_qp hca_max_ether_chan 1510Sstevel@tonic-gate #define hca_eec_max_ci_priv_sz hca_opaque7 1520Sstevel@tonic-gate #define hca_rdd_max_ci_priv_sz hca_opaque8 153*929Ssrust #define hca_max_map_per_fmr hca_opaque9 1540Sstevel@tonic-gate 1550Sstevel@tonic-gate 1560Sstevel@tonic-gate /* 1570Sstevel@tonic-gate * ibt_wc_t 1580Sstevel@tonic-gate */ 1590Sstevel@tonic-gate #define wc_eecn wc_opaque3 /* End-to-End Context RD's only */ 1600Sstevel@tonic-gate 1610Sstevel@tonic-gate 1620Sstevel@tonic-gate /* Channel Interface version */ 1630Sstevel@tonic-gate typedef enum ibc_version_e { 164*929Ssrust IBCI_V1 = 1, 165*929Ssrust IBCI_V2 = 2 /* FMR Support */ 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 uint8_t ev_port; /* Valid for PORT UP/DOWN events */ 2250Sstevel@tonic-gate ibt_srq_hdl_t ev_srq_hdl; /* SRQ handle */ 2260Sstevel@tonic-gate } ibc_async_event_t; 2270Sstevel@tonic-gate 2280Sstevel@tonic-gate 2290Sstevel@tonic-gate typedef struct ibc_operations_s { 2300Sstevel@tonic-gate /* HCA */ 2310Sstevel@tonic-gate ibt_status_t (*ibc_query_hca_ports)(ibc_hca_hdl_t hca, uint8_t port, 2320Sstevel@tonic-gate ibt_hca_portinfo_t *info_p); 2330Sstevel@tonic-gate ibt_status_t (*ibc_modify_ports)(ibc_hca_hdl_t hca, uint8_t port, 2340Sstevel@tonic-gate ibt_port_modify_flags_t flags, uint8_t init_type); 2350Sstevel@tonic-gate ibt_status_t (*ibc_modify_system_image)(ibc_hca_hdl_t hca, 2360Sstevel@tonic-gate ib_guid_t sys_guid); 2370Sstevel@tonic-gate 2380Sstevel@tonic-gate /* Protection Domain */ 2390Sstevel@tonic-gate ibt_status_t (*ibc_alloc_pd)(ibc_hca_hdl_t hca, ibt_pd_flags_t flags, 2400Sstevel@tonic-gate ibc_pd_hdl_t *pd_p); 2410Sstevel@tonic-gate ibt_status_t (*ibc_free_pd)(ibc_hca_hdl_t hca, ibc_pd_hdl_t pd); 2420Sstevel@tonic-gate 2430Sstevel@tonic-gate /* Reliable Datagram Domain */ 2440Sstevel@tonic-gate ibt_status_t (*ibc_alloc_rdd)(ibc_hca_hdl_t hca, ibc_rdd_flags_t flags, 2450Sstevel@tonic-gate ibc_rdd_hdl_t *rdd_p); 2460Sstevel@tonic-gate ibt_status_t (*ibc_free_rdd)(ibc_hca_hdl_t hca, ibc_rdd_hdl_t rdd); 2470Sstevel@tonic-gate 2480Sstevel@tonic-gate /* Address Handle */ 2490Sstevel@tonic-gate ibt_status_t (*ibc_alloc_ah)(ibc_hca_hdl_t hca, ibt_ah_flags_t flags, 2500Sstevel@tonic-gate ibc_pd_hdl_t pd, ibt_adds_vect_t *attr_p, ibc_ah_hdl_t *ah_p); 2510Sstevel@tonic-gate ibt_status_t (*ibc_free_ah)(ibc_hca_hdl_t hca, ibc_ah_hdl_t ah); 2520Sstevel@tonic-gate ibt_status_t (*ibc_query_ah)(ibc_hca_hdl_t hca, ibc_ah_hdl_t ah, 2530Sstevel@tonic-gate ibc_pd_hdl_t *pd_p, ibt_adds_vect_t *attr_p); 2540Sstevel@tonic-gate ibt_status_t (*ibc_modify_ah)(ibc_hca_hdl_t hca, ibc_ah_hdl_t ah, 2550Sstevel@tonic-gate ibt_adds_vect_t *attr_p); 2560Sstevel@tonic-gate 2570Sstevel@tonic-gate /* Queue Pair */ 2580Sstevel@tonic-gate ibt_status_t (*ibc_alloc_qp)(ibc_hca_hdl_t hca, ibtl_qp_hdl_t ibtl_qp, 2590Sstevel@tonic-gate ibt_qp_type_t type, ibt_qp_alloc_attr_t *attr_p, 2600Sstevel@tonic-gate ibt_chan_sizes_t *queue_sizes_p, ib_qpn_t *qpn, ibc_qp_hdl_t *qp_p); 2610Sstevel@tonic-gate ibt_status_t (*ibc_alloc_special_qp)(ibc_hca_hdl_t hca, uint8_t port, 2620Sstevel@tonic-gate ibtl_qp_hdl_t ibt_qp, ibt_sqp_type_t type, 2630Sstevel@tonic-gate ibt_qp_alloc_attr_t *attr_p, ibt_chan_sizes_t *queue_sizes_p, 2640Sstevel@tonic-gate ibc_qp_hdl_t *qp_p); 2650Sstevel@tonic-gate ibt_status_t (*ibc_free_qp)(ibc_hca_hdl_t hca, ibc_qp_hdl_t qp, 2660Sstevel@tonic-gate ibc_free_qp_flags_t free_qp_flags, ibc_qpn_hdl_t *qpnh_p); 2670Sstevel@tonic-gate ibt_status_t (*ibc_release_qpn)(ibc_hca_hdl_t hca, ibc_qpn_hdl_t qpnh); 2680Sstevel@tonic-gate ibt_status_t (*ibc_query_qp)(ibc_hca_hdl_t hca, ibc_qp_hdl_t qp, 2690Sstevel@tonic-gate ibt_qp_query_attr_t *attr_p); 2700Sstevel@tonic-gate ibt_status_t (*ibc_modify_qp)(ibc_hca_hdl_t hca, ibc_qp_hdl_t qp, 2710Sstevel@tonic-gate ibt_cep_modify_flags_t flags, ibt_qp_info_t *info_p, 2720Sstevel@tonic-gate ibt_queue_sizes_t *actual_sz); 2730Sstevel@tonic-gate 2740Sstevel@tonic-gate /* Completion Queues */ 2750Sstevel@tonic-gate ibt_status_t (*ibc_alloc_cq)(ibc_hca_hdl_t hca, ibt_cq_hdl_t ibt_cq, 2760Sstevel@tonic-gate ibt_cq_attr_t *attr_p, ibc_cq_hdl_t *cq_p, uint_t *actual_size); 2770Sstevel@tonic-gate ibt_status_t (*ibc_free_cq)(ibc_hca_hdl_t hca, ibc_cq_hdl_t cq); 2780Sstevel@tonic-gate ibt_status_t (*ibc_query_cq)(ibc_hca_hdl_t hca, ibc_cq_hdl_t cq, 2790Sstevel@tonic-gate uint_t *entries); 2800Sstevel@tonic-gate ibt_status_t (*ibc_resize_cq)(ibc_hca_hdl_t hca, ibc_cq_hdl_t cq, 2810Sstevel@tonic-gate uint_t size, uint_t *actual_size); 2820Sstevel@tonic-gate ibt_status_t (*ibc_alloc_cq_sched)(ibc_hca_hdl_t hca, 2830Sstevel@tonic-gate ibt_cq_sched_flags_t flags, ibc_cq_handler_attr_t *handler_attrs_p); 2840Sstevel@tonic-gate ibt_status_t (*ibc_free_cq_sched)(ibc_hca_hdl_t hca, 2850Sstevel@tonic-gate ibt_cq_handler_id_t id); 2860Sstevel@tonic-gate 2870Sstevel@tonic-gate /* EE Context */ 2880Sstevel@tonic-gate ibt_status_t (*ibc_alloc_eec)(ibc_hca_hdl_t hca, ibc_eec_flags_t flags, 2890Sstevel@tonic-gate ibtl_eec_hdl_t ibtl_eec, ibc_rdd_hdl_t rdd, ibc_eec_hdl_t *eec_p); 2900Sstevel@tonic-gate ibt_status_t (*ibc_free_eec)(ibc_hca_hdl_t hca, ibc_eec_hdl_t eec); 2910Sstevel@tonic-gate ibt_status_t (*ibc_query_eec)(ibc_hca_hdl_t hca, ibc_eec_hdl_t eec, 2920Sstevel@tonic-gate ibt_eec_query_attr_t *attr_p); 2930Sstevel@tonic-gate ibt_status_t (*ibc_modify_eec)(ibc_hca_hdl_t hca, ibc_eec_hdl_t eec, 2940Sstevel@tonic-gate ibt_cep_modify_flags_t flags, ibt_eec_info_t *info_p); 2950Sstevel@tonic-gate 2960Sstevel@tonic-gate /* Memory Registration */ 2970Sstevel@tonic-gate ibt_status_t (*ibc_register_mr)(ibc_hca_hdl_t hca, ibc_pd_hdl_t pd, 2980Sstevel@tonic-gate ibt_mr_attr_t *attr_p, void *ibtl_reserved, ibc_mr_hdl_t *mr_p, 2990Sstevel@tonic-gate ibt_mr_desc_t *mem_desc); 3000Sstevel@tonic-gate ibt_status_t (*ibc_register_buf)(ibc_hca_hdl_t hca, ibc_pd_hdl_t pd, 3010Sstevel@tonic-gate ibt_smr_attr_t *attrp, struct buf *buf, void *ibtl_reserved, 3020Sstevel@tonic-gate ibc_mr_hdl_t *mr_hdl_p, ibt_mr_desc_t *mem_desc); 3030Sstevel@tonic-gate ibt_status_t (*ibc_register_shared_mr)(ibc_hca_hdl_t hca, 3040Sstevel@tonic-gate ibc_mr_hdl_t mr, ibc_pd_hdl_t pd, ibt_smr_attr_t *attr_p, 3050Sstevel@tonic-gate void *ibtl_reserved, ibc_mr_hdl_t *mr_p, ibt_mr_desc_t *mem_desc); 3060Sstevel@tonic-gate ibt_status_t (*ibc_deregister_mr)(ibc_hca_hdl_t hca, ibc_mr_hdl_t mr); 3070Sstevel@tonic-gate ibt_status_t (*ibc_query_mr)(ibc_hca_hdl_t hca, ibc_mr_hdl_t mr, 3080Sstevel@tonic-gate ibt_mr_query_attr_t *info_p); 3090Sstevel@tonic-gate ibt_status_t (*ibc_reregister_mr)(ibc_hca_hdl_t hca, ibc_mr_hdl_t mr, 3100Sstevel@tonic-gate ibc_pd_hdl_t pd, ibt_mr_attr_t *attr_p, void *ibtl_reserved, 3110Sstevel@tonic-gate ibc_mr_hdl_t *mr_p, ibt_mr_desc_t *mem_desc); 3120Sstevel@tonic-gate ibt_status_t (*ibc_reregister_buf)(ibc_hca_hdl_t hca, ibc_mr_hdl_t mr, 3130Sstevel@tonic-gate ibc_pd_hdl_t pd, ibt_smr_attr_t *attrp, struct buf *buf, 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_sync_mr)(ibc_hca_hdl_t hca, 3160Sstevel@tonic-gate ibt_mr_sync_t *mr_segments, size_t num_segments); 3170Sstevel@tonic-gate 3180Sstevel@tonic-gate /* Memory Window */ 3190Sstevel@tonic-gate ibt_status_t (*ibc_alloc_mw)(ibc_hca_hdl_t hca, ibc_pd_hdl_t pd, 3200Sstevel@tonic-gate ibt_mw_flags_t flags, ibc_mw_hdl_t *mw_p, ibt_rkey_t *rkey_p); 3210Sstevel@tonic-gate ibt_status_t (*ibc_free_mw)(ibc_hca_hdl_t hca, ibc_mw_hdl_t mw); 3220Sstevel@tonic-gate ibt_status_t (*ibc_query_mw)(ibc_hca_hdl_t hca, ibc_mw_hdl_t mw, 3230Sstevel@tonic-gate ibt_mw_query_attr_t *mw_attr_p); 3240Sstevel@tonic-gate 3250Sstevel@tonic-gate /* Multicast Group */ 3260Sstevel@tonic-gate ibt_status_t (*ibc_attach_mcg)(ibc_hca_hdl_t hca, ibc_qp_hdl_t qp, 3270Sstevel@tonic-gate ib_gid_t gid, ib_lid_t lid); 3280Sstevel@tonic-gate ibt_status_t (*ibc_detach_mcg)(ibc_hca_hdl_t hca, ibc_qp_hdl_t qp, 3290Sstevel@tonic-gate ib_gid_t gid, ib_lid_t lid); 3300Sstevel@tonic-gate 3310Sstevel@tonic-gate /* WR processing */ 3320Sstevel@tonic-gate ibt_status_t (*ibc_post_send)(ibc_hca_hdl_t hca, ibc_qp_hdl_t qp, 3330Sstevel@tonic-gate ibt_send_wr_t *wr_p, uint_t num_wr, uint_t *num_posted); 3340Sstevel@tonic-gate ibt_status_t (*ibc_post_recv)(ibc_hca_hdl_t hca, ibc_qp_hdl_t qp, 3350Sstevel@tonic-gate ibt_recv_wr_t *wr_p, uint_t num_wr, uint_t *num_posted); 3360Sstevel@tonic-gate ibt_status_t (*ibc_poll_cq)(ibc_hca_hdl_t hca, ibc_cq_hdl_t cq, 3370Sstevel@tonic-gate ibt_wc_t *wc_p, uint_t num_wc, uint_t *num_polled); 3380Sstevel@tonic-gate ibt_status_t (*ibc_notify_cq)(ibc_hca_hdl_t hca, ibc_cq_hdl_t cq, 3390Sstevel@tonic-gate ibt_cq_notify_flags_t flags); 3400Sstevel@tonic-gate 3410Sstevel@tonic-gate /* CI Object Private Data */ 3420Sstevel@tonic-gate ibt_status_t (*ibc_ci_data_in)(ibc_hca_hdl_t hca, 3430Sstevel@tonic-gate ibt_ci_data_flags_t flags, ibt_object_type_t object, 3440Sstevel@tonic-gate void *ibc_object_handle, void *data_p, size_t data_sz); 3450Sstevel@tonic-gate ibt_status_t (*ibc_ci_data_out)(ibc_hca_hdl_t hca, 3460Sstevel@tonic-gate ibt_ci_data_flags_t flags, ibt_object_type_t object, 3470Sstevel@tonic-gate void *ibc_object_handle, void *data_p, size_t data_sz); 3480Sstevel@tonic-gate 3490Sstevel@tonic-gate /* Shared Receive Queues */ 3500Sstevel@tonic-gate ibt_status_t (*ibc_alloc_srq)(ibc_hca_hdl_t hca, ibt_srq_flags_t flags, 3510Sstevel@tonic-gate ibt_srq_hdl_t ibt_srq, ibc_pd_hdl_t pd, ibt_srq_sizes_t *sizes, 3520Sstevel@tonic-gate ibc_srq_hdl_t *ibc_srq_p, ibt_srq_sizes_t *real_size_p); 3530Sstevel@tonic-gate ibt_status_t (*ibc_free_srq)(ibc_hca_hdl_t hca, ibc_srq_hdl_t srq); 3540Sstevel@tonic-gate ibt_status_t (*ibc_query_srq)(ibc_hca_hdl_t hca, ibc_srq_hdl_t srq, 3550Sstevel@tonic-gate ibc_pd_hdl_t *pd_p, ibt_srq_sizes_t *sizes_p, uint_t *limit); 3560Sstevel@tonic-gate ibt_status_t (*ibc_modify_srq)(ibc_hca_hdl_t hca, ibc_srq_hdl_t srq, 3570Sstevel@tonic-gate ibt_srq_modify_flags_t flags, uint_t size, uint_t limit, 3580Sstevel@tonic-gate uint_t *real_size_p); 3590Sstevel@tonic-gate ibt_status_t (*ibc_post_srq)(ibc_hca_hdl_t hca, ibc_srq_hdl_t srq, 3600Sstevel@tonic-gate ibt_recv_wr_t *wr, uint_t num_wr, uint_t *num_posted_p); 3610Sstevel@tonic-gate 3620Sstevel@tonic-gate /* Address translation */ 3630Sstevel@tonic-gate ibt_status_t (*ibc_map_mem_area)(ibc_hca_hdl_t hca_hdl, 3640Sstevel@tonic-gate ibt_va_attr_t *va_attrs, void *ibtl_reserved, 3650Sstevel@tonic-gate uint_t paddr_list_len, ibt_phys_buf_t *paddr_list_p, 366*929Ssrust uint_t *num_paddr_p, size_t *paddr_bufsz_p, 367*929Ssrust ib_memlen_t *paddr_offset_p, ibc_ma_hdl_t *ma_hdl_p); 3680Sstevel@tonic-gate ibt_status_t (*ibc_unmap_mem_area)(ibc_hca_hdl_t hca_hdl, 3690Sstevel@tonic-gate ibc_ma_hdl_t ma_hdl); 3700Sstevel@tonic-gate 3710Sstevel@tonic-gate /* Allocate L_Key */ 3720Sstevel@tonic-gate ibt_status_t (*ibc_alloc_lkey)(ibc_hca_hdl_t hca_hdl, ibc_pd_hdl_t pd, 3730Sstevel@tonic-gate ibt_lkey_flags_t flags, uint_t phys_buf_list_sz, 3740Sstevel@tonic-gate ibc_mr_hdl_t *mr_p, ibt_pmr_desc_t *mem_desc_p); 3750Sstevel@tonic-gate 3760Sstevel@tonic-gate /* Physical Register Memory Region */ 3770Sstevel@tonic-gate ibt_status_t (*ibc_register_physical_mr)(ibc_hca_hdl_t hca, 3780Sstevel@tonic-gate ibc_pd_hdl_t pd, ibt_pmr_attr_t *mem_pattr, void *ibtl_reserved, 3790Sstevel@tonic-gate ibc_mr_hdl_t *mr_p, ibt_pmr_desc_t *mem_desc_p); 3800Sstevel@tonic-gate ibt_status_t (*ibc_reregister_physical_mr)(ibc_hca_hdl_t hca, 3810Sstevel@tonic-gate ibc_mr_hdl_t mr, ibc_pd_hdl_t pd, ibt_pmr_attr_t *mem_pattr, 3820Sstevel@tonic-gate void *ibtl_reserved, ibc_mr_hdl_t *mr_p, 3830Sstevel@tonic-gate ibt_pmr_desc_t *mem_desc_p); 384*929Ssrust 385*929Ssrust /* Fast Memory Registration (FMR) */ 386*929Ssrust ibt_status_t (*ibc_create_fmr_pool)(ibc_hca_hdl_t hca, ibc_pd_hdl_t pd, 387*929Ssrust ibt_fmr_pool_attr_t *fmr_params, ibc_fmr_pool_hdl_t *fmr_pool_p); 388*929Ssrust ibt_status_t (*ibc_destroy_fmr_pool)(ibc_hca_hdl_t hca, 389*929Ssrust ibc_fmr_pool_hdl_t fmr_pool); 390*929Ssrust ibt_status_t (*ibc_flush_fmr_pool)(ibc_hca_hdl_t hca, 391*929Ssrust ibc_fmr_pool_hdl_t fmr_pool); 392*929Ssrust ibt_status_t (*ibc_register_physical_fmr)(ibc_hca_hdl_t hca, 393*929Ssrust ibc_fmr_pool_hdl_t fmr_pool, ibt_pmr_attr_t *mem_pattr, 394*929Ssrust void *ibtl_reserved, ibc_mr_hdl_t *mr_hdl_p, 395*929Ssrust ibt_pmr_desc_t *mem_desc_p); 396*929Ssrust ibt_status_t (*ibc_deregister_fmr)(ibc_hca_hdl_t hca, ibc_mr_hdl_t mr); 3970Sstevel@tonic-gate } ibc_operations_t; 3980Sstevel@tonic-gate 3990Sstevel@tonic-gate 4000Sstevel@tonic-gate /* 4010Sstevel@tonic-gate * The ibc_hca_info_s structure is used for HCA drivers to communicate its 4020Sstevel@tonic-gate * HCA specific information to IBTF when it attaches a device via ibc_attach(). 4030Sstevel@tonic-gate * 4040Sstevel@tonic-gate * IBTF assumes that the structures pointed to by the hca_ops and hca_attr 4050Sstevel@tonic-gate * structure members are persistent. 4060Sstevel@tonic-gate */ 4070Sstevel@tonic-gate typedef struct ibc_hca_info_s { 4080Sstevel@tonic-gate ibc_version_t hca_ci_vers; /* CI Version */ 4090Sstevel@tonic-gate dev_info_t *hca_dip; /* HCA dev_info */ 4100Sstevel@tonic-gate ibc_hca_hdl_t hca_handle; /* used for call through */ 4110Sstevel@tonic-gate /* "hca_ops" */ 4120Sstevel@tonic-gate ibc_operations_t *hca_ops; 4130Sstevel@tonic-gate ibt_hca_attr_t *hca_attr; 4140Sstevel@tonic-gate ibc_cq_handler_attr_t hca_def_cq_handler_attr; 4150Sstevel@tonic-gate } ibc_hca_info_t; 4160Sstevel@tonic-gate 4170Sstevel@tonic-gate 4180Sstevel@tonic-gate /* Channel Interface return status */ 4190Sstevel@tonic-gate typedef enum ibc_status_e { 4200Sstevel@tonic-gate IBC_SUCCESS = 0, 4210Sstevel@tonic-gate IBC_FAILURE = 1 4220Sstevel@tonic-gate } ibc_status_t; 4230Sstevel@tonic-gate 4240Sstevel@tonic-gate /* 4250Sstevel@tonic-gate * CI up-calls to IBTF. 4260Sstevel@tonic-gate */ 4270Sstevel@tonic-gate 4280Sstevel@tonic-gate /* 4290Sstevel@tonic-gate * ibc_init 4300Sstevel@tonic-gate * Registers CI clients with the Solaris I/O framework 4310Sstevel@tonic-gate * 4320Sstevel@tonic-gate * ibc_fini 4330Sstevel@tonic-gate * Un-Registers CI clients with the Solaris I/O framework 4340Sstevel@tonic-gate */ 4350Sstevel@tonic-gate int ibc_init(struct modlinkage *modlp); 4360Sstevel@tonic-gate void ibc_fini(struct modlinkage *modlp); 4370Sstevel@tonic-gate 4380Sstevel@tonic-gate /* 4390Sstevel@tonic-gate * ibc_attach 440401Shiremath * Register HCA device with IBTF. During this call HCA driver provides 441401Shiremath * driver's information neededby IBTF. 4420Sstevel@tonic-gate * 4430Sstevel@tonic-gate * ibc_post_attach 4440Sstevel@tonic-gate * After a successful ibc_attach, this must be called. 4450Sstevel@tonic-gate * 4460Sstevel@tonic-gate * ibc_pre_detach 4470Sstevel@tonic-gate * Attempt to De-Register HCA Device from IBTF. 4480Sstevel@tonic-gate * This requires the cooperation of IBTF clients to 4490Sstevel@tonic-gate * stop using this HCA. Upon success, the HCA driver 4500Sstevel@tonic-gate * is committed to calling ibc_detach. 4510Sstevel@tonic-gate * 4520Sstevel@tonic-gate * ibc_detach 4530Sstevel@tonic-gate * De-Register HCA Device from IBTF. 4540Sstevel@tonic-gate * This function will succeed if ibc_pre_detach has previously 4550Sstevel@tonic-gate * succeeded for this device. 4560Sstevel@tonic-gate */ 4570Sstevel@tonic-gate ibc_status_t ibc_attach(ibc_clnt_hdl_t *ibc_hdl_p, ibc_hca_info_t *info_p); 4580Sstevel@tonic-gate void ibc_post_attach(ibc_clnt_hdl_t ibc_hdl); 4590Sstevel@tonic-gate ibc_status_t ibc_pre_detach(ibc_clnt_hdl_t ibc_hdl, ddi_detach_cmd_t cmd); 4600Sstevel@tonic-gate void ibc_detach(ibc_clnt_hdl_t ibc_hdl); 4610Sstevel@tonic-gate 4620Sstevel@tonic-gate /* 4630Sstevel@tonic-gate * ibc_cq_handler 4640Sstevel@tonic-gate * IBTF Completion Queue Notification Handler. 4650Sstevel@tonic-gate */ 4660Sstevel@tonic-gate void ibc_cq_handler(ibc_clnt_hdl_t ibc_hdl, ibt_cq_hdl_t ibt_cq); 4670Sstevel@tonic-gate 4680Sstevel@tonic-gate /* 4690Sstevel@tonic-gate * ibc_async_handler 4700Sstevel@tonic-gate * IBTF Asynchronous event/error handler. 4710Sstevel@tonic-gate */ 4720Sstevel@tonic-gate void ibc_async_handler(ibc_clnt_hdl_t ibc_hdl, ibt_async_code_t code, 4730Sstevel@tonic-gate ibc_async_event_t *event_p); 474401Shiremath 4750Sstevel@tonic-gate /* 4760Sstevel@tonic-gate * ibc_memory_handler 4770Sstevel@tonic-gate * IBTF memory event/error handler. 4780Sstevel@tonic-gate */ 4790Sstevel@tonic-gate void ibc_memory_handler(ibc_clnt_hdl_t ibc_hdl, ibt_mem_code_t code, 4800Sstevel@tonic-gate ibt_mem_data_t *data_p, void *ibtl_reserved); 4810Sstevel@tonic-gate 4820Sstevel@tonic-gate /* 4830Sstevel@tonic-gate * ibc_get_ci_failure() 4840Sstevel@tonic-gate * 4850Sstevel@tonic-gate * Used to obtain a special IBTF failure code for CI specific failures, 4860Sstevel@tonic-gate * failures other than those defined in ibt_status_t. 4870Sstevel@tonic-gate */ 4880Sstevel@tonic-gate ibt_status_t ibc_get_ci_failure(uint64_t ena); 4890Sstevel@tonic-gate 4900Sstevel@tonic-gate #ifdef __cplusplus 4910Sstevel@tonic-gate } 4920Sstevel@tonic-gate #endif 4930Sstevel@tonic-gate 4940Sstevel@tonic-gate #endif /* _SYS_IB_IBTL_IBCI_H */ 495