From 047e51173af7845e46555faaf124bce09f9af3f4 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Wed, 26 Mar 2014 11:56:59 +0000 Subject: [PATCH] ib_srpt: Clean up srpt_handle_send_err_comp() This patch does not change any functionality. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5390 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- srpt/src/ib_srpt.c | 34 ++++++++++++---------------------- 1 file changed, 12 insertions(+), 22 deletions(-) diff --git a/srpt/src/ib_srpt.c b/srpt/src/ib_srpt.c index 8f66293e4..7191242bd 100644 --- a/srpt/src/ib_srpt.c +++ b/srpt/src/ib_srpt.c @@ -1417,41 +1417,31 @@ void srpt_on_abort_cmd(struct scst_cmd *cmd) static void srpt_handle_send_err_comp(struct srpt_rdma_ch *ch, u64 wr_id, enum scst_exec_context context) { - struct srpt_send_ioctx *ioctx; - enum srpt_command_state state; - struct scst_cmd *scmnd; - u32 index; + u32 index = idx_from_wr_id(wr_id); + struct srpt_send_ioctx *ioctx = ch->ioctx_ring[index]; + enum srpt_command_state state = ioctx->state; srpt_adjust_srq_wr_avail(ch, 1); - index = idx_from_wr_id(wr_id); - ioctx = ch->ioctx_ring[index]; - state = ioctx->state; - scmnd = &ioctx->scmnd; - - EXTRACHECKS_WARN_ON(state != SRPT_STATE_CMD_RSP_SENT - && state != SRPT_STATE_MGMT_RSP_SENT - && state != SRPT_STATE_NEED_DATA - && state != SRPT_STATE_DONE); - - /* - * If SRP_RSP sending failed, undo the ch->req_lim and ch->req_lim_delta - * changes. - */ - if (state == SRPT_STATE_CMD_RSP_SENT - || state == SRPT_STATE_MGMT_RSP_SENT) - srpt_undo_inc_req_lim(ch, ioctx->req_lim_delta); switch (state) { - default: + case SRPT_STATE_NEED_DATA: + srpt_abort_cmd(ioctx, context); + break; + case SRPT_STATE_CMD_RSP_SENT: + srpt_undo_inc_req_lim(ch, ioctx->req_lim_delta); srpt_abort_cmd(ioctx, context); break; case SRPT_STATE_MGMT_RSP_SENT: + srpt_undo_inc_req_lim(ch, ioctx->req_lim_delta); srpt_put_send_ioctx(ioctx); break; case SRPT_STATE_DONE: PRINT_ERROR("Received more than one IB error completion" " for wr_id = %u.", (unsigned)index); break; + default: + EXTRACHECKS_WARN_ON(true); + break; } }