ib_srpt: Simplify last WQE processing

git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@3911 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Bart Van Assche
2011-11-06 10:35:24 +00:00
parent cf04c8541a
commit aad2d7cb80
2 changed files with 5 additions and 12 deletions

View File

@@ -343,8 +343,6 @@ static const char *get_ch_state_name(enum rdma_ch_state s)
return "disconnecting";
case CH_DRAINING:
return "draining";
case CH_RELEASING:
return "releasing";
}
return "???";
}
@@ -372,7 +370,7 @@ static void srpt_qp_event(struct ib_event *event, struct srpt_rdma_ch *ch)
TRACE_DBG("%s, state %s: received Last WQE event.",
ch->sess_name, get_ch_state_name(ch->state));
ch->last_wqe_received = true;
srpt_test_and_set_ch_state(ch, CH_DRAINING, CH_RELEASING);
wake_up_process(ch->thread);
break;
default:
PRINT_ERROR("received unrecognized IB QP event %d",
@@ -2161,7 +2159,6 @@ static bool __srpt_close_ch(struct srpt_rdma_ch *ch)
break;
case CH_DISCONNECTING:
case CH_DRAINING:
case CH_RELEASING:
break;
}
@@ -2206,9 +2203,6 @@ static void srpt_drain_channel(struct ib_cm_id *cm_id)
if (ret < 0)
PRINT_ERROR("Setting queue pair in error state"
" failed: %d", ret);
if (ch->last_wqe_received)
srpt_test_and_set_ch_state(ch, CH_DRAINING,
CH_RELEASING);
}
}
@@ -2224,7 +2218,8 @@ static void srpt_free_ch(struct scst_session *sess)
sdev = ch->sport->sdev;
BUG_ON(!sdev);
WARN_ON(ch->state != CH_RELEASING);
WARN_ON(ch->state != CH_DRAINING);
WARN_ON(!ch->last_wqe_received);
BUG_ON(!ch->thread);
BUG_ON(ch->thread == current);
@@ -3022,7 +3017,7 @@ static int srpt_perform_rdmas(struct srpt_rdma_ch *ch,
ioctx->ioctx.index);
msleep(1000);
}
while (ch->state != CH_RELEASING && !ioctx->rdma_aborted) {
while (ch->state != CH_DRAINING && !ioctx->rdma_aborted) {
PRINT_INFO("Waiting until RDMA abort finished [%d]",
ioctx->ioctx.index);
msleep(1000);

View File

@@ -271,15 +271,13 @@ struct srpt_send_ioctx {
* @CH_DISCONNECTING: DREQ has been received and waiting for DREP or DREQ has
* been sent and waiting for DREP or channel is being closed
* for another reason.
* @CH_DRAINING: QP is in ERR state; waiting for last WQE event.
* @CH_RELEASING: Last WQE event has been received; releasing resources.
* @CH_DRAINING: QP is in ERR state.
*/
enum rdma_ch_state {
CH_CONNECTING,
CH_LIVE,
CH_DISCONNECTING,
CH_DRAINING,
CH_RELEASING
};
/**