rpc_rdma.h revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _RPC_RPC_RDMA_H
#define _RPC_RPC_RDMA_H
#pragma ident "%Z%%M% %I% %E% SMI"
#include <rpc/rpc_sztypes.h>
#ifdef __cplusplus
extern "C" {
#endif
#define RPCRDMA_VERS 0 /* Version of the RPC over RDMA protocol */
/*
* The size of an RPC call or reply message
*/
#define RPC_MSG_SZ 1024
/*
* Storage for a chunk list
*/
#define RPC_CL_SZ 1024
/*
* Chunk size
*/
#define MINCHUNK 1024
/*
* Size of receive buffer
*/
#define RPC_BUF_SIZE 2048
#define NOWAIT 0 /* don't wait for operation of complete */
/*
* RDMA xdr buffer control and other control flags. Add new flags here,
* set them in private structure for xdr over RDMA in xdr_rdma.c
*/
#define RDMA_NOCHUNK 0x1
/*
* Return codes from RDMA operations
*/
typedef enum {
RDMA_SUCCESS = 0, /* successful operation */
/*
* connection errors
*/
/*
* RDMATF errors
*/
/*
* fallback error
*/
} rdma_stat;
/*
* Memory region context. This is an RDMA provider generated
* handle for a registered arbitrary size contiguous virtual
* memory. The RDMA Interface Adapter needs this for local or
* remote memory access.
*
* The mrc_rmr field holds the remote memory region context
* which is sent over-the-wire to provide the remote host
* with RDMA access to the memory region.
*/
struct mrc {
union {
struct mr {
} mr;
} lhdl;
};
/*
* The XDR offset value is used by the XDR
* routine to identify the position in the
* RPC message where the opaque object would
* normally occur. Neither the data content
* of the chunk, nor its size field are included
* in the RPC message. The XDR offset is calculated
* as if the chunks were present.
*
* The remaining fields identify the chunk of data
* on the sender. The c_memhandle identifies a
* registered RDMA memory region and the c_addr
* and c_len fields identify the chunk within it.
*/
struct clist {
};
enum rdma_proc {
RDMA_MSG = 0, /* chunk list and RPC msg follow */
};
/*
* Listener information for a service
*/
struct rdma_svc_data {
queue_t q; /* queue_t to place incoming pkts */
int active; /* If active, after registeration startup */
};
/*
* Per RDMA plugin module information.
* Will be populated by each plugin
* module during its initialization.
*/
typedef struct rdma_mod {
char *rdma_api; /* "kvipl", "ibtf", etc */
int rdma_count; /* # of devices */
} rdma_mod_t;
/*
* Registry of RDMA plugins
*/
typedef struct rdma_registry {
/*
* RDMA transport information
*/
typedef struct rdma_info {
} rdma_info_t;
/*
* RDMA Connection information
*/
typedef struct conn {
int c_ref; /* no. of clients of connection */
#define C_IDLE 0x80000000
#define C_CONN_PEND 0x40000000
#define C_CONNECTED 0x20000000
#define C_ERROR 0x10000000
#define C_DISCONN_PEND 0x08000000
#define C_REMOTE_DOWN 0x04000000
} CONN;
/*
* Memory management for the RDMA buffers
*/
/*
* RDMA buffer types
*/
typedef enum {
SEND_BUFFER, /* buf for send msg */
SEND_DESCRIPTOR, /* buf used for send msg descriptor in plugins only */
RECV_BUFFER, /* buf for recv msg */
RECV_DESCRIPTOR, /* buf used for recv msg descriptor in plugins only */
CHUNK_BUFFER /* chunk buf used in RDMATF only and not in plugins */
} rdma_btype;
/*
* RDMA buffer information
*/
typedef struct rdma_buf {
int len; /* length of buffer */
} rdma_buf_t;
/*
* Data transferred from plugin interrupt to svc_queuereq()
*/
struct recv_data {
int status;
};
/*
* Operations vector for RDMA transports.
*/
typedef struct rdmaops {
/* Network */
void **handle);
/* Connection */
void *, CONN **);
/* Server side listner start and stop routines */
void (*rdma_svc_listen)(struct rdma_svc_data *);
void (*rdma_svc_stop)(struct rdma_svc_data *);
/* Memory */
struct mrc *, void **);
void *);
/* Buffer */
/* Transfer */
/* RDMA */
/* INFO */
} rdmaops_t;
/*
* RDMA operations.
*/
#define RDMA_REL_CONN(conn) \
#ifdef _KERNEL
extern rdma_registry_t *rdma_mod_head;
extern int rdma_modloaded; /* flag for loading RDMA plugins */
extern int rdma_dev_available; /* rdma device is loaded or not */
extern uint_t rdma_minchunk;
/*
* General RDMA routines
*/
extern int rdma_modload();
/*
* RDMA XDR
*/
extern void xdrrdma_destroy(XDR *);
#endif /* _KERNEL */
#ifdef __cplusplus
}
#endif
#endif /* _RPC_RPC_RDMA_H */