1*9e39c5baSBill Taylor /* 2*9e39c5baSBill Taylor * CDDL HEADER START 3*9e39c5baSBill Taylor * 4*9e39c5baSBill Taylor * The contents of this file are subject to the terms of the 5*9e39c5baSBill Taylor * Common Development and Distribution License (the "License"). 6*9e39c5baSBill Taylor * You may not use this file except in compliance with the License. 7*9e39c5baSBill Taylor * 8*9e39c5baSBill Taylor * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9*9e39c5baSBill Taylor * or http://www.opensolaris.org/os/licensing. 10*9e39c5baSBill Taylor * See the License for the specific language governing permissions 11*9e39c5baSBill Taylor * and limitations under the License. 12*9e39c5baSBill Taylor * 13*9e39c5baSBill Taylor * When distributing Covered Code, include this CDDL HEADER in each 14*9e39c5baSBill Taylor * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15*9e39c5baSBill Taylor * If applicable, add the following below this CDDL HEADER, with the 16*9e39c5baSBill Taylor * fields enclosed by brackets "[]" replaced with your own identifying 17*9e39c5baSBill Taylor * information: Portions Copyright [yyyy] [name of copyright owner] 18*9e39c5baSBill Taylor * 19*9e39c5baSBill Taylor * CDDL HEADER END 20*9e39c5baSBill Taylor */ 21*9e39c5baSBill Taylor 22*9e39c5baSBill Taylor /* 23*9e39c5baSBill Taylor * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 24*9e39c5baSBill Taylor * Use is subject to license terms. 25*9e39c5baSBill Taylor */ 26*9e39c5baSBill Taylor 27*9e39c5baSBill Taylor #ifndef _SYS_IB_ADAPTERS_TAVOR_QP_H 28*9e39c5baSBill Taylor #define _SYS_IB_ADAPTERS_TAVOR_QP_H 29*9e39c5baSBill Taylor 30*9e39c5baSBill Taylor /* 31*9e39c5baSBill Taylor * tavor_qp.h 32*9e39c5baSBill Taylor * Contains all of the prototypes, #defines, and structures necessary 33*9e39c5baSBill Taylor * for all of the Queue Pair Processing routines. 34*9e39c5baSBill Taylor * Specifically it contains the various flags, structures used for managing 35*9e39c5baSBill Taylor * Tavor queue pairs, and prototypes for many of the functions consumed by 36*9e39c5baSBill Taylor * other parts of the Tavor driver (including those routines directly 37*9e39c5baSBill Taylor * exposed through the IBTF CI interface). 38*9e39c5baSBill Taylor */ 39*9e39c5baSBill Taylor 40*9e39c5baSBill Taylor #include <sys/types.h> 41*9e39c5baSBill Taylor #include <sys/conf.h> 42*9e39c5baSBill Taylor #include <sys/ddi.h> 43*9e39c5baSBill Taylor #include <sys/sunddi.h> 44*9e39c5baSBill Taylor 45*9e39c5baSBill Taylor #ifdef __cplusplus 46*9e39c5baSBill Taylor extern "C" { 47*9e39c5baSBill Taylor #endif 48*9e39c5baSBill Taylor 49*9e39c5baSBill Taylor 50*9e39c5baSBill Taylor /* 51*9e39c5baSBill Taylor * The following defines specify the default number of Queue Pairs (QP) and 52*9e39c5baSBill Taylor * their maximum size. Settings exist for the supported DDR DIMM sizes of 53*9e39c5baSBill Taylor * 128MB and 256MB. If a DIMM greater than 256 is found, then the 256MB 54*9e39c5baSBill Taylor * profile is used. See tavor_cfg.c for more discussion on config profiles. 55*9e39c5baSBill Taylor * 56*9e39c5baSBill Taylor * For manual configuration (not using config profiles), these values are 57*9e39c5baSBill Taylor * controllable through the "tavor_log_max_qp_sz" and "tavor_log_num_qp" 58*9e39c5baSBill Taylor * configuration variables, respectively. To override config profile settings 59*9e39c5baSBill Taylor * the 'tavor_alt_config_enable' configuration variable must first be set. 60*9e39c5baSBill Taylor * 61*9e39c5baSBill Taylor * Note: We also have a define for the minimum size of a QP. QPs allocated 62*9e39c5baSBill Taylor * with size 0, 1, 2, or 3 will always get back a QP of size 4. This is the 63*9e39c5baSBill Taylor * smallest size that Tavor hardware and software can correctly handle. 64*9e39c5baSBill Taylor */ 65*9e39c5baSBill Taylor #define TAVOR_NUM_QP_SHIFT_128 0x10 66*9e39c5baSBill Taylor #define TAVOR_NUM_QP_SHIFT_256 0x11 67*9e39c5baSBill Taylor #define TAVOR_QP_SZ_SHIFT 0x10 68*9e39c5baSBill Taylor #define TAVOR_QP_SZ (1 << TAVOR_QP_SZ_SHIFT) 69*9e39c5baSBill Taylor #define TAVOR_QP_MIN_SIZE 0x4 70*9e39c5baSBill Taylor 71*9e39c5baSBill Taylor /* 72*9e39c5baSBill Taylor * Minimal configuration values. 73*9e39c5baSBill Taylor */ 74*9e39c5baSBill Taylor #define TAVOR_NUM_QP_SHIFT_MIN 0xD 75*9e39c5baSBill Taylor #define TAVOR_QP_SZ_SHIFT_MIN 0x9 76*9e39c5baSBill Taylor 77*9e39c5baSBill Taylor /* 78*9e39c5baSBill Taylor * The following macro determines whether the contents of QP memory (WQEs) 79*9e39c5baSBill Taylor * need to be sync'd (with ddi_dma_sync()). This decision is based on whether 80*9e39c5baSBill Taylor * the QP memory is in DDR memory (no sync) or system memory (sync required). 81*9e39c5baSBill Taylor * And it also supports the possibility that if a CQ in system memory is mapped 82*9e39c5baSBill Taylor * DDI_DMA_CONSISTENT, it can be configured to not be sync'd because of the 83*9e39c5baSBill Taylor * "sync override" parameter in the config profile. 84*9e39c5baSBill Taylor */ 85*9e39c5baSBill Taylor #define TAVOR_QP_IS_SYNC_REQ(state, wqinfo) \ 86*9e39c5baSBill Taylor ((((((state)->ts_cfg_profile->cp_streaming_consistent) && \ 87*9e39c5baSBill Taylor ((state)->ts_cfg_profile->cp_consistent_syncoverride))) || \ 88*9e39c5baSBill Taylor ((wqinfo).qa_location == TAVOR_QUEUE_LOCATION_INDDR)) \ 89*9e39c5baSBill Taylor ? 0 : 1) 90*9e39c5baSBill Taylor 91*9e39c5baSBill Taylor /* 92*9e39c5baSBill Taylor * The following defines specify the size of the individual Queue Pair 93*9e39c5baSBill Taylor * Context (QPC) entries. Below we also specify the size of the "Extended 94*9e39c5baSBill Taylor * QPC entries as well. 95*9e39c5baSBill Taylor */ 96*9e39c5baSBill Taylor #define TAVOR_QPC_SIZE_SHIFT 0x8 97*9e39c5baSBill Taylor #define TAVOR_QPC_SIZE (1 << TAVOR_QPC_SIZE_SHIFT) 98*9e39c5baSBill Taylor #define TAVOR_EQPC_SIZE_SHIFT 0x5 99*9e39c5baSBill Taylor #define TAVOR_EQPC_SIZE (1 << TAVOR_EQPC_SIZE_SHIFT) 100*9e39c5baSBill Taylor 101*9e39c5baSBill Taylor /* 102*9e39c5baSBill Taylor * The following defines specify the default number of Tavor RDMA Backing 103*9e39c5baSBill Taylor * entries (RDB). Settings exist for the supported DDR DIMM sizes of 128MB and 104*9e39c5baSBill Taylor * 256MB. If a DIMM greater than 256 is found, then the 256MB profile is used. 105*9e39c5baSBill Taylor * See tavor_cfg.c for more discussion on config profiles. 106*9e39c5baSBill Taylor * 107*9e39c5baSBill Taylor * For manual configuration (not using config profiles), this value is 108*9e39c5baSBill Taylor * controllable through the "tavor_log_num_rdb" configuration variable. To 109*9e39c5baSBill Taylor * override config profile settings the 'tavor_alt_config_enable' configuration 110*9e39c5baSBill Taylor * variable must first be set. 111*9e39c5baSBill Taylor * 112*9e39c5baSBill Taylor * Below we also include the defines that are used to specify four (4) 113*9e39c5baSBill Taylor * outstanding RDMA Reads/Atomics per QP. 114*9e39c5baSBill Taylor */ 115*9e39c5baSBill Taylor 116*9e39c5baSBill Taylor #define TAVOR_NUM_RDB_SHIFT_128 0x12 117*9e39c5baSBill Taylor #define TAVOR_NUM_RDB_SHIFT_256 0x13 118*9e39c5baSBill Taylor 119*9e39c5baSBill Taylor #define TAVOR_HCA_MAX_RDMA_IN_QP 0x4 120*9e39c5baSBill Taylor #define TAVOR_HCA_MAX_RDMA_OUT_QP 0x4 121*9e39c5baSBill Taylor 122*9e39c5baSBill Taylor /* 123*9e39c5baSBill Taylor * Minimal configuration value. 124*9e39c5baSBill Taylor */ 125*9e39c5baSBill Taylor #define TAVOR_NUM_RDB_SHIFT_MIN 0xC 126*9e39c5baSBill Taylor 127*9e39c5baSBill Taylor /* 128*9e39c5baSBill Taylor * The following defines specify the size of the individual RDMA Backing 129*9e39c5baSBill Taylor * entries (RDB). 130*9e39c5baSBill Taylor */ 131*9e39c5baSBill Taylor #define TAVOR_RDB_SIZE_SHIFT 0x5 132*9e39c5baSBill Taylor #define TAVOR_RDB_SIZE (1 << TAVOR_RDB_SIZE_SHIFT) 133*9e39c5baSBill Taylor 134*9e39c5baSBill Taylor /* 135*9e39c5baSBill Taylor * This defines the maximum number of SGLs per WQE. This value is 136*9e39c5baSBill Taylor * controllable through the "tavor_wqe_max_sgl" configuration variable (but 137*9e39c5baSBill Taylor * should not be set larger than this value). 138*9e39c5baSBill Taylor */ 139*9e39c5baSBill Taylor #define TAVOR_NUM_WQE_SGL 0x10 140*9e39c5baSBill Taylor 141*9e39c5baSBill Taylor /* Define for maximum QP number mask (QP number is 24 bits) */ 142*9e39c5baSBill Taylor #define TAVOR_QP_MAXNUMBER_MSK 0xFFFFFF 143*9e39c5baSBill Taylor 144*9e39c5baSBill Taylor /* 145*9e39c5baSBill Taylor * This define and the following macro are used to find a schedule queue for 146*9e39c5baSBill Taylor * a new QP based on its queue pair number. Note: This is a rather simple 147*9e39c5baSBill Taylor * method that we use today. We simply choose from the schedule queue based 148*9e39c5baSBill Taylor * on the 4 least significant bits of the QP number. 149*9e39c5baSBill Taylor */ 150*9e39c5baSBill Taylor #define TAVOR_QP_TO_SCHEDQ_MASK 0xF 151*9e39c5baSBill Taylor #define TAVOR_QP_SCHEDQ_GET(qpnum) ((qpnum) & TAVOR_QP_TO_SCHEDQ_MASK) 152*9e39c5baSBill Taylor 153*9e39c5baSBill Taylor /* 154*9e39c5baSBill Taylor * This define determines the frequency with which the AckReq bit will be 155*9e39c5baSBill Taylor * set in outgoing RC packets. By default it is set to five (5) or 2^5 = 32. 156*9e39c5baSBill Taylor * So AckReq will be set once every 32 packets sent. This value is 157*9e39c5baSBill Taylor * controllable through the "tavor_qp_ackreq_freq" configuration variable. 158*9e39c5baSBill Taylor */ 159*9e39c5baSBill Taylor #define TAVOR_QP_ACKREQ_FREQ 0x5 160*9e39c5baSBill Taylor 161*9e39c5baSBill Taylor /* 162*9e39c5baSBill Taylor * Define the maximum message size (log 2). Note: This value corresponds 163*9e39c5baSBill Taylor * to the maximum allowable message sized as defined by the IBA spec. 164*9e39c5baSBill Taylor */ 165*9e39c5baSBill Taylor #define TAVOR_QP_LOG_MAX_MSGSZ 0x1F 166*9e39c5baSBill Taylor 167*9e39c5baSBill Taylor /* 168*9e39c5baSBill Taylor * This macro is used to determine the appropriate alignment for a Tavor 169*9e39c5baSBill Taylor * work queue (see tavor_qp_alloc() and tavor_special_qp_alloc()). Note: 170*9e39c5baSBill Taylor * Tavor work queues are aligned on their combined size (i.e. combined size 171*9e39c5baSBill Taylor * of send queue and receive queue) because of certain hardware limitations 172*9e39c5baSBill Taylor * (i.e. work queue memory cannot cross a 32-bit boundary). 173*9e39c5baSBill Taylor */ 174*9e39c5baSBill Taylor #define TAVOR_QP_WQ_ALIGN(qp_size) \ 175*9e39c5baSBill Taylor (1 << ((((qp_size) & ((qp_size) - 1)) == 0) ? \ 176*9e39c5baSBill Taylor highbit((qp_size)) - 1 : highbit((qp_size)))) 177*9e39c5baSBill Taylor 178*9e39c5baSBill Taylor /* 179*9e39c5baSBill Taylor * This macro is used to determine if the tavor known QP type (qp_serv) is the 180*9e39c5baSBill Taylor * same as the caller passed in IBT type (qp_trans). This is used in QP modify 181*9e39c5baSBill Taylor * to ensure the types match. 182*9e39c5baSBill Taylor */ 183*9e39c5baSBill Taylor #define TAVOR_QP_TYPE_VALID(qp_trans, qp_serv) \ 184*9e39c5baSBill Taylor ((qp_trans == IBT_UD_SRV && qp_serv == TAVOR_QP_UD) || \ 185*9e39c5baSBill Taylor (qp_trans == IBT_RC_SRV && qp_serv == TAVOR_QP_RC) || \ 186*9e39c5baSBill Taylor (qp_trans == IBT_UC_SRV && qp_serv == TAVOR_QP_UC)) 187*9e39c5baSBill Taylor 188*9e39c5baSBill Taylor /* 189*9e39c5baSBill Taylor * The following enumerated type is used to capture all the various types 190*9e39c5baSBill Taylor * of Tavor work queue types. Note: It is specifically used as an argument 191*9e39c5baSBill Taylor * to the tavor_qp_sgl_to_logwqesz() routine. 192*9e39c5baSBill Taylor * The defines below are also used by the tavor_qp_sgl_to_logwqesz() routine 193*9e39c5baSBill Taylor * they indicate the amount of overhead (in WQE header size) consumed by 194*9e39c5baSBill Taylor * each of the following types of WQEs. This information is used to round 195*9e39c5baSBill Taylor * the WQE size to the next largest power-of-2 (and to determine the number 196*9e39c5baSBill Taylor * of SGLs that are supported for the given WQE type). There is also a define 197*9e39c5baSBill Taylor * below used to specify the minimum size for a WQE. The minimum size is set 198*9e39c5baSBill Taylor * to 64 bytes (a single cacheline). 199*9e39c5baSBill Taylor */ 200*9e39c5baSBill Taylor typedef enum { 201*9e39c5baSBill Taylor TAVOR_QP_WQ_TYPE_SENDQ, 202*9e39c5baSBill Taylor TAVOR_QP_WQ_TYPE_RECVQ, 203*9e39c5baSBill Taylor TAVOR_QP_WQ_TYPE_SENDMLX_QP0, 204*9e39c5baSBill Taylor TAVOR_QP_WQ_TYPE_SENDMLX_QP1 205*9e39c5baSBill Taylor } tavor_qp_wq_type_t; 206*9e39c5baSBill Taylor #define TAVOR_QP_WQE_MAX_SIZE 0x3F0 207*9e39c5baSBill Taylor #define TAVOR_QP_WQE_MLX_SND_HDRS 0x40 208*9e39c5baSBill Taylor #define TAVOR_QP_WQE_MLX_RCV_HDRS 0x10 209*9e39c5baSBill Taylor #define TAVOR_QP_WQE_MLX_QP0_HDRS 0x40 210*9e39c5baSBill Taylor #define TAVOR_QP_WQE_MLX_QP1_HDRS 0x70 211*9e39c5baSBill Taylor #define TAVOR_QP_WQE_LOG_MINIMUM 0x6 212*9e39c5baSBill Taylor 213*9e39c5baSBill Taylor 214*9e39c5baSBill Taylor /* 215*9e39c5baSBill Taylor * The tavor_qp_info_t structure is used internally by the Tavor driver to 216*9e39c5baSBill Taylor * pass information to and from the tavor_qp_alloc() and 217*9e39c5baSBill Taylor * tavor_special_qp_alloc() routines. It contains placeholders for all of the 218*9e39c5baSBill Taylor * potential inputs and outputs that either routine can take. 219*9e39c5baSBill Taylor */ 220*9e39c5baSBill Taylor typedef struct tavor_qp_info_s { 221*9e39c5baSBill Taylor ibt_qp_alloc_attr_t *qpi_attrp; 222*9e39c5baSBill Taylor uint_t qpi_type; 223*9e39c5baSBill Taylor uint_t qpi_port; 224*9e39c5baSBill Taylor ibtl_qp_hdl_t qpi_ibt_qphdl; 225*9e39c5baSBill Taylor ibt_chan_sizes_t *qpi_queueszp; 226*9e39c5baSBill Taylor ib_qpn_t *qpi_qpn; 227*9e39c5baSBill Taylor tavor_qphdl_t qpi_qphdl; 228*9e39c5baSBill Taylor } tavor_qp_info_t; 229*9e39c5baSBill Taylor 230*9e39c5baSBill Taylor /* 231*9e39c5baSBill Taylor * The QPN entry which is stored in the AVL tree 232*9e39c5baSBill Taylor */ 233*9e39c5baSBill Taylor typedef struct tavor_qpn_entry_s { 234*9e39c5baSBill Taylor avl_node_t qpn_avlnode; 235*9e39c5baSBill Taylor uint_t qpn_refcnt; 236*9e39c5baSBill Taylor uint_t qpn_counter; 237*9e39c5baSBill Taylor uint_t qpn_indx; 238*9e39c5baSBill Taylor tavor_rsrc_t *qpn_qpc; 239*9e39c5baSBill Taylor } tavor_qpn_entry_t; 240*9e39c5baSBill Taylor #define TAVOR_QPN_NOFLAG 0x0 241*9e39c5baSBill Taylor #define TAVOR_QPN_RELEASE 0x1 242*9e39c5baSBill Taylor #define TAVOR_QPN_FREE_ONLY 0x2 243*9e39c5baSBill Taylor 244*9e39c5baSBill Taylor /* 245*9e39c5baSBill Taylor * The tavor_sw_qp_s structure is also referred to using the "tavor_qphdl_t" 246*9e39c5baSBill Taylor * typedef (see tavor_typedef.h). It encodes all the information necessary 247*9e39c5baSBill Taylor * to track the various resources needed to allocate, query, modify, and 248*9e39c5baSBill Taylor * (later) free both normal QP and special QP. 249*9e39c5baSBill Taylor * 250*9e39c5baSBill Taylor * Specifically, it has a lock to ensure single threaded access to the QP. 251*9e39c5baSBill Taylor * It has QP state, type, and number, pointers to the PD, MR, and CQ handles 252*9e39c5baSBill Taylor * associated with the QP, and pointers to the buffer where the work queues 253*9e39c5baSBill Taylor * come from. 254*9e39c5baSBill Taylor * 255*9e39c5baSBill Taylor * It has two pointers (one per work queue) to the workQ headers for the WRID 256*9e39c5baSBill Taylor * list, as well as pointers to the last WQE on each chain (used when 257*9e39c5baSBill Taylor * connecting a new chain of WQEs to a previously executing chain - see 258*9e39c5baSBill Taylor * tavor_wr.c). It's also got the real WQE size, real number of SGL per WQE, 259*9e39c5baSBill Taylor * and the size of each of the work queues (in number of WQEs). 260*9e39c5baSBill Taylor * 261*9e39c5baSBill Taylor * Additionally, it has pointers to the resources associated with the QP 262*9e39c5baSBill Taylor * (including the obligatory backpointer to the resource for the QP handle 263*9e39c5baSBill Taylor * itself. But it also has some flags, like "qp_forward_sqd_event" and 264*9e39c5baSBill Taylor * "qp_sqd_still_draining" (which are used to indicate whether a Send Queue 265*9e39c5baSBill Taylor * Drained Event should be forwarded to the IBTF) or "qp_is_special", 266*9e39c5baSBill Taylor * "qp_portnum", and "qp_pkeyindx" (which are used by special QP to store 267*9e39c5baSBill Taylor * necessary information about the type of the QP, which port it's connected 268*9e39c5baSBill Taylor * to, and what its current PKey index is set to). 269*9e39c5baSBill Taylor */ 270*9e39c5baSBill Taylor struct tavor_sw_qp_s { 271*9e39c5baSBill Taylor kmutex_t qp_lock; 272*9e39c5baSBill Taylor uint_t qp_state; 273*9e39c5baSBill Taylor uint32_t qp_qpnum; 274*9e39c5baSBill Taylor tavor_pdhdl_t qp_pdhdl; 275*9e39c5baSBill Taylor uint_t qp_serv_type; 276*9e39c5baSBill Taylor uint_t qp_sync; 277*9e39c5baSBill Taylor tavor_mrhdl_t qp_mrhdl; 278*9e39c5baSBill Taylor uint_t qp_sq_sigtype; 279*9e39c5baSBill Taylor uint_t qp_is_special; 280*9e39c5baSBill Taylor uint_t qp_is_umap; 281*9e39c5baSBill Taylor uint32_t qp_uarpg; 282*9e39c5baSBill Taylor devmap_cookie_t qp_umap_dhp; 283*9e39c5baSBill Taylor uint_t qp_portnum; 284*9e39c5baSBill Taylor uint_t qp_pkeyindx; 285*9e39c5baSBill Taylor 286*9e39c5baSBill Taylor /* Send Work Queue */ 287*9e39c5baSBill Taylor tavor_cqhdl_t qp_sq_cqhdl; 288*9e39c5baSBill Taylor uint64_t *qp_sq_lastwqeaddr; 289*9e39c5baSBill Taylor tavor_workq_hdr_t *qp_sq_wqhdr; 290*9e39c5baSBill Taylor uint32_t *qp_sq_buf; 291*9e39c5baSBill Taylor uint32_t qp_sq_bufsz; 292*9e39c5baSBill Taylor uint32_t qp_sq_log_wqesz; 293*9e39c5baSBill Taylor uint32_t qp_sq_sgl; 294*9e39c5baSBill Taylor 295*9e39c5baSBill Taylor /* Receive Work Queue */ 296*9e39c5baSBill Taylor tavor_cqhdl_t qp_rq_cqhdl; 297*9e39c5baSBill Taylor uint64_t *qp_rq_lastwqeaddr; 298*9e39c5baSBill Taylor tavor_workq_hdr_t *qp_rq_wqhdr; 299*9e39c5baSBill Taylor uint32_t *qp_rq_buf; 300*9e39c5baSBill Taylor uint32_t qp_rq_bufsz; 301*9e39c5baSBill Taylor uint32_t qp_rq_log_wqesz; 302*9e39c5baSBill Taylor uint32_t qp_rq_sgl; 303*9e39c5baSBill Taylor 304*9e39c5baSBill Taylor uint64_t qp_desc_off; 305*9e39c5baSBill Taylor 306*9e39c5baSBill Taylor tavor_rsrc_t *qp_qpcrsrcp; 307*9e39c5baSBill Taylor tavor_rsrc_t *qp_rsrcp; 308*9e39c5baSBill Taylor void *qp_hdlrarg; 309*9e39c5baSBill Taylor tavor_rsrc_t *qp_rdbrsrcp; 310*9e39c5baSBill Taylor uint64_t qp_rdb_ddraddr; 311*9e39c5baSBill Taylor uint_t qp_forward_sqd_event; 312*9e39c5baSBill Taylor uint_t qp_sqd_still_draining; 313*9e39c5baSBill Taylor 314*9e39c5baSBill Taylor /* Shared Receive Queue */ 315*9e39c5baSBill Taylor tavor_srqhdl_t qp_srqhdl; 316*9e39c5baSBill Taylor uint_t qp_srq_en; 317*9e39c5baSBill Taylor 318*9e39c5baSBill Taylor /* Refcnt of QP belongs to an MCG */ 319*9e39c5baSBill Taylor uint_t qp_mcg_refcnt; 320*9e39c5baSBill Taylor 321*9e39c5baSBill Taylor /* save the mtu & srate from init2rtr for future use */ 322*9e39c5baSBill Taylor uint_t qp_save_mtu; 323*9e39c5baSBill Taylor ibt_srate_t qp_save_srate; 324*9e39c5baSBill Taylor tavor_qpn_entry_t *qp_qpn_hdl; 325*9e39c5baSBill Taylor 326*9e39c5baSBill Taylor struct tavor_qalloc_info_s qp_wqinfo; 327*9e39c5baSBill Taylor 328*9e39c5baSBill Taylor struct tavor_hw_qpc_s qpc; 329*9e39c5baSBill Taylor }; 330*9e39c5baSBill Taylor _NOTE(READ_ONLY_DATA(tavor_sw_qp_s::qp_qpnum 331*9e39c5baSBill Taylor tavor_sw_qp_s::qp_sync 332*9e39c5baSBill Taylor tavor_sw_qp_s::qp_sq_buf 333*9e39c5baSBill Taylor tavor_sw_qp_s::qp_sq_log_wqesz 334*9e39c5baSBill Taylor tavor_sw_qp_s::qp_sq_bufsz 335*9e39c5baSBill Taylor tavor_sw_qp_s::qp_sq_sgl 336*9e39c5baSBill Taylor tavor_sw_qp_s::qp_rq_buf 337*9e39c5baSBill Taylor tavor_sw_qp_s::qp_rq_log_wqesz 338*9e39c5baSBill Taylor tavor_sw_qp_s::qp_rq_bufsz 339*9e39c5baSBill Taylor tavor_sw_qp_s::qp_rq_sgl 340*9e39c5baSBill Taylor tavor_sw_qp_s::qp_desc_off 341*9e39c5baSBill Taylor tavor_sw_qp_s::qp_mrhdl 342*9e39c5baSBill Taylor tavor_sw_qp_s::qp_wqinfo 343*9e39c5baSBill Taylor tavor_sw_qp_s::qp_qpcrsrcp 344*9e39c5baSBill Taylor tavor_sw_qp_s::qp_rsrcp 345*9e39c5baSBill Taylor tavor_sw_qp_s::qp_hdlrarg 346*9e39c5baSBill Taylor tavor_sw_qp_s::qp_pdhdl 347*9e39c5baSBill Taylor tavor_sw_qp_s::qp_sq_cqhdl 348*9e39c5baSBill Taylor tavor_sw_qp_s::qp_rq_cqhdl 349*9e39c5baSBill Taylor tavor_sw_qp_s::qp_sq_sigtype 350*9e39c5baSBill Taylor tavor_sw_qp_s::qp_serv_type 351*9e39c5baSBill Taylor tavor_sw_qp_s::qp_is_special 352*9e39c5baSBill Taylor tavor_sw_qp_s::qp_is_umap 353*9e39c5baSBill Taylor tavor_sw_qp_s::qp_uarpg 354*9e39c5baSBill Taylor tavor_sw_qp_s::qp_portnum 355*9e39c5baSBill Taylor tavor_sw_qp_s::qp_qpn_hdl)) 356*9e39c5baSBill Taylor _NOTE(MUTEX_PROTECTS_DATA(tavor_sw_qp_s::qp_lock, 357*9e39c5baSBill Taylor tavor_sw_qp_s::qp_sq_wqhdr 358*9e39c5baSBill Taylor tavor_sw_qp_s::qp_sq_lastwqeaddr 359*9e39c5baSBill Taylor tavor_sw_qp_s::qp_rq_wqhdr 360*9e39c5baSBill Taylor tavor_sw_qp_s::qp_rq_lastwqeaddr 361*9e39c5baSBill Taylor tavor_sw_qp_s::qp_state 362*9e39c5baSBill Taylor tavor_sw_qp_s::qp_rdbrsrcp 363*9e39c5baSBill Taylor tavor_sw_qp_s::qp_rdb_ddraddr 364*9e39c5baSBill Taylor tavor_sw_qp_s::qpc 365*9e39c5baSBill Taylor tavor_sw_qp_s::qp_forward_sqd_event 366*9e39c5baSBill Taylor tavor_sw_qp_s::qp_sqd_still_draining 367*9e39c5baSBill Taylor tavor_sw_qp_s::qp_mcg_refcnt 368*9e39c5baSBill Taylor tavor_sw_qp_s::qp_save_mtu 369*9e39c5baSBill Taylor tavor_sw_qp_s::qp_umap_dhp)) 370*9e39c5baSBill Taylor 371*9e39c5baSBill Taylor /* 372*9e39c5baSBill Taylor * The following defines are used to indicate whether a QP is special or 373*9e39c5baSBill Taylor * not (and what type it is). They are used in the "qp_is_special" field 374*9e39c5baSBill Taylor * above. 375*9e39c5baSBill Taylor */ 376*9e39c5baSBill Taylor #define TAVOR_QP_SMI 0x1 377*9e39c5baSBill Taylor #define TAVOR_QP_GSI 0x2 378*9e39c5baSBill Taylor 379*9e39c5baSBill Taylor /* 380*9e39c5baSBill Taylor * The tavor_qp_options_t structure is used in the Tavor QP allocation 381*9e39c5baSBill Taylor * routines to provide additional option functionality. When a NULL pointer 382*9e39c5baSBill Taylor * is passed in place of a pointer to this struct, it is a way of specifying 383*9e39c5baSBill Taylor * the "default" behavior. Using this structure, however, is a way of 384*9e39c5baSBill Taylor * controlling any extended behavior. 385*9e39c5baSBill Taylor * 386*9e39c5baSBill Taylor * Currently, the only defined "extended" behavior is for specifying whether 387*9e39c5baSBill Taylor * a given QP's work queues should be allocated from kernel system memory 388*9e39c5baSBill Taylor * (TAVOR_QUEUE_LOCATION_NORMAL) or should be allocated from local DDR memory 389*9e39c5baSBill Taylor * (TAVOR_QUEUE_LOCATION_INDDR). This defaults today to always allocating 390*9e39c5baSBill Taylor * from kernel system memory but can be changed by using the 391*9e39c5baSBill Taylor * "tavor_qp_wq_inddr" configuration variable. 392*9e39c5baSBill Taylor */ 393*9e39c5baSBill Taylor typedef struct tavor_qp_options_s { 394*9e39c5baSBill Taylor uint_t qpo_wq_loc; 395*9e39c5baSBill Taylor } tavor_qp_options_t; 396*9e39c5baSBill Taylor 397*9e39c5baSBill Taylor 398*9e39c5baSBill Taylor /* Defined in tavor_qp.c */ 399*9e39c5baSBill Taylor int tavor_qp_alloc(tavor_state_t *state, tavor_qp_info_t *qpinfo, 400*9e39c5baSBill Taylor uint_t sleepflag, tavor_qp_options_t *op); 401*9e39c5baSBill Taylor int tavor_special_qp_alloc(tavor_state_t *state, tavor_qp_info_t *qpinfo, 402*9e39c5baSBill Taylor uint_t sleepflag, tavor_qp_options_t *op); 403*9e39c5baSBill Taylor int tavor_qp_free(tavor_state_t *state, tavor_qphdl_t *qphdl, 404*9e39c5baSBill Taylor ibc_free_qp_flags_t free_qp_flags, ibc_qpn_hdl_t *qpnh, uint_t sleepflag); 405*9e39c5baSBill Taylor int tavor_qp_query(tavor_state_t *state, tavor_qphdl_t qphdl, 406*9e39c5baSBill Taylor ibt_qp_query_attr_t *attr_p); 407*9e39c5baSBill Taylor tavor_qphdl_t tavor_qphdl_from_qpnum(tavor_state_t *state, uint_t qpnum); 408*9e39c5baSBill Taylor void tavor_qp_release_qpn(tavor_state_t *state, tavor_qpn_entry_t *entry, 409*9e39c5baSBill Taylor int flags); 410*9e39c5baSBill Taylor void tavor_qpn_avl_init(tavor_state_t *state); 411*9e39c5baSBill Taylor void tavor_qpn_avl_fini(tavor_state_t *state); 412*9e39c5baSBill Taylor 413*9e39c5baSBill Taylor /* Defined in tavor_qpmod.c */ 414*9e39c5baSBill Taylor int tavor_qp_modify(tavor_state_t *state, tavor_qphdl_t qp, 415*9e39c5baSBill Taylor ibt_cep_modify_flags_t flags, ibt_qp_info_t *info_p, 416*9e39c5baSBill Taylor ibt_queue_sizes_t *actual_sz); 417*9e39c5baSBill Taylor int tavor_qp_to_reset(tavor_state_t *state, tavor_qphdl_t qp); 418*9e39c5baSBill Taylor 419*9e39c5baSBill Taylor #ifdef __cplusplus 420*9e39c5baSBill Taylor } 421*9e39c5baSBill Taylor #endif 422*9e39c5baSBill Taylor 423*9e39c5baSBill Taylor #endif /* _SYS_IB_ADAPTERS_TAVOR_QP_H */ 424