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.
27 uint32_t avg_send_size;
28 uint32_t recv_bufsize;
29 uint32_t recv_threshold;
33 char *msg; /* initialized in ibw_init_memory once per connection */
34 int wr_id; /* position in wr_index list; also used as wr id */
36 char *msg_large; /* allocated specially for "large" message */
37 struct ibv_mr *mr_large;
39 char *queued_msg; /* set at ibw_send - can be different than above */
41 struct ibw_wr *next, *prev; /* in wr_list_avail or wr_list_used */
45 struct event_context *ectx;
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 ibw_connstate_fn_t connstate_func; /* see ibw_init */
55 ibw_receive_fn_t receive_func; /* see ibw_init */
57 long pagesize; /* sysconf result for memalign */
61 char *buf; /* talloced memory buffer */
62 uint32_t bufsize; /* allocated size of buf - always grows */
63 uint32_t len; /* message part length */
64 uint32_t to_read; /* 4 or *((uint32_t)buf) if len>=sizeof(uint32_t) */
67 struct ibw_conn_priv {
68 struct ibv_comp_channel *verbs_channel;
69 struct fd_event *verbs_channel_event;
71 struct rdma_cm_id *cm_id; /* client's cm id */
75 struct ibv_cq *cq; /* qp is in cm_id */
77 char *buf_send; /* max_send_wr * avg_send_size */
78 struct ibv_mr *mr_send;
79 struct ibw_wr *wr_list_avail;
80 struct ibw_wr *wr_list_used;
81 struct ibw_wr **wr_index; /* array[0..(qsize-1)] of (ibw_wr *) */
82 int wr_sent; /* # of send wrs in the CQ */
85 struct ibw_wr *extra_sent;
86 struct ibw_wr *extra_avail;
87 int extra_max; /* max wr_id in the queue */
89 /* buf_recv is a ring buffer */
90 char *buf_recv; /* max_recv_wr * avg_recv_size */
91 struct ibv_mr *mr_recv;
92 int recv_index; /* index of the next recv buffer when refilling */