Rough implementation of buffer handling.
[Samba.git] / ctdb / ib / ibwrapper_internal.h
blobb022c92c717a7e91f0caaa634371490a850d9d9a
1 /*
2 * Unix SMB/CIFS implementation.
3 * Wrap Infiniband calls.
5 * Copyright (C) Sven Oehme <oehmes@de.ibm.com> 2006
7 * Major code contributions by Peter Somogyi <psomogyi@gamax.hu>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 typedef struct _ibw_opts {
25 int max_send_wr;
26 int max_recv_wr;
27 int max_msg_size;
28 } ibw_opts;
30 typedef struct _ibw_wr {
31 char *msg; /* initialized in ibw_init_memory once */
32 ibw_conn *conn; /*valid only when in wr_list_used */
33 int wr_id; /* position in wr_index list; also used as wr id */
34 struct _ibw_wr *next, *prev; /* in wr_list_avail or wr_list_used */
35 } ibw_wr;
37 typedef enum {
38 IWINT_INIT = 0,
39 IWINT_ADDR_RESOLVED,
40 IWINT_ROUTE_RESOLVED,
41 IWINT_ERROR
42 } ibw_state_ctx;
44 typedef struct _ibw_ctx_priv {
45 struct event_context *ectx;
47 ibw_opts opts;
49 struct rdma_cm_id *cm_id; /* server cm id */
51 struct rdma_event_channel *cm_channel;
52 struct fd_event *cm_channel_event;
54 struct rdma_event_channel *cm_channel;
55 struct fd_event *cm_channel_event;
56 struct ibv_comp_channel *verbs_channel;
57 struct fd_event *verbs_channel_event;
59 struct ibv_pd *pd;
61 ibw_connstate_fn_t connstate_func;
62 ibw_receive_fn_t receive_func;
64 long pagesize; /* sysconf result for memalign */
65 } ibw_ctx_priv;
67 typedef struct _ibw_conn_priv {
68 struct rdma_cm_id *cm_id; /* client's cm id */
69 int is_accepted;
71 struct ibv_cq *cq; /* qp is in cm_id */
72 struct ibv_mr *mr;
73 char *buf; /* fixed size (opts.bufsize) buffer for send/recv */
74 ibw_wr *wr_list_avail;
75 ibw_wr *wr_list_used;
76 ibw_wr **wr_index; /* array[0..(max_send_wr + max_recv_wr)-1] of (ibw_wr *) */
77 } ibw_conn_priv;