.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /******************************************************************************* |
---|
2 | 3 | * This file contains iSCSI extentions for RDMA (iSER) Verbs |
---|
3 | 4 | * |
---|
.. | .. |
---|
5 | 6 | * |
---|
6 | 7 | * Nicholas A. Bellinger <nab@linux-iscsi.org> |
---|
7 | 8 | * |
---|
8 | | - * This program is free software; you can redistribute it and/or modify |
---|
9 | | - * it under the terms of the GNU General Public License as published by |
---|
10 | | - * the Free Software Foundation; either version 2 of the License, or |
---|
11 | | - * (at your option) any later version. |
---|
12 | | - * |
---|
13 | | - * This program is distributed in the hope that it will be useful, |
---|
14 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
15 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
16 | | - * GNU General Public License for more details. |
---|
17 | 9 | ****************************************************************************/ |
---|
18 | 10 | |
---|
19 | 11 | #include <linux/string.h> |
---|
.. | .. |
---|
23 | 15 | #include <linux/in.h> |
---|
24 | 16 | #include <linux/in6.h> |
---|
25 | 17 | #include <rdma/ib_verbs.h> |
---|
| 18 | +#include <rdma/ib_cm.h> |
---|
26 | 19 | #include <rdma/rdma_cm.h> |
---|
27 | 20 | #include <target/target_core_base.h> |
---|
28 | 21 | #include <target/target_core_fabric.h> |
---|
.. | .. |
---|
31 | 24 | |
---|
32 | 25 | #include "ib_isert.h" |
---|
33 | 26 | |
---|
34 | | -#define ISERT_MAX_CONN 8 |
---|
35 | | -#define ISER_MAX_RX_CQ_LEN (ISERT_QP_MAX_RECV_DTOS * ISERT_MAX_CONN) |
---|
36 | | -#define ISER_MAX_TX_CQ_LEN \ |
---|
37 | | - ((ISERT_QP_MAX_REQ_DTOS + ISCSI_DEF_XMIT_CMDS_MAX) * ISERT_MAX_CONN) |
---|
38 | | -#define ISER_MAX_CQ_LEN (ISER_MAX_RX_CQ_LEN + ISER_MAX_TX_CQ_LEN + \ |
---|
39 | | - ISERT_MAX_CONN) |
---|
40 | | - |
---|
41 | 27 | static int isert_debug_level; |
---|
42 | 28 | module_param_named(debug_level, isert_debug_level, int, 0644); |
---|
43 | 29 | MODULE_PARM_DESC(debug_level, "Enable debug tracing if > 0 (default:0)"); |
---|
| 30 | + |
---|
| 31 | +static int isert_sg_tablesize_set(const char *val, |
---|
| 32 | + const struct kernel_param *kp); |
---|
| 33 | +static const struct kernel_param_ops sg_tablesize_ops = { |
---|
| 34 | + .set = isert_sg_tablesize_set, |
---|
| 35 | + .get = param_get_int, |
---|
| 36 | +}; |
---|
| 37 | + |
---|
| 38 | +static int isert_sg_tablesize = ISCSI_ISER_MIN_SG_TABLESIZE; |
---|
| 39 | +module_param_cb(sg_tablesize, &sg_tablesize_ops, &isert_sg_tablesize, 0644); |
---|
| 40 | +MODULE_PARM_DESC(sg_tablesize, |
---|
| 41 | + "Number of gather/scatter entries in a single scsi command, should >= 128 (default: 128, max: 4096)"); |
---|
44 | 42 | |
---|
45 | 43 | static DEFINE_MUTEX(device_list_mutex); |
---|
46 | 44 | static LIST_HEAD(device_list); |
---|
.. | .. |
---|
60 | 58 | static void isert_send_done(struct ib_cq *cq, struct ib_wc *wc); |
---|
61 | 59 | static void isert_login_recv_done(struct ib_cq *cq, struct ib_wc *wc); |
---|
62 | 60 | static void isert_login_send_done(struct ib_cq *cq, struct ib_wc *wc); |
---|
| 61 | + |
---|
| 62 | +static int isert_sg_tablesize_set(const char *val, const struct kernel_param *kp) |
---|
| 63 | +{ |
---|
| 64 | + int n = 0, ret; |
---|
| 65 | + |
---|
| 66 | + ret = kstrtoint(val, 10, &n); |
---|
| 67 | + if (ret != 0 || n < ISCSI_ISER_MIN_SG_TABLESIZE || |
---|
| 68 | + n > ISCSI_ISER_MAX_SG_TABLESIZE) |
---|
| 69 | + return -EINVAL; |
---|
| 70 | + |
---|
| 71 | + return param_set_int(val, kp); |
---|
| 72 | +} |
---|
| 73 | + |
---|
63 | 74 | |
---|
64 | 75 | static inline bool |
---|
65 | 76 | isert_prot_cmd(struct isert_conn *conn, struct se_cmd *cmd) |
---|
.. | .. |
---|
89 | 100 | } |
---|
90 | 101 | } |
---|
91 | 102 | |
---|
92 | | -static struct isert_comp * |
---|
93 | | -isert_comp_get(struct isert_conn *isert_conn) |
---|
94 | | -{ |
---|
95 | | - struct isert_device *device = isert_conn->device; |
---|
96 | | - struct isert_comp *comp; |
---|
97 | | - int i, min = 0; |
---|
98 | | - |
---|
99 | | - mutex_lock(&device_list_mutex); |
---|
100 | | - for (i = 0; i < device->comps_used; i++) |
---|
101 | | - if (device->comps[i].active_qps < |
---|
102 | | - device->comps[min].active_qps) |
---|
103 | | - min = i; |
---|
104 | | - comp = &device->comps[min]; |
---|
105 | | - comp->active_qps++; |
---|
106 | | - mutex_unlock(&device_list_mutex); |
---|
107 | | - |
---|
108 | | - isert_info("conn %p, using comp %p min_index: %d\n", |
---|
109 | | - isert_conn, comp, min); |
---|
110 | | - |
---|
111 | | - return comp; |
---|
112 | | -} |
---|
113 | | - |
---|
114 | | -static void |
---|
115 | | -isert_comp_put(struct isert_comp *comp) |
---|
116 | | -{ |
---|
117 | | - mutex_lock(&device_list_mutex); |
---|
118 | | - comp->active_qps--; |
---|
119 | | - mutex_unlock(&device_list_mutex); |
---|
120 | | -} |
---|
121 | | - |
---|
122 | 103 | static struct ib_qp * |
---|
123 | 104 | isert_create_qp(struct isert_conn *isert_conn, |
---|
124 | | - struct isert_comp *comp, |
---|
125 | 105 | struct rdma_cm_id *cma_id) |
---|
126 | 106 | { |
---|
| 107 | + u32 cq_size = ISERT_QP_MAX_REQ_DTOS + ISERT_QP_MAX_RECV_DTOS + 2; |
---|
127 | 108 | struct isert_device *device = isert_conn->device; |
---|
| 109 | + struct ib_device *ib_dev = device->ib_device; |
---|
128 | 110 | struct ib_qp_init_attr attr; |
---|
129 | | - int ret; |
---|
| 111 | + int ret, factor; |
---|
| 112 | + |
---|
| 113 | + isert_conn->cq = ib_cq_pool_get(ib_dev, cq_size, -1, IB_POLL_WORKQUEUE); |
---|
| 114 | + if (IS_ERR(isert_conn->cq)) { |
---|
| 115 | + isert_err("Unable to allocate cq\n"); |
---|
| 116 | + ret = PTR_ERR(isert_conn->cq); |
---|
| 117 | + return ERR_PTR(ret); |
---|
| 118 | + } |
---|
| 119 | + isert_conn->cq_size = cq_size; |
---|
130 | 120 | |
---|
131 | 121 | memset(&attr, 0, sizeof(struct ib_qp_init_attr)); |
---|
132 | 122 | attr.event_handler = isert_qp_event_callback; |
---|
133 | 123 | attr.qp_context = isert_conn; |
---|
134 | | - attr.send_cq = comp->cq; |
---|
135 | | - attr.recv_cq = comp->cq; |
---|
| 124 | + attr.send_cq = isert_conn->cq; |
---|
| 125 | + attr.recv_cq = isert_conn->cq; |
---|
136 | 126 | attr.cap.max_send_wr = ISERT_QP_MAX_REQ_DTOS + 1; |
---|
137 | 127 | attr.cap.max_recv_wr = ISERT_QP_MAX_RECV_DTOS + 1; |
---|
138 | | - attr.cap.max_rdma_ctxs = ISCSI_DEF_XMIT_CMDS_MAX; |
---|
| 128 | + factor = rdma_rw_mr_factor(device->ib_device, cma_id->port_num, |
---|
| 129 | + isert_sg_tablesize); |
---|
| 130 | + attr.cap.max_rdma_ctxs = ISCSI_DEF_XMIT_CMDS_MAX * factor; |
---|
139 | 131 | attr.cap.max_send_sge = device->ib_device->attrs.max_send_sge; |
---|
140 | 132 | attr.cap.max_recv_sge = 1; |
---|
141 | 133 | attr.sq_sig_type = IB_SIGNAL_REQ_WR; |
---|
142 | 134 | attr.qp_type = IB_QPT_RC; |
---|
143 | 135 | if (device->pi_capable) |
---|
144 | | - attr.create_flags |= IB_QP_CREATE_SIGNATURE_EN; |
---|
| 136 | + attr.create_flags |= IB_QP_CREATE_INTEGRITY_EN; |
---|
145 | 137 | |
---|
146 | 138 | ret = rdma_create_qp(cma_id, device->pd, &attr); |
---|
147 | 139 | if (ret) { |
---|
148 | 140 | isert_err("rdma_create_qp failed for cma_id %d\n", ret); |
---|
| 141 | + ib_cq_pool_put(isert_conn->cq, isert_conn->cq_size); |
---|
| 142 | + |
---|
149 | 143 | return ERR_PTR(ret); |
---|
150 | 144 | } |
---|
151 | 145 | |
---|
152 | 146 | return cma_id->qp; |
---|
153 | | -} |
---|
154 | | - |
---|
155 | | -static int |
---|
156 | | -isert_conn_setup_qp(struct isert_conn *isert_conn, struct rdma_cm_id *cma_id) |
---|
157 | | -{ |
---|
158 | | - struct isert_comp *comp; |
---|
159 | | - int ret; |
---|
160 | | - |
---|
161 | | - comp = isert_comp_get(isert_conn); |
---|
162 | | - isert_conn->qp = isert_create_qp(isert_conn, comp, cma_id); |
---|
163 | | - if (IS_ERR(isert_conn->qp)) { |
---|
164 | | - ret = PTR_ERR(isert_conn->qp); |
---|
165 | | - goto err; |
---|
166 | | - } |
---|
167 | | - |
---|
168 | | - return 0; |
---|
169 | | -err: |
---|
170 | | - isert_comp_put(comp); |
---|
171 | | - return ret; |
---|
172 | 147 | } |
---|
173 | 148 | |
---|
174 | 149 | static int |
---|
.. | .. |
---|
190 | 165 | rx_desc = isert_conn->rx_descs; |
---|
191 | 166 | |
---|
192 | 167 | for (i = 0; i < ISERT_QP_MAX_RECV_DTOS; i++, rx_desc++) { |
---|
193 | | - dma_addr = ib_dma_map_single(ib_dev, (void *)rx_desc, |
---|
194 | | - ISER_RX_PAYLOAD_SIZE, DMA_FROM_DEVICE); |
---|
| 168 | + dma_addr = ib_dma_map_single(ib_dev, rx_desc->buf, |
---|
| 169 | + ISER_RX_SIZE, DMA_FROM_DEVICE); |
---|
195 | 170 | if (ib_dma_mapping_error(ib_dev, dma_addr)) |
---|
196 | 171 | goto dma_map_fail; |
---|
197 | 172 | |
---|
198 | 173 | rx_desc->dma_addr = dma_addr; |
---|
199 | 174 | |
---|
200 | 175 | rx_sg = &rx_desc->rx_sg; |
---|
201 | | - rx_sg->addr = rx_desc->dma_addr; |
---|
| 176 | + rx_sg->addr = rx_desc->dma_addr + isert_get_hdr_offset(rx_desc); |
---|
202 | 177 | rx_sg->length = ISER_RX_PAYLOAD_SIZE; |
---|
203 | 178 | rx_sg->lkey = device->pd->local_dma_lkey; |
---|
204 | 179 | rx_desc->rx_cqe.done = isert_recv_done; |
---|
.. | .. |
---|
210 | 185 | rx_desc = isert_conn->rx_descs; |
---|
211 | 186 | for (j = 0; j < i; j++, rx_desc++) { |
---|
212 | 187 | ib_dma_unmap_single(ib_dev, rx_desc->dma_addr, |
---|
213 | | - ISER_RX_PAYLOAD_SIZE, DMA_FROM_DEVICE); |
---|
| 188 | + ISER_RX_SIZE, DMA_FROM_DEVICE); |
---|
214 | 189 | } |
---|
215 | 190 | kfree(isert_conn->rx_descs); |
---|
216 | 191 | isert_conn->rx_descs = NULL; |
---|
.. | .. |
---|
231 | 206 | rx_desc = isert_conn->rx_descs; |
---|
232 | 207 | for (i = 0; i < ISERT_QP_MAX_RECV_DTOS; i++, rx_desc++) { |
---|
233 | 208 | ib_dma_unmap_single(ib_dev, rx_desc->dma_addr, |
---|
234 | | - ISER_RX_PAYLOAD_SIZE, DMA_FROM_DEVICE); |
---|
| 209 | + ISER_RX_SIZE, DMA_FROM_DEVICE); |
---|
235 | 210 | } |
---|
236 | 211 | |
---|
237 | 212 | kfree(isert_conn->rx_descs); |
---|
238 | 213 | isert_conn->rx_descs = NULL; |
---|
239 | | -} |
---|
240 | | - |
---|
241 | | -static void |
---|
242 | | -isert_free_comps(struct isert_device *device) |
---|
243 | | -{ |
---|
244 | | - int i; |
---|
245 | | - |
---|
246 | | - for (i = 0; i < device->comps_used; i++) { |
---|
247 | | - struct isert_comp *comp = &device->comps[i]; |
---|
248 | | - |
---|
249 | | - if (comp->cq) |
---|
250 | | - ib_free_cq(comp->cq); |
---|
251 | | - } |
---|
252 | | - kfree(device->comps); |
---|
253 | | -} |
---|
254 | | - |
---|
255 | | -static int |
---|
256 | | -isert_alloc_comps(struct isert_device *device) |
---|
257 | | -{ |
---|
258 | | - int i, max_cqe, ret = 0; |
---|
259 | | - |
---|
260 | | - device->comps_used = min(ISERT_MAX_CQ, min_t(int, num_online_cpus(), |
---|
261 | | - device->ib_device->num_comp_vectors)); |
---|
262 | | - |
---|
263 | | - isert_info("Using %d CQs, %s supports %d vectors support " |
---|
264 | | - "pi_capable %d\n", |
---|
265 | | - device->comps_used, device->ib_device->name, |
---|
266 | | - device->ib_device->num_comp_vectors, |
---|
267 | | - device->pi_capable); |
---|
268 | | - |
---|
269 | | - device->comps = kcalloc(device->comps_used, sizeof(struct isert_comp), |
---|
270 | | - GFP_KERNEL); |
---|
271 | | - if (!device->comps) |
---|
272 | | - return -ENOMEM; |
---|
273 | | - |
---|
274 | | - max_cqe = min(ISER_MAX_CQ_LEN, device->ib_device->attrs.max_cqe); |
---|
275 | | - |
---|
276 | | - for (i = 0; i < device->comps_used; i++) { |
---|
277 | | - struct isert_comp *comp = &device->comps[i]; |
---|
278 | | - |
---|
279 | | - comp->device = device; |
---|
280 | | - comp->cq = ib_alloc_cq(device->ib_device, comp, max_cqe, i, |
---|
281 | | - IB_POLL_WORKQUEUE); |
---|
282 | | - if (IS_ERR(comp->cq)) { |
---|
283 | | - isert_err("Unable to allocate cq\n"); |
---|
284 | | - ret = PTR_ERR(comp->cq); |
---|
285 | | - comp->cq = NULL; |
---|
286 | | - goto out_cq; |
---|
287 | | - } |
---|
288 | | - } |
---|
289 | | - |
---|
290 | | - return 0; |
---|
291 | | -out_cq: |
---|
292 | | - isert_free_comps(device); |
---|
293 | | - return ret; |
---|
294 | 214 | } |
---|
295 | 215 | |
---|
296 | 216 | static int |
---|
.. | .. |
---|
303 | 223 | ib_dev->attrs.max_send_sge, ib_dev->attrs.max_recv_sge); |
---|
304 | 224 | isert_dbg("devattr->max_sge_rd: %d\n", ib_dev->attrs.max_sge_rd); |
---|
305 | 225 | |
---|
306 | | - ret = isert_alloc_comps(device); |
---|
307 | | - if (ret) |
---|
308 | | - goto out; |
---|
309 | | - |
---|
310 | 226 | device->pd = ib_alloc_pd(ib_dev, 0); |
---|
311 | 227 | if (IS_ERR(device->pd)) { |
---|
312 | 228 | ret = PTR_ERR(device->pd); |
---|
313 | 229 | isert_err("failed to allocate pd, device %p, ret=%d\n", |
---|
314 | 230 | device, ret); |
---|
315 | | - goto out_cq; |
---|
| 231 | + return ret; |
---|
316 | 232 | } |
---|
317 | 233 | |
---|
318 | 234 | /* Check signature cap */ |
---|
319 | 235 | device->pi_capable = ib_dev->attrs.device_cap_flags & |
---|
320 | | - IB_DEVICE_SIGNATURE_HANDOVER ? true : false; |
---|
| 236 | + IB_DEVICE_INTEGRITY_HANDOVER ? true : false; |
---|
321 | 237 | |
---|
322 | 238 | return 0; |
---|
323 | | - |
---|
324 | | -out_cq: |
---|
325 | | - isert_free_comps(device); |
---|
326 | | -out: |
---|
327 | | - if (ret > 0) |
---|
328 | | - ret = -EINVAL; |
---|
329 | | - return ret; |
---|
330 | 239 | } |
---|
331 | 240 | |
---|
332 | 241 | static void |
---|
.. | .. |
---|
335 | 244 | isert_info("device %p\n", device); |
---|
336 | 245 | |
---|
337 | 246 | ib_dealloc_pd(device->pd); |
---|
338 | | - isert_free_comps(device); |
---|
339 | 247 | } |
---|
340 | 248 | |
---|
341 | 249 | static void |
---|
.. | .. |
---|
416 | 324 | ISER_RX_PAYLOAD_SIZE, DMA_TO_DEVICE); |
---|
417 | 325 | kfree(isert_conn->login_rsp_buf); |
---|
418 | 326 | |
---|
419 | | - ib_dma_unmap_single(ib_dev, isert_conn->login_req_dma, |
---|
420 | | - ISER_RX_PAYLOAD_SIZE, |
---|
421 | | - DMA_FROM_DEVICE); |
---|
422 | | - kfree(isert_conn->login_req_buf); |
---|
| 327 | + ib_dma_unmap_single(ib_dev, isert_conn->login_desc->dma_addr, |
---|
| 328 | + ISER_RX_SIZE, DMA_FROM_DEVICE); |
---|
| 329 | + kfree(isert_conn->login_desc); |
---|
423 | 330 | } |
---|
424 | 331 | |
---|
425 | 332 | static int |
---|
.. | .. |
---|
428 | 335 | { |
---|
429 | 336 | int ret; |
---|
430 | 337 | |
---|
431 | | - isert_conn->login_req_buf = kzalloc(sizeof(*isert_conn->login_req_buf), |
---|
| 338 | + isert_conn->login_desc = kzalloc(sizeof(*isert_conn->login_desc), |
---|
432 | 339 | GFP_KERNEL); |
---|
433 | | - if (!isert_conn->login_req_buf) |
---|
| 340 | + if (!isert_conn->login_desc) |
---|
434 | 341 | return -ENOMEM; |
---|
435 | 342 | |
---|
436 | | - isert_conn->login_req_dma = ib_dma_map_single(ib_dev, |
---|
437 | | - isert_conn->login_req_buf, |
---|
438 | | - ISER_RX_PAYLOAD_SIZE, DMA_FROM_DEVICE); |
---|
439 | | - ret = ib_dma_mapping_error(ib_dev, isert_conn->login_req_dma); |
---|
| 343 | + isert_conn->login_desc->dma_addr = ib_dma_map_single(ib_dev, |
---|
| 344 | + isert_conn->login_desc->buf, |
---|
| 345 | + ISER_RX_SIZE, DMA_FROM_DEVICE); |
---|
| 346 | + ret = ib_dma_mapping_error(ib_dev, isert_conn->login_desc->dma_addr); |
---|
440 | 347 | if (ret) { |
---|
441 | | - isert_err("login_req_dma mapping error: %d\n", ret); |
---|
442 | | - isert_conn->login_req_dma = 0; |
---|
443 | | - goto out_free_login_req_buf; |
---|
| 348 | + isert_err("login_desc dma mapping error: %d\n", ret); |
---|
| 349 | + isert_conn->login_desc->dma_addr = 0; |
---|
| 350 | + goto out_free_login_desc; |
---|
444 | 351 | } |
---|
445 | 352 | |
---|
446 | 353 | isert_conn->login_rsp_buf = kzalloc(ISER_RX_PAYLOAD_SIZE, GFP_KERNEL); |
---|
447 | 354 | if (!isert_conn->login_rsp_buf) { |
---|
448 | 355 | ret = -ENOMEM; |
---|
449 | | - goto out_unmap_login_req_buf; |
---|
| 356 | + goto out_unmap_login_desc; |
---|
450 | 357 | } |
---|
451 | 358 | |
---|
452 | 359 | isert_conn->login_rsp_dma = ib_dma_map_single(ib_dev, |
---|
.. | .. |
---|
463 | 370 | |
---|
464 | 371 | out_free_login_rsp_buf: |
---|
465 | 372 | kfree(isert_conn->login_rsp_buf); |
---|
466 | | -out_unmap_login_req_buf: |
---|
467 | | - ib_dma_unmap_single(ib_dev, isert_conn->login_req_dma, |
---|
468 | | - ISER_RX_PAYLOAD_SIZE, DMA_FROM_DEVICE); |
---|
469 | | -out_free_login_req_buf: |
---|
470 | | - kfree(isert_conn->login_req_buf); |
---|
| 373 | +out_unmap_login_desc: |
---|
| 374 | + ib_dma_unmap_single(ib_dev, isert_conn->login_desc->dma_addr, |
---|
| 375 | + ISER_RX_SIZE, DMA_FROM_DEVICE); |
---|
| 376 | +out_free_login_desc: |
---|
| 377 | + kfree(isert_conn->login_desc); |
---|
471 | 378 | return ret; |
---|
472 | 379 | } |
---|
473 | 380 | |
---|
.. | .. |
---|
497 | 404 | } |
---|
498 | 405 | } |
---|
499 | 406 | |
---|
| 407 | +static void |
---|
| 408 | +isert_destroy_qp(struct isert_conn *isert_conn) |
---|
| 409 | +{ |
---|
| 410 | + ib_destroy_qp(isert_conn->qp); |
---|
| 411 | + ib_cq_pool_put(isert_conn->cq, isert_conn->cq_size); |
---|
| 412 | +} |
---|
| 413 | + |
---|
500 | 414 | static int |
---|
501 | 415 | isert_connect_request(struct rdma_cm_id *cma_id, struct rdma_cm_event *event) |
---|
502 | 416 | { |
---|
.. | .. |
---|
510 | 424 | if (!np->enabled) { |
---|
511 | 425 | spin_unlock_bh(&np->np_thread_lock); |
---|
512 | 426 | isert_dbg("iscsi_np is not enabled, reject connect request\n"); |
---|
513 | | - return rdma_reject(cma_id, NULL, 0); |
---|
| 427 | + return rdma_reject(cma_id, NULL, 0, IB_CM_REJ_CONSUMER_DEFINED); |
---|
514 | 428 | } |
---|
515 | 429 | spin_unlock_bh(&np->np_thread_lock); |
---|
516 | 430 | |
---|
.. | .. |
---|
524 | 438 | isert_init_conn(isert_conn); |
---|
525 | 439 | isert_conn->cm_id = cma_id; |
---|
526 | 440 | |
---|
527 | | - ret = isert_alloc_login_buf(isert_conn, cma_id->device); |
---|
528 | | - if (ret) |
---|
529 | | - goto out; |
---|
530 | | - |
---|
531 | 441 | device = isert_device_get(cma_id); |
---|
532 | 442 | if (IS_ERR(device)) { |
---|
533 | 443 | ret = PTR_ERR(device); |
---|
534 | | - goto out_rsp_dma_map; |
---|
| 444 | + goto out; |
---|
535 | 445 | } |
---|
536 | 446 | isert_conn->device = device; |
---|
537 | 447 | |
---|
538 | | - isert_set_nego_params(isert_conn, &event->param.conn); |
---|
539 | | - |
---|
540 | | - ret = isert_conn_setup_qp(isert_conn, cma_id); |
---|
| 448 | + ret = isert_alloc_login_buf(isert_conn, cma_id->device); |
---|
541 | 449 | if (ret) |
---|
542 | 450 | goto out_conn_dev; |
---|
| 451 | + |
---|
| 452 | + isert_set_nego_params(isert_conn, &event->param.conn); |
---|
| 453 | + |
---|
| 454 | + isert_conn->qp = isert_create_qp(isert_conn, cma_id); |
---|
| 455 | + if (IS_ERR(isert_conn->qp)) { |
---|
| 456 | + ret = PTR_ERR(isert_conn->qp); |
---|
| 457 | + goto out_rsp_dma_map; |
---|
| 458 | + } |
---|
543 | 459 | |
---|
544 | 460 | ret = isert_login_post_recv(isert_conn); |
---|
545 | 461 | if (ret) |
---|
546 | | - goto out_conn_dev; |
---|
| 462 | + goto out_destroy_qp; |
---|
547 | 463 | |
---|
548 | 464 | ret = isert_rdma_accept(isert_conn); |
---|
549 | 465 | if (ret) |
---|
550 | | - goto out_conn_dev; |
---|
| 466 | + goto out_destroy_qp; |
---|
551 | 467 | |
---|
552 | 468 | mutex_lock(&isert_np->mutex); |
---|
553 | 469 | list_add_tail(&isert_conn->node, &isert_np->accepted); |
---|
.. | .. |
---|
555 | 471 | |
---|
556 | 472 | return 0; |
---|
557 | 473 | |
---|
558 | | -out_conn_dev: |
---|
559 | | - isert_device_put(device); |
---|
| 474 | +out_destroy_qp: |
---|
| 475 | + isert_destroy_qp(isert_conn); |
---|
560 | 476 | out_rsp_dma_map: |
---|
561 | 477 | isert_free_login_buf(isert_conn); |
---|
| 478 | +out_conn_dev: |
---|
| 479 | + isert_device_put(device); |
---|
562 | 480 | out: |
---|
563 | 481 | kfree(isert_conn); |
---|
564 | | - rdma_reject(cma_id, NULL, 0); |
---|
| 482 | + rdma_reject(cma_id, NULL, 0, IB_CM_REJ_CONSUMER_DEFINED); |
---|
565 | 483 | return ret; |
---|
566 | 484 | } |
---|
567 | 485 | |
---|
.. | .. |
---|
579 | 497 | !isert_conn->dev_removed) |
---|
580 | 498 | rdma_destroy_id(isert_conn->cm_id); |
---|
581 | 499 | |
---|
582 | | - if (isert_conn->qp) { |
---|
583 | | - struct isert_comp *comp = isert_conn->qp->recv_cq->cq_context; |
---|
| 500 | + if (isert_conn->qp) |
---|
| 501 | + isert_destroy_qp(isert_conn); |
---|
584 | 502 | |
---|
585 | | - isert_comp_put(comp); |
---|
586 | | - ib_destroy_qp(isert_conn->qp); |
---|
587 | | - } |
---|
588 | | - |
---|
589 | | - if (isert_conn->login_req_buf) |
---|
| 503 | + if (isert_conn->login_desc) |
---|
590 | 504 | isert_free_login_buf(isert_conn); |
---|
591 | 505 | |
---|
592 | 506 | isert_device_put(device); |
---|
.. | .. |
---|
742 | 656 | isert_connect_error(struct rdma_cm_id *cma_id) |
---|
743 | 657 | { |
---|
744 | 658 | struct isert_conn *isert_conn = cma_id->qp->qp_context; |
---|
| 659 | + struct isert_np *isert_np = cma_id->context; |
---|
745 | 660 | |
---|
746 | 661 | ib_drain_qp(isert_conn->qp); |
---|
| 662 | + |
---|
| 663 | + mutex_lock(&isert_np->mutex); |
---|
747 | 664 | list_del_init(&isert_conn->node); |
---|
| 665 | + mutex_unlock(&isert_np->mutex); |
---|
748 | 666 | isert_conn->cm_id = NULL; |
---|
749 | 667 | isert_put_conn(isert_conn); |
---|
750 | 668 | |
---|
.. | .. |
---|
774 | 692 | case RDMA_CM_EVENT_ESTABLISHED: |
---|
775 | 693 | isert_connected_handler(cma_id); |
---|
776 | 694 | break; |
---|
777 | | - case RDMA_CM_EVENT_ADDR_CHANGE: /* FALLTHRU */ |
---|
778 | | - case RDMA_CM_EVENT_DISCONNECTED: /* FALLTHRU */ |
---|
| 695 | + case RDMA_CM_EVENT_ADDR_CHANGE: |
---|
| 696 | + case RDMA_CM_EVENT_DISCONNECTED: |
---|
779 | 697 | case RDMA_CM_EVENT_TIMEWAIT_EXIT: /* FALLTHRU */ |
---|
780 | 698 | ret = isert_disconnected_handler(cma_id, event->event); |
---|
781 | 699 | break; |
---|
.. | .. |
---|
794 | 712 | case RDMA_CM_EVENT_REJECTED: |
---|
795 | 713 | isert_info("Connection rejected: %s\n", |
---|
796 | 714 | rdma_reject_msg(cma_id, event->status)); |
---|
797 | | - /* fall through */ |
---|
| 715 | + fallthrough; |
---|
798 | 716 | case RDMA_CM_EVENT_UNREACHABLE: |
---|
799 | 717 | case RDMA_CM_EVENT_CONNECT_ERROR: |
---|
800 | 718 | ret = isert_connect_error(cma_id); |
---|
.. | .. |
---|
972 | 890 | int ret; |
---|
973 | 891 | |
---|
974 | 892 | memset(&sge, 0, sizeof(struct ib_sge)); |
---|
975 | | - sge.addr = isert_conn->login_req_dma; |
---|
| 893 | + sge.addr = isert_conn->login_desc->dma_addr + |
---|
| 894 | + isert_get_hdr_offset(isert_conn->login_desc); |
---|
976 | 895 | sge.length = ISER_RX_PAYLOAD_SIZE; |
---|
977 | 896 | sge.lkey = isert_conn->device->pd->local_dma_lkey; |
---|
978 | 897 | |
---|
979 | 898 | isert_dbg("Setup sge: addr: %llx length: %d 0x%08x\n", |
---|
980 | 899 | sge.addr, sge.length, sge.lkey); |
---|
981 | 900 | |
---|
982 | | - isert_conn->login_req_buf->rx_cqe.done = isert_login_recv_done; |
---|
| 901 | + isert_conn->login_desc->rx_cqe.done = isert_login_recv_done; |
---|
983 | 902 | |
---|
984 | 903 | memset(&rx_wr, 0, sizeof(struct ib_recv_wr)); |
---|
985 | | - rx_wr.wr_cqe = &isert_conn->login_req_buf->rx_cqe; |
---|
| 904 | + rx_wr.wr_cqe = &isert_conn->login_desc->rx_cqe; |
---|
986 | 905 | rx_wr.sg_list = &sge; |
---|
987 | 906 | rx_wr.num_sge = 1; |
---|
988 | 907 | |
---|
.. | .. |
---|
1059 | 978 | static void |
---|
1060 | 979 | isert_rx_login_req(struct isert_conn *isert_conn) |
---|
1061 | 980 | { |
---|
1062 | | - struct iser_rx_desc *rx_desc = isert_conn->login_req_buf; |
---|
| 981 | + struct iser_rx_desc *rx_desc = isert_conn->login_desc; |
---|
1063 | 982 | int rx_buflen = isert_conn->login_req_len; |
---|
1064 | 983 | struct iscsi_conn *conn = isert_conn->conn; |
---|
1065 | 984 | struct iscsi_login *login = conn->conn_login; |
---|
.. | .. |
---|
1071 | 990 | |
---|
1072 | 991 | if (login->first_request) { |
---|
1073 | 992 | struct iscsi_login_req *login_req = |
---|
1074 | | - (struct iscsi_login_req *)&rx_desc->iscsi_header; |
---|
| 993 | + (struct iscsi_login_req *)isert_get_iscsi_hdr(rx_desc); |
---|
1075 | 994 | /* |
---|
1076 | 995 | * Setup the initial iscsi_login values from the leading |
---|
1077 | 996 | * login request PDU. |
---|
.. | .. |
---|
1090 | 1009 | login->tsih = be16_to_cpu(login_req->tsih); |
---|
1091 | 1010 | } |
---|
1092 | 1011 | |
---|
1093 | | - memcpy(&login->req[0], (void *)&rx_desc->iscsi_header, ISCSI_HDR_LEN); |
---|
| 1012 | + memcpy(&login->req[0], isert_get_iscsi_hdr(rx_desc), ISCSI_HDR_LEN); |
---|
1094 | 1013 | |
---|
1095 | 1014 | size = min(rx_buflen, MAX_KEY_VALUE_PAIRS); |
---|
1096 | 1015 | isert_dbg("Using login payload size: %d, rx_buflen: %d " |
---|
1097 | 1016 | "MAX_KEY_VALUE_PAIRS: %d\n", size, rx_buflen, |
---|
1098 | 1017 | MAX_KEY_VALUE_PAIRS); |
---|
1099 | | - memcpy(login->req_buf, &rx_desc->data[0], size); |
---|
| 1018 | + memcpy(login->req_buf, isert_get_data(rx_desc), size); |
---|
1100 | 1019 | |
---|
1101 | 1020 | if (login->first_request) { |
---|
1102 | 1021 | complete(&isert_conn->login_comp); |
---|
.. | .. |
---|
1161 | 1080 | if (imm_data_len != data_len) { |
---|
1162 | 1081 | sg_nents = max(1UL, DIV_ROUND_UP(imm_data_len, PAGE_SIZE)); |
---|
1163 | 1082 | sg_copy_from_buffer(cmd->se_cmd.t_data_sg, sg_nents, |
---|
1164 | | - &rx_desc->data[0], imm_data_len); |
---|
| 1083 | + isert_get_data(rx_desc), imm_data_len); |
---|
1165 | 1084 | isert_dbg("Copy Immediate sg_nents: %u imm_data_len: %d\n", |
---|
1166 | 1085 | sg_nents, imm_data_len); |
---|
1167 | 1086 | } else { |
---|
1168 | 1087 | sg_init_table(&isert_cmd->sg, 1); |
---|
1169 | 1088 | cmd->se_cmd.t_data_sg = &isert_cmd->sg; |
---|
1170 | 1089 | cmd->se_cmd.t_data_nents = 1; |
---|
1171 | | - sg_set_buf(&isert_cmd->sg, &rx_desc->data[0], imm_data_len); |
---|
| 1090 | + sg_set_buf(&isert_cmd->sg, isert_get_data(rx_desc), |
---|
| 1091 | + imm_data_len); |
---|
1172 | 1092 | isert_dbg("Transfer Immediate imm_data_len: %d\n", |
---|
1173 | 1093 | imm_data_len); |
---|
1174 | 1094 | } |
---|
.. | .. |
---|
1186 | 1106 | rc = iscsit_sequence_cmd(conn, cmd, buf, hdr->cmdsn); |
---|
1187 | 1107 | |
---|
1188 | 1108 | if (!rc && dump_payload == false && unsol_data) |
---|
1189 | | - iscsit_set_unsoliticed_dataout(cmd); |
---|
| 1109 | + iscsit_set_unsolicited_dataout(cmd); |
---|
1190 | 1110 | else if (dump_payload && imm_data) |
---|
1191 | 1111 | target_put_sess_cmd(&cmd->se_cmd); |
---|
1192 | 1112 | |
---|
.. | .. |
---|
1237 | 1157 | } |
---|
1238 | 1158 | isert_dbg("Copying DataOut: sg_start: %p, sg_off: %u " |
---|
1239 | 1159 | "sg_nents: %u from %p %u\n", sg_start, sg_off, |
---|
1240 | | - sg_nents, &rx_desc->data[0], unsol_data_len); |
---|
| 1160 | + sg_nents, isert_get_data(rx_desc), unsol_data_len); |
---|
1241 | 1161 | |
---|
1242 | | - sg_copy_from_buffer(sg_start, sg_nents, &rx_desc->data[0], |
---|
| 1162 | + sg_copy_from_buffer(sg_start, sg_nents, isert_get_data(rx_desc), |
---|
1243 | 1163 | unsol_data_len); |
---|
1244 | 1164 | |
---|
1245 | 1165 | rc = iscsit_check_dataout_payload(cmd, hdr, false); |
---|
.. | .. |
---|
1250 | 1170 | * multiple data-outs on the same command can arrive - |
---|
1251 | 1171 | * so post the buffer before hand |
---|
1252 | 1172 | */ |
---|
1253 | | - rc = isert_post_recv(isert_conn, rx_desc); |
---|
1254 | | - if (rc) { |
---|
1255 | | - isert_err("ib_post_recv failed with %d\n", rc); |
---|
1256 | | - return rc; |
---|
1257 | | - } |
---|
1258 | | - return 0; |
---|
| 1173 | + return isert_post_recv(isert_conn, rx_desc); |
---|
1259 | 1174 | } |
---|
1260 | 1175 | |
---|
1261 | 1176 | static int |
---|
.. | .. |
---|
1298 | 1213 | } |
---|
1299 | 1214 | cmd->text_in_ptr = text_in; |
---|
1300 | 1215 | |
---|
1301 | | - memcpy(cmd->text_in_ptr, &rx_desc->data[0], payload_length); |
---|
| 1216 | + memcpy(cmd->text_in_ptr, isert_get_data(rx_desc), payload_length); |
---|
1302 | 1217 | |
---|
1303 | 1218 | return iscsit_process_text_cmd(conn, cmd, hdr); |
---|
1304 | 1219 | } |
---|
.. | .. |
---|
1308 | 1223 | uint32_t read_stag, uint64_t read_va, |
---|
1309 | 1224 | uint32_t write_stag, uint64_t write_va) |
---|
1310 | 1225 | { |
---|
1311 | | - struct iscsi_hdr *hdr = &rx_desc->iscsi_header; |
---|
| 1226 | + struct iscsi_hdr *hdr = isert_get_iscsi_hdr(rx_desc); |
---|
1312 | 1227 | struct iscsi_conn *conn = isert_conn->conn; |
---|
1313 | 1228 | struct iscsi_cmd *cmd; |
---|
1314 | 1229 | struct isert_cmd *isert_cmd; |
---|
.. | .. |
---|
1406 | 1321 | struct isert_conn *isert_conn = wc->qp->qp_context; |
---|
1407 | 1322 | struct ib_device *ib_dev = isert_conn->cm_id->device; |
---|
1408 | 1323 | struct iser_rx_desc *rx_desc = cqe_to_rx_desc(wc->wr_cqe); |
---|
1409 | | - struct iscsi_hdr *hdr = &rx_desc->iscsi_header; |
---|
1410 | | - struct iser_ctrl *iser_ctrl = &rx_desc->iser_header; |
---|
| 1324 | + struct iscsi_hdr *hdr = isert_get_iscsi_hdr(rx_desc); |
---|
| 1325 | + struct iser_ctrl *iser_ctrl = isert_get_iser_hdr(rx_desc); |
---|
1411 | 1326 | uint64_t read_va = 0, write_va = 0; |
---|
1412 | 1327 | uint32_t read_stag = 0, write_stag = 0; |
---|
1413 | 1328 | |
---|
.. | .. |
---|
1421 | 1336 | rx_desc->in_use = true; |
---|
1422 | 1337 | |
---|
1423 | 1338 | ib_dma_sync_single_for_cpu(ib_dev, rx_desc->dma_addr, |
---|
1424 | | - ISER_RX_PAYLOAD_SIZE, DMA_FROM_DEVICE); |
---|
| 1339 | + ISER_RX_SIZE, DMA_FROM_DEVICE); |
---|
1425 | 1340 | |
---|
1426 | 1341 | isert_dbg("DMA: 0x%llx, iSCSI opcode: 0x%02x, ITT: 0x%08x, flags: 0x%02x dlen: %d\n", |
---|
1427 | 1342 | rx_desc->dma_addr, hdr->opcode, hdr->itt, hdr->flags, |
---|
.. | .. |
---|
1456 | 1371 | read_stag, read_va, write_stag, write_va); |
---|
1457 | 1372 | |
---|
1458 | 1373 | ib_dma_sync_single_for_device(ib_dev, rx_desc->dma_addr, |
---|
1459 | | - ISER_RX_PAYLOAD_SIZE, DMA_FROM_DEVICE); |
---|
| 1374 | + ISER_RX_SIZE, DMA_FROM_DEVICE); |
---|
1460 | 1375 | } |
---|
1461 | 1376 | |
---|
1462 | 1377 | static void |
---|
.. | .. |
---|
1470 | 1385 | return; |
---|
1471 | 1386 | } |
---|
1472 | 1387 | |
---|
1473 | | - ib_dma_sync_single_for_cpu(ib_dev, isert_conn->login_req_dma, |
---|
1474 | | - ISER_RX_PAYLOAD_SIZE, DMA_FROM_DEVICE); |
---|
| 1388 | + ib_dma_sync_single_for_cpu(ib_dev, isert_conn->login_desc->dma_addr, |
---|
| 1389 | + ISER_RX_SIZE, DMA_FROM_DEVICE); |
---|
1475 | 1390 | |
---|
1476 | 1391 | isert_conn->login_req_len = wc->byte_len - ISER_HEADERS_LEN; |
---|
1477 | 1392 | |
---|
.. | .. |
---|
1486 | 1401 | complete(&isert_conn->login_req_comp); |
---|
1487 | 1402 | mutex_unlock(&isert_conn->mutex); |
---|
1488 | 1403 | |
---|
1489 | | - ib_dma_sync_single_for_device(ib_dev, isert_conn->login_req_dma, |
---|
1490 | | - ISER_RX_PAYLOAD_SIZE, DMA_FROM_DEVICE); |
---|
| 1404 | + ib_dma_sync_single_for_device(ib_dev, isert_conn->login_desc->dma_addr, |
---|
| 1405 | + ISER_RX_SIZE, DMA_FROM_DEVICE); |
---|
1491 | 1406 | } |
---|
1492 | 1407 | |
---|
1493 | 1408 | static void |
---|
.. | .. |
---|
1580 | 1495 | transport_generic_free_cmd(&cmd->se_cmd, 0); |
---|
1581 | 1496 | break; |
---|
1582 | 1497 | } |
---|
1583 | | - /* fall through */ |
---|
| 1498 | + fallthrough; |
---|
1584 | 1499 | default: |
---|
1585 | 1500 | iscsit_release_cmd(cmd); |
---|
1586 | 1501 | break; |
---|
.. | .. |
---|
1642 | 1557 | } |
---|
1643 | 1558 | sec_offset_err = mr_status.sig_err.sig_err_offset; |
---|
1644 | 1559 | do_div(sec_offset_err, block_size); |
---|
1645 | | - se_cmd->bad_sector = sec_offset_err + se_cmd->t_task_lba; |
---|
| 1560 | + se_cmd->sense_info = sec_offset_err + se_cmd->t_task_lba; |
---|
1646 | 1561 | |
---|
1647 | 1562 | isert_err("PI error found type %d at sector 0x%llx " |
---|
1648 | 1563 | "expected 0x%x vs actual 0x%x\n", |
---|
1649 | 1564 | mr_status.sig_err.err_type, |
---|
1650 | | - (unsigned long long)se_cmd->bad_sector, |
---|
| 1565 | + (unsigned long long)se_cmd->sense_info, |
---|
1651 | 1566 | mr_status.sig_err.expected, |
---|
1652 | 1567 | mr_status.sig_err.actual); |
---|
1653 | 1568 | ret = 1; |
---|
.. | .. |
---|
1677 | 1592 | |
---|
1678 | 1593 | isert_dbg("Cmd %p\n", isert_cmd); |
---|
1679 | 1594 | |
---|
1680 | | - ret = isert_check_pi_status(cmd, isert_cmd->rw.sig->sig_mr); |
---|
| 1595 | + ret = isert_check_pi_status(cmd, isert_cmd->rw.reg->mr); |
---|
1681 | 1596 | isert_rdma_rw_ctx_destroy(isert_cmd, isert_conn); |
---|
1682 | 1597 | |
---|
1683 | 1598 | if (ret) { |
---|
.. | .. |
---|
1723 | 1638 | iscsit_stop_dataout_timer(cmd); |
---|
1724 | 1639 | |
---|
1725 | 1640 | if (isert_prot_cmd(isert_conn, se_cmd)) |
---|
1726 | | - ret = isert_check_pi_status(se_cmd, isert_cmd->rw.sig->sig_mr); |
---|
| 1641 | + ret = isert_check_pi_status(se_cmd, isert_cmd->rw.reg->mr); |
---|
1727 | 1642 | isert_rdma_rw_ctx_destroy(isert_cmd, isert_conn); |
---|
1728 | 1643 | cmd->write_data_done = 0; |
---|
1729 | 1644 | |
---|
.. | .. |
---|
1758 | 1673 | switch (cmd->i_state) { |
---|
1759 | 1674 | case ISTATE_SEND_TASKMGTRSP: |
---|
1760 | 1675 | iscsit_tmr_post_handler(cmd, cmd->conn); |
---|
1761 | | - /* fall through */ |
---|
| 1676 | + fallthrough; |
---|
1762 | 1677 | case ISTATE_SEND_REJECT: |
---|
1763 | 1678 | case ISTATE_SEND_TEXTRSP: |
---|
1764 | 1679 | cmd->i_state = ISTATE_SENT_STATUS; |
---|
.. | .. |
---|
1832 | 1747 | int ret; |
---|
1833 | 1748 | |
---|
1834 | 1749 | ret = isert_post_recv(isert_conn, isert_cmd->rx_desc); |
---|
1835 | | - if (ret) { |
---|
1836 | | - isert_err("ib_post_recv failed with %d\n", ret); |
---|
| 1750 | + if (ret) |
---|
1837 | 1751 | return ret; |
---|
1838 | | - } |
---|
1839 | 1752 | |
---|
1840 | 1753 | ret = ib_post_send(isert_conn->qp, &isert_cmd->tx_desc.send_wr, NULL); |
---|
1841 | 1754 | if (ret) { |
---|
.. | .. |
---|
2067 | 1980 | } |
---|
2068 | 1981 | |
---|
2069 | 1982 | static inline void |
---|
2070 | | -isert_set_dif_domain(struct se_cmd *se_cmd, struct ib_sig_attrs *sig_attrs, |
---|
2071 | | - struct ib_sig_domain *domain) |
---|
| 1983 | +isert_set_dif_domain(struct se_cmd *se_cmd, struct ib_sig_domain *domain) |
---|
2072 | 1984 | { |
---|
2073 | 1985 | domain->sig_type = IB_SIG_TYPE_T10_DIF; |
---|
2074 | 1986 | domain->sig.dif.bg_type = IB_T10DIF_CRC; |
---|
.. | .. |
---|
2096 | 2008 | case TARGET_PROT_DIN_INSERT: |
---|
2097 | 2009 | case TARGET_PROT_DOUT_STRIP: |
---|
2098 | 2010 | sig_attrs->mem.sig_type = IB_SIG_TYPE_NONE; |
---|
2099 | | - isert_set_dif_domain(se_cmd, sig_attrs, &sig_attrs->wire); |
---|
| 2011 | + isert_set_dif_domain(se_cmd, &sig_attrs->wire); |
---|
2100 | 2012 | break; |
---|
2101 | 2013 | case TARGET_PROT_DOUT_INSERT: |
---|
2102 | 2014 | case TARGET_PROT_DIN_STRIP: |
---|
2103 | 2015 | sig_attrs->wire.sig_type = IB_SIG_TYPE_NONE; |
---|
2104 | | - isert_set_dif_domain(se_cmd, sig_attrs, &sig_attrs->mem); |
---|
| 2016 | + isert_set_dif_domain(se_cmd, &sig_attrs->mem); |
---|
2105 | 2017 | break; |
---|
2106 | 2018 | case TARGET_PROT_DIN_PASS: |
---|
2107 | 2019 | case TARGET_PROT_DOUT_PASS: |
---|
2108 | | - isert_set_dif_domain(se_cmd, sig_attrs, &sig_attrs->wire); |
---|
2109 | | - isert_set_dif_domain(se_cmd, sig_attrs, &sig_attrs->mem); |
---|
| 2020 | + isert_set_dif_domain(se_cmd, &sig_attrs->wire); |
---|
| 2021 | + isert_set_dif_domain(se_cmd, &sig_attrs->mem); |
---|
2110 | 2022 | break; |
---|
2111 | 2023 | default: |
---|
2112 | 2024 | isert_err("Unsupported PI operation %d\n", se_cmd->prot_op); |
---|
.. | .. |
---|
2208 | 2120 | &isert_cmd->tx_desc.send_wr); |
---|
2209 | 2121 | |
---|
2210 | 2122 | rc = isert_post_recv(isert_conn, isert_cmd->rx_desc); |
---|
2211 | | - if (rc) { |
---|
2212 | | - isert_err("ib_post_recv failed with %d\n", rc); |
---|
| 2123 | + if (rc) |
---|
2213 | 2124 | return rc; |
---|
2214 | | - } |
---|
2215 | 2125 | |
---|
2216 | 2126 | chain_wr = &isert_cmd->tx_desc.send_wr; |
---|
2217 | 2127 | } |
---|
.. | .. |
---|
2515 | 2425 | { |
---|
2516 | 2426 | struct isert_np *isert_np = np->np_context; |
---|
2517 | 2427 | struct isert_conn *isert_conn, *n; |
---|
| 2428 | + LIST_HEAD(drop_conn_list); |
---|
2518 | 2429 | |
---|
2519 | 2430 | if (isert_np->cm_id) |
---|
2520 | 2431 | rdma_destroy_id(isert_np->cm_id); |
---|
.. | .. |
---|
2534 | 2445 | node) { |
---|
2535 | 2446 | isert_info("cleaning isert_conn %p state (%d)\n", |
---|
2536 | 2447 | isert_conn, isert_conn->state); |
---|
2537 | | - isert_connect_release(isert_conn); |
---|
| 2448 | + list_move_tail(&isert_conn->node, &drop_conn_list); |
---|
2538 | 2449 | } |
---|
2539 | 2450 | } |
---|
2540 | 2451 | |
---|
.. | .. |
---|
2545 | 2456 | node) { |
---|
2546 | 2457 | isert_info("cleaning isert_conn %p state (%d)\n", |
---|
2547 | 2458 | isert_conn, isert_conn->state); |
---|
2548 | | - isert_connect_release(isert_conn); |
---|
| 2459 | + list_move_tail(&isert_conn->node, &drop_conn_list); |
---|
2549 | 2460 | } |
---|
2550 | 2461 | } |
---|
2551 | 2462 | mutex_unlock(&isert_np->mutex); |
---|
2552 | 2463 | |
---|
| 2464 | + list_for_each_entry_safe(isert_conn, n, &drop_conn_list, node) { |
---|
| 2465 | + list_del_init(&isert_conn->node); |
---|
| 2466 | + isert_connect_release(isert_conn); |
---|
| 2467 | + } |
---|
| 2468 | + |
---|
2553 | 2469 | np->np_context = NULL; |
---|
2554 | 2470 | kfree(isert_np); |
---|
2555 | 2471 | } |
---|