blob: 99fc8b899648b3109c26e66e725c92eb7d677ece [file] [log] [blame]
Or Gerlitz49cd5382006-05-11 10:00:21 +03001/*
2 * iSER transport for the Open iSCSI Initiator & iSER transport internals
3 *
4 * Copyright (C) 2004 Dmitry Yusupov
5 * Copyright (C) 2004 Alex Aizman
6 * Copyright (C) 2005 Mike Christie
7 * based on code maintained by open-iscsi@googlegroups.com
8 *
9 * Copyright (c) 2004, 2005, 2006 Voltaire, Inc. All rights reserved.
10 * Copyright (c) 2005, 2006 Cisco Systems. All rights reserved.
Or Gerlitz28f292e2013-05-08 12:21:18 +000011 * Copyright (c) 2013 Mellanox Technologies. All rights reserved.
Or Gerlitz49cd5382006-05-11 10:00:21 +030012 *
13 * This software is available to you under a choice of one of two
14 * licenses. You may choose to be licensed under the terms of the GNU
15 * General Public License (GPL) Version 2, available from the file
16 * COPYING in the main directory of this source tree, or the
17 * OpenIB.org BSD license below:
18 *
19 * Redistribution and use in source and binary forms, with or
20 * without modification, are permitted provided that the following
21 * conditions are met:
22 *
23 * - Redistributions of source code must retain the above
24 * copyright notice, this list of conditions and the following
25 * disclaimer.
26 *
27 * - Redistributions in binary form must reproduce the above
28 * copyright notice, this list of conditions and the following
29 * disclaimer in the documentation and/or other materials
30 * provided with the distribution.
31 *
32 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
33 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
34 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
35 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
36 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
37 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
38 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
39 * SOFTWARE.
Or Gerlitz49cd5382006-05-11 10:00:21 +030040 */
41#ifndef __ISCSI_ISER_H__
42#define __ISCSI_ISER_H__
43
44#include <linux/types.h>
45#include <linux/net.h>
Roi Dayan4f363882013-05-01 13:25:25 +000046#include <linux/printk.h>
Or Gerlitz49cd5382006-05-11 10:00:21 +030047#include <scsi/libiscsi.h>
48#include <scsi/scsi_transport_iscsi.h>
49
Alexey Dobriyana6b7a402011-06-06 10:43:46 +000050#include <linux/interrupt.h>
Or Gerlitz49cd5382006-05-11 10:00:21 +030051#include <linux/wait.h>
52#include <linux/sched.h>
53#include <linux/list.h>
54#include <linux/slab.h>
55#include <linux/dma-mapping.h>
56#include <linux/mutex.h>
57#include <linux/mempool.h>
58#include <linux/uio.h>
59
60#include <linux/socket.h>
61#include <linux/in.h>
62#include <linux/in6.h>
63
64#include <rdma/ib_verbs.h>
65#include <rdma/ib_fmr_pool.h>
66#include <rdma/rdma_cm.h>
67
68#define DRV_NAME "iser"
69#define PFX DRV_NAME ": "
Roi Dayanc1d786e2013-05-01 13:25:24 +000070#define DRV_VER "1.1"
Or Gerlitz49cd5382006-05-11 10:00:21 +030071
72#define iser_dbg(fmt, arg...) \
73 do { \
Roi Dayan4f363882013-05-01 13:25:25 +000074 if (iser_debug_level > 2) \
Eli Dorfman6f735e32008-04-29 13:46:52 -070075 printk(KERN_DEBUG PFX "%s:" fmt,\
76 __func__ , ## arg); \
77 } while (0)
78
79#define iser_warn(fmt, arg...) \
80 do { \
Or Gerlitzf91424c2013-07-28 12:35:36 +030081 if (iser_debug_level > 0) \
Roi Dayan4f363882013-05-01 13:25:25 +000082 pr_warn(PFX "%s:" fmt, \
83 __func__ , ## arg); \
84 } while (0)
85
86#define iser_info(fmt, arg...) \
87 do { \
Or Gerlitzf91424c2013-07-28 12:35:36 +030088 if (iser_debug_level > 1) \
Roi Dayan4f363882013-05-01 13:25:25 +000089 pr_info(PFX "%s:" fmt, \
Or Gerlitz49cd5382006-05-11 10:00:21 +030090 __func__ , ## arg); \
91 } while (0)
92
93#define iser_err(fmt, arg...) \
94 do { \
95 printk(KERN_ERR PFX "%s:" fmt, \
96 __func__ , ## arg); \
97 } while (0)
98
Erez Zilber8dfa0872006-09-11 12:22:30 +030099#define SHIFT_4K 12
Or Gerlitz0ace64b2011-08-01 21:12:09 +0000100#define SIZE_4K (1ULL << SHIFT_4K)
Erez Zilber8dfa0872006-09-11 12:22:30 +0300101#define MASK_4K (~(SIZE_4K-1))
102
Lucas De Marchi25985ed2011-03-30 22:57:33 -0300103 /* support up to 512KB in one RDMA */
Erez Zilber8dfa0872006-09-11 12:22:30 +0300104#define ISCSI_ISER_SG_TABLESIZE (0x80000 >> SHIFT_4K)
Shlomo Pongratzb7f04512013-07-28 12:35:38 +0300105#define ISER_DEF_XMIT_CMDS_DEFAULT 512
106#if ISCSI_DEF_XMIT_CMDS_MAX > ISER_DEF_XMIT_CMDS_DEFAULT
107 #define ISER_DEF_XMIT_CMDS_MAX ISCSI_DEF_XMIT_CMDS_MAX
108#else
109 #define ISER_DEF_XMIT_CMDS_MAX ISER_DEF_XMIT_CMDS_DEFAULT
110#endif
111#define ISER_DEF_CMD_PER_LUN ISER_DEF_XMIT_CMDS_MAX
Or Gerlitz49cd5382006-05-11 10:00:21 +0300112
113/* QP settings */
114/* Maximal bounds on received asynchronous PDUs */
115#define ISER_MAX_RX_MISC_PDUS 4 /* NOOP_IN(2) , ASYNC_EVENT(2) */
116
117#define ISER_MAX_TX_MISC_PDUS 6 /* NOOP_OUT(2), TEXT(1), *
118 * SCSI_TMFUNC(2), LOGOUT(1) */
119
Shlomo Pongratzb7f04512013-07-28 12:35:38 +0300120#define ISER_QP_MAX_RECV_DTOS (ISER_DEF_XMIT_CMDS_MAX)
Or Gerlitzbcc60c32010-02-08 13:17:42 +0000121
Shlomo Pongratzb7f04512013-07-28 12:35:38 +0300122#define ISER_MIN_POSTED_RX (ISER_DEF_XMIT_CMDS_MAX >> 2)
Or Gerlitz49cd5382006-05-11 10:00:21 +0300123
124/* the max TX (send) WR supported by the iSER QP is defined by *
125 * max_send_wr = T * (1 + D) + C ; D is how many inflight dataouts we expect *
126 * to have at max for SCSI command. The tx posting & completion handling code *
127 * supports -EAGAIN scheme where tx is suspended till the QP has room for more *
128 * send WR. D=8 comes from 64K/8K */
129
130#define ISER_INFLIGHT_DATAOUTS 8
131
Shlomo Pongratzb7f04512013-07-28 12:35:38 +0300132#define ISER_QP_MAX_REQ_DTOS (ISER_DEF_XMIT_CMDS_MAX * \
Or Gerlitz49cd5382006-05-11 10:00:21 +0300133 (1 + ISER_INFLIGHT_DATAOUTS) + \
134 ISER_MAX_TX_MISC_PDUS + \
135 ISER_MAX_RX_MISC_PDUS)
136
Alex Tabachnik6b5a8fb2014-03-05 19:43:47 +0200137/* Max registration work requests per command */
138#define ISER_MAX_REG_WR_PER_CMD 5
139
140/* For Signature we don't support DATAOUTs so no need to make room for them */
141#define ISER_QP_SIG_MAX_REQ_DTOS (ISER_DEF_XMIT_CMDS_MAX * \
142 (1 + ISER_MAX_REG_WR_PER_CMD) + \
143 ISER_MAX_TX_MISC_PDUS + \
144 ISER_MAX_RX_MISC_PDUS)
145
Or Gerlitz49cd5382006-05-11 10:00:21 +0300146#define ISER_VER 0x10
147#define ISER_WSV 0x08
148#define ISER_RSV 0x04
149
Sagi Grimberg7306b8f2014-03-05 19:43:39 +0200150#define ISER_FASTREG_LI_WRID 0xffffffffffffffffULL
Sagi Grimbergdb523b82014-01-23 12:31:28 +0200151
Or Gerlitz49cd5382006-05-11 10:00:21 +0300152struct iser_hdr {
153 u8 flags;
154 u8 rsvd[3];
155 __be32 write_stag; /* write rkey */
156 __be64 write_va;
157 __be32 read_stag; /* read rkey */
158 __be64 read_va;
159} __attribute__((packed));
160
Or Gerlitz8d8399d2013-05-01 13:25:27 +0000161
162#define ISER_ZBVA_NOT_SUPPORTED 0x80
163#define ISER_SEND_W_INV_NOT_SUPPORTED 0x40
164
165struct iser_cm_hdr {
166 u8 flags;
167 u8 rsvd[3];
168} __packed;
169
Or Gerlitzbcc60c32010-02-08 13:17:42 +0000170/* Constant PDU lengths calculations */
171#define ISER_HEADERS_LEN (sizeof(struct iser_hdr) + sizeof(struct iscsi_hdr))
172
173#define ISER_RECV_DATA_SEG_LEN 128
174#define ISER_RX_PAYLOAD_SIZE (ISER_HEADERS_LEN + ISER_RECV_DATA_SEG_LEN)
175#define ISER_RX_LOGIN_SIZE (ISER_HEADERS_LEN + ISCSI_DEF_MAX_RECV_SEG_LEN)
Or Gerlitz49cd5382006-05-11 10:00:21 +0300176
177/* Length of an object name string */
178#define ISER_OBJECT_NAME_SIZE 64
179
180enum iser_ib_conn_state {
181 ISER_CONN_INIT, /* descriptor allocd, no conn */
182 ISER_CONN_PENDING, /* in the process of being established */
183 ISER_CONN_UP, /* up and running */
184 ISER_CONN_TERMINATING, /* in the process of being terminated */
185 ISER_CONN_DOWN, /* shut down */
186 ISER_CONN_STATES_NUM
187};
188
189enum iser_task_status {
190 ISER_TASK_STATUS_INIT = 0,
191 ISER_TASK_STATUS_STARTED,
192 ISER_TASK_STATUS_COMPLETED
193};
194
195enum iser_data_dir {
196 ISER_DIR_IN = 0, /* to initiator */
197 ISER_DIR_OUT, /* from initiator */
198 ISER_DIRS_NUM
199};
200
201struct iser_data_buf {
202 void *buf; /* pointer to the sg list */
203 unsigned int size; /* num entries of this sg */
204 unsigned long data_len; /* total data len */
205 unsigned int dma_nents; /* returned by dma_map_sg */
206 char *copy_buf; /* allocated copy buf for SGs unaligned *
207 * for rdma which are copied */
208 struct scatterlist sg_single; /* SG-ified clone of a non SG SC or *
209 * unaligned SG */
210 };
211
212/* fwd declarations */
213struct iser_device;
Alex Tabachnik5a33a662012-09-23 15:17:44 +0000214struct iser_cq_desc;
Or Gerlitz49cd5382006-05-11 10:00:21 +0300215struct iscsi_iser_conn;
Mike Christie2261ec32008-05-21 15:54:11 -0500216struct iscsi_iser_task;
Mike Christie412eeaf2008-05-21 15:54:14 -0500217struct iscsi_endpoint;
Or Gerlitz49cd5382006-05-11 10:00:21 +0300218
219struct iser_mem_reg {
220 u32 lkey;
221 u32 rkey;
222 u64 va;
223 u64 len;
224 void *mem_h;
Sagi Grimberg55878562013-07-28 12:35:42 +0300225 int is_mr;
Or Gerlitz49cd5382006-05-11 10:00:21 +0300226};
227
228struct iser_regd_buf {
229 struct iser_mem_reg reg; /* memory registration info */
230 void *virt_addr;
231 struct iser_device *device; /* device->device for dma_unmap */
Or Gerlitz49cd5382006-05-11 10:00:21 +0300232 enum dma_data_direction direction; /* direction for dma_unmap */
233 unsigned int data_size;
Or Gerlitz49cd5382006-05-11 10:00:21 +0300234};
235
236enum iser_desc_type {
Or Gerlitz49cd5382006-05-11 10:00:21 +0300237 ISCSI_TX_CONTROL ,
238 ISCSI_TX_SCSI_COMMAND,
239 ISCSI_TX_DATAOUT
240};
241
Or Gerlitzf19624a2010-02-08 13:19:56 +0000242struct iser_tx_desc {
Or Gerlitz49cd5382006-05-11 10:00:21 +0300243 struct iser_hdr iser_header;
244 struct iscsi_hdr iscsi_header;
Or Gerlitz49cd5382006-05-11 10:00:21 +0300245 enum iser_desc_type type;
Or Gerlitzf19624a2010-02-08 13:19:56 +0000246 u64 dma_addr;
247 /* sg[0] points to iser/iscsi headers, sg[1] optionally points to either
248 of immediate data, unsolicited data-out or control (login,text) */
249 struct ib_sge tx_sg[2];
250 int num_sge;
Or Gerlitz49cd5382006-05-11 10:00:21 +0300251};
252
Or Gerlitzbcc60c32010-02-08 13:17:42 +0000253#define ISER_RX_PAD_SIZE (256 - (ISER_RX_PAYLOAD_SIZE + \
254 sizeof(u64) + sizeof(struct ib_sge)))
255struct iser_rx_desc {
256 struct iser_hdr iser_header;
257 struct iscsi_hdr iscsi_header;
258 char data[ISER_RECV_DATA_SEG_LEN];
259 u64 dma_addr;
260 struct ib_sge rx_sg;
261 char pad[ISER_RX_PAD_SIZE];
262} __attribute__((packed));
263
Alex Tabachnik5a33a662012-09-23 15:17:44 +0000264#define ISER_MAX_CQ 4
265
Sagi Grimbergb4e155f2013-07-28 12:35:39 +0300266struct iser_conn;
267struct iscsi_iser_task;
268
Or Gerlitz49cd5382006-05-11 10:00:21 +0300269struct iser_device {
270 struct ib_device *ib_device;
271 struct ib_pd *pd;
Sagi Grimberg65198d62014-03-05 19:43:42 +0200272 struct ib_device_attr dev_attr;
Alex Tabachnik5a33a662012-09-23 15:17:44 +0000273 struct ib_cq *rx_cq[ISER_MAX_CQ];
274 struct ib_cq *tx_cq[ISER_MAX_CQ];
Or Gerlitz49cd5382006-05-11 10:00:21 +0300275 struct ib_mr *mr;
Alex Tabachnik5a33a662012-09-23 15:17:44 +0000276 struct tasklet_struct cq_tasklet[ISER_MAX_CQ];
Or Gerlitz2110f9b2010-05-05 17:30:10 +0300277 struct ib_event_handler event_handler;
Or Gerlitz49cd5382006-05-11 10:00:21 +0300278 struct list_head ig_list; /* entry in ig devices list */
279 int refcount;
Alex Tabachnik5a33a662012-09-23 15:17:44 +0000280 int cq_active_qps[ISER_MAX_CQ];
281 int cqs_used;
282 struct iser_cq_desc *cq_desc;
Sagi Grimbergb4e155f2013-07-28 12:35:39 +0300283 int (*iser_alloc_rdma_reg_res)(struct iser_conn *ib_conn,
284 unsigned cmds_max);
285 void (*iser_free_rdma_reg_res)(struct iser_conn *ib_conn);
286 int (*iser_reg_rdma_mem)(struct iscsi_iser_task *iser_task,
287 enum iser_data_dir cmd_dir);
288 void (*iser_unreg_rdma_mem)(struct iscsi_iser_task *iser_task,
289 enum iser_data_dir cmd_dir);
Or Gerlitz49cd5382006-05-11 10:00:21 +0300290};
291
Sagi Grimberg73bc06b2014-03-05 19:43:43 +0200292enum iser_reg_indicator {
Alex Tabachnik6b5a8fb2014-03-05 19:43:47 +0200293 ISER_DATA_KEY_VALID = 1 << 0,
294 ISER_PROT_KEY_VALID = 1 << 1,
295 ISER_SIG_KEY_VALID = 1 << 2,
296 ISER_FASTREG_PROTECTED = 1 << 3,
297};
298
299struct iser_pi_context {
300 struct ib_mr *prot_mr;
301 struct ib_fast_reg_page_list *prot_frpl;
302 struct ib_mr *sig_mr;
Sagi Grimberg73bc06b2014-03-05 19:43:43 +0200303};
304
Sagi Grimberg55878562013-07-28 12:35:42 +0300305struct fast_reg_descriptor {
306 struct list_head list;
307 /* For fast registration - FRWR */
308 struct ib_mr *data_mr;
309 struct ib_fast_reg_page_list *data_frpl;
Alex Tabachnik6b5a8fb2014-03-05 19:43:47 +0200310 struct iser_pi_context *pi_ctx;
Sagi Grimberg73bc06b2014-03-05 19:43:43 +0200311 /* registration indicators container */
312 u8 reg_indicators;
Sagi Grimberg55878562013-07-28 12:35:42 +0300313};
314
Or Gerlitz49cd5382006-05-11 10:00:21 +0300315struct iser_conn {
316 struct iscsi_iser_conn *iser_conn; /* iser conn for upcalls */
Mike Christie412eeaf2008-05-21 15:54:14 -0500317 struct iscsi_endpoint *ep;
Or Gerlitz49cd5382006-05-11 10:00:21 +0300318 enum iser_ib_conn_state state; /* rdma connection state */
Mike Christieb40977d2008-05-21 15:54:03 -0500319 atomic_t refcount;
Or Gerlitz49cd5382006-05-11 10:00:21 +0300320 spinlock_t lock; /* used for state changes */
321 struct iser_device *device; /* device context */
322 struct rdma_cm_id *cma_id; /* CMA ID */
323 struct ib_qp *qp; /* QP */
Or Gerlitz49cd5382006-05-11 10:00:21 +0300324 wait_queue_head_t wait; /* waitq for conn/disconn */
Shlomo Pongratzb7f04512013-07-28 12:35:38 +0300325 unsigned qp_max_recv_dtos; /* num of rx buffers */
326 unsigned qp_max_recv_dtos_mask; /* above minus 1 */
327 unsigned min_posted_rx; /* qp_max_recv_dtos >> 2 */
Or Gerlitz704315f2010-02-08 13:18:39 +0000328 int post_recv_buf_count; /* posted rx count */
Or Gerlitz49cd5382006-05-11 10:00:21 +0300329 atomic_t post_send_buf_count; /* posted tx count */
Or Gerlitz49cd5382006-05-11 10:00:21 +0300330 char name[ISER_OBJECT_NAME_SIZE];
Or Gerlitz49cd5382006-05-11 10:00:21 +0300331 struct list_head conn_list; /* entry in ig conn list */
Or Gerlitzbcc60c32010-02-08 13:17:42 +0000332
333 char *login_buf;
Or Gerlitz2c4ce602011-11-04 00:19:46 +0200334 char *login_req_buf, *login_resp_buf;
335 u64 login_req_dma, login_resp_dma;
Or Gerlitzbcc60c32010-02-08 13:17:42 +0000336 unsigned int rx_desc_head;
337 struct iser_rx_desc *rx_descs;
338 struct ib_recv_wr rx_wr[ISER_MIN_POSTED_RX];
Alex Tabachnik7f733842014-03-05 19:43:46 +0200339 bool pi_support;
Sagi Grimberg7306b8f2014-03-05 19:43:39 +0200340
341 /* Connection memory registration pool */
Sagi Grimberge6575712013-07-28 12:35:41 +0300342 union {
343 struct {
344 struct ib_fmr_pool *pool; /* pool of IB FMRs */
345 struct iser_page_vec *page_vec; /* represents SG to fmr maps*
346 * maps serialized as tx is*/
347 } fmr;
Sagi Grimberg55878562013-07-28 12:35:42 +0300348 struct {
349 struct list_head pool;
350 int pool_size;
Sagi Grimberg7306b8f2014-03-05 19:43:39 +0200351 } fastreg;
352 };
Or Gerlitz49cd5382006-05-11 10:00:21 +0300353};
354
355struct iscsi_iser_conn {
356 struct iscsi_conn *iscsi_conn;/* ptr to iscsi conn */
357 struct iser_conn *ib_conn; /* iSER IB conn */
Or Gerlitz49cd5382006-05-11 10:00:21 +0300358};
359
Mike Christie2261ec32008-05-21 15:54:11 -0500360struct iscsi_iser_task {
Or Gerlitzf19624a2010-02-08 13:19:56 +0000361 struct iser_tx_desc desc;
Or Gerlitz49cd5382006-05-11 10:00:21 +0300362 struct iscsi_iser_conn *iser_conn;
Or Gerlitz49cd5382006-05-11 10:00:21 +0300363 enum iser_task_status status;
364 int command_sent; /* set if command sent */
365 int dir[ISER_DIRS_NUM]; /* set if dir use*/
366 struct iser_regd_buf rdma_regd[ISER_DIRS_NUM];/* regd rdma buf */
367 struct iser_data_buf data[ISER_DIRS_NUM]; /* orig. data des*/
368 struct iser_data_buf data_copy[ISER_DIRS_NUM];/* contig. copy */
369};
370
371struct iser_page_vec {
372 u64 *pages;
373 int length;
374 int offset;
375 int data_size;
376};
377
Alex Tabachnik5a33a662012-09-23 15:17:44 +0000378struct iser_cq_desc {
379 struct iser_device *device;
380 int cq_index;
381};
382
Or Gerlitz49cd5382006-05-11 10:00:21 +0300383struct iser_global {
384 struct mutex device_list_mutex;/* */
385 struct list_head device_list; /* all iSER devices */
386 struct mutex connlist_mutex;
387 struct list_head connlist; /* all iSER IB connections */
388
Roland Dreiere54f8182006-11-29 15:33:07 -0800389 struct kmem_cache *desc_cache;
Or Gerlitz49cd5382006-05-11 10:00:21 +0300390};
391
392extern struct iser_global ig;
393extern int iser_debug_level;
Alex Tabachnik7f733842014-03-05 19:43:46 +0200394extern bool iser_pi_enable;
395extern int iser_pi_guard;
Or Gerlitz49cd5382006-05-11 10:00:21 +0300396
397/* allocate connection resources needed for rdma functionality */
398int iser_conn_set_full_featured_mode(struct iscsi_conn *conn);
399
Mike Christie2747fdb2008-05-21 15:54:08 -0500400int iser_send_control(struct iscsi_conn *conn,
Mike Christie2261ec32008-05-21 15:54:11 -0500401 struct iscsi_task *task);
Or Gerlitz49cd5382006-05-11 10:00:21 +0300402
Mike Christie2747fdb2008-05-21 15:54:08 -0500403int iser_send_command(struct iscsi_conn *conn,
Mike Christie2261ec32008-05-21 15:54:11 -0500404 struct iscsi_task *task);
Or Gerlitz49cd5382006-05-11 10:00:21 +0300405
Mike Christie2747fdb2008-05-21 15:54:08 -0500406int iser_send_data_out(struct iscsi_conn *conn,
Mike Christie2261ec32008-05-21 15:54:11 -0500407 struct iscsi_task *task,
Mike Christie2747fdb2008-05-21 15:54:08 -0500408 struct iscsi_data *hdr);
Or Gerlitz49cd5382006-05-11 10:00:21 +0300409
410void iscsi_iser_recv(struct iscsi_conn *conn,
411 struct iscsi_hdr *hdr,
412 char *rx_data,
413 int rx_data_len);
414
Mike Christie412eeaf2008-05-21 15:54:14 -0500415void iser_conn_init(struct iser_conn *ib_conn);
Or Gerlitz49cd5382006-05-11 10:00:21 +0300416
Mike Christieb40977d2008-05-21 15:54:03 -0500417void iser_conn_get(struct iser_conn *ib_conn);
418
Or Gerlitz39ff05d2010-05-05 17:31:44 +0300419int iser_conn_put(struct iser_conn *ib_conn, int destroy_cma_id_allowed);
Or Gerlitz49cd5382006-05-11 10:00:21 +0300420
421void iser_conn_terminate(struct iser_conn *ib_conn);
422
Or Gerlitzbcc60c32010-02-08 13:17:42 +0000423void iser_rcv_completion(struct iser_rx_desc *desc,
424 unsigned long dto_xfer_len,
425 struct iser_conn *ib_conn);
Or Gerlitz49cd5382006-05-11 10:00:21 +0300426
Or Gerlitzf19624a2010-02-08 13:19:56 +0000427void iser_snd_completion(struct iser_tx_desc *desc, struct iser_conn *ib_conn);
Or Gerlitz49cd5382006-05-11 10:00:21 +0300428
Mike Christie2261ec32008-05-21 15:54:11 -0500429void iser_task_rdma_init(struct iscsi_iser_task *task);
Or Gerlitz49cd5382006-05-11 10:00:21 +0300430
Mike Christie2261ec32008-05-21 15:54:11 -0500431void iser_task_rdma_finalize(struct iscsi_iser_task *task);
Or Gerlitz49cd5382006-05-11 10:00:21 +0300432
Or Gerlitzbcc60c32010-02-08 13:17:42 +0000433void iser_free_rx_descriptors(struct iser_conn *ib_conn);
434
Sagi Grimberg9a8b08f2014-03-05 19:43:44 +0200435void iser_finalize_rdma_unaligned_sg(struct iscsi_iser_task *iser_task,
436 struct iser_data_buf *mem,
437 struct iser_data_buf *mem_copy,
438 enum iser_data_dir cmd_dir);
Or Gerlitz49cd5382006-05-11 10:00:21 +0300439
Sagi Grimberge6575712013-07-28 12:35:41 +0300440int iser_reg_rdma_mem_fmr(struct iscsi_iser_task *task,
441 enum iser_data_dir cmd_dir);
Sagi Grimberg7306b8f2014-03-05 19:43:39 +0200442int iser_reg_rdma_mem_fastreg(struct iscsi_iser_task *task,
443 enum iser_data_dir cmd_dir);
Or Gerlitz49cd5382006-05-11 10:00:21 +0300444
445int iser_connect(struct iser_conn *ib_conn,
446 struct sockaddr_in *src_addr,
447 struct sockaddr_in *dst_addr,
448 int non_blocking);
449
450int iser_reg_page_vec(struct iser_conn *ib_conn,
451 struct iser_page_vec *page_vec,
452 struct iser_mem_reg *mem_reg);
453
Sagi Grimberge6575712013-07-28 12:35:41 +0300454void iser_unreg_mem_fmr(struct iscsi_iser_task *iser_task,
455 enum iser_data_dir cmd_dir);
Sagi Grimberg7306b8f2014-03-05 19:43:39 +0200456void iser_unreg_mem_fastreg(struct iscsi_iser_task *iser_task,
457 enum iser_data_dir cmd_dir);
Or Gerlitz49cd5382006-05-11 10:00:21 +0300458
Or Gerlitzbcc60c32010-02-08 13:17:42 +0000459int iser_post_recvl(struct iser_conn *ib_conn);
460int iser_post_recvm(struct iser_conn *ib_conn, int count);
Or Gerlitzf19624a2010-02-08 13:19:56 +0000461int iser_post_send(struct iser_conn *ib_conn, struct iser_tx_desc *tx_desc);
Or Gerlitz49cd5382006-05-11 10:00:21 +0300462
Mike Christie2261ec32008-05-21 15:54:11 -0500463int iser_dma_map_task_data(struct iscsi_iser_task *iser_task,
Erez Zilber74a20782006-09-27 16:43:06 +0300464 struct iser_data_buf *data,
465 enum iser_data_dir iser_dir,
466 enum dma_data_direction dma_dir);
467
Sagi Grimberg9a8b08f2014-03-05 19:43:44 +0200468void iser_dma_unmap_task_data(struct iscsi_iser_task *iser_task,
469 struct iser_data_buf *data);
Or Gerlitzf19624a2010-02-08 13:19:56 +0000470int iser_initialize_task_headers(struct iscsi_task *task,
471 struct iser_tx_desc *tx_desc);
Shlomo Pongratzb7f04512013-07-28 12:35:38 +0300472int iser_alloc_rx_descriptors(struct iser_conn *ib_conn, struct iscsi_session *session);
473int iser_create_fmr_pool(struct iser_conn *ib_conn, unsigned cmds_max);
Shlomo Pongratz986db0d2013-07-28 12:35:37 +0300474void iser_free_fmr_pool(struct iser_conn *ib_conn);
Sagi Grimberg7306b8f2014-03-05 19:43:39 +0200475int iser_create_fastreg_pool(struct iser_conn *ib_conn, unsigned cmds_max);
476void iser_free_fastreg_pool(struct iser_conn *ib_conn);
Or Gerlitz49cd5382006-05-11 10:00:21 +0300477#endif