diff options
| -rw-r--r-- | drivers/infiniband/hw/qib/qib_rc.c | 10 | ||||
| -rw-r--r-- | drivers/infiniband/ulp/iser/iscsi_iser.c | 11 | ||||
| -rw-r--r-- | drivers/infiniband/ulp/iser/iscsi_iser.h | 4 | ||||
| -rw-r--r-- | drivers/infiniband/ulp/iser/iser_initiator.c | 31 | ||||
| -rw-r--r-- | drivers/infiniband/ulp/iser/iser_verbs.c | 33 |
5 files changed, 63 insertions, 26 deletions
diff --git a/drivers/infiniband/hw/qib/qib_rc.c b/drivers/infiniband/hw/qib/qib_rc.c index afaf4ac79f42..894afac26f3b 100644 --- a/drivers/infiniband/hw/qib/qib_rc.c +++ b/drivers/infiniband/hw/qib/qib_rc.c | |||
| @@ -271,13 +271,9 @@ int qib_make_rc_req(struct qib_qp *qp) | |||
| 271 | goto bail; | 271 | goto bail; |
| 272 | } | 272 | } |
| 273 | wqe = get_swqe_ptr(qp, qp->s_last); | 273 | wqe = get_swqe_ptr(qp, qp->s_last); |
| 274 | while (qp->s_last != qp->s_acked) { | 274 | qib_send_complete(qp, wqe, qp->s_last != qp->s_acked ? |
| 275 | qib_send_complete(qp, wqe, IB_WC_SUCCESS); | 275 | IB_WC_SUCCESS : IB_WC_WR_FLUSH_ERR); |
| 276 | if (++qp->s_last >= qp->s_size) | 276 | /* will get called again */ |
| 277 | qp->s_last = 0; | ||
| 278 | wqe = get_swqe_ptr(qp, qp->s_last); | ||
| 279 | } | ||
| 280 | qib_send_complete(qp, wqe, IB_WC_WR_FLUSH_ERR); | ||
| 281 | goto done; | 277 | goto done; |
| 282 | } | 278 | } |
| 283 | 279 | ||
diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c b/drivers/infiniband/ulp/iser/iscsi_iser.c index 84e8c293a715..c42b8f390c0b 100644 --- a/drivers/infiniband/ulp/iser/iscsi_iser.c +++ b/drivers/infiniband/ulp/iser/iscsi_iser.c | |||
| @@ -151,7 +151,6 @@ int iser_initialize_task_headers(struct iscsi_task *task, | |||
| 151 | tx_desc->tx_sg[0].length = ISER_HEADERS_LEN; | 151 | tx_desc->tx_sg[0].length = ISER_HEADERS_LEN; |
| 152 | tx_desc->tx_sg[0].lkey = device->mr->lkey; | 152 | tx_desc->tx_sg[0].lkey = device->mr->lkey; |
| 153 | 153 | ||
| 154 | iser_task->headers_initialized = 1; | ||
| 155 | iser_task->iser_conn = iser_conn; | 154 | iser_task->iser_conn = iser_conn; |
| 156 | return 0; | 155 | return 0; |
| 157 | } | 156 | } |
| @@ -166,8 +165,7 @@ iscsi_iser_task_init(struct iscsi_task *task) | |||
| 166 | { | 165 | { |
| 167 | struct iscsi_iser_task *iser_task = task->dd_data; | 166 | struct iscsi_iser_task *iser_task = task->dd_data; |
| 168 | 167 | ||
| 169 | if (!iser_task->headers_initialized) | 168 | if (iser_initialize_task_headers(task, &iser_task->desc)) |
| 170 | if (iser_initialize_task_headers(task, &iser_task->desc)) | ||
| 171 | return -ENOMEM; | 169 | return -ENOMEM; |
| 172 | 170 | ||
| 173 | /* mgmt task */ | 171 | /* mgmt task */ |
| @@ -278,6 +276,13 @@ iscsi_iser_task_xmit(struct iscsi_task *task) | |||
| 278 | static void iscsi_iser_cleanup_task(struct iscsi_task *task) | 276 | static void iscsi_iser_cleanup_task(struct iscsi_task *task) |
| 279 | { | 277 | { |
| 280 | struct iscsi_iser_task *iser_task = task->dd_data; | 278 | struct iscsi_iser_task *iser_task = task->dd_data; |
| 279 | struct iser_tx_desc *tx_desc = &iser_task->desc; | ||
| 280 | |||
| 281 | struct iscsi_iser_conn *iser_conn = task->conn->dd_data; | ||
| 282 | struct iser_device *device = iser_conn->ib_conn->device; | ||
| 283 | |||
| 284 | ib_dma_unmap_single(device->ib_device, | ||
| 285 | tx_desc->dma_addr, ISER_HEADERS_LEN, DMA_TO_DEVICE); | ||
| 281 | 286 | ||
| 282 | /* mgmt tasks do not need special cleanup */ | 287 | /* mgmt tasks do not need special cleanup */ |
| 283 | if (!task->sc) | 288 | if (!task->sc) |
diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.h b/drivers/infiniband/ulp/iser/iscsi_iser.h index db6f3ce9f3bf..db7ea3704da7 100644 --- a/drivers/infiniband/ulp/iser/iscsi_iser.h +++ b/drivers/infiniband/ulp/iser/iscsi_iser.h | |||
| @@ -257,7 +257,8 @@ struct iser_conn { | |||
| 257 | struct list_head conn_list; /* entry in ig conn list */ | 257 | struct list_head conn_list; /* entry in ig conn list */ |
| 258 | 258 | ||
| 259 | char *login_buf; | 259 | char *login_buf; |
| 260 | u64 login_dma; | 260 | char *login_req_buf, *login_resp_buf; |
| 261 | u64 login_req_dma, login_resp_dma; | ||
| 261 | unsigned int rx_desc_head; | 262 | unsigned int rx_desc_head; |
| 262 | struct iser_rx_desc *rx_descs; | 263 | struct iser_rx_desc *rx_descs; |
| 263 | struct ib_recv_wr rx_wr[ISER_MIN_POSTED_RX]; | 264 | struct ib_recv_wr rx_wr[ISER_MIN_POSTED_RX]; |
| @@ -277,7 +278,6 @@ struct iscsi_iser_task { | |||
| 277 | struct iser_regd_buf rdma_regd[ISER_DIRS_NUM];/* regd rdma buf */ | 278 | struct iser_regd_buf rdma_regd[ISER_DIRS_NUM];/* regd rdma buf */ |
| 278 | struct iser_data_buf data[ISER_DIRS_NUM]; /* orig. data des*/ | 279 | struct iser_data_buf data[ISER_DIRS_NUM]; /* orig. data des*/ |
| 279 | struct iser_data_buf data_copy[ISER_DIRS_NUM];/* contig. copy */ | 280 | struct iser_data_buf data_copy[ISER_DIRS_NUM];/* contig. copy */ |
| 280 | int headers_initialized; | ||
| 281 | }; | 281 | }; |
| 282 | 282 | ||
| 283 | struct iser_page_vec { | 283 | struct iser_page_vec { |
diff --git a/drivers/infiniband/ulp/iser/iser_initiator.c b/drivers/infiniband/ulp/iser/iser_initiator.c index f299de6b419b..a607542fc796 100644 --- a/drivers/infiniband/ulp/iser/iser_initiator.c +++ b/drivers/infiniband/ulp/iser/iser_initiator.c | |||
| @@ -221,8 +221,14 @@ void iser_free_rx_descriptors(struct iser_conn *ib_conn) | |||
| 221 | struct iser_device *device = ib_conn->device; | 221 | struct iser_device *device = ib_conn->device; |
| 222 | 222 | ||
| 223 | if (ib_conn->login_buf) { | 223 | if (ib_conn->login_buf) { |
| 224 | ib_dma_unmap_single(device->ib_device, ib_conn->login_dma, | 224 | if (ib_conn->login_req_dma) |
| 225 | ISER_RX_LOGIN_SIZE, DMA_FROM_DEVICE); | 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); | ||
| 226 | kfree(ib_conn->login_buf); | 232 | kfree(ib_conn->login_buf); |
| 227 | } | 233 | } |
| 228 | 234 | ||
| @@ -394,6 +400,7 @@ int iser_send_control(struct iscsi_conn *conn, | |||
| 394 | unsigned long data_seg_len; | 400 | unsigned long data_seg_len; |
| 395 | int err = 0; | 401 | int err = 0; |
| 396 | struct iser_device *device; | 402 | struct iser_device *device; |
| 403 | struct iser_conn *ib_conn = iser_conn->ib_conn; | ||
| 397 | 404 | ||
| 398 | /* build the tx desc regd header and add it to the tx desc dto */ | 405 | /* build the tx desc regd header and add it to the tx desc dto */ |
| 399 | mdesc->type = ISCSI_TX_CONTROL; | 406 | mdesc->type = ISCSI_TX_CONTROL; |
| @@ -409,9 +416,19 @@ int iser_send_control(struct iscsi_conn *conn, | |||
| 409 | iser_err("data present on non login task!!!\n"); | 416 | iser_err("data present on non login task!!!\n"); |
| 410 | goto send_control_error; | 417 | goto send_control_error; |
| 411 | } | 418 | } |
| 412 | memcpy(iser_conn->ib_conn->login_buf, task->data, | 419 | |
| 420 | ib_dma_sync_single_for_cpu(device->ib_device, | ||
| 421 | ib_conn->login_req_dma, task->data_count, | ||
| 422 | DMA_TO_DEVICE); | ||
| 423 | |||
| 424 | memcpy(iser_conn->ib_conn->login_req_buf, task->data, | ||
| 413 | task->data_count); | 425 | task->data_count); |
| 414 | tx_dsg->addr = iser_conn->ib_conn->login_dma; | 426 | |
| 427 | ib_dma_sync_single_for_device(device->ib_device, | ||
| 428 | ib_conn->login_req_dma, task->data_count, | ||
| 429 | DMA_TO_DEVICE); | ||
| 430 | |||
| 431 | tx_dsg->addr = iser_conn->ib_conn->login_req_dma; | ||
| 415 | tx_dsg->length = task->data_count; | 432 | tx_dsg->length = task->data_count; |
| 416 | tx_dsg->lkey = device->mr->lkey; | 433 | tx_dsg->lkey = device->mr->lkey; |
| 417 | mdesc->num_sge = 2; | 434 | mdesc->num_sge = 2; |
| @@ -445,8 +462,8 @@ void iser_rcv_completion(struct iser_rx_desc *rx_desc, | |||
| 445 | int rx_buflen, outstanding, count, err; | 462 | int rx_buflen, outstanding, count, err; |
| 446 | 463 | ||
| 447 | /* differentiate between login to all other PDUs */ | 464 | /* differentiate between login to all other PDUs */ |
| 448 | if ((char *)rx_desc == ib_conn->login_buf) { | 465 | if ((char *)rx_desc == ib_conn->login_resp_buf) { |
| 449 | rx_dma = ib_conn->login_dma; | 466 | rx_dma = ib_conn->login_resp_dma; |
| 450 | rx_buflen = ISER_RX_LOGIN_SIZE; | 467 | rx_buflen = ISER_RX_LOGIN_SIZE; |
| 451 | } else { | 468 | } else { |
| 452 | rx_dma = rx_desc->dma_addr; | 469 | rx_dma = rx_desc->dma_addr; |
| @@ -473,7 +490,7 @@ void iser_rcv_completion(struct iser_rx_desc *rx_desc, | |||
| 473 | * for the posted rx bufs refcount to become zero handles everything */ | 490 | * for the posted rx bufs refcount to become zero handles everything */ |
| 474 | conn->ib_conn->post_recv_buf_count--; | 491 | conn->ib_conn->post_recv_buf_count--; |
| 475 | 492 | ||
| 476 | if (rx_dma == ib_conn->login_dma) | 493 | if (rx_dma == ib_conn->login_resp_dma) |
| 477 | return; | 494 | return; |
| 478 | 495 | ||
| 479 | outstanding = ib_conn->post_recv_buf_count; | 496 | outstanding = ib_conn->post_recv_buf_count; |
diff --git a/drivers/infiniband/ulp/iser/iser_verbs.c b/drivers/infiniband/ulp/iser/iser_verbs.c index ede1475bee09..e28877c4ce15 100644 --- a/drivers/infiniband/ulp/iser/iser_verbs.c +++ b/drivers/infiniband/ulp/iser/iser_verbs.c | |||
| @@ -155,20 +155,39 @@ static int iser_create_ib_conn_res(struct iser_conn *ib_conn) | |||
| 155 | { | 155 | { |
| 156 | struct iser_device *device; | 156 | struct iser_device *device; |
| 157 | struct ib_qp_init_attr init_attr; | 157 | struct ib_qp_init_attr init_attr; |
| 158 | int ret = -ENOMEM; | 158 | int req_err, resp_err, ret = -ENOMEM; |
| 159 | struct ib_fmr_pool_param params; | 159 | struct ib_fmr_pool_param params; |
| 160 | 160 | ||
| 161 | BUG_ON(ib_conn->device == NULL); | 161 | BUG_ON(ib_conn->device == NULL); |
| 162 | 162 | ||
| 163 | device = ib_conn->device; | 163 | device = ib_conn->device; |
| 164 | 164 | ||
| 165 | ib_conn->login_buf = kmalloc(ISER_RX_LOGIN_SIZE, GFP_KERNEL); | 165 | ib_conn->login_buf = kmalloc(ISCSI_DEF_MAX_RECV_SEG_LEN + |
| 166 | ISER_RX_LOGIN_SIZE, GFP_KERNEL); | ||
| 166 | if (!ib_conn->login_buf) | 167 | if (!ib_conn->login_buf) |
| 167 | goto out_err; | 168 | goto out_err; |
| 168 | 169 | ||
| 169 | ib_conn->login_dma = ib_dma_map_single(ib_conn->device->ib_device, | 170 | ib_conn->login_req_buf = ib_conn->login_buf; |
| 170 | (void *)ib_conn->login_buf, ISER_RX_LOGIN_SIZE, | 171 | ib_conn->login_resp_buf = ib_conn->login_buf + ISCSI_DEF_MAX_RECV_SEG_LEN; |
| 171 | DMA_FROM_DEVICE); | 172 | |
| 173 | ib_conn->login_req_dma = ib_dma_map_single(ib_conn->device->ib_device, | ||
| 174 | (void *)ib_conn->login_req_buf, | ||
| 175 | ISCSI_DEF_MAX_RECV_SEG_LEN, DMA_TO_DEVICE); | ||
| 176 | |||
| 177 | ib_conn->login_resp_dma = ib_dma_map_single(ib_conn->device->ib_device, | ||
| 178 | (void *)ib_conn->login_resp_buf, | ||
| 179 | ISER_RX_LOGIN_SIZE, DMA_FROM_DEVICE); | ||
| 180 | |||
| 181 | req_err = ib_dma_mapping_error(device->ib_device, ib_conn->login_req_dma); | ||
| 182 | resp_err = ib_dma_mapping_error(device->ib_device, ib_conn->login_resp_dma); | ||
| 183 | |||
| 184 | if (req_err || resp_err) { | ||
| 185 | if (req_err) | ||
| 186 | ib_conn->login_req_dma = 0; | ||
| 187 | if (resp_err) | ||
| 188 | ib_conn->login_resp_dma = 0; | ||
| 189 | goto out_err; | ||
| 190 | } | ||
| 172 | 191 | ||
| 173 | ib_conn->page_vec = kmalloc(sizeof(struct iser_page_vec) + | 192 | ib_conn->page_vec = kmalloc(sizeof(struct iser_page_vec) + |
| 174 | (sizeof(u64) * (ISCSI_ISER_SG_TABLESIZE +1)), | 193 | (sizeof(u64) * (ISCSI_ISER_SG_TABLESIZE +1)), |
| @@ -658,11 +677,11 @@ int iser_post_recvl(struct iser_conn *ib_conn) | |||
| 658 | struct ib_sge sge; | 677 | struct ib_sge sge; |
| 659 | int ib_ret; | 678 | int ib_ret; |
| 660 | 679 | ||
| 661 | sge.addr = ib_conn->login_dma; | 680 | sge.addr = ib_conn->login_resp_dma; |
| 662 | sge.length = ISER_RX_LOGIN_SIZE; | 681 | sge.length = ISER_RX_LOGIN_SIZE; |
| 663 | sge.lkey = ib_conn->device->mr->lkey; | 682 | sge.lkey = ib_conn->device->mr->lkey; |
| 664 | 683 | ||
| 665 | rx_wr.wr_id = (unsigned long)ib_conn->login_buf; | 684 | rx_wr.wr_id = (unsigned long)ib_conn->login_resp_buf; |
| 666 | rx_wr.sg_list = &sge; | 685 | rx_wr.sg_list = &sge; |
| 667 | rx_wr.num_sge = 1; | 686 | rx_wr.num_sge = 1; |
| 668 | rx_wr.next = NULL; | 687 | rx_wr.next = NULL; |
