ib_srpt: Simplify the code for waking up the srpt thread after login

git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5054 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Bart Van Assche
2013-10-10 12:53:59 +00:00
parent 404b21b5f0
commit cdf784a6ad
2 changed files with 3 additions and 24 deletions

View File

@@ -1976,7 +1976,7 @@ static void srpt_process_send_completion(struct ib_cq *cq,
opcode == SRPT_RDMA_ABORT) {
srpt_handle_rdma_comp(ch, ch->ioctx_ring[index], opcode,
srpt_xmt_rsp_context);
} else if (opcode != SRPT_RDMA_ZEROLENGTH_WRITE) {
} else {
WARN(true, "unexpected opcode %d", opcode);
}
} else {
@@ -1991,8 +1991,7 @@ static void srpt_process_send_completion(struct ib_cq *cq,
opcode, index, wc->status);
srpt_handle_rdma_err_comp(ch, ch->ioctx_ring[index],
opcode, srpt_xmt_rsp_context);
} else if (opcode != SRPT_RDMA_MID &&
opcode != SRPT_RDMA_ZEROLENGTH_WRITE) {
} else if (opcode != SRPT_RDMA_MID) {
WARN(true, "unexpected opcode %d", opcode);
}
}
@@ -2776,25 +2775,6 @@ static void srpt_cm_rej_recv(struct ib_cm_id *cm_id)
srpt_drain_channel(cm_id);
}
/**
* srpt_zerolength_write() - Perform a zero-length RDMA write.
*
* A quote from the InfiniBand specification: C9-88: For an HCA responder
* using Reliable Connection service, for each zero-length RDMA READ or WRITE
* request, the R_Key shall not be validated, even if the request includes
* Immediate data.
*/
static int srpt_zerolength_write(struct srpt_rdma_ch *ch)
{
struct ib_send_wr wr, *bad_wr;
memset(&wr, 0, sizeof(wr));
wr.opcode = IB_WR_RDMA_WRITE;
wr.wr_id = encode_wr_id(SRPT_RDMA_ZEROLENGTH_WRITE, 0xffffffffUL);
wr.send_flags = IB_SEND_SIGNALED;
return ib_post_send(ch->qp, &wr, &bad_wr);
}
/**
* srpt_cm_rtu_recv() - Process IB CM RTU_RECEIVED and USER_ESTABLISHED events.
*
@@ -2809,7 +2789,7 @@ static void srpt_cm_rtu_recv(struct ib_cm_id *cm_id)
ret = srpt_ch_qp_rts(ch, ch->qp);
if (ret == 0 && srpt_test_and_set_ch_state(ch, CH_CONNECTING,
CH_LIVE)) {
WARN_ON(srpt_zerolength_write(ch) < 0);
wake_up_process(ch->thread);
} else {
srpt_close_ch(ch);
}

View File

@@ -139,7 +139,6 @@ enum srpt_opcode {
SRPT_RDMA_ABORT,
SRPT_RDMA_READ_LAST,
SRPT_RDMA_WRITE_LAST,
SRPT_RDMA_ZEROLENGTH_WRITE,
};
static inline u64 encode_wr_id(enum srpt_opcode opcode, u32 idx)