1*0Sstevel@tonic-gate /* 2*0Sstevel@tonic-gate * CDDL HEADER START 3*0Sstevel@tonic-gate * 4*0Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*0Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*0Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*0Sstevel@tonic-gate * with the License. 8*0Sstevel@tonic-gate * 9*0Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*0Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*0Sstevel@tonic-gate * See the License for the specific language governing permissions 12*0Sstevel@tonic-gate * and limitations under the License. 13*0Sstevel@tonic-gate * 14*0Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*0Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*0Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*0Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*0Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*0Sstevel@tonic-gate * 20*0Sstevel@tonic-gate * CDDL HEADER END 21*0Sstevel@tonic-gate */ 22*0Sstevel@tonic-gate /* 23*0Sstevel@tonic-gate * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 24*0Sstevel@tonic-gate * Use is subject to license terms. 25*0Sstevel@tonic-gate */ 26*0Sstevel@tonic-gate 27*0Sstevel@tonic-gate #ifndef _RPC_RPC_RDMA_H 28*0Sstevel@tonic-gate #define _RPC_RPC_RDMA_H 29*0Sstevel@tonic-gate 30*0Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 31*0Sstevel@tonic-gate 32*0Sstevel@tonic-gate #include <rpc/rpc.h> 33*0Sstevel@tonic-gate #include <rpc/rpc_sztypes.h> 34*0Sstevel@tonic-gate #include <sys/sunddi.h> 35*0Sstevel@tonic-gate #include <sys/sunldi.h> 36*0Sstevel@tonic-gate 37*0Sstevel@tonic-gate #ifdef __cplusplus 38*0Sstevel@tonic-gate extern "C" { 39*0Sstevel@tonic-gate #endif 40*0Sstevel@tonic-gate 41*0Sstevel@tonic-gate #define RPCRDMA_VERS 0 /* Version of the RPC over RDMA protocol */ 42*0Sstevel@tonic-gate #define RDMATF_VERS 1 /* Version of the API used by RPC for RDMA */ 43*0Sstevel@tonic-gate #define RDMATF_VERS_1 1 /* Current version of RDMATF */ 44*0Sstevel@tonic-gate 45*0Sstevel@tonic-gate /* 46*0Sstevel@tonic-gate * The size of an RPC call or reply message 47*0Sstevel@tonic-gate */ 48*0Sstevel@tonic-gate #define RPC_MSG_SZ 1024 49*0Sstevel@tonic-gate 50*0Sstevel@tonic-gate /* 51*0Sstevel@tonic-gate * Storage for a chunk list 52*0Sstevel@tonic-gate */ 53*0Sstevel@tonic-gate #define RPC_CL_SZ 1024 54*0Sstevel@tonic-gate 55*0Sstevel@tonic-gate /* 56*0Sstevel@tonic-gate * Chunk size 57*0Sstevel@tonic-gate */ 58*0Sstevel@tonic-gate #define MINCHUNK 1024 59*0Sstevel@tonic-gate 60*0Sstevel@tonic-gate /* 61*0Sstevel@tonic-gate * Size of receive buffer 62*0Sstevel@tonic-gate */ 63*0Sstevel@tonic-gate #define RPC_BUF_SIZE 2048 64*0Sstevel@tonic-gate 65*0Sstevel@tonic-gate #define NOWAIT 0 /* don't wait for operation of complete */ 66*0Sstevel@tonic-gate #define WAIT 1 /* wait and ensure that operation is complete */ 67*0Sstevel@tonic-gate 68*0Sstevel@tonic-gate /* 69*0Sstevel@tonic-gate * RDMA xdr buffer control and other control flags. Add new flags here, 70*0Sstevel@tonic-gate * set them in private structure for xdr over RDMA in xdr_rdma.c 71*0Sstevel@tonic-gate */ 72*0Sstevel@tonic-gate #define RDMA_NOCHUNK 0x1 73*0Sstevel@tonic-gate 74*0Sstevel@tonic-gate /* 75*0Sstevel@tonic-gate * Return codes from RDMA operations 76*0Sstevel@tonic-gate */ 77*0Sstevel@tonic-gate typedef enum { 78*0Sstevel@tonic-gate 79*0Sstevel@tonic-gate RDMA_SUCCESS = 0, /* successful operation */ 80*0Sstevel@tonic-gate 81*0Sstevel@tonic-gate RDMA_INVAL = 1, /* invalid parameter */ 82*0Sstevel@tonic-gate RDMA_TIMEDOUT = 2, /* operation timed out */ 83*0Sstevel@tonic-gate RDMA_INTR = 3, /* operation interrupted */ 84*0Sstevel@tonic-gate RDMA_NORESOURCE = 4, /* insufficient resource */ 85*0Sstevel@tonic-gate /* 86*0Sstevel@tonic-gate * connection errors 87*0Sstevel@tonic-gate */ 88*0Sstevel@tonic-gate RDMA_REJECT = 5, /* connection req rejected */ 89*0Sstevel@tonic-gate RDMA_NOLISTENER = 6, /* no listener on server */ 90*0Sstevel@tonic-gate RDMA_UNREACHABLE = 7, /* host unreachable */ 91*0Sstevel@tonic-gate RDMA_CONNLOST = 8, /* connection lost */ 92*0Sstevel@tonic-gate 93*0Sstevel@tonic-gate RDMA_XPRTFAILED = 9, /* RDMA transport failed */ 94*0Sstevel@tonic-gate RDMA_PROTECTERR = 10, /* memory protection error */ 95*0Sstevel@tonic-gate RDMA_OVERRUN = 11, /* transport overrun */ 96*0Sstevel@tonic-gate RDMA_RECVQEMPTY = 12, /* incoming pkt dropped, recv q empty */ 97*0Sstevel@tonic-gate RDMA_PROTFAILED = 13, /* RDMA protocol failed */ 98*0Sstevel@tonic-gate RDMA_NOTSUPP = 14, /* requested feature not supported */ 99*0Sstevel@tonic-gate RDMA_REMOTERR = 15, /* error at remote end */ 100*0Sstevel@tonic-gate /* 101*0Sstevel@tonic-gate * RDMATF errors 102*0Sstevel@tonic-gate */ 103*0Sstevel@tonic-gate RDMA_BADVERS = 16, /* mismatch RDMATF versions */ 104*0Sstevel@tonic-gate RDMA_REG_EXIST = 17, /* RDMATF registration already exists */ 105*0Sstevel@tonic-gate 106*0Sstevel@tonic-gate /* 107*0Sstevel@tonic-gate * fallback error 108*0Sstevel@tonic-gate */ 109*0Sstevel@tonic-gate RDMA_FAILED = 18 /* generic error */ 110*0Sstevel@tonic-gate } rdma_stat; 111*0Sstevel@tonic-gate 112*0Sstevel@tonic-gate /* 113*0Sstevel@tonic-gate * Memory region context. This is an RDMA provider generated 114*0Sstevel@tonic-gate * handle for a registered arbitrary size contiguous virtual 115*0Sstevel@tonic-gate * memory. The RDMA Interface Adapter needs this for local or 116*0Sstevel@tonic-gate * remote memory access. 117*0Sstevel@tonic-gate * 118*0Sstevel@tonic-gate * The mrc_rmr field holds the remote memory region context 119*0Sstevel@tonic-gate * which is sent over-the-wire to provide the remote host 120*0Sstevel@tonic-gate * with RDMA access to the memory region. 121*0Sstevel@tonic-gate */ 122*0Sstevel@tonic-gate struct mrc { 123*0Sstevel@tonic-gate uint32_t mrc_rmr; /* Remote MR context, sent OTW */ 124*0Sstevel@tonic-gate union { 125*0Sstevel@tonic-gate struct mr { 126*0Sstevel@tonic-gate uint32_t lmr; /* Local MR context */ 127*0Sstevel@tonic-gate uint64_t linfo; /* Local memory info */ 128*0Sstevel@tonic-gate } mr; 129*0Sstevel@tonic-gate } lhdl; 130*0Sstevel@tonic-gate }; 131*0Sstevel@tonic-gate 132*0Sstevel@tonic-gate #define mrc_lmr lhdl.mr.lmr 133*0Sstevel@tonic-gate #define mrc_linfo lhdl.mr.linfo 134*0Sstevel@tonic-gate 135*0Sstevel@tonic-gate /* 136*0Sstevel@tonic-gate * The XDR offset value is used by the XDR 137*0Sstevel@tonic-gate * routine to identify the position in the 138*0Sstevel@tonic-gate * RPC message where the opaque object would 139*0Sstevel@tonic-gate * normally occur. Neither the data content 140*0Sstevel@tonic-gate * of the chunk, nor its size field are included 141*0Sstevel@tonic-gate * in the RPC message. The XDR offset is calculated 142*0Sstevel@tonic-gate * as if the chunks were present. 143*0Sstevel@tonic-gate * 144*0Sstevel@tonic-gate * The remaining fields identify the chunk of data 145*0Sstevel@tonic-gate * on the sender. The c_memhandle identifies a 146*0Sstevel@tonic-gate * registered RDMA memory region and the c_addr 147*0Sstevel@tonic-gate * and c_len fields identify the chunk within it. 148*0Sstevel@tonic-gate */ 149*0Sstevel@tonic-gate struct clist { 150*0Sstevel@tonic-gate uint32 c_xdroff; /* XDR offset */ 151*0Sstevel@tonic-gate uint32 c_len; /* Length */ 152*0Sstevel@tonic-gate struct mrc c_smemhandle; /* src memory handle */ 153*0Sstevel@tonic-gate uint64 c_ssynchandle; /* src sync handle */ 154*0Sstevel@tonic-gate uint64 c_saddr; /* src address */ 155*0Sstevel@tonic-gate struct mrc c_dmemhandle; /* dst memory handle */ 156*0Sstevel@tonic-gate uint64 c_dsynchandle; /* dst sync handle */ 157*0Sstevel@tonic-gate uint64 c_daddr; /* dst address */ 158*0Sstevel@tonic-gate struct clist *c_next; /* Next chunk */ 159*0Sstevel@tonic-gate }; 160*0Sstevel@tonic-gate 161*0Sstevel@tonic-gate typedef struct clist clist; 162*0Sstevel@tonic-gate 163*0Sstevel@tonic-gate enum rdma_proc { 164*0Sstevel@tonic-gate RDMA_MSG = 0, /* chunk list and RPC msg follow */ 165*0Sstevel@tonic-gate RDMA_NOMSG = 1, /* only chunk list follows */ 166*0Sstevel@tonic-gate RDMA_MSGP = 2, /* chunk list and RPC msg with padding follow */ 167*0Sstevel@tonic-gate RDMA_DONE = 3 /* signal completion of chunk transfer */ 168*0Sstevel@tonic-gate }; 169*0Sstevel@tonic-gate 170*0Sstevel@tonic-gate /* 171*0Sstevel@tonic-gate * Listener information for a service 172*0Sstevel@tonic-gate */ 173*0Sstevel@tonic-gate struct rdma_svc_data { 174*0Sstevel@tonic-gate queue_t q; /* queue_t to place incoming pkts */ 175*0Sstevel@tonic-gate int active; /* If active, after registeration startup */ 176*0Sstevel@tonic-gate rdma_stat err_code; /* Error code from plugin layer */ 177*0Sstevel@tonic-gate int32_t svcid; /* RDMA based service identifier */ 178*0Sstevel@tonic-gate }; 179*0Sstevel@tonic-gate 180*0Sstevel@tonic-gate /* 181*0Sstevel@tonic-gate * Per RDMA plugin module information. 182*0Sstevel@tonic-gate * Will be populated by each plugin 183*0Sstevel@tonic-gate * module during its initialization. 184*0Sstevel@tonic-gate */ 185*0Sstevel@tonic-gate typedef struct rdma_mod { 186*0Sstevel@tonic-gate char *rdma_api; /* "kvipl", "ibtf", etc */ 187*0Sstevel@tonic-gate uint_t rdma_version; /* RDMATF API version */ 188*0Sstevel@tonic-gate int rdma_count; /* # of devices */ 189*0Sstevel@tonic-gate struct rdmaops *rdma_ops; /* rdma op vector for api */ 190*0Sstevel@tonic-gate } rdma_mod_t; 191*0Sstevel@tonic-gate 192*0Sstevel@tonic-gate /* 193*0Sstevel@tonic-gate * Registry of RDMA plugins 194*0Sstevel@tonic-gate */ 195*0Sstevel@tonic-gate typedef struct rdma_registry { 196*0Sstevel@tonic-gate rdma_mod_t *r_mod; /* plugin mod info */ 197*0Sstevel@tonic-gate struct rdma_registry *r_next; /* next registered RDMA plugin */ 198*0Sstevel@tonic-gate } rdma_registry_t; 199*0Sstevel@tonic-gate 200*0Sstevel@tonic-gate /* 201*0Sstevel@tonic-gate * RDMA transport information 202*0Sstevel@tonic-gate */ 203*0Sstevel@tonic-gate typedef struct rdma_info { 204*0Sstevel@tonic-gate uint_t addrlen; /* address length */ 205*0Sstevel@tonic-gate uint_t mts; /* max transfer size */ 206*0Sstevel@tonic-gate uint_t mtu; /* native mtu size of unlerlying network */ 207*0Sstevel@tonic-gate } rdma_info_t; 208*0Sstevel@tonic-gate 209*0Sstevel@tonic-gate /* 210*0Sstevel@tonic-gate * RDMA Connection information 211*0Sstevel@tonic-gate */ 212*0Sstevel@tonic-gate typedef struct conn { 213*0Sstevel@tonic-gate rdma_mod_t *c_rdmamod; /* RDMA transport info for conn */ 214*0Sstevel@tonic-gate struct netbuf c_raddr; /* remote address */ 215*0Sstevel@tonic-gate struct netbuf c_laddr; /* local address */ 216*0Sstevel@tonic-gate int c_ref; /* no. of clients of connection */ 217*0Sstevel@tonic-gate struct conn *c_next; /* next in list of connections */ 218*0Sstevel@tonic-gate struct conn *c_prev; /* prev in list of connections */ 219*0Sstevel@tonic-gate caddr_t c_private; /* transport specific stuff */ 220*0Sstevel@tonic-gate 221*0Sstevel@tonic-gate #define C_IDLE 0x80000000 222*0Sstevel@tonic-gate #define C_CONN_PEND 0x40000000 223*0Sstevel@tonic-gate #define C_CONNECTED 0x20000000 224*0Sstevel@tonic-gate #define C_ERROR 0x10000000 225*0Sstevel@tonic-gate #define C_DISCONN_PEND 0x08000000 226*0Sstevel@tonic-gate #define C_REMOTE_DOWN 0x04000000 227*0Sstevel@tonic-gate 228*0Sstevel@tonic-gate uint_t c_state; /* state of connection */ 229*0Sstevel@tonic-gate kmutex_t c_lock; /* protect c_state and c_ref fields */ 230*0Sstevel@tonic-gate kcondvar_t c_cv; /* to signal when pending is done */ 231*0Sstevel@tonic-gate } CONN; 232*0Sstevel@tonic-gate 233*0Sstevel@tonic-gate 234*0Sstevel@tonic-gate /* 235*0Sstevel@tonic-gate * Memory management for the RDMA buffers 236*0Sstevel@tonic-gate */ 237*0Sstevel@tonic-gate /* 238*0Sstevel@tonic-gate * RDMA buffer types 239*0Sstevel@tonic-gate */ 240*0Sstevel@tonic-gate typedef enum { 241*0Sstevel@tonic-gate SEND_BUFFER, /* buf for send msg */ 242*0Sstevel@tonic-gate SEND_DESCRIPTOR, /* buf used for send msg descriptor in plugins only */ 243*0Sstevel@tonic-gate RECV_BUFFER, /* buf for recv msg */ 244*0Sstevel@tonic-gate RECV_DESCRIPTOR, /* buf used for recv msg descriptor in plugins only */ 245*0Sstevel@tonic-gate CHUNK_BUFFER /* chunk buf used in RDMATF only and not in plugins */ 246*0Sstevel@tonic-gate } rdma_btype; 247*0Sstevel@tonic-gate 248*0Sstevel@tonic-gate /* 249*0Sstevel@tonic-gate * RDMA buffer information 250*0Sstevel@tonic-gate */ 251*0Sstevel@tonic-gate typedef struct rdma_buf { 252*0Sstevel@tonic-gate rdma_btype type; /* buffer type */ 253*0Sstevel@tonic-gate int len; /* length of buffer */ 254*0Sstevel@tonic-gate caddr_t addr; /* buffer address */ 255*0Sstevel@tonic-gate struct mrc handle; /* buffer registration handle */ 256*0Sstevel@tonic-gate } rdma_buf_t; 257*0Sstevel@tonic-gate 258*0Sstevel@tonic-gate /* 259*0Sstevel@tonic-gate * Data transferred from plugin interrupt to svc_queuereq() 260*0Sstevel@tonic-gate */ 261*0Sstevel@tonic-gate struct recv_data { 262*0Sstevel@tonic-gate CONN *conn; 263*0Sstevel@tonic-gate int status; 264*0Sstevel@tonic-gate rdma_buf_t rpcmsg; 265*0Sstevel@tonic-gate }; 266*0Sstevel@tonic-gate 267*0Sstevel@tonic-gate /* 268*0Sstevel@tonic-gate * Operations vector for RDMA transports. 269*0Sstevel@tonic-gate */ 270*0Sstevel@tonic-gate typedef struct rdmaops { 271*0Sstevel@tonic-gate /* Network */ 272*0Sstevel@tonic-gate rdma_stat (*rdma_reachable)(int addr_type, struct netbuf *, 273*0Sstevel@tonic-gate void **handle); 274*0Sstevel@tonic-gate /* Connection */ 275*0Sstevel@tonic-gate rdma_stat (*rdma_get_conn)(struct netbuf *, int addr_type, 276*0Sstevel@tonic-gate void *, CONN **); 277*0Sstevel@tonic-gate rdma_stat (*rdma_rel_conn)(CONN *); 278*0Sstevel@tonic-gate /* Server side listner start and stop routines */ 279*0Sstevel@tonic-gate void (*rdma_svc_listen)(struct rdma_svc_data *); 280*0Sstevel@tonic-gate void (*rdma_svc_stop)(struct rdma_svc_data *); 281*0Sstevel@tonic-gate /* Memory */ 282*0Sstevel@tonic-gate rdma_stat (*rdma_regmem)(CONN *, caddr_t, uint_t, struct mrc *); 283*0Sstevel@tonic-gate rdma_stat (*rdma_deregmem)(CONN *, caddr_t, struct mrc); 284*0Sstevel@tonic-gate rdma_stat (*rdma_regmemsync)(CONN *, caddr_t, uint_t, 285*0Sstevel@tonic-gate struct mrc *, void **); 286*0Sstevel@tonic-gate rdma_stat (*rdma_deregmemsync)(CONN *, caddr_t, struct mrc, 287*0Sstevel@tonic-gate void *); 288*0Sstevel@tonic-gate rdma_stat (*rdma_syncmem)(CONN *, void *, caddr_t, int, int); 289*0Sstevel@tonic-gate /* Buffer */ 290*0Sstevel@tonic-gate rdma_stat (*rdma_buf_alloc)(CONN *, rdma_buf_t *); 291*0Sstevel@tonic-gate void (*rdma_buf_free)(CONN *, rdma_buf_t *); 292*0Sstevel@tonic-gate /* Transfer */ 293*0Sstevel@tonic-gate rdma_stat (*rdma_send)(CONN *, clist *, uint32_t); 294*0Sstevel@tonic-gate rdma_stat (*rdma_send_resp)(CONN *, clist *, uint32_t); 295*0Sstevel@tonic-gate rdma_stat (*rdma_clnt_recvbuf)(CONN *, clist *, uint32_t); 296*0Sstevel@tonic-gate rdma_stat (*rdma_svc_recvbuf)(CONN *, clist *); 297*0Sstevel@tonic-gate rdma_stat (*rdma_recv)(CONN *, clist **, uint32_t); 298*0Sstevel@tonic-gate /* RDMA */ 299*0Sstevel@tonic-gate rdma_stat (*rdma_read)(CONN *, clist *, int); 300*0Sstevel@tonic-gate rdma_stat (*rdma_write)(CONN *, clist *, int); 301*0Sstevel@tonic-gate /* INFO */ 302*0Sstevel@tonic-gate rdma_stat (*rdma_getinfo)(rdma_info_t *info); 303*0Sstevel@tonic-gate 304*0Sstevel@tonic-gate } rdmaops_t; 305*0Sstevel@tonic-gate 306*0Sstevel@tonic-gate /* 307*0Sstevel@tonic-gate * RDMA operations. 308*0Sstevel@tonic-gate */ 309*0Sstevel@tonic-gate #define RDMA_REACHABLE(rdma_ops, addr_type, addr, handle) \ 310*0Sstevel@tonic-gate (*(rdma_ops)->rdma_reachable)(addr_type, addr, handle) 311*0Sstevel@tonic-gate 312*0Sstevel@tonic-gate #define RDMA_GET_CONN(rdma_ops, addr, addr_type, handle, conn) \ 313*0Sstevel@tonic-gate (*(rdma_ops)->rdma_get_conn)(addr, addr_type, handle, conn) 314*0Sstevel@tonic-gate 315*0Sstevel@tonic-gate #define RDMA_REL_CONN(conn) \ 316*0Sstevel@tonic-gate (*(conn)->c_rdmamod->rdma_ops->rdma_rel_conn)(conn) 317*0Sstevel@tonic-gate 318*0Sstevel@tonic-gate #define RDMA_REGMEM(conn, buff, len, handle) \ 319*0Sstevel@tonic-gate (*(conn)->c_rdmamod->rdma_ops->rdma_regmem)(conn, buff, len, handle) 320*0Sstevel@tonic-gate 321*0Sstevel@tonic-gate #define RDMA_DEREGMEM(conn, buff, handle) \ 322*0Sstevel@tonic-gate (*(conn)->c_rdmamod->rdma_ops->rdma_deregmem)(conn, buff, handle) 323*0Sstevel@tonic-gate 324*0Sstevel@tonic-gate #define RDMA_REGMEMSYNC(conn, buff, len, handle, synchandle) \ 325*0Sstevel@tonic-gate (*(conn)->c_rdmamod->rdma_ops->rdma_regmemsync)(conn, buff, \ 326*0Sstevel@tonic-gate len, handle, synchandle) 327*0Sstevel@tonic-gate 328*0Sstevel@tonic-gate #define RDMA_DEREGMEMSYNC(conn, buff, handle, synchandle) \ 329*0Sstevel@tonic-gate (*(conn)->c_rdmamod->rdma_ops->rdma_deregmemsync)(conn, buff, \ 330*0Sstevel@tonic-gate handle, synchandle) 331*0Sstevel@tonic-gate 332*0Sstevel@tonic-gate #define RDMA_SYNCMEM(conn, handle, buff, len, direction) \ 333*0Sstevel@tonic-gate (*(conn)->c_rdmamod->rdma_ops->rdma_syncmem)(conn, handle, \ 334*0Sstevel@tonic-gate buff, len, direction) 335*0Sstevel@tonic-gate 336*0Sstevel@tonic-gate #define RDMA_BUF_ALLOC(conn, rbuf) \ 337*0Sstevel@tonic-gate (*(conn)->c_rdmamod->rdma_ops->rdma_buf_alloc)(conn, rbuf) 338*0Sstevel@tonic-gate 339*0Sstevel@tonic-gate #define RDMA_BUF_FREE(conn, rbuf) \ 340*0Sstevel@tonic-gate (*(conn)->c_rdmamod->rdma_ops->rdma_buf_free)(conn, rbuf) 341*0Sstevel@tonic-gate 342*0Sstevel@tonic-gate #define RDMA_SEND(conn, sendlist, xid) \ 343*0Sstevel@tonic-gate (*(conn)->c_rdmamod->rdma_ops->rdma_send)(conn, sendlist, xid) 344*0Sstevel@tonic-gate 345*0Sstevel@tonic-gate #define RDMA_SEND_RESP(conn, sendlist, xid) \ 346*0Sstevel@tonic-gate (*(conn)->c_rdmamod->rdma_ops->rdma_send_resp)(conn, sendlist, xid) 347*0Sstevel@tonic-gate 348*0Sstevel@tonic-gate #define RDMA_CLNT_RECVBUF(conn, cl, xid) \ 349*0Sstevel@tonic-gate (*(conn)->c_rdmamod->rdma_ops->rdma_clnt_recvbuf)(conn, cl, xid) 350*0Sstevel@tonic-gate 351*0Sstevel@tonic-gate #define RDMA_SVC_RECVBUF(conn, cl) \ 352*0Sstevel@tonic-gate (*(conn)->c_rdmamod->rdma_ops->rdma_svc_recvbuf)(conn, cl) 353*0Sstevel@tonic-gate 354*0Sstevel@tonic-gate #define RDMA_RECV(conn, recvlist, xid) \ 355*0Sstevel@tonic-gate (*(conn)->c_rdmamod->rdma_ops->rdma_recv)(conn, recvlist, xid) 356*0Sstevel@tonic-gate 357*0Sstevel@tonic-gate #define RDMA_READ(conn, cl, wait) \ 358*0Sstevel@tonic-gate (*(conn)->c_rdmamod->rdma_ops->rdma_read)(conn, cl, wait) 359*0Sstevel@tonic-gate 360*0Sstevel@tonic-gate #define RDMA_WRITE(conn, cl, wait) \ 361*0Sstevel@tonic-gate (*(conn)->c_rdmamod->rdma_ops->rdma_write)(conn, cl, wait) 362*0Sstevel@tonic-gate 363*0Sstevel@tonic-gate #define RDMA_GETINFO(rdma_mod, info) \ 364*0Sstevel@tonic-gate (*(rdma_mod)->rdma_ops->rdma_getinfo)(info) 365*0Sstevel@tonic-gate 366*0Sstevel@tonic-gate #ifdef _KERNEL 367*0Sstevel@tonic-gate extern rdma_registry_t *rdma_mod_head; 368*0Sstevel@tonic-gate extern krwlock_t rdma_lock; /* protects rdma_mod_head list */ 369*0Sstevel@tonic-gate extern int rdma_modloaded; /* flag for loading RDMA plugins */ 370*0Sstevel@tonic-gate extern int rdma_dev_available; /* rdma device is loaded or not */ 371*0Sstevel@tonic-gate extern kmutex_t rdma_modload_lock; /* protects rdma_modloaded flag */ 372*0Sstevel@tonic-gate extern uint_t rdma_minchunk; 373*0Sstevel@tonic-gate extern ldi_ident_t rpcmod_li; /* needed by layed driver framework */ 374*0Sstevel@tonic-gate 375*0Sstevel@tonic-gate /* 376*0Sstevel@tonic-gate * General RDMA routines 377*0Sstevel@tonic-gate */ 378*0Sstevel@tonic-gate extern void clist_add(struct clist **clp, uint32_t xdroff, int len, 379*0Sstevel@tonic-gate struct mrc *shandle, caddr_t saddr, 380*0Sstevel@tonic-gate struct mrc *dhandle, caddr_t daddr); 381*0Sstevel@tonic-gate extern void clist_free(struct clist *cl); 382*0Sstevel@tonic-gate extern int clist_register(CONN *conn, struct clist *cl, bool_t src); 383*0Sstevel@tonic-gate extern int clist_deregister(CONN *conn, struct clist *cl, bool_t src); 384*0Sstevel@tonic-gate rdma_stat rdma_clnt_postrecv(CONN *conn, uint32_t xid); 385*0Sstevel@tonic-gate rdma_stat rdma_svc_postrecv(CONN *conn); 386*0Sstevel@tonic-gate extern rdma_stat clist_syncmem(CONN *conn, struct clist *cl, bool_t src); 387*0Sstevel@tonic-gate extern rdma_stat rdma_register_mod(rdma_mod_t *mod); 388*0Sstevel@tonic-gate extern rdma_stat rdma_unregister_mod(rdma_mod_t *mod); 389*0Sstevel@tonic-gate extern void rdma_buf_free(CONN *conn, rdma_buf_t *rbuf); 390*0Sstevel@tonic-gate extern int rdma_modload(); 391*0Sstevel@tonic-gate 392*0Sstevel@tonic-gate /* 393*0Sstevel@tonic-gate * RDMA XDR 394*0Sstevel@tonic-gate */ 395*0Sstevel@tonic-gate extern void xdrrdma_create(XDR *, caddr_t, uint_t, int, struct clist *, 396*0Sstevel@tonic-gate enum xdr_op, CONN *); 397*0Sstevel@tonic-gate extern void xdrrdma_destroy(XDR *); 398*0Sstevel@tonic-gate extern struct clist *xdrrdma_clist(XDR *); 399*0Sstevel@tonic-gate extern uint_t xdrrdma_getpos(XDR *); 400*0Sstevel@tonic-gate extern bool_t xdrrdma_setpos(XDR *, uint_t); 401*0Sstevel@tonic-gate extern bool_t xdr_clist(XDR *, clist *); 402*0Sstevel@tonic-gate extern bool_t xdr_do_clist(XDR *, clist **); 403*0Sstevel@tonic-gate extern uint_t xdr_getbufsize(XDR *); 404*0Sstevel@tonic-gate unsigned int xdrrdma_sizeof(xdrproc_t func, void *data, int min_chunk); 405*0Sstevel@tonic-gate unsigned int xdrrdma_authsize(AUTH *auth, struct cred *cred, int min_chunk); 406*0Sstevel@tonic-gate #endif /* _KERNEL */ 407*0Sstevel@tonic-gate 408*0Sstevel@tonic-gate #ifdef __cplusplus 409*0Sstevel@tonic-gate } 410*0Sstevel@tonic-gate #endif 411*0Sstevel@tonic-gate 412*0Sstevel@tonic-gate #endif /* _RPC_RPC_RDMA_H */ 413