1*7c478bd9Sstevel@tonic-gate /* 2*7c478bd9Sstevel@tonic-gate * CDDL HEADER START 3*7c478bd9Sstevel@tonic-gate * 4*7c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*7c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*7c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*7c478bd9Sstevel@tonic-gate * with the License. 8*7c478bd9Sstevel@tonic-gate * 9*7c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*7c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*7c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 12*7c478bd9Sstevel@tonic-gate * and limitations under the License. 13*7c478bd9Sstevel@tonic-gate * 14*7c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*7c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*7c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*7c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*7c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*7c478bd9Sstevel@tonic-gate * 20*7c478bd9Sstevel@tonic-gate * CDDL HEADER END 21*7c478bd9Sstevel@tonic-gate */ 22*7c478bd9Sstevel@tonic-gate /* 23*7c478bd9Sstevel@tonic-gate * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 24*7c478bd9Sstevel@tonic-gate * Use is subject to license terms. 25*7c478bd9Sstevel@tonic-gate */ 26*7c478bd9Sstevel@tonic-gate 27*7c478bd9Sstevel@tonic-gate #ifndef _IB_H 28*7c478bd9Sstevel@tonic-gate #define _IB_H 29*7c478bd9Sstevel@tonic-gate 30*7c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 31*7c478bd9Sstevel@tonic-gate 32*7c478bd9Sstevel@tonic-gate /* 33*7c478bd9Sstevel@tonic-gate * ib.h, rpcib plugin interface. 34*7c478bd9Sstevel@tonic-gate */ 35*7c478bd9Sstevel@tonic-gate 36*7c478bd9Sstevel@tonic-gate #include <sys/types.h> 37*7c478bd9Sstevel@tonic-gate #include <sys/ddi.h> 38*7c478bd9Sstevel@tonic-gate #include <sys/sunddi.h> 39*7c478bd9Sstevel@tonic-gate #include <sys/conf.h> 40*7c478bd9Sstevel@tonic-gate #include <sys/stat.h> 41*7c478bd9Sstevel@tonic-gate #include <rpc/rpc.h> 42*7c478bd9Sstevel@tonic-gate #include <rpc/rpc_rdma.h> 43*7c478bd9Sstevel@tonic-gate #include <sys/ib/ibtl/ibti.h> 44*7c478bd9Sstevel@tonic-gate 45*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 46*7c478bd9Sstevel@tonic-gate extern "C" { 47*7c478bd9Sstevel@tonic-gate #endif 48*7c478bd9Sstevel@tonic-gate 49*7c478bd9Sstevel@tonic-gate #define MAX_BUFS 256 /* max no. of buffers per pool */ 50*7c478bd9Sstevel@tonic-gate #define DEF_CQ_SIZE 4096 - 1 /* default CQ size */ 51*7c478bd9Sstevel@tonic-gate /* 52*7c478bd9Sstevel@tonic-gate * Tavor returns the next higher power of 2 53*7c478bd9Sstevel@tonic-gate * CQ entries than the requested size. 54*7c478bd9Sstevel@tonic-gate * For instance, if you request (2^12 - 1) 55*7c478bd9Sstevel@tonic-gate * CQ entries, Tavor returns 2^12 entries. 56*7c478bd9Sstevel@tonic-gate * 4K CQ entries suffice. Hence, 4096 - 1. 57*7c478bd9Sstevel@tonic-gate */ 58*7c478bd9Sstevel@tonic-gate #define DEF_SQ_SIZE 128 /* default SendQ size */ 59*7c478bd9Sstevel@tonic-gate #define DEF_RQ_SIZE 256 /* default RecvQ size */ 60*7c478bd9Sstevel@tonic-gate #define DSEG_MAX 2 61*7c478bd9Sstevel@tonic-gate #define RQ_DSEG_MAX 1 /* default RQ data seg */ 62*7c478bd9Sstevel@tonic-gate #define IBSRM_HB 0x8000 /* high order bit of pkey */ 63*7c478bd9Sstevel@tonic-gate #define NFS_SEC_KEY0 0x6878 /* randomly selected NFS security key */ 64*7c478bd9Sstevel@tonic-gate #define NFS_SEC_KEY1 0x8679 65*7c478bd9Sstevel@tonic-gate 66*7c478bd9Sstevel@tonic-gate /* max no. of refresh attempts on IBT_CM_CONN_STALE error */ 67*7c478bd9Sstevel@tonic-gate #define REFRESH_ATTEMPTS 3 68*7c478bd9Sstevel@tonic-gate 69*7c478bd9Sstevel@tonic-gate typedef struct rib_hca_s rib_hca_t; 70*7c478bd9Sstevel@tonic-gate typedef struct rib_qp_s rib_qp_t; 71*7c478bd9Sstevel@tonic-gate typedef struct rib_cq_s rib_cq_t; 72*7c478bd9Sstevel@tonic-gate 73*7c478bd9Sstevel@tonic-gate /* 74*7c478bd9Sstevel@tonic-gate * Notification for RDMA_DONE is based on xid 75*7c478bd9Sstevel@tonic-gate */ 76*7c478bd9Sstevel@tonic-gate struct rdma_done_list { 77*7c478bd9Sstevel@tonic-gate uint32_t xid; /* XID waiting for RDMA_DONE */ 78*7c478bd9Sstevel@tonic-gate kcondvar_t rdma_done_cv; /* cv for RDMA_DONE */ 79*7c478bd9Sstevel@tonic-gate struct rdma_done_list *next; 80*7c478bd9Sstevel@tonic-gate struct rdma_done_list *prev; 81*7c478bd9Sstevel@tonic-gate }; 82*7c478bd9Sstevel@tonic-gate 83*7c478bd9Sstevel@tonic-gate /* 84*7c478bd9Sstevel@tonic-gate * State of the plugin. 85*7c478bd9Sstevel@tonic-gate * ACCEPT = accepting new connections and requests 86*7c478bd9Sstevel@tonic-gate * NO_ACCEPT = not accepting new connection and requests 87*7c478bd9Sstevel@tonic-gate */ 88*7c478bd9Sstevel@tonic-gate #define ACCEPT 1 89*7c478bd9Sstevel@tonic-gate #define NO_ACCEPT 2 90*7c478bd9Sstevel@tonic-gate 91*7c478bd9Sstevel@tonic-gate /* 92*7c478bd9Sstevel@tonic-gate * Send Wait states 93*7c478bd9Sstevel@tonic-gate */ 94*7c478bd9Sstevel@tonic-gate #define SEND_WAIT -1 95*7c478bd9Sstevel@tonic-gate 96*7c478bd9Sstevel@tonic-gate /* 97*7c478bd9Sstevel@tonic-gate * Reply states 98*7c478bd9Sstevel@tonic-gate */ 99*7c478bd9Sstevel@tonic-gate #define REPLY_WAIT -1 100*7c478bd9Sstevel@tonic-gate 101*7c478bd9Sstevel@tonic-gate typedef void * rib_pvoid; 102*7c478bd9Sstevel@tonic-gate typedef rib_pvoid RIB_SYNCMEM_HANDLE; 103*7c478bd9Sstevel@tonic-gate 104*7c478bd9Sstevel@tonic-gate /* 105*7c478bd9Sstevel@tonic-gate * IB buffer pool management structure 106*7c478bd9Sstevel@tonic-gate */ 107*7c478bd9Sstevel@tonic-gate 108*7c478bd9Sstevel@tonic-gate /* 109*7c478bd9Sstevel@tonic-gate * Buffer pool info 110*7c478bd9Sstevel@tonic-gate */ 111*7c478bd9Sstevel@tonic-gate typedef struct { 112*7c478bd9Sstevel@tonic-gate kmutex_t buflock; /* lock for this structure */ 113*7c478bd9Sstevel@tonic-gate caddr_t buf; /* pool address */ 114*7c478bd9Sstevel@tonic-gate uint32_t bufhandle; /* rkey for this pool */ 115*7c478bd9Sstevel@tonic-gate ulong_t bufsize; /* size of pool */ 116*7c478bd9Sstevel@tonic-gate int rsize; /* size of each element */ 117*7c478bd9Sstevel@tonic-gate int numelems; /* no. of elements allocated */ 118*7c478bd9Sstevel@tonic-gate int buffree; /* no. of free elements */ 119*7c478bd9Sstevel@tonic-gate void *buflist[1]; /* free elements in pool */ 120*7c478bd9Sstevel@tonic-gate } bufpool_t; 121*7c478bd9Sstevel@tonic-gate 122*7c478bd9Sstevel@tonic-gate typedef struct { 123*7c478bd9Sstevel@tonic-gate bufpool_t *bpool; 124*7c478bd9Sstevel@tonic-gate ibt_mr_hdl_t *mr_hdl; 125*7c478bd9Sstevel@tonic-gate ibt_mr_desc_t *mr_desc; /* vaddr, lkey, rkey */ 126*7c478bd9Sstevel@tonic-gate } rib_bufpool_t; 127*7c478bd9Sstevel@tonic-gate 128*7c478bd9Sstevel@tonic-gate /* 129*7c478bd9Sstevel@tonic-gate * ATS relsted defines and structures. 130*7c478bd9Sstevel@tonic-gate */ 131*7c478bd9Sstevel@tonic-gate #define ATS_AR_DATA_LEN 16 132*7c478bd9Sstevel@tonic-gate #define IBD_NAME "ibd" 133*7c478bd9Sstevel@tonic-gate #define N_IBD_INSTANCES 4 134*7c478bd9Sstevel@tonic-gate 135*7c478bd9Sstevel@tonic-gate typedef struct rpcib_ats_s { 136*7c478bd9Sstevel@tonic-gate int ras_inst; 137*7c478bd9Sstevel@tonic-gate ib_pkey_t ras_pkey; 138*7c478bd9Sstevel@tonic-gate ib_gid_t ras_port_gid; 139*7c478bd9Sstevel@tonic-gate sa_family_t ras_inet_type; 140*7c478bd9Sstevel@tonic-gate union { 141*7c478bd9Sstevel@tonic-gate struct sockaddr_in ras_sockaddr; 142*7c478bd9Sstevel@tonic-gate struct sockaddr_in6 ras_sockaddr6; 143*7c478bd9Sstevel@tonic-gate } ra_sin; 144*7c478bd9Sstevel@tonic-gate #define ras_sin ra_sin.ras_sockaddr 145*7c478bd9Sstevel@tonic-gate #define ras_sin6 ra_sin.ras_sockaddr6 146*7c478bd9Sstevel@tonic-gate } rpcib_ats_t; 147*7c478bd9Sstevel@tonic-gate 148*7c478bd9Sstevel@tonic-gate typedef struct rpcib_ibd_insts_s { 149*7c478bd9Sstevel@tonic-gate int rib_ibd_alloc; 150*7c478bd9Sstevel@tonic-gate int rib_ibd_cnt; 151*7c478bd9Sstevel@tonic-gate rpcib_ats_t *rib_ats; 152*7c478bd9Sstevel@tonic-gate } rpcib_ibd_insts_t; 153*7c478bd9Sstevel@tonic-gate 154*7c478bd9Sstevel@tonic-gate /* 155*7c478bd9Sstevel@tonic-gate * Service types supported by RPCIB 156*7c478bd9Sstevel@tonic-gate * For now only NFS is supported. 157*7c478bd9Sstevel@tonic-gate */ 158*7c478bd9Sstevel@tonic-gate #define NFS 1 159*7c478bd9Sstevel@tonic-gate #define NLM 2 160*7c478bd9Sstevel@tonic-gate 161*7c478bd9Sstevel@tonic-gate /* 162*7c478bd9Sstevel@tonic-gate * Tracks consumer state (client or server). 163*7c478bd9Sstevel@tonic-gate */ 164*7c478bd9Sstevel@tonic-gate typedef enum { 165*7c478bd9Sstevel@tonic-gate RIB_SERVER, 166*7c478bd9Sstevel@tonic-gate RIB_CLIENT 167*7c478bd9Sstevel@tonic-gate } rib_mode_t; 168*7c478bd9Sstevel@tonic-gate 169*7c478bd9Sstevel@tonic-gate /* 170*7c478bd9Sstevel@tonic-gate * CQ structure 171*7c478bd9Sstevel@tonic-gate */ 172*7c478bd9Sstevel@tonic-gate struct rib_cq_s { 173*7c478bd9Sstevel@tonic-gate rib_hca_t *rib_hca; 174*7c478bd9Sstevel@tonic-gate ibt_cq_hdl_t rib_cq_hdl; 175*7c478bd9Sstevel@tonic-gate }; 176*7c478bd9Sstevel@tonic-gate 177*7c478bd9Sstevel@tonic-gate /* 178*7c478bd9Sstevel@tonic-gate * RPCIB plugin state 179*7c478bd9Sstevel@tonic-gate */ 180*7c478bd9Sstevel@tonic-gate typedef struct rpcib_state { 181*7c478bd9Sstevel@tonic-gate ibt_clnt_hdl_t ibt_clnt_hdl; 182*7c478bd9Sstevel@tonic-gate uint32_t hca_count; 183*7c478bd9Sstevel@tonic-gate uint32_t nhca_inited; 184*7c478bd9Sstevel@tonic-gate ib_guid_t *hca_guids; 185*7c478bd9Sstevel@tonic-gate rib_hca_t *hcas; 186*7c478bd9Sstevel@tonic-gate int refcount; 187*7c478bd9Sstevel@tonic-gate kmutex_t open_hca_lock; 188*7c478bd9Sstevel@tonic-gate rib_hca_t *hca; /* the hca being used */ 189*7c478bd9Sstevel@tonic-gate queue_t *q; /* up queue for a serv_type */ 190*7c478bd9Sstevel@tonic-gate uint32_t service_type; /* NFS, NLM, etc */ 191*7c478bd9Sstevel@tonic-gate void *private; 192*7c478bd9Sstevel@tonic-gate } rpcib_state_t; 193*7c478bd9Sstevel@tonic-gate 194*7c478bd9Sstevel@tonic-gate /* 195*7c478bd9Sstevel@tonic-gate * Each registered service's data structure. 196*7c478bd9Sstevel@tonic-gate * Each HCA has a list of these structures, which are the registered 197*7c478bd9Sstevel@tonic-gate * services on this HCA. 198*7c478bd9Sstevel@tonic-gate */ 199*7c478bd9Sstevel@tonic-gate typedef struct rib_service rib_service_t; 200*7c478bd9Sstevel@tonic-gate struct rib_service { 201*7c478bd9Sstevel@tonic-gate uint32_t srv_type; /* i.e, NFS, NLM, v4CBD */ 202*7c478bd9Sstevel@tonic-gate 203*7c478bd9Sstevel@tonic-gate /* 204*7c478bd9Sstevel@tonic-gate * service name, i.e, <IP>::NFS or <IP>::NLM. Since 205*7c478bd9Sstevel@tonic-gate * each type of service can be registered with many 206*7c478bd9Sstevel@tonic-gate * IP addrs(srv_name) and is running on all ports 207*7c478bd9Sstevel@tonic-gate * for all HCAs. 208*7c478bd9Sstevel@tonic-gate */ 209*7c478bd9Sstevel@tonic-gate char *srv_name; 210*7c478bd9Sstevel@tonic-gate 211*7c478bd9Sstevel@tonic-gate uint32_t srv_port; /* port on which registered */ 212*7c478bd9Sstevel@tonic-gate ib_svc_id_t srv_id; /* from ibt_register call */ 213*7c478bd9Sstevel@tonic-gate ibt_srv_hdl_t srv_hdl; /* from ibt_register call */ 214*7c478bd9Sstevel@tonic-gate ibt_sbind_hdl_t *srv_sbind_hdl; /* from ibt_bind call */ 215*7c478bd9Sstevel@tonic-gate ibt_ar_t srv_ar; 216*7c478bd9Sstevel@tonic-gate 217*7c478bd9Sstevel@tonic-gate /* 218*7c478bd9Sstevel@tonic-gate * pointer to the next service registered on this 219*7c478bd9Sstevel@tonic-gate * particular HCA 220*7c478bd9Sstevel@tonic-gate */ 221*7c478bd9Sstevel@tonic-gate rib_service_t *srv_next; 222*7c478bd9Sstevel@tonic-gate }; 223*7c478bd9Sstevel@tonic-gate 224*7c478bd9Sstevel@tonic-gate /* 225*7c478bd9Sstevel@tonic-gate * Connection lists 226*7c478bd9Sstevel@tonic-gate */ 227*7c478bd9Sstevel@tonic-gate typedef struct { 228*7c478bd9Sstevel@tonic-gate krwlock_t conn_lock; /* list lock */ 229*7c478bd9Sstevel@tonic-gate CONN *conn_hd; /* list head */ 230*7c478bd9Sstevel@tonic-gate } rib_conn_list_t; 231*7c478bd9Sstevel@tonic-gate 232*7c478bd9Sstevel@tonic-gate enum hca_state { 233*7c478bd9Sstevel@tonic-gate HCA_INITED, /* hca in up and running state */ 234*7c478bd9Sstevel@tonic-gate HCA_DETACHED /* hca in detached state */ 235*7c478bd9Sstevel@tonic-gate }; 236*7c478bd9Sstevel@tonic-gate 237*7c478bd9Sstevel@tonic-gate /* 238*7c478bd9Sstevel@tonic-gate * RPCIB per HCA structure 239*7c478bd9Sstevel@tonic-gate */ 240*7c478bd9Sstevel@tonic-gate struct rib_hca_s { 241*7c478bd9Sstevel@tonic-gate ibt_clnt_hdl_t ibt_clnt_hdl; 242*7c478bd9Sstevel@tonic-gate 243*7c478bd9Sstevel@tonic-gate /* 244*7c478bd9Sstevel@tonic-gate * per HCA. 245*7c478bd9Sstevel@tonic-gate */ 246*7c478bd9Sstevel@tonic-gate ibt_hca_hdl_t hca_hdl; /* HCA handle */ 247*7c478bd9Sstevel@tonic-gate ibt_hca_attr_t hca_attrs; /* HCA attributes */ 248*7c478bd9Sstevel@tonic-gate ibt_pd_hdl_t pd_hdl; 249*7c478bd9Sstevel@tonic-gate ib_guid_t hca_guid; 250*7c478bd9Sstevel@tonic-gate uint32_t hca_nports; 251*7c478bd9Sstevel@tonic-gate ibt_hca_portinfo_t *hca_ports; 252*7c478bd9Sstevel@tonic-gate size_t hca_pinfosz; 253*7c478bd9Sstevel@tonic-gate enum hca_state state; /* state of HCA */ 254*7c478bd9Sstevel@tonic-gate krwlock_t state_lock; /* protects state field */ 255*7c478bd9Sstevel@tonic-gate bool_t inuse; /* indicates HCA usage */ 256*7c478bd9Sstevel@tonic-gate kmutex_t inuse_lock; /* protects inuse field */ 257*7c478bd9Sstevel@tonic-gate /* 258*7c478bd9Sstevel@tonic-gate * List of services registered on all ports available 259*7c478bd9Sstevel@tonic-gate * on this HCA. Only one consumer of KRPC can register 260*7c478bd9Sstevel@tonic-gate * its services at one time or tear them down at one 261*7c478bd9Sstevel@tonic-gate * time. 262*7c478bd9Sstevel@tonic-gate */ 263*7c478bd9Sstevel@tonic-gate rib_service_t *service_list; 264*7c478bd9Sstevel@tonic-gate krwlock_t service_list_lock; 265*7c478bd9Sstevel@tonic-gate 266*7c478bd9Sstevel@tonic-gate rib_service_t *ats_list; /* Service list for ATS */ 267*7c478bd9Sstevel@tonic-gate 268*7c478bd9Sstevel@tonic-gate rib_conn_list_t cl_conn_list; /* client conn list */ 269*7c478bd9Sstevel@tonic-gate rib_conn_list_t srv_conn_list; /* server conn list */ 270*7c478bd9Sstevel@tonic-gate 271*7c478bd9Sstevel@tonic-gate rib_cq_t *clnt_scq; 272*7c478bd9Sstevel@tonic-gate rib_cq_t *clnt_rcq; 273*7c478bd9Sstevel@tonic-gate rib_cq_t *svc_scq; 274*7c478bd9Sstevel@tonic-gate rib_cq_t *svc_rcq; 275*7c478bd9Sstevel@tonic-gate kmutex_t cb_lock; 276*7c478bd9Sstevel@tonic-gate kcondvar_t cb_cv; 277*7c478bd9Sstevel@tonic-gate 278*7c478bd9Sstevel@tonic-gate rib_bufpool_t *recv_pool; /* recv buf pool */ 279*7c478bd9Sstevel@tonic-gate rib_bufpool_t *send_pool; /* send buf pool */ 280*7c478bd9Sstevel@tonic-gate 281*7c478bd9Sstevel@tonic-gate void *iblock; /* interrupt cookie */ 282*7c478bd9Sstevel@tonic-gate }; 283*7c478bd9Sstevel@tonic-gate 284*7c478bd9Sstevel@tonic-gate 285*7c478bd9Sstevel@tonic-gate /* 286*7c478bd9Sstevel@tonic-gate * Structure on wait state of a post send 287*7c478bd9Sstevel@tonic-gate */ 288*7c478bd9Sstevel@tonic-gate struct send_wid { 289*7c478bd9Sstevel@tonic-gate uint32_t xid; 290*7c478bd9Sstevel@tonic-gate int cv_sig; 291*7c478bd9Sstevel@tonic-gate kmutex_t sendwait_lock; 292*7c478bd9Sstevel@tonic-gate kcondvar_t wait_cv; 293*7c478bd9Sstevel@tonic-gate uint_t status; 294*7c478bd9Sstevel@tonic-gate rib_qp_t *qp; 295*7c478bd9Sstevel@tonic-gate int nsbufs; /* # of send buffers posted */ 296*7c478bd9Sstevel@tonic-gate uint64_t sbufaddr[DSEG_MAX]; /* posted send buffers */ 297*7c478bd9Sstevel@tonic-gate }; 298*7c478bd9Sstevel@tonic-gate 299*7c478bd9Sstevel@tonic-gate /* 300*7c478bd9Sstevel@tonic-gate * Structure on reply descriptor for recv queue. 301*7c478bd9Sstevel@tonic-gate * Different from the above posting of a descriptor. 302*7c478bd9Sstevel@tonic-gate */ 303*7c478bd9Sstevel@tonic-gate struct reply { 304*7c478bd9Sstevel@tonic-gate uint32_t xid; 305*7c478bd9Sstevel@tonic-gate uint_t status; 306*7c478bd9Sstevel@tonic-gate uint64_t vaddr_cq; /* buf addr from CQ */ 307*7c478bd9Sstevel@tonic-gate uint_t bytes_xfer; 308*7c478bd9Sstevel@tonic-gate kcondvar_t wait_cv; 309*7c478bd9Sstevel@tonic-gate struct reply *next; 310*7c478bd9Sstevel@tonic-gate struct reply *prev; 311*7c478bd9Sstevel@tonic-gate }; 312*7c478bd9Sstevel@tonic-gate 313*7c478bd9Sstevel@tonic-gate struct svc_recv { 314*7c478bd9Sstevel@tonic-gate rib_qp_t *qp; 315*7c478bd9Sstevel@tonic-gate uint64_t vaddr; 316*7c478bd9Sstevel@tonic-gate uint_t bytes_xfer; 317*7c478bd9Sstevel@tonic-gate }; 318*7c478bd9Sstevel@tonic-gate 319*7c478bd9Sstevel@tonic-gate struct recv_wid { 320*7c478bd9Sstevel@tonic-gate uint32_t xid; 321*7c478bd9Sstevel@tonic-gate rib_qp_t *qp; 322*7c478bd9Sstevel@tonic-gate uint64_t addr; /* posted buf addr */ 323*7c478bd9Sstevel@tonic-gate }; 324*7c478bd9Sstevel@tonic-gate 325*7c478bd9Sstevel@tonic-gate /* 326*7c478bd9Sstevel@tonic-gate * Per QP data structure 327*7c478bd9Sstevel@tonic-gate */ 328*7c478bd9Sstevel@tonic-gate struct rib_qp_s { 329*7c478bd9Sstevel@tonic-gate rib_hca_t *hca; 330*7c478bd9Sstevel@tonic-gate rib_mode_t mode; /* RIB_SERVER or RIB_CLIENT */ 331*7c478bd9Sstevel@tonic-gate CONN rdmaconn; 332*7c478bd9Sstevel@tonic-gate ibt_channel_hdl_t qp_hdl; 333*7c478bd9Sstevel@tonic-gate uint_t port_num; 334*7c478bd9Sstevel@tonic-gate ib_qpn_t qpn; 335*7c478bd9Sstevel@tonic-gate int chan_flags; 336*7c478bd9Sstevel@tonic-gate clock_t timeout; 337*7c478bd9Sstevel@tonic-gate ibt_rc_chan_query_attr_t qp_q_attrs; 338*7c478bd9Sstevel@tonic-gate rib_cq_t *send_cq; /* send CQ */ 339*7c478bd9Sstevel@tonic-gate rib_cq_t *recv_cq; /* recv CQ */ 340*7c478bd9Sstevel@tonic-gate 341*7c478bd9Sstevel@tonic-gate /* 342*7c478bd9Sstevel@tonic-gate * Number of pre-posted rbufs 343*7c478bd9Sstevel@tonic-gate */ 344*7c478bd9Sstevel@tonic-gate uint_t n_posted_rbufs; 345*7c478bd9Sstevel@tonic-gate kcondvar_t posted_rbufs_cv; 346*7c478bd9Sstevel@tonic-gate kmutex_t posted_rbufs_lock; 347*7c478bd9Sstevel@tonic-gate 348*7c478bd9Sstevel@tonic-gate /* 349*7c478bd9Sstevel@tonic-gate * RPC reply 350*7c478bd9Sstevel@tonic-gate */ 351*7c478bd9Sstevel@tonic-gate uint_t rep_list_size; 352*7c478bd9Sstevel@tonic-gate struct reply *replylist; 353*7c478bd9Sstevel@tonic-gate kmutex_t replylist_lock; 354*7c478bd9Sstevel@tonic-gate 355*7c478bd9Sstevel@tonic-gate /* 356*7c478bd9Sstevel@tonic-gate * server only, RDMA_DONE 357*7c478bd9Sstevel@tonic-gate */ 358*7c478bd9Sstevel@tonic-gate struct rdma_done_list *rdlist; 359*7c478bd9Sstevel@tonic-gate kmutex_t rdlist_lock; 360*7c478bd9Sstevel@tonic-gate 361*7c478bd9Sstevel@tonic-gate kmutex_t cb_lock; 362*7c478bd9Sstevel@tonic-gate kcondvar_t cb_conn_cv; 363*7c478bd9Sstevel@tonic-gate 364*7c478bd9Sstevel@tonic-gate caddr_t q; /* upstream queue */ 365*7c478bd9Sstevel@tonic-gate }; 366*7c478bd9Sstevel@tonic-gate 367*7c478bd9Sstevel@tonic-gate #define ctoqp(conn) ((rib_qp_t *)((conn)->c_private)) 368*7c478bd9Sstevel@tonic-gate #define qptoc(rqp) ((CONN *)&((rqp)->rdmaconn)) 369*7c478bd9Sstevel@tonic-gate 370*7c478bd9Sstevel@tonic-gate /* 371*7c478bd9Sstevel@tonic-gate * Timeout for various calls 372*7c478bd9Sstevel@tonic-gate */ 373*7c478bd9Sstevel@tonic-gate #define CONN_WAIT_TIME 40 374*7c478bd9Sstevel@tonic-gate #define SEND_WAIT_TIME 40 /* time for send completion */ 375*7c478bd9Sstevel@tonic-gate 376*7c478bd9Sstevel@tonic-gate #define REPLY_WAIT_TIME 40 /* time to get reply from remote QP */ 377*7c478bd9Sstevel@tonic-gate 378*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 379*7c478bd9Sstevel@tonic-gate } 380*7c478bd9Sstevel@tonic-gate #endif 381*7c478bd9Sstevel@tonic-gate 382*7c478bd9Sstevel@tonic-gate #endif /* !_IB_H */ 383