diff options
| -rw-r--r-- | drivers/infiniband/ulp/iser/iscsi_iser.c | 45 | ||||
| -rw-r--r-- | drivers/infiniband/ulp/iser/iscsi_iser.h | 10 | ||||
| -rw-r--r-- | drivers/infiniband/ulp/iser/iser_initiator.c | 54 | ||||
| -rw-r--r-- | drivers/infiniband/ulp/iser/iser_memory.c | 20 | ||||
| -rw-r--r-- | drivers/infiniband/ulp/iser/iser_verbs.c | 9 |
5 files changed, 59 insertions, 79 deletions
diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c b/drivers/infiniband/ulp/iser/iscsi_iser.c index a0ec2d012f95..bfbbb2d1aff7 100644 --- a/drivers/infiniband/ulp/iser/iscsi_iser.c +++ b/drivers/infiniband/ulp/iser/iscsi_iser.c | |||
| @@ -146,8 +146,8 @@ static int iscsi_iser_pdu_alloc(struct iscsi_task *task, uint8_t opcode) | |||
| 146 | int iser_initialize_task_headers(struct iscsi_task *task, | 146 | int iser_initialize_task_headers(struct iscsi_task *task, |
| 147 | struct iser_tx_desc *tx_desc) | 147 | struct iser_tx_desc *tx_desc) |
| 148 | { | 148 | { |
| 149 | struct iscsi_iser_conn *iser_conn = task->conn->dd_data; | 149 | struct iser_conn *ib_conn = task->conn->dd_data; |
| 150 | struct iser_device *device = iser_conn->ib_conn->device; | 150 | struct iser_device *device = ib_conn->device; |
| 151 | struct iscsi_iser_task *iser_task = task->dd_data; | 151 | struct iscsi_iser_task *iser_task = task->dd_data; |
| 152 | u64 dma_addr; | 152 | u64 dma_addr; |
| 153 | 153 | ||
| @@ -161,7 +161,7 @@ int iser_initialize_task_headers(struct iscsi_task *task, | |||
| 161 | tx_desc->tx_sg[0].length = ISER_HEADERS_LEN; | 161 | tx_desc->tx_sg[0].length = ISER_HEADERS_LEN; |
| 162 | tx_desc->tx_sg[0].lkey = device->mr->lkey; | 162 | tx_desc->tx_sg[0].lkey = device->mr->lkey; |
| 163 | 163 | ||
| 164 | iser_task->iser_conn = iser_conn; | 164 | iser_task->ib_conn = ib_conn; |
| 165 | return 0; | 165 | return 0; |
| 166 | } | 166 | } |
| 167 | /** | 167 | /** |
| @@ -288,10 +288,9 @@ iscsi_iser_task_xmit(struct iscsi_task *task) | |||
| 288 | static void iscsi_iser_cleanup_task(struct iscsi_task *task) | 288 | static void iscsi_iser_cleanup_task(struct iscsi_task *task) |
| 289 | { | 289 | { |
| 290 | struct iscsi_iser_task *iser_task = task->dd_data; | 290 | struct iscsi_iser_task *iser_task = task->dd_data; |
| 291 | struct iser_tx_desc *tx_desc = &iser_task->desc; | 291 | struct iser_tx_desc *tx_desc = &iser_task->desc; |
| 292 | 292 | struct iser_conn *ib_conn = task->conn->dd_data; | |
| 293 | struct iscsi_iser_conn *iser_conn = task->conn->dd_data; | 293 | struct iser_device *device = ib_conn->device; |
| 294 | struct iser_device *device = iser_conn->ib_conn->device; | ||
| 295 | 294 | ||
| 296 | ib_dma_unmap_single(device->ib_device, | 295 | ib_dma_unmap_single(device->ib_device, |
| 297 | tx_desc->dma_addr, ISER_HEADERS_LEN, DMA_TO_DEVICE); | 296 | tx_desc->dma_addr, ISER_HEADERS_LEN, DMA_TO_DEVICE); |
| @@ -323,9 +322,8 @@ iscsi_iser_conn_create(struct iscsi_cls_session *cls_session, uint32_t conn_idx) | |||
| 323 | { | 322 | { |
| 324 | struct iscsi_conn *conn; | 323 | struct iscsi_conn *conn; |
| 325 | struct iscsi_cls_conn *cls_conn; | 324 | struct iscsi_cls_conn *cls_conn; |
| 326 | struct iscsi_iser_conn *iser_conn; | ||
| 327 | 325 | ||
| 328 | cls_conn = iscsi_conn_setup(cls_session, sizeof(*iser_conn), conn_idx); | 326 | cls_conn = iscsi_conn_setup(cls_session, 0, conn_idx); |
| 329 | if (!cls_conn) | 327 | if (!cls_conn) |
| 330 | return NULL; | 328 | return NULL; |
| 331 | conn = cls_conn->dd_data; | 329 | conn = cls_conn->dd_data; |
| @@ -336,10 +334,6 @@ iscsi_iser_conn_create(struct iscsi_cls_session *cls_session, uint32_t conn_idx) | |||
| 336 | */ | 334 | */ |
| 337 | conn->max_recv_dlength = ISER_RECV_DATA_SEG_LEN; | 335 | conn->max_recv_dlength = ISER_RECV_DATA_SEG_LEN; |
| 338 | 336 | ||
| 339 | iser_conn = conn->dd_data; | ||
| 340 | conn->dd_data = iser_conn; | ||
| 341 | iser_conn->iscsi_conn = conn; | ||
| 342 | |||
| 343 | return cls_conn; | 337 | return cls_conn; |
| 344 | } | 338 | } |
| 345 | 339 | ||
| @@ -347,8 +341,7 @@ static void | |||
| 347 | iscsi_iser_conn_destroy(struct iscsi_cls_conn *cls_conn) | 341 | iscsi_iser_conn_destroy(struct iscsi_cls_conn *cls_conn) |
| 348 | { | 342 | { |
| 349 | struct iscsi_conn *conn = cls_conn->dd_data; | 343 | struct iscsi_conn *conn = cls_conn->dd_data; |
| 350 | struct iscsi_iser_conn *iser_conn = conn->dd_data; | 344 | struct iser_conn *ib_conn = conn->dd_data; |
| 351 | struct iser_conn *ib_conn = iser_conn->ib_conn; | ||
| 352 | 345 | ||
| 353 | iscsi_conn_teardown(cls_conn); | 346 | iscsi_conn_teardown(cls_conn); |
| 354 | /* | 347 | /* |
| @@ -357,7 +350,7 @@ iscsi_iser_conn_destroy(struct iscsi_cls_conn *cls_conn) | |||
| 357 | * we free it here. | 350 | * we free it here. |
| 358 | */ | 351 | */ |
| 359 | if (ib_conn) { | 352 | if (ib_conn) { |
| 360 | ib_conn->iser_conn = NULL; | 353 | ib_conn->iscsi_conn = NULL; |
| 361 | iser_conn_put(ib_conn, 1); /* deref iscsi/ib conn unbinding */ | 354 | iser_conn_put(ib_conn, 1); /* deref iscsi/ib conn unbinding */ |
| 362 | } | 355 | } |
| 363 | } | 356 | } |
| @@ -368,7 +361,6 @@ iscsi_iser_conn_bind(struct iscsi_cls_session *cls_session, | |||
| 368 | int is_leading) | 361 | int is_leading) |
| 369 | { | 362 | { |
| 370 | struct iscsi_conn *conn = cls_conn->dd_data; | 363 | struct iscsi_conn *conn = cls_conn->dd_data; |
| 371 | struct iscsi_iser_conn *iser_conn; | ||
| 372 | struct iscsi_session *session; | 364 | struct iscsi_session *session; |
| 373 | struct iser_conn *ib_conn; | 365 | struct iser_conn *ib_conn; |
| 374 | struct iscsi_endpoint *ep; | 366 | struct iscsi_endpoint *ep; |
| @@ -395,11 +387,11 @@ iscsi_iser_conn_bind(struct iscsi_cls_session *cls_session, | |||
| 395 | /* binds the iSER connection retrieved from the previously | 387 | /* binds the iSER connection retrieved from the previously |
| 396 | * connected ep_handle to the iSCSI layer connection. exchanges | 388 | * connected ep_handle to the iSCSI layer connection. exchanges |
| 397 | * connection pointers */ | 389 | * connection pointers */ |
| 398 | iser_info("binding iscsi/iser conn %p %p to ib_conn %p\n", | 390 | iser_info("binding iscsi conn %p to ib_conn %p\n", conn, ib_conn); |
| 399 | conn, conn->dd_data, ib_conn); | 391 | |
| 400 | iser_conn = conn->dd_data; | 392 | conn->dd_data = ib_conn; |
| 401 | ib_conn->iser_conn = iser_conn; | 393 | ib_conn->iscsi_conn = conn; |
| 402 | iser_conn->ib_conn = ib_conn; | 394 | |
| 403 | iser_conn_get(ib_conn); /* ref iscsi/ib conn binding */ | 395 | iser_conn_get(ib_conn); /* ref iscsi/ib conn binding */ |
| 404 | return 0; | 396 | return 0; |
| 405 | } | 397 | } |
| @@ -408,8 +400,7 @@ static void | |||
| 408 | iscsi_iser_conn_stop(struct iscsi_cls_conn *cls_conn, int flag) | 400 | iscsi_iser_conn_stop(struct iscsi_cls_conn *cls_conn, int flag) |
| 409 | { | 401 | { |
| 410 | struct iscsi_conn *conn = cls_conn->dd_data; | 402 | struct iscsi_conn *conn = cls_conn->dd_data; |
| 411 | struct iscsi_iser_conn *iser_conn = conn->dd_data; | 403 | struct iser_conn *ib_conn = conn->dd_data; |
| 412 | struct iser_conn *ib_conn = iser_conn->ib_conn; | ||
| 413 | 404 | ||
| 414 | /* | 405 | /* |
| 415 | * Userspace may have goofed up and not bound the connection or | 406 | * Userspace may have goofed up and not bound the connection or |
| @@ -423,7 +414,7 @@ iscsi_iser_conn_stop(struct iscsi_cls_conn *cls_conn, int flag) | |||
| 423 | */ | 414 | */ |
| 424 | iser_conn_put(ib_conn, 1); /* deref iscsi/ib conn unbinding */ | 415 | iser_conn_put(ib_conn, 1); /* deref iscsi/ib conn unbinding */ |
| 425 | } | 416 | } |
| 426 | iser_conn->ib_conn = NULL; | 417 | conn->dd_data = NULL; |
| 427 | } | 418 | } |
| 428 | 419 | ||
| 429 | static void iscsi_iser_session_destroy(struct iscsi_cls_session *cls_session) | 420 | static void iscsi_iser_session_destroy(struct iscsi_cls_session *cls_session) |
| @@ -661,7 +652,7 @@ iscsi_iser_ep_disconnect(struct iscsi_endpoint *ep) | |||
| 661 | struct iser_conn *ib_conn; | 652 | struct iser_conn *ib_conn; |
| 662 | 653 | ||
| 663 | ib_conn = ep->dd_data; | 654 | ib_conn = ep->dd_data; |
| 664 | if (ib_conn->iser_conn) | 655 | if (ib_conn->iscsi_conn) |
| 665 | /* | 656 | /* |
| 666 | * Must suspend xmit path if the ep is bound to the | 657 | * Must suspend xmit path if the ep is bound to the |
| 667 | * iscsi_conn, so we know we are not accessing the ib_conn | 658 | * iscsi_conn, so we know we are not accessing the ib_conn |
| @@ -669,7 +660,7 @@ iscsi_iser_ep_disconnect(struct iscsi_endpoint *ep) | |||
| 669 | * | 660 | * |
| 670 | * This may not be bound if the ep poll failed. | 661 | * This may not be bound if the ep poll failed. |
| 671 | */ | 662 | */ |
| 672 | iscsi_suspend_tx(ib_conn->iser_conn->iscsi_conn); | 663 | iscsi_suspend_tx(ib_conn->iscsi_conn); |
| 673 | 664 | ||
| 674 | 665 | ||
| 675 | iser_info("ib conn %p state %d\n", ib_conn, ib_conn->state); | 666 | iser_info("ib conn %p state %d\n", ib_conn, ib_conn->state); |
diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.h b/drivers/infiniband/ulp/iser/iscsi_iser.h index 95f291fca178..41fa5e9c1bcc 100644 --- a/drivers/infiniband/ulp/iser/iscsi_iser.h +++ b/drivers/infiniband/ulp/iser/iscsi_iser.h | |||
| @@ -214,7 +214,6 @@ struct iser_data_buf { | |||
| 214 | /* fwd declarations */ | 214 | /* fwd declarations */ |
| 215 | struct iser_device; | 215 | struct iser_device; |
| 216 | struct iser_cq_desc; | 216 | struct iser_cq_desc; |
| 217 | struct iscsi_iser_conn; | ||
| 218 | struct iscsi_iser_task; | 217 | struct iscsi_iser_task; |
| 219 | struct iscsi_endpoint; | 218 | struct iscsi_endpoint; |
| 220 | 219 | ||
| @@ -319,7 +318,7 @@ struct fast_reg_descriptor { | |||
| 319 | }; | 318 | }; |
| 320 | 319 | ||
| 321 | struct iser_conn { | 320 | struct iser_conn { |
| 322 | struct iscsi_iser_conn *iser_conn; /* iser conn for upcalls */ | 321 | struct iscsi_conn *iscsi_conn; |
| 323 | struct iscsi_endpoint *ep; | 322 | struct iscsi_endpoint *ep; |
| 324 | enum iser_ib_conn_state state; /* rdma connection state */ | 323 | enum iser_ib_conn_state state; /* rdma connection state */ |
| 325 | atomic_t refcount; | 324 | atomic_t refcount; |
| @@ -358,14 +357,9 @@ struct iser_conn { | |||
| 358 | }; | 357 | }; |
| 359 | }; | 358 | }; |
| 360 | 359 | ||
| 361 | struct iscsi_iser_conn { | ||
| 362 | struct iscsi_conn *iscsi_conn;/* ptr to iscsi conn */ | ||
| 363 | struct iser_conn *ib_conn; /* iSER IB conn */ | ||
| 364 | }; | ||
| 365 | |||
| 366 | struct iscsi_iser_task { | 360 | struct iscsi_iser_task { |
| 367 | struct iser_tx_desc desc; | 361 | struct iser_tx_desc desc; |
| 368 | struct iscsi_iser_conn *iser_conn; | 362 | struct iser_conn *ib_conn; |
| 369 | enum iser_task_status status; | 363 | enum iser_task_status status; |
| 370 | struct scsi_cmnd *sc; | 364 | struct scsi_cmnd *sc; |
| 371 | int command_sent; /* set if command sent */ | 365 | int command_sent; /* set if command sent */ |
diff --git a/drivers/infiniband/ulp/iser/iser_initiator.c b/drivers/infiniband/ulp/iser/iser_initiator.c index 7fd95fe6d989..401909006aec 100644 --- a/drivers/infiniband/ulp/iser/iser_initiator.c +++ b/drivers/infiniband/ulp/iser/iser_initiator.c | |||
| @@ -49,7 +49,7 @@ static int iser_prepare_read_cmd(struct iscsi_task *task, | |||
| 49 | 49 | ||
| 50 | { | 50 | { |
| 51 | struct iscsi_iser_task *iser_task = task->dd_data; | 51 | struct iscsi_iser_task *iser_task = task->dd_data; |
| 52 | struct iser_device *device = iser_task->iser_conn->ib_conn->device; | 52 | struct iser_device *device = iser_task->ib_conn->device; |
| 53 | struct iser_regd_buf *regd_buf; | 53 | struct iser_regd_buf *regd_buf; |
| 54 | int err; | 54 | int err; |
| 55 | struct iser_hdr *hdr = &iser_task->desc.iser_header; | 55 | struct iser_hdr *hdr = &iser_task->desc.iser_header; |
| @@ -77,7 +77,7 @@ static int iser_prepare_read_cmd(struct iscsi_task *task, | |||
| 77 | iser_err("Total data length: %ld, less than EDTL: " | 77 | iser_err("Total data length: %ld, less than EDTL: " |
| 78 | "%d, in READ cmd BHS itt: %d, conn: 0x%p\n", | 78 | "%d, in READ cmd BHS itt: %d, conn: 0x%p\n", |
| 79 | iser_task->data[ISER_DIR_IN].data_len, edtl, | 79 | iser_task->data[ISER_DIR_IN].data_len, edtl, |
| 80 | task->itt, iser_task->iser_conn); | 80 | task->itt, iser_task->ib_conn); |
| 81 | return -EINVAL; | 81 | return -EINVAL; |
| 82 | } | 82 | } |
| 83 | 83 | ||
| @@ -110,7 +110,7 @@ iser_prepare_write_cmd(struct iscsi_task *task, | |||
| 110 | unsigned int edtl) | 110 | unsigned int edtl) |
| 111 | { | 111 | { |
| 112 | struct iscsi_iser_task *iser_task = task->dd_data; | 112 | struct iscsi_iser_task *iser_task = task->dd_data; |
| 113 | struct iser_device *device = iser_task->iser_conn->ib_conn->device; | 113 | struct iser_device *device = iser_task->ib_conn->device; |
| 114 | struct iser_regd_buf *regd_buf; | 114 | struct iser_regd_buf *regd_buf; |
| 115 | int err; | 115 | int err; |
| 116 | struct iser_hdr *hdr = &iser_task->desc.iser_header; | 116 | struct iser_hdr *hdr = &iser_task->desc.iser_header; |
| @@ -349,7 +349,7 @@ free_login_buf: | |||
| 349 | 349 | ||
| 350 | static int iser_post_rx_bufs(struct iscsi_conn *conn, struct iscsi_hdr *req) | 350 | static int iser_post_rx_bufs(struct iscsi_conn *conn, struct iscsi_hdr *req) |
| 351 | { | 351 | { |
| 352 | struct iscsi_iser_conn *iser_conn = conn->dd_data; | 352 | struct iser_conn *ib_conn = conn->dd_data; |
| 353 | struct iscsi_session *session = conn->session; | 353 | struct iscsi_session *session = conn->session; |
| 354 | 354 | ||
| 355 | iser_dbg("req op %x flags %x\n", req->opcode, req->flags); | 355 | iser_dbg("req op %x flags %x\n", req->opcode, req->flags); |
| @@ -362,19 +362,18 @@ static int iser_post_rx_bufs(struct iscsi_conn *conn, struct iscsi_hdr *req) | |||
| 362 | * response) and no posted send buffers left - they must have been | 362 | * response) and no posted send buffers left - they must have been |
| 363 | * consumed during previous login phases. | 363 | * consumed during previous login phases. |
| 364 | */ | 364 | */ |
| 365 | WARN_ON(iser_conn->ib_conn->post_recv_buf_count != 1); | 365 | WARN_ON(ib_conn->post_recv_buf_count != 1); |
| 366 | WARN_ON(atomic_read(&iser_conn->ib_conn->post_send_buf_count) != 0); | 366 | WARN_ON(atomic_read(&ib_conn->post_send_buf_count) != 0); |
| 367 | 367 | ||
| 368 | if (session->discovery_sess) { | 368 | if (session->discovery_sess) { |
| 369 | iser_info("Discovery session, re-using login RX buffer\n"); | 369 | iser_info("Discovery session, re-using login RX buffer\n"); |
| 370 | return 0; | 370 | return 0; |
| 371 | } else | 371 | } else |
| 372 | iser_info("Normal session, posting batch of RX %d buffers\n", | 372 | iser_info("Normal session, posting batch of RX %d buffers\n", |
| 373 | iser_conn->ib_conn->min_posted_rx); | 373 | ib_conn->min_posted_rx); |
| 374 | 374 | ||
| 375 | /* Initial post receive buffers */ | 375 | /* Initial post receive buffers */ |
| 376 | if (iser_post_recvm(iser_conn->ib_conn, | 376 | if (iser_post_recvm(ib_conn, ib_conn->min_posted_rx)) |
| 377 | iser_conn->ib_conn->min_posted_rx)) | ||
| 378 | return -ENOMEM; | 377 | return -ENOMEM; |
| 379 | 378 | ||
| 380 | return 0; | 379 | return 0; |
| @@ -386,7 +385,7 @@ static int iser_post_rx_bufs(struct iscsi_conn *conn, struct iscsi_hdr *req) | |||
| 386 | int iser_send_command(struct iscsi_conn *conn, | 385 | int iser_send_command(struct iscsi_conn *conn, |
| 387 | struct iscsi_task *task) | 386 | struct iscsi_task *task) |
| 388 | { | 387 | { |
| 389 | struct iscsi_iser_conn *iser_conn = conn->dd_data; | 388 | struct iser_conn *ib_conn = conn->dd_data; |
| 390 | struct iscsi_iser_task *iser_task = task->dd_data; | 389 | struct iscsi_iser_task *iser_task = task->dd_data; |
| 391 | unsigned long edtl; | 390 | unsigned long edtl; |
| 392 | int err; | 391 | int err; |
| @@ -399,7 +398,7 @@ int iser_send_command(struct iscsi_conn *conn, | |||
| 399 | 398 | ||
| 400 | /* build the tx desc regd header and add it to the tx desc dto */ | 399 | /* build the tx desc regd header and add it to the tx desc dto */ |
| 401 | tx_desc->type = ISCSI_TX_SCSI_COMMAND; | 400 | tx_desc->type = ISCSI_TX_SCSI_COMMAND; |
| 402 | iser_create_send_desc(iser_conn->ib_conn, tx_desc); | 401 | iser_create_send_desc(ib_conn, tx_desc); |
| 403 | 402 | ||
| 404 | if (hdr->flags & ISCSI_FLAG_CMD_READ) { | 403 | if (hdr->flags & ISCSI_FLAG_CMD_READ) { |
| 405 | data_buf = &iser_task->data[ISER_DIR_IN]; | 404 | data_buf = &iser_task->data[ISER_DIR_IN]; |
| @@ -438,7 +437,7 @@ int iser_send_command(struct iscsi_conn *conn, | |||
| 438 | 437 | ||
| 439 | iser_task->status = ISER_TASK_STATUS_STARTED; | 438 | iser_task->status = ISER_TASK_STATUS_STARTED; |
| 440 | 439 | ||
| 441 | err = iser_post_send(iser_conn->ib_conn, tx_desc); | 440 | err = iser_post_send(ib_conn, tx_desc); |
| 442 | if (!err) | 441 | if (!err) |
| 443 | return 0; | 442 | return 0; |
| 444 | 443 | ||
| @@ -454,7 +453,7 @@ int iser_send_data_out(struct iscsi_conn *conn, | |||
| 454 | struct iscsi_task *task, | 453 | struct iscsi_task *task, |
| 455 | struct iscsi_data *hdr) | 454 | struct iscsi_data *hdr) |
| 456 | { | 455 | { |
| 457 | struct iscsi_iser_conn *iser_conn = conn->dd_data; | 456 | struct iser_conn *ib_conn = conn->dd_data; |
| 458 | struct iscsi_iser_task *iser_task = task->dd_data; | 457 | struct iscsi_iser_task *iser_task = task->dd_data; |
| 459 | struct iser_tx_desc *tx_desc = NULL; | 458 | struct iser_tx_desc *tx_desc = NULL; |
| 460 | struct iser_regd_buf *regd_buf; | 459 | struct iser_regd_buf *regd_buf; |
| @@ -503,7 +502,7 @@ int iser_send_data_out(struct iscsi_conn *conn, | |||
| 503 | itt, buf_offset, data_seg_len); | 502 | itt, buf_offset, data_seg_len); |
| 504 | 503 | ||
| 505 | 504 | ||
| 506 | err = iser_post_send(iser_conn->ib_conn, tx_desc); | 505 | err = iser_post_send(ib_conn, tx_desc); |
| 507 | if (!err) | 506 | if (!err) |
| 508 | return 0; | 507 | return 0; |
| 509 | 508 | ||
| @@ -516,19 +515,18 @@ send_data_out_error: | |||
| 516 | int iser_send_control(struct iscsi_conn *conn, | 515 | int iser_send_control(struct iscsi_conn *conn, |
| 517 | struct iscsi_task *task) | 516 | struct iscsi_task *task) |
| 518 | { | 517 | { |
| 519 | struct iscsi_iser_conn *iser_conn = conn->dd_data; | 518 | struct iser_conn *ib_conn = conn->dd_data; |
| 520 | struct iscsi_iser_task *iser_task = task->dd_data; | 519 | struct iscsi_iser_task *iser_task = task->dd_data; |
| 521 | struct iser_tx_desc *mdesc = &iser_task->desc; | 520 | struct iser_tx_desc *mdesc = &iser_task->desc; |
| 522 | unsigned long data_seg_len; | 521 | unsigned long data_seg_len; |
| 523 | int err = 0; | 522 | int err = 0; |
| 524 | struct iser_device *device; | 523 | struct iser_device *device; |
| 525 | struct iser_conn *ib_conn = iser_conn->ib_conn; | ||
| 526 | 524 | ||
| 527 | /* build the tx desc regd header and add it to the tx desc dto */ | 525 | /* build the tx desc regd header and add it to the tx desc dto */ |
| 528 | mdesc->type = ISCSI_TX_CONTROL; | 526 | mdesc->type = ISCSI_TX_CONTROL; |
| 529 | iser_create_send_desc(iser_conn->ib_conn, mdesc); | 527 | iser_create_send_desc(ib_conn, mdesc); |
| 530 | 528 | ||
| 531 | device = iser_conn->ib_conn->device; | 529 | device = ib_conn->device; |
| 532 | 530 | ||
| 533 | data_seg_len = ntoh24(task->hdr->dlength); | 531 | data_seg_len = ntoh24(task->hdr->dlength); |
| 534 | 532 | ||
| @@ -543,14 +541,13 @@ int iser_send_control(struct iscsi_conn *conn, | |||
| 543 | ib_conn->login_req_dma, task->data_count, | 541 | ib_conn->login_req_dma, task->data_count, |
| 544 | DMA_TO_DEVICE); | 542 | DMA_TO_DEVICE); |
| 545 | 543 | ||
| 546 | memcpy(iser_conn->ib_conn->login_req_buf, task->data, | 544 | memcpy(ib_conn->login_req_buf, task->data, task->data_count); |
| 547 | task->data_count); | ||
| 548 | 545 | ||
| 549 | ib_dma_sync_single_for_device(device->ib_device, | 546 | ib_dma_sync_single_for_device(device->ib_device, |
| 550 | ib_conn->login_req_dma, task->data_count, | 547 | ib_conn->login_req_dma, task->data_count, |
| 551 | DMA_TO_DEVICE); | 548 | DMA_TO_DEVICE); |
| 552 | 549 | ||
| 553 | tx_dsg->addr = iser_conn->ib_conn->login_req_dma; | 550 | tx_dsg->addr = ib_conn->login_req_dma; |
| 554 | tx_dsg->length = task->data_count; | 551 | tx_dsg->length = task->data_count; |
| 555 | tx_dsg->lkey = device->mr->lkey; | 552 | tx_dsg->lkey = device->mr->lkey; |
| 556 | mdesc->num_sge = 2; | 553 | mdesc->num_sge = 2; |
| @@ -559,7 +556,7 @@ int iser_send_control(struct iscsi_conn *conn, | |||
| 559 | if (task == conn->login_task) { | 556 | if (task == conn->login_task) { |
| 560 | iser_dbg("op %x dsl %lx, posting login rx buffer\n", | 557 | iser_dbg("op %x dsl %lx, posting login rx buffer\n", |
| 561 | task->hdr->opcode, data_seg_len); | 558 | task->hdr->opcode, data_seg_len); |
| 562 | err = iser_post_recvl(iser_conn->ib_conn); | 559 | err = iser_post_recvl(ib_conn); |
| 563 | if (err) | 560 | if (err) |
| 564 | goto send_control_error; | 561 | goto send_control_error; |
| 565 | err = iser_post_rx_bufs(conn, task->hdr); | 562 | err = iser_post_rx_bufs(conn, task->hdr); |
| @@ -567,7 +564,7 @@ int iser_send_control(struct iscsi_conn *conn, | |||
| 567 | goto send_control_error; | 564 | goto send_control_error; |
| 568 | } | 565 | } |
| 569 | 566 | ||
| 570 | err = iser_post_send(iser_conn->ib_conn, mdesc); | 567 | err = iser_post_send(ib_conn, mdesc); |
| 571 | if (!err) | 568 | if (!err) |
| 572 | return 0; | 569 | return 0; |
| 573 | 570 | ||
| @@ -583,7 +580,6 @@ void iser_rcv_completion(struct iser_rx_desc *rx_desc, | |||
| 583 | unsigned long rx_xfer_len, | 580 | unsigned long rx_xfer_len, |
| 584 | struct iser_conn *ib_conn) | 581 | struct iser_conn *ib_conn) |
| 585 | { | 582 | { |
| 586 | struct iscsi_iser_conn *conn = ib_conn->iser_conn; | ||
| 587 | struct iscsi_hdr *hdr; | 583 | struct iscsi_hdr *hdr; |
| 588 | u64 rx_dma; | 584 | u64 rx_dma; |
| 589 | int rx_buflen, outstanding, count, err; | 585 | int rx_buflen, outstanding, count, err; |
| @@ -605,17 +601,17 @@ void iser_rcv_completion(struct iser_rx_desc *rx_desc, | |||
| 605 | iser_dbg("op 0x%x itt 0x%x dlen %d\n", hdr->opcode, | 601 | iser_dbg("op 0x%x itt 0x%x dlen %d\n", hdr->opcode, |
| 606 | hdr->itt, (int)(rx_xfer_len - ISER_HEADERS_LEN)); | 602 | hdr->itt, (int)(rx_xfer_len - ISER_HEADERS_LEN)); |
| 607 | 603 | ||
| 608 | iscsi_iser_recv(conn->iscsi_conn, hdr, | 604 | iscsi_iser_recv(ib_conn->iscsi_conn, hdr, rx_desc->data, |
| 609 | rx_desc->data, rx_xfer_len - ISER_HEADERS_LEN); | 605 | rx_xfer_len - ISER_HEADERS_LEN); |
| 610 | 606 | ||
| 611 | ib_dma_sync_single_for_device(ib_conn->device->ib_device, rx_dma, | 607 | ib_dma_sync_single_for_device(ib_conn->device->ib_device, rx_dma, |
| 612 | rx_buflen, DMA_FROM_DEVICE); | 608 | rx_buflen, DMA_FROM_DEVICE); |
| 613 | 609 | ||
| 614 | /* decrementing conn->post_recv_buf_count only --after-- freeing the * | 610 | /* decrementing conn->post_recv_buf_count only --after-- freeing the * |
| 615 | * task eliminates the need to worry on tasks which are completed in * | 611 | * task eliminates the need to worry on tasks which are completed in * |
| 616 | * parallel to the execution of iser_conn_term. So the code that waits * | 612 | * parallel to the execution of iser_conn_term. So the code that waits * |
| 617 | * for the posted rx bufs refcount to become zero handles everything */ | 613 | * for the posted rx bufs refcount to become zero handles everything */ |
| 618 | conn->ib_conn->post_recv_buf_count--; | 614 | ib_conn->post_recv_buf_count--; |
| 619 | 615 | ||
| 620 | if (rx_dma == ib_conn->login_resp_dma) | 616 | if (rx_dma == ib_conn->login_resp_dma) |
| 621 | return; | 617 | return; |
| @@ -676,7 +672,7 @@ void iser_task_rdma_init(struct iscsi_iser_task *iser_task) | |||
| 676 | 672 | ||
| 677 | void iser_task_rdma_finalize(struct iscsi_iser_task *iser_task) | 673 | void iser_task_rdma_finalize(struct iscsi_iser_task *iser_task) |
| 678 | { | 674 | { |
| 679 | struct iser_device *device = iser_task->iser_conn->ib_conn->device; | 675 | struct iser_device *device = iser_task->ib_conn->device; |
| 680 | int is_rdma_data_aligned = 1; | 676 | int is_rdma_data_aligned = 1; |
| 681 | int is_rdma_prot_aligned = 1; | 677 | int is_rdma_prot_aligned = 1; |
| 682 | int prot_count = scsi_prot_sg_count(iser_task->sc); | 678 | int prot_count = scsi_prot_sg_count(iser_task->sc); |
diff --git a/drivers/infiniband/ulp/iser/iser_memory.c b/drivers/infiniband/ulp/iser/iser_memory.c index 0995565f5dda..bc3f70e44c95 100644 --- a/drivers/infiniband/ulp/iser/iser_memory.c +++ b/drivers/infiniband/ulp/iser/iser_memory.c | |||
| @@ -49,7 +49,7 @@ static int iser_start_rdma_unaligned_sg(struct iscsi_iser_task *iser_task, | |||
| 49 | struct iser_data_buf *data_copy, | 49 | struct iser_data_buf *data_copy, |
| 50 | enum iser_data_dir cmd_dir) | 50 | enum iser_data_dir cmd_dir) |
| 51 | { | 51 | { |
| 52 | struct ib_device *dev = iser_task->iser_conn->ib_conn->device->ib_device; | 52 | struct ib_device *dev = iser_task->ib_conn->device->ib_device; |
| 53 | struct scatterlist *sgl = (struct scatterlist *)data->buf; | 53 | struct scatterlist *sgl = (struct scatterlist *)data->buf; |
| 54 | struct scatterlist *sg; | 54 | struct scatterlist *sg; |
| 55 | char *mem = NULL; | 55 | char *mem = NULL; |
| @@ -116,7 +116,7 @@ void iser_finalize_rdma_unaligned_sg(struct iscsi_iser_task *iser_task, | |||
| 116 | struct ib_device *dev; | 116 | struct ib_device *dev; |
| 117 | unsigned long cmd_data_len; | 117 | unsigned long cmd_data_len; |
| 118 | 118 | ||
| 119 | dev = iser_task->iser_conn->ib_conn->device->ib_device; | 119 | dev = iser_task->ib_conn->device->ib_device; |
| 120 | 120 | ||
| 121 | ib_dma_unmap_sg(dev, &data_copy->sg_single, 1, | 121 | ib_dma_unmap_sg(dev, &data_copy->sg_single, 1, |
| 122 | (cmd_dir == ISER_DIR_OUT) ? | 122 | (cmd_dir == ISER_DIR_OUT) ? |
| @@ -322,7 +322,7 @@ int iser_dma_map_task_data(struct iscsi_iser_task *iser_task, | |||
| 322 | struct ib_device *dev; | 322 | struct ib_device *dev; |
| 323 | 323 | ||
| 324 | iser_task->dir[iser_dir] = 1; | 324 | iser_task->dir[iser_dir] = 1; |
| 325 | dev = iser_task->iser_conn->ib_conn->device->ib_device; | 325 | dev = iser_task->ib_conn->device->ib_device; |
| 326 | 326 | ||
| 327 | data->dma_nents = ib_dma_map_sg(dev, data->buf, data->size, dma_dir); | 327 | data->dma_nents = ib_dma_map_sg(dev, data->buf, data->size, dma_dir); |
| 328 | if (data->dma_nents == 0) { | 328 | if (data->dma_nents == 0) { |
| @@ -337,7 +337,7 @@ void iser_dma_unmap_task_data(struct iscsi_iser_task *iser_task, | |||
| 337 | { | 337 | { |
| 338 | struct ib_device *dev; | 338 | struct ib_device *dev; |
| 339 | 339 | ||
| 340 | dev = iser_task->iser_conn->ib_conn->device->ib_device; | 340 | dev = iser_task->ib_conn->device->ib_device; |
| 341 | ib_dma_unmap_sg(dev, data->buf, data->size, DMA_FROM_DEVICE); | 341 | ib_dma_unmap_sg(dev, data->buf, data->size, DMA_FROM_DEVICE); |
| 342 | } | 342 | } |
| 343 | 343 | ||
| @@ -348,7 +348,7 @@ static int fall_to_bounce_buf(struct iscsi_iser_task *iser_task, | |||
| 348 | enum iser_data_dir cmd_dir, | 348 | enum iser_data_dir cmd_dir, |
| 349 | int aligned_len) | 349 | int aligned_len) |
| 350 | { | 350 | { |
| 351 | struct iscsi_conn *iscsi_conn = iser_task->iser_conn->iscsi_conn; | 351 | struct iscsi_conn *iscsi_conn = iser_task->ib_conn->iscsi_conn; |
| 352 | 352 | ||
| 353 | iscsi_conn->fmr_unalign_cnt++; | 353 | iscsi_conn->fmr_unalign_cnt++; |
| 354 | iser_warn("rdma alignment violation (%d/%d aligned) or FMR not supported\n", | 354 | iser_warn("rdma alignment violation (%d/%d aligned) or FMR not supported\n", |
| @@ -377,7 +377,7 @@ static int fall_to_bounce_buf(struct iscsi_iser_task *iser_task, | |||
| 377 | int iser_reg_rdma_mem_fmr(struct iscsi_iser_task *iser_task, | 377 | int iser_reg_rdma_mem_fmr(struct iscsi_iser_task *iser_task, |
| 378 | enum iser_data_dir cmd_dir) | 378 | enum iser_data_dir cmd_dir) |
| 379 | { | 379 | { |
| 380 | struct iser_conn *ib_conn = iser_task->iser_conn->ib_conn; | 380 | struct iser_conn *ib_conn = iser_task->ib_conn; |
| 381 | struct iser_device *device = ib_conn->device; | 381 | struct iser_device *device = ib_conn->device; |
| 382 | struct ib_device *ibdev = device->ib_device; | 382 | struct ib_device *ibdev = device->ib_device; |
| 383 | struct iser_data_buf *mem = &iser_task->data[cmd_dir]; | 383 | struct iser_data_buf *mem = &iser_task->data[cmd_dir]; |
| @@ -533,7 +533,7 @@ iser_reg_sig_mr(struct iscsi_iser_task *iser_task, | |||
| 533 | struct fast_reg_descriptor *desc, struct ib_sge *data_sge, | 533 | struct fast_reg_descriptor *desc, struct ib_sge *data_sge, |
| 534 | struct ib_sge *prot_sge, struct ib_sge *sig_sge) | 534 | struct ib_sge *prot_sge, struct ib_sge *sig_sge) |
| 535 | { | 535 | { |
| 536 | struct iser_conn *iser_conn = iser_task->iser_conn->ib_conn; | 536 | struct iser_conn *ib_conn = iser_task->ib_conn; |
| 537 | struct iser_pi_context *pi_ctx = desc->pi_ctx; | 537 | struct iser_pi_context *pi_ctx = desc->pi_ctx; |
| 538 | struct ib_send_wr sig_wr, inv_wr; | 538 | struct ib_send_wr sig_wr, inv_wr; |
| 539 | struct ib_send_wr *bad_wr, *wr = NULL; | 539 | struct ib_send_wr *bad_wr, *wr = NULL; |
| @@ -579,7 +579,7 @@ iser_reg_sig_mr(struct iscsi_iser_task *iser_task, | |||
| 579 | else | 579 | else |
| 580 | wr->next = &sig_wr; | 580 | wr->next = &sig_wr; |
| 581 | 581 | ||
| 582 | ret = ib_post_send(iser_conn->qp, wr, &bad_wr); | 582 | ret = ib_post_send(ib_conn->qp, wr, &bad_wr); |
| 583 | if (ret) { | 583 | if (ret) { |
| 584 | iser_err("reg_sig_mr failed, ret:%d\n", ret); | 584 | iser_err("reg_sig_mr failed, ret:%d\n", ret); |
| 585 | goto err; | 585 | goto err; |
| @@ -609,7 +609,7 @@ static int iser_fast_reg_mr(struct iscsi_iser_task *iser_task, | |||
| 609 | struct ib_sge *sge) | 609 | struct ib_sge *sge) |
| 610 | { | 610 | { |
| 611 | struct fast_reg_descriptor *desc = regd_buf->reg.mem_h; | 611 | struct fast_reg_descriptor *desc = regd_buf->reg.mem_h; |
| 612 | struct iser_conn *ib_conn = iser_task->iser_conn->ib_conn; | 612 | struct iser_conn *ib_conn = iser_task->ib_conn; |
| 613 | struct iser_device *device = ib_conn->device; | 613 | struct iser_device *device = ib_conn->device; |
| 614 | struct ib_device *ibdev = device->ib_device; | 614 | struct ib_device *ibdev = device->ib_device; |
| 615 | struct ib_mr *mr; | 615 | struct ib_mr *mr; |
| @@ -700,7 +700,7 @@ static int iser_fast_reg_mr(struct iscsi_iser_task *iser_task, | |||
| 700 | int iser_reg_rdma_mem_fastreg(struct iscsi_iser_task *iser_task, | 700 | int iser_reg_rdma_mem_fastreg(struct iscsi_iser_task *iser_task, |
| 701 | enum iser_data_dir cmd_dir) | 701 | enum iser_data_dir cmd_dir) |
| 702 | { | 702 | { |
| 703 | struct iser_conn *ib_conn = iser_task->iser_conn->ib_conn; | 703 | struct iser_conn *ib_conn = iser_task->ib_conn; |
| 704 | struct iser_device *device = ib_conn->device; | 704 | struct iser_device *device = ib_conn->device; |
| 705 | struct ib_device *ibdev = device->ib_device; | 705 | struct ib_device *ibdev = device->ib_device; |
| 706 | struct iser_data_buf *mem = &iser_task->data[cmd_dir]; | 706 | struct iser_data_buf *mem = &iser_task->data[cmd_dir]; |
diff --git a/drivers/infiniband/ulp/iser/iser_verbs.c b/drivers/infiniband/ulp/iser/iser_verbs.c index 89fadd85a776..b3668a59ca8d 100644 --- a/drivers/infiniband/ulp/iser/iser_verbs.c +++ b/drivers/infiniband/ulp/iser/iser_verbs.c | |||
| @@ -745,9 +745,8 @@ static int iser_disconnected_handler(struct rdma_cm_id *cma_id) | |||
| 745 | * terminated asynchronously from the iSCSI layer's perspective. */ | 745 | * terminated asynchronously from the iSCSI layer's perspective. */ |
| 746 | if (iser_conn_state_comp_exch(ib_conn, ISER_CONN_UP, | 746 | if (iser_conn_state_comp_exch(ib_conn, ISER_CONN_UP, |
| 747 | ISER_CONN_TERMINATING)){ | 747 | ISER_CONN_TERMINATING)){ |
| 748 | if (ib_conn->iser_conn) | 748 | if (ib_conn->iscsi_conn) |
| 749 | iscsi_conn_failure(ib_conn->iser_conn->iscsi_conn, | 749 | iscsi_conn_failure(ib_conn->iscsi_conn, ISCSI_ERR_CONN_FAILED); |
| 750 | ISCSI_ERR_CONN_FAILED); | ||
| 751 | else | 750 | else |
| 752 | iser_err("iscsi_iser connection isn't bound\n"); | 751 | iser_err("iscsi_iser connection isn't bound\n"); |
| 753 | } | 752 | } |
| @@ -951,7 +950,7 @@ void iser_unreg_mem_fastreg(struct iscsi_iser_task *iser_task, | |||
| 951 | enum iser_data_dir cmd_dir) | 950 | enum iser_data_dir cmd_dir) |
| 952 | { | 951 | { |
| 953 | struct iser_mem_reg *reg = &iser_task->rdma_regd[cmd_dir].reg; | 952 | struct iser_mem_reg *reg = &iser_task->rdma_regd[cmd_dir].reg; |
| 954 | struct iser_conn *ib_conn = iser_task->iser_conn->ib_conn; | 953 | struct iser_conn *ib_conn = iser_task->ib_conn; |
| 955 | struct fast_reg_descriptor *desc = reg->mem_h; | 954 | struct fast_reg_descriptor *desc = reg->mem_h; |
| 956 | 955 | ||
| 957 | if (!reg->is_mr) | 956 | if (!reg->is_mr) |
| @@ -1061,7 +1060,7 @@ static void iser_handle_comp_error(struct iser_tx_desc *desc, | |||
| 1061 | * perspective. */ | 1060 | * perspective. */ |
| 1062 | if (iser_conn_state_comp_exch(ib_conn, ISER_CONN_UP, | 1061 | if (iser_conn_state_comp_exch(ib_conn, ISER_CONN_UP, |
| 1063 | ISER_CONN_TERMINATING)) | 1062 | ISER_CONN_TERMINATING)) |
| 1064 | iscsi_conn_failure(ib_conn->iser_conn->iscsi_conn, | 1063 | iscsi_conn_failure(ib_conn->iscsi_conn, |
| 1065 | ISCSI_ERR_CONN_FAILED); | 1064 | ISCSI_ERR_CONN_FAILED); |
| 1066 | 1065 | ||
| 1067 | /* no more non completed posts to the QP, complete the | 1066 | /* no more non completed posts to the QP, complete the |
