diff --git a/srpt/src/ib_srpt.c b/srpt/src/ib_srpt.c index 220436658..77b9d238e 100644 --- a/srpt/src/ib_srpt.c +++ b/srpt/src/ib_srpt.c @@ -2055,7 +2055,6 @@ static void srpt_completion(struct ib_cq *cq, void *ctx) { struct srpt_rdma_ch *ch = ctx; - atomic_inc(&ch->processing_compl); switch (thread) { case MODE_IB_COMPLETION_IN_THREAD: wake_up_interruptible(&ch->wait_queue); @@ -2067,7 +2066,6 @@ static void srpt_completion(struct ib_cq *cq, void *ctx) srpt_process_completion(cq, ch, SCST_CONTEXT_TASKLET); break; } - atomic_dec(&ch->processing_compl); } static int srpt_compl_thread(void *arg) @@ -2182,20 +2180,9 @@ err_destroy_cq: static void srpt_destroy_ch_ib(struct srpt_rdma_ch *ch) { - struct ib_qp_attr qp_attr; - int ret; - if (ch->thread) kthread_stop(ch->thread); - qp_attr.qp_state = IB_QPS_RESET; - ret = ib_modify_qp(ch->qp, &qp_attr, IB_QP_STATE); - if (ret < 0) - PRINT_ERROR("Resetting queue pair state failed: %d", ret); - - while (atomic_read(&ch->processing_compl)) - ; - ib_destroy_qp(ch->qp); ib_destroy_cq(ch->cq); } @@ -2210,12 +2197,20 @@ static void srpt_unregister_channel(struct srpt_rdma_ch *ch) __releases(&ch->sport->sdev->spinlock) { struct srpt_device *sdev; + struct ib_qp_attr qp_attr; + int ret; sdev = ch->sport->sdev; list_del(&ch->list); atomic_set(&ch->state, RDMA_CHANNEL_DISCONNECTING); spin_unlock_irq(&sdev->spinlock); + qp_attr.qp_state = IB_QPS_ERR; + ret = ib_modify_qp(ch->qp, &qp_attr, IB_QP_STATE); + if (ret < 0) + PRINT_ERROR("Setting queue pair in error state failed: %d", + ret); + /* * At this point it is guaranteed that no new commands will be sent to * the SCST core for channel ch, which is a requirement for @@ -2524,7 +2519,6 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id, ch->sport = &sdev->port[param->port - 1]; ch->cm_id = cm_id; ch->rq_size = max(SRPT_RQ_SIZE, scst_get_max_lun_commands(NULL, 0)); - atomic_set(&ch->processing_compl, 0); atomic_set(&ch->state, RDMA_CHANNEL_CONNECTING); INIT_LIST_HEAD(&ch->cmd_wait_list); diff --git a/srpt/src/ib_srpt.h b/srpt/src/ib_srpt.h index 0056beb26..55bc4ca9f 100644 --- a/srpt/src/ib_srpt.h +++ b/srpt/src/ib_srpt.h @@ -285,7 +285,6 @@ struct srpt_rdma_ch { struct ib_cm_id *cm_id; struct ib_qp *qp; int rq_size; - atomic_t processing_compl; struct ib_cq *cq; atomic_t sq_wr_avail; struct srpt_port *sport;