1
/*$Id: armci-vapi.h,v 1.21.2.1 2007-03-06 19:50:24 vinod Exp $ */
9
#include <mtl_common.h>
11
#include <vapi_common.h>
15
#include <infiniband/verbs.h>
19
#define DSCRID_NBDSCR 10000
21
#define MAX_RDMA_SIZE (8388608)
22
#define DEFAULT_ADDR_LEN (8) /* format length of hcalid/qp_num.*/
24
#define DEFAULT_PORT (1) /*for vapi*/
25
#define DEFAULT_MTU (MTU1024)
26
#define DEFAULT_PSN (0)
27
#define DEFAULT_PKEY_IX (0)
28
#define DEFAULT_P_KEY (0x0)
29
#define DEFAULT_MIN_RNR_TIMER (5)
30
#define DEFAULT_SERVICE_LEVEL (0)
31
#define DEFAULT_TIME_OUT (5)
32
#define DEFAULT_STATIC_RATE (2)
33
#define DEFAULT_SRC_PATH_BITS (0)
34
#define DEFAULT_RETRY_COUNT (1)
35
#define DEFAULT_RNR_RETRY (1)
38
#define DEFAULT_R_KEY (0x0)
39
#define DEFAULT_L_KEY (0x0)
41
#define DEFAULT_MAX_WQE 2048/*(1023)*/
44
void *data_ptr; /* pointer where the data should go */
45
long ack; /* header ack */
46
void *ack_ptr; /* pointer where the data should go */
47
#if defined(PEND_BUFS)
48
unsigned int imm_msg:1;
49
unsigned int data_len:31;
56
VAPI_sg_lst_entry_t ssg_entry;
58
VAPI_sg_lst_entry_t rsg_entry;
61
struct ibv_send_wr sdscr;
62
struct ibv_sge ssg_entry;
63
struct ibv_recv_wr rdscr;
64
struct ibv_sge rsg_entry;
72
VAPI_mr_hndl_t memhndl;
77
struct ibv_mr *memhndl;
79
}armci_vapi_memhndl_t;
81
extern char * armci_vapi_client_mem_alloc(int);
87
VAPI_sr_desc_t sdescr;
88
VAPI_rr_desc_t rdescr;
89
VAPI_sg_lst_entry_t sg_entry[56]; /*ff:this has to be malloced*/
92
struct ibv_send_wr sdescr;
93
struct ibv_recv_wr rdescr;
94
struct ibv_sge sg_entry[56]; /*ff:this has to be malloced*/
105
VAPI_rr_desc_t descr;
106
VAPI_sg_lst_entry_t sg_entry[56]; /*ff:this has to be malloced*/
109
struct ibv_recv_wr descr;
110
struct ibv_send_wr sg_entry[56]; /*ff:this has to be malloced*/
116
#if defined(PEND_BUFS)
118
/* typedef struct { */
119
/* struct ibv_recv_wr dscr; */
120
/* struct ibv_sge sg_entry; */
122
/* typedef struct { */
123
/* struct ibv_sge sg_entry; */
124
/* struct ibv_recv_wr rdscr; */
125
/* struct ibv_send_wr sdscr; */
126
/* } PENDBUF_NW_T; */
127
#define IMMBUF_NW_T \
128
struct ibv_recv_wr dscr; \
129
struct ibv_sge sg_entry; \
131
#define PENDBUF_NW_T \
132
struct ibv_sge sg_entry; \
133
struct ibv_recv_wr rdscr; \
134
struct ibv_send_wr sdscr;
136
#define IS_IMM_MSG(msginfo) ((msginfo).tag.imm_msg)
138
void armci_complete_immbuf(void *vbuf);
139
void armci_complete_pendbuf(void *buf);
140
/*Note that start_put and start_get cannot report completion from
141
within. They have to just return and report completion later.
143
void armci_pbuf_start_put(void *src, void *dst, int bytes, int proc,
145
void armci_pbuf_start_get(void *msg_info,
146
void *src, void *dst, int bytes, int proc,
149
#error "PEND_BUFS only implemented for OPENIB"
153
void armci_client_nbcall_complete(sr_descr_t *,int,int);
154
void armci_vapi_set_mark_buf_send_complete(int);
156
#define ARMCI_MEMHDL_T armci_vapi_memhndl_t
158
#define REGIONS_REQUIRE_MEMHDL
160
#define PIPE_BUFSIZE__ (4096)
161
#define PIPE_MIN_BUFSIZE 1024
162
#define PIPE_MEDIUM_BUFSIZE (2*1024)
165
#define VBUF_DLEN 4*64*1023
166
#define MSG_BUFLEN_DBL ((VBUF_DLEN)>>3)
168
#if defined(PEND_BUFS)
169
#define IMM_BUF_NUM_DEFAULT 4
170
#define IMM_BUF_LEN_DEFAULT 2048
171
#define PENDING_BUF_NUM_DEFAULT 20
172
#define PENDING_BUF_LEN_DEFAULT (VBUF_DLEN)
176
# define STRIDED_GET_BUFLEN_DBL 31*1024
177
# define STRIDED_GET_BUFLEN (STRIDED_GET_BUFLEN_DBL<<3)
178
# define MAX_BUFLEN (STRIDED_GET_BUFLEN+EXTRA_MSG_BUFLEN)
180
# define MAX_BUFLEN (MSG_BUFLEN+EXTRA_MSG_BUFLEN)
182
#define BALANCE_BUFFERS
183
#ifdef BALANCE_BUFFERS
184
# define BALANCE_FACTOR 1.6
185
/* # define BALANCE_FACTOR 2.0 */
186
# define BALANCE_BUFSIZE 25000
189
#define BUF_EXTRA_FIELD_T armci_vapi_field_t
190
#define GET_SEND_BUFFER _armci_buf_get
191
#define FREE_SEND_BUFFER _armci_buf_release
193
#define INIT_SEND_BUF(_field,_snd,_rcv) _snd=1;_rcv=1;memset(&((_field).sdscr),0,sizeof(VAPI_sr_desc_t));(_field).sdscr.id=avail+1;armci_vapi_set_mark_buf_send_complete(avail+1)
196
#define INIT_SEND_BUF(_field,_snd,_rcv) _snd=1;_rcv=1;memset(&((_field).sdscr),0,sizeof(struct ibv_send_wr));(_field).sdscr.wr_id=avail+1;armci_vapi_set_mark_buf_send_complete(avail+1)
198
#define BUF_ALLOCATE armci_vapi_client_mem_alloc
200
#define CLEAR_SEND_BUF_FIELD(_field,_snd,_rcv,_to,_op) armci_vapi_complete_buf((armci_vapi_field_t *)(&(_field)),(_snd),(_rcv),(_to),(_op));_snd=0;_rcv=0;_to=0
202
#define TEST_SEND_BUF_FIELD(_field,_snd,_rcv,_to,_op,_pret) armci_vapi_test_buf((armci_vapi_field_t *)(&(_field)),(_snd),(_rcv),(_to),(_op),(_pret))
204
#define CLIENT_BUF_BYPASS 1
206
#define _armci_bypass 1
208
#define COMPLETE_HANDLE _armci_buf_complete_nb_request
210
#if defined(ALLOW_PIN)
211
# define NB_CMPL_T sr_descr_t*
212
# define ARMCI_NB_WAIT(_cntr) if(_cntr)if(nb_handle->tag==(_cntr)->tag)\
213
armci_client_nbcall_complete(_cntr,nb_handle->tag,nb_handle->op);
214
# define CLEAR_HNDL_FIELD(_x) _x=NULL
217
/* #define DIRECT_PUT_MIN_SIZE 8192 */
218
#define DIRECT_PUT_MIN_SIZE 0
220
#define LONG_GET_THRESHOLD 2147483648
221
#define LONG_GET_THRESHOLD_STRIDED 2147483648
223
#error "ARMCI_STAMP used to define ARMCI_VAPI_COMPLETE not found!"
224
#define ARMCI_VAPI_COMPLETE 1088451863
226
#define ARMCI_VAPI_COMPLETE ARMCI_STAMP
228
#define ARMCI_POST_SCATTER 1000000001
229
#define ARMCI_VAPI_CLEAR 0
231
#define VAPI_SGGET_MIN_COLUMN 720
232
#define VAPI_SGPUT_MIN_COLUMN 720
235
/* #define VAPI_SGGET_MIN_COLUMN 2147483648 */
236
#define VAPI_SGPUT_MIN_COLUMN 2147483648
237
#define VAPI_SGGET_MIN_COLUMN 10
238
/* #define VAPI_SGPUT_MIN_COLUMN 720 */
240
#define DSCRID_SCATTERCLIENT 70000
241
#define DSCRID_SCATTERCLIENT_END 70000+9999
243
#define MAX_PENDING 32
249
#define PUT_NO_SRV_COPY /*server rdma-s from to client buffers (in
251
remote memory (bypassing
252
servers intermediate buffers) when possible*/
253
#define GET_NO_SRV_COPY /*server rdma-s from remote memory to client
254
buffers (in buffers.c) (bypassing server
255
intermediate buffers) when possible*/
256
int no_srv_copy_nsegs_ulimit();/*max #contig segs for which we avoid server copy. Too many segments might overflow a queue*/
258
#define GET_STRIDED_COPY_PIPELINED /*client copies data from buffers
259
to user memory in segments rather
260
than waiting for all the data*/
261
#define GET_STRIDED_COPY_PIPELINED_SIZE (1*1024) /*size of each segment*/
264
#endif /* _VAPI_CONST_H */
266
extern void armci_wait_ack(char *buffer);
267
extern void armci_complete_multi_sglist_sends(int proc);
268
extern void armci_client_direct_send(int p,void *src_buf, void *dst_buf, int len,void** contextptr,int nbtag,ARMCI_MEMHDL_T *lochdl,ARMCI_MEMHDL_T *remhdl);