aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/ulp/iser
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-03-21 13:33:42 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-03-21 13:33:42 -0400
commit0c2fe82a9b106f1c03719783134360586d718a69 (patch)
treeec1a18ca49f1e6724ef3a93727f5f73b7df61931 /drivers/infiniband/ulp/iser
parent5f0e685f316a1de6d3af8b23eaf46651faca32ab (diff)
parentf0e88aeb19dac00ed2e09fd4d39ee65f32d5e968 (diff)
Merge tag 'rdma-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland/infiniband
Pull InfiniBand/RDMA changes for the 3.4 merge window from Roland Dreier: "Nothing big really stands out; by patch count lots of fixes to the mlx4 driver plus some cleanups and fixes to the core and other drivers." * tag 'rdma-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland/infiniband: (28 commits) mlx4_core: Scale size of MTT table with system RAM mlx4_core: Allow dynamic MTU configuration for IB ports IB/mlx4: Fix info returned when querying IBoE ports IB/mlx4: Fix possible missed completion event mlx4_core: Report thermal error events mlx4_core: Fix one more static exported function IB: Change CQE "csum_ok" field to a bit flag RDMA/iwcm: Reject connect requests if cmid is not in LISTEN state RDMA/cxgb3: Don't pass irq flags to flush_qp() mlx4_core: Get rid of redundant ext_port_cap flags RDMA/ucma: Fix AB-BA deadlock IB/ehca: Fix ilog2() compile failure IB: Use central enum for speed instead of hard-coded values IB/iser: Post initial receive buffers before sending the final login request IB/iser: Free IB connection resources in the proper place IB/srp: Consolidate repetitive sysfs code IB/srp: Use pr_fmt() and pr_err()/pr_warn() IB/core: Fix SDR rates in sysfs mlx4: Enforce device max FMR maps in FMR alloc IB/mlx4: Set bad_wr for invalid send opcode ...
Diffstat (limited to 'drivers/infiniband/ulp/iser')
-rw-r--r--drivers/infiniband/ulp/iser/iscsi_iser.c18
-rw-r--r--drivers/infiniband/ulp/iser/iscsi_iser.h1
-rw-r--r--drivers/infiniband/ulp/iser/iser_initiator.c42
-rw-r--r--drivers/infiniband/ulp/iser/iser_verbs.c12
4 files changed, 34 insertions, 39 deletions
diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c b/drivers/infiniband/ulp/iser/iscsi_iser.c
index 9a43cb07f294..db43b3117168 100644
--- a/drivers/infiniband/ulp/iser/iscsi_iser.c
+++ b/drivers/infiniband/ulp/iser/iscsi_iser.c
@@ -364,6 +364,9 @@ iscsi_iser_conn_bind(struct iscsi_cls_session *cls_session,
364 } 364 }
365 ib_conn = ep->dd_data; 365 ib_conn = ep->dd_data;
366 366
367 if (iser_alloc_rx_descriptors(ib_conn))
368 return -ENOMEM;
369
367 /* binds the iSER connection retrieved from the previously 370 /* binds the iSER connection retrieved from the previously
368 * connected ep_handle to the iSCSI layer connection. exchanges 371 * connected ep_handle to the iSCSI layer connection. exchanges
369 * connection pointers */ 372 * connection pointers */
@@ -398,19 +401,6 @@ iscsi_iser_conn_stop(struct iscsi_cls_conn *cls_conn, int flag)
398 iser_conn->ib_conn = NULL; 401 iser_conn->ib_conn = NULL;
399} 402}
400 403
401static int
402iscsi_iser_conn_start(struct iscsi_cls_conn *cls_conn)
403{
404 struct iscsi_conn *conn = cls_conn->dd_data;
405 int err;
406
407 err = iser_conn_set_full_featured_mode(conn);
408 if (err)
409 return err;
410
411 return iscsi_conn_start(cls_conn);
412}
413
414static void iscsi_iser_session_destroy(struct iscsi_cls_session *cls_session) 404static void iscsi_iser_session_destroy(struct iscsi_cls_session *cls_session)
415{ 405{
416 struct Scsi_Host *shost = iscsi_session_to_shost(cls_session); 406 struct Scsi_Host *shost = iscsi_session_to_shost(cls_session);
@@ -724,7 +714,7 @@ static struct iscsi_transport iscsi_iser_transport = {
724 .get_conn_param = iscsi_conn_get_param, 714 .get_conn_param = iscsi_conn_get_param,
725 .get_ep_param = iscsi_iser_get_ep_param, 715 .get_ep_param = iscsi_iser_get_ep_param,
726 .get_session_param = iscsi_session_get_param, 716 .get_session_param = iscsi_session_get_param,
727 .start_conn = iscsi_iser_conn_start, 717 .start_conn = iscsi_conn_start,
728 .stop_conn = iscsi_iser_conn_stop, 718 .stop_conn = iscsi_iser_conn_stop,
729 /* iscsi host params */ 719 /* iscsi host params */
730 .get_host_param = iscsi_host_get_param, 720 .get_host_param = iscsi_host_get_param,
diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.h b/drivers/infiniband/ulp/iser/iscsi_iser.h
index db7ea3704da7..296be431a0e9 100644
--- a/drivers/infiniband/ulp/iser/iscsi_iser.h
+++ b/drivers/infiniband/ulp/iser/iscsi_iser.h
@@ -366,4 +366,5 @@ int iser_dma_map_task_data(struct iscsi_iser_task *iser_task,
366void iser_dma_unmap_task_data(struct iscsi_iser_task *iser_task); 366void iser_dma_unmap_task_data(struct iscsi_iser_task *iser_task);
367int iser_initialize_task_headers(struct iscsi_task *task, 367int iser_initialize_task_headers(struct iscsi_task *task,
368 struct iser_tx_desc *tx_desc); 368 struct iser_tx_desc *tx_desc);
369int iser_alloc_rx_descriptors(struct iser_conn *ib_conn);
369#endif 370#endif
diff --git a/drivers/infiniband/ulp/iser/iser_initiator.c b/drivers/infiniband/ulp/iser/iser_initiator.c
index a607542fc796..a00ccd1ca333 100644
--- a/drivers/infiniband/ulp/iser/iser_initiator.c
+++ b/drivers/infiniband/ulp/iser/iser_initiator.c
@@ -170,7 +170,7 @@ static void iser_create_send_desc(struct iser_conn *ib_conn,
170} 170}
171 171
172 172
173static int iser_alloc_rx_descriptors(struct iser_conn *ib_conn) 173int iser_alloc_rx_descriptors(struct iser_conn *ib_conn)
174{ 174{
175 int i, j; 175 int i, j;
176 u64 dma_addr; 176 u64 dma_addr;
@@ -220,18 +220,6 @@ void iser_free_rx_descriptors(struct iser_conn *ib_conn)
220 struct iser_rx_desc *rx_desc; 220 struct iser_rx_desc *rx_desc;
221 struct iser_device *device = ib_conn->device; 221 struct iser_device *device = ib_conn->device;
222 222
223 if (ib_conn->login_buf) {
224 if (ib_conn->login_req_dma)
225 ib_dma_unmap_single(device->ib_device,
226 ib_conn->login_req_dma,
227 ISCSI_DEF_MAX_RECV_SEG_LEN, DMA_TO_DEVICE);
228 if (ib_conn->login_resp_dma)
229 ib_dma_unmap_single(device->ib_device,
230 ib_conn->login_resp_dma,
231 ISER_RX_LOGIN_SIZE, DMA_FROM_DEVICE);
232 kfree(ib_conn->login_buf);
233 }
234
235 if (!ib_conn->rx_descs) 223 if (!ib_conn->rx_descs)
236 return; 224 return;
237 225
@@ -242,23 +230,24 @@ void iser_free_rx_descriptors(struct iser_conn *ib_conn)
242 kfree(ib_conn->rx_descs); 230 kfree(ib_conn->rx_descs);
243} 231}
244 232
245/** 233static int iser_post_rx_bufs(struct iscsi_conn *conn, struct iscsi_hdr *req)
246 * iser_conn_set_full_featured_mode - (iSER API)
247 */
248int iser_conn_set_full_featured_mode(struct iscsi_conn *conn)
249{ 234{
250 struct iscsi_iser_conn *iser_conn = conn->dd_data; 235 struct iscsi_iser_conn *iser_conn = conn->dd_data;
251 236
252 iser_dbg("Initially post: %d\n", ISER_MIN_POSTED_RX); 237 iser_dbg("req op %x flags %x\n", req->opcode, req->flags);
253 238 /* check if this is the last login - going to full feature phase */
254 /* Check that there is no posted recv or send buffers left - */ 239 if ((req->flags & ISCSI_FULL_FEATURE_PHASE) != ISCSI_FULL_FEATURE_PHASE)
255 /* they must be consumed during the login phase */ 240 return 0;
256 BUG_ON(iser_conn->ib_conn->post_recv_buf_count != 0);
257 BUG_ON(atomic_read(&iser_conn->ib_conn->post_send_buf_count) != 0);
258 241
259 if (iser_alloc_rx_descriptors(iser_conn->ib_conn)) 242 /*
260 return -ENOMEM; 243 * Check that there is one posted recv buffer (for the last login
244 * response) and no posted send buffers left - they must have been
245 * consumed during previous login phases.
246 */
247 WARN_ON(iser_conn->ib_conn->post_recv_buf_count != 1);
248 WARN_ON(atomic_read(&iser_conn->ib_conn->post_send_buf_count) != 0);
261 249
250 iser_dbg("Initially post: %d\n", ISER_MIN_POSTED_RX);
262 /* Initial post receive buffers */ 251 /* Initial post receive buffers */
263 if (iser_post_recvm(iser_conn->ib_conn, ISER_MIN_POSTED_RX)) 252 if (iser_post_recvm(iser_conn->ib_conn, ISER_MIN_POSTED_RX))
264 return -ENOMEM; 253 return -ENOMEM;
@@ -438,6 +427,9 @@ int iser_send_control(struct iscsi_conn *conn,
438 err = iser_post_recvl(iser_conn->ib_conn); 427 err = iser_post_recvl(iser_conn->ib_conn);
439 if (err) 428 if (err)
440 goto send_control_error; 429 goto send_control_error;
430 err = iser_post_rx_bufs(conn, task->hdr);
431 if (err)
432 goto send_control_error;
441 } 433 }
442 434
443 err = iser_post_send(iser_conn->ib_conn, mdesc); 435 err = iser_post_send(iser_conn->ib_conn, mdesc);
diff --git a/drivers/infiniband/ulp/iser/iser_verbs.c b/drivers/infiniband/ulp/iser/iser_verbs.c
index e28877c4ce15..14224ba44fd8 100644
--- a/drivers/infiniband/ulp/iser/iser_verbs.c
+++ b/drivers/infiniband/ulp/iser/iser_verbs.c
@@ -274,6 +274,18 @@ static int iser_free_ib_conn_res(struct iser_conn *ib_conn, int can_destroy_id)
274 ib_conn->cma_id = NULL; 274 ib_conn->cma_id = NULL;
275 kfree(ib_conn->page_vec); 275 kfree(ib_conn->page_vec);
276 276
277 if (ib_conn->login_buf) {
278 if (ib_conn->login_req_dma)
279 ib_dma_unmap_single(ib_conn->device->ib_device,
280 ib_conn->login_req_dma,
281 ISCSI_DEF_MAX_RECV_SEG_LEN, DMA_TO_DEVICE);
282 if (ib_conn->login_resp_dma)
283 ib_dma_unmap_single(ib_conn->device->ib_device,
284 ib_conn->login_resp_dma,
285 ISER_RX_LOGIN_SIZE, DMA_FROM_DEVICE);
286 kfree(ib_conn->login_buf);
287 }
288
277 return 0; 289 return 0;
278} 290}
279 291