aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband
diff options
context:
space:
mode:
authorOr Gerlitz <ogerlitz@voltaire.com>2010-02-08 08:18:39 -0500
committerRoland Dreier <rolandd@cisco.com>2010-02-24 12:41:11 -0500
commit704315f082d473b34047817f0a6a01924f38501e (patch)
treec32c2a8e5470679b42d8aa3fae86c56bc9bc8f4c /drivers/infiniband
parentbcc60c381d857ced653e912cbe6121294773e147 (diff)
IB/iser: Remove atomic counter for posted receive buffers
Now that both the posting and reaping of receive buffers is done in the completion path, the counter of outstanding buffers not be atomic. Signed-off-by: Or Gerlitz <ogerlitz@voltaire.com> Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r--drivers/infiniband/ulp/iser/iscsi_iser.h2
-rw-r--r--drivers/infiniband/ulp/iser/iser_initiator.c6
-rw-r--r--drivers/infiniband/ulp/iser/iser_verbs.c16
3 files changed, 12 insertions, 12 deletions
diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.h b/drivers/infiniband/ulp/iser/iscsi_iser.h
index 83effb610594..4491235340de 100644
--- a/drivers/infiniband/ulp/iser/iscsi_iser.h
+++ b/drivers/infiniband/ulp/iser/iscsi_iser.h
@@ -266,7 +266,7 @@ struct iser_conn {
266 struct ib_fmr_pool *fmr_pool; /* pool of IB FMRs */ 266 struct ib_fmr_pool *fmr_pool; /* pool of IB FMRs */
267 int disc_evt_flag; /* disconn event delivered */ 267 int disc_evt_flag; /* disconn event delivered */
268 wait_queue_head_t wait; /* waitq for conn/disconn */ 268 wait_queue_head_t wait; /* waitq for conn/disconn */
269 atomic_t post_recv_buf_count; /* posted rx count */ 269 int post_recv_buf_count; /* posted rx count */
270 atomic_t post_send_buf_count; /* posted tx count */ 270 atomic_t post_send_buf_count; /* posted tx count */
271 char name[ISER_OBJECT_NAME_SIZE]; 271 char name[ISER_OBJECT_NAME_SIZE];
272 struct iser_page_vec *page_vec; /* represents SG to fmr maps* 272 struct iser_page_vec *page_vec; /* represents SG to fmr maps*
diff --git a/drivers/infiniband/ulp/iser/iser_initiator.c b/drivers/infiniband/ulp/iser/iser_initiator.c
index 6d9bbe6363ee..3e65a43d2154 100644
--- a/drivers/infiniband/ulp/iser/iser_initiator.c
+++ b/drivers/infiniband/ulp/iser/iser_initiator.c
@@ -268,7 +268,7 @@ int iser_conn_set_full_featured_mode(struct iscsi_conn *conn)
268 268
269 /* Check that there is no posted recv or send buffers left - */ 269 /* Check that there is no posted recv or send buffers left - */
270 /* they must be consumed during the login phase */ 270 /* they must be consumed during the login phase */
271 BUG_ON(atomic_read(&iser_conn->ib_conn->post_recv_buf_count) != 0); 271 BUG_ON(iser_conn->ib_conn->post_recv_buf_count != 0);
272 BUG_ON(atomic_read(&iser_conn->ib_conn->post_send_buf_count) != 0); 272 BUG_ON(atomic_read(&iser_conn->ib_conn->post_send_buf_count) != 0);
273 273
274 if (iser_alloc_rx_descriptors(iser_conn->ib_conn)) 274 if (iser_alloc_rx_descriptors(iser_conn->ib_conn))
@@ -569,12 +569,12 @@ void iser_rcv_completion(struct iser_rx_desc *rx_desc,
569 * task eliminates the need to worry on tasks which are completed in * 569 * task eliminates the need to worry on tasks which are completed in *
570 * parallel to the execution of iser_conn_term. So the code that waits * 570 * parallel to the execution of iser_conn_term. So the code that waits *
571 * for the posted rx bufs refcount to become zero handles everything */ 571 * for the posted rx bufs refcount to become zero handles everything */
572 atomic_dec(&conn->ib_conn->post_recv_buf_count); 572 conn->ib_conn->post_recv_buf_count--;
573 573
574 if (rx_dma == ib_conn->login_dma) 574 if (rx_dma == ib_conn->login_dma)
575 return; 575 return;
576 576
577 outstanding = atomic_read(&ib_conn->post_recv_buf_count); 577 outstanding = ib_conn->post_recv_buf_count;
578 if (outstanding + ISER_MIN_POSTED_RX <= ISER_QP_MAX_RECV_DTOS) { 578 if (outstanding + ISER_MIN_POSTED_RX <= ISER_QP_MAX_RECV_DTOS) {
579 count = min(ISER_QP_MAX_RECV_DTOS - outstanding, 579 count = min(ISER_QP_MAX_RECV_DTOS - outstanding,
580 ISER_MIN_POSTED_RX); 580 ISER_MIN_POSTED_RX);
diff --git a/drivers/infiniband/ulp/iser/iser_verbs.c b/drivers/infiniband/ulp/iser/iser_verbs.c
index 89b956044060..202c00dc6a76 100644
--- a/drivers/infiniband/ulp/iser/iser_verbs.c
+++ b/drivers/infiniband/ulp/iser/iser_verbs.c
@@ -453,7 +453,7 @@ static void iser_disconnected_handler(struct rdma_cm_id *cma_id)
453 ISCSI_ERR_CONN_FAILED); 453 ISCSI_ERR_CONN_FAILED);
454 454
455 /* Complete the termination process if no posts are pending */ 455 /* Complete the termination process if no posts are pending */
456 if ((atomic_read(&ib_conn->post_recv_buf_count) == 0) && 456 if (ib_conn->post_recv_buf_count == 0 &&
457 (atomic_read(&ib_conn->post_send_buf_count) == 0)) { 457 (atomic_read(&ib_conn->post_send_buf_count) == 0)) {
458 ib_conn->state = ISER_CONN_DOWN; 458 ib_conn->state = ISER_CONN_DOWN;
459 wake_up_interruptible(&ib_conn->wait); 459 wake_up_interruptible(&ib_conn->wait);
@@ -500,7 +500,7 @@ void iser_conn_init(struct iser_conn *ib_conn)
500{ 500{
501 ib_conn->state = ISER_CONN_INIT; 501 ib_conn->state = ISER_CONN_INIT;
502 init_waitqueue_head(&ib_conn->wait); 502 init_waitqueue_head(&ib_conn->wait);
503 atomic_set(&ib_conn->post_recv_buf_count, 0); 503 ib_conn->post_recv_buf_count = 0;
504 atomic_set(&ib_conn->post_send_buf_count, 0); 504 atomic_set(&ib_conn->post_send_buf_count, 0);
505 atomic_set(&ib_conn->refcount, 1); 505 atomic_set(&ib_conn->refcount, 1);
506 INIT_LIST_HEAD(&ib_conn->conn_list); 506 INIT_LIST_HEAD(&ib_conn->conn_list);
@@ -651,11 +651,11 @@ int iser_post_recvl(struct iser_conn *ib_conn)
651 rx_wr.num_sge = 1; 651 rx_wr.num_sge = 1;
652 rx_wr.next = NULL; 652 rx_wr.next = NULL;
653 653
654 atomic_inc(&ib_conn->post_recv_buf_count); 654 ib_conn->post_recv_buf_count++;
655 ib_ret = ib_post_recv(ib_conn->qp, &rx_wr, &rx_wr_failed); 655 ib_ret = ib_post_recv(ib_conn->qp, &rx_wr, &rx_wr_failed);
656 if (ib_ret) { 656 if (ib_ret) {
657 iser_err("ib_post_recv failed ret=%d\n", ib_ret); 657 iser_err("ib_post_recv failed ret=%d\n", ib_ret);
658 atomic_dec(&ib_conn->post_recv_buf_count); 658 ib_conn->post_recv_buf_count--;
659 } 659 }
660 return ib_ret; 660 return ib_ret;
661} 661}
@@ -679,11 +679,11 @@ int iser_post_recvm(struct iser_conn *ib_conn, int count)
679 rx_wr--; 679 rx_wr--;
680 rx_wr->next = NULL; /* mark end of work requests list */ 680 rx_wr->next = NULL; /* mark end of work requests list */
681 681
682 atomic_add(count, &ib_conn->post_recv_buf_count); 682 ib_conn->post_recv_buf_count += count;
683 ib_ret = ib_post_recv(ib_conn->qp, ib_conn->rx_wr, &rx_wr_failed); 683 ib_ret = ib_post_recv(ib_conn->qp, ib_conn->rx_wr, &rx_wr_failed);
684 if (ib_ret) { 684 if (ib_ret) {
685 iser_err("ib_post_recv failed ret=%d\n", ib_ret); 685 iser_err("ib_post_recv failed ret=%d\n", ib_ret);
686 atomic_sub(count, &ib_conn->post_recv_buf_count); 686 ib_conn->post_recv_buf_count -= count;
687 } else 687 } else
688 ib_conn->rx_desc_head = my_rx_head; 688 ib_conn->rx_desc_head = my_rx_head;
689 return ib_ret; 689 return ib_ret;
@@ -778,14 +778,14 @@ static void iser_handle_comp_error(struct iser_desc *desc,
778 778
779 if ((char *)desc == ib_conn->login_buf || 779 if ((char *)desc == ib_conn->login_buf ||
780 (rx_first <= rx && rx <= rx_last)) 780 (rx_first <= rx && rx <= rx_last))
781 atomic_dec(&ib_conn->post_recv_buf_count); 781 ib_conn->post_recv_buf_count--;
782 else { /* type is TX control/command/dataout */ 782 else { /* type is TX control/command/dataout */
783 if (desc->type == ISCSI_TX_DATAOUT) 783 if (desc->type == ISCSI_TX_DATAOUT)
784 kmem_cache_free(ig.desc_cache, desc); 784 kmem_cache_free(ig.desc_cache, desc);
785 atomic_dec(&ib_conn->post_send_buf_count); 785 atomic_dec(&ib_conn->post_send_buf_count);
786 } 786 }
787 787
788 if (atomic_read(&ib_conn->post_recv_buf_count) == 0 && 788 if (ib_conn->post_recv_buf_count == 0 &&
789 atomic_read(&ib_conn->post_send_buf_count) == 0) { 789 atomic_read(&ib_conn->post_send_buf_count) == 0) {
790 /* getting here when the state is UP means that the conn is * 790 /* getting here when the state is UP means that the conn is *
791 * being terminated asynchronously from the iSCSI layer's * 791 * being terminated asynchronously from the iSCSI layer's *