Using struct <type> instead of typedefs.
[vlendec/samba-autobuild/.git] / ctdb / ib / ibwrapper_internal.h
1 /*
2  * Unix SMB/CIFS implementation.
3  * Wrap Infiniband calls.
4  *
5  * Copyright (C) Sven Oehme <oehmes@de.ibm.com> 2006
6  *
7  * Major code contributions by Peter Somogyi <psomogyi@gamax.hu>
8  *
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.
13  *
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.
18  *
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.
22  */
23
24 struct ibw_opts {
25         int     max_send_wr;
26         int     max_recv_wr;
27 };
28
29 struct ibw_wr {
30         char    *msg; /* initialized in ibw_init_memory once per connection */
31         int     wr_id; /* position in wr_index list; also used as wr id */
32         struct _ibw_wr *next, *prev; /* in wr_list_avail or wr_list_used */
33 };
34
35 struct ibw_ctx_priv {
36         struct event_context *ectx;
37
38         struct ibw_opts opts;
39
40         struct rdma_cm_id       *cm_id; /* server cm id */
41
42         struct rdma_event_channel *cm_channel;
43         struct fd_event *cm_channel_event;
44
45         struct ibv_pd          *pd;
46         enum iwint_state_ctx    state2;
47
48         ibw_connstate_fn_t connstate_func; /* see ibw_init */
49         ibw_receive_fn_t receive_func; /* see ibw_init */
50
51         long    pagesize; /* sysconf result for memalign */
52         int     qsize; /* opts.max_send_wr + opts.max_recv_wr */
53         int     max_msg_size; /* see ibw_init */
54 };
55
56 struct ibw_conn_priv {
57         struct ibv_comp_channel *verbs_channel;
58         struct fd_event *verbs_channel_event;
59
60         struct rdma_cm_id *cm_id; /* client's cm id */
61         int     is_accepted;
62
63         struct ibv_cq   *cq; /* qp is in cm_id */
64         struct ibv_mr *mr;
65         char *buf; /* fixed size (qsize * opts.max_msg_size) buffer for send/recv */
66         struct ibw_wr *wr_list_avail;
67         struct ibw_wr *wr_list_used;
68         struct ibw_wr **wr_index; /* array[0..(qsize-1)] of (ibw_wr *) */
69 };
70