ib_srpt: Internal change to the credit algorithm. No externally observable behavior is changed.

git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@3575 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Bart Van Assche
2011-06-13 12:38:18 +00:00
parent 93da6cc2b9
commit 00efb5c667
2 changed files with 11 additions and 13 deletions

View File

@@ -251,7 +251,7 @@ static int srpt_adjust_req_lim(struct srpt_rdma_ch *ch, int req_lim_change,
/**
* srpt_inc_req_lim() - Increase ch->req_lim and decrease ch->req_lim_delta.
*
* Returns the previous value of ch->req_lim_delta.
* Returns one more than the previous value of ch->req_lim_delta.
*/
static int srpt_inc_req_lim(struct srpt_rdma_ch *ch)
{
@@ -259,8 +259,8 @@ static int srpt_inc_req_lim(struct srpt_rdma_ch *ch)
unsigned long flags;
spin_lock_irqsave(&ch->spinlock, flags);
req_lim_delta = ch->req_lim_delta;
ch->req_lim += 1 + req_lim_delta;
req_lim_delta = ch->req_lim_delta + 1;
ch->req_lim += req_lim_delta;
ch->req_lim_delta = 0;
spin_unlock_irqrestore(&ch->spinlock, flags);
@@ -272,7 +272,7 @@ static int srpt_inc_req_lim(struct srpt_rdma_ch *ch)
*/
static int srpt_undo_inc_req_lim(struct srpt_rdma_ch *ch, int req_lim_delta)
{
return srpt_adjust_req_lim(ch, -(1 + req_lim_delta), req_lim_delta);
return srpt_adjust_req_lim(ch, -req_lim_delta, req_lim_delta - 1);
}
/**
@@ -1510,8 +1510,7 @@ static int srpt_build_cmd_rsp(struct srpt_rdma_ch *ch,
memset(srp_rsp, 0, sizeof *srp_rsp);
srp_rsp->opcode = SRP_RSP;
srp_rsp->req_lim_delta =
__constant_cpu_to_be32(ioctx->req_lim_delta + 1);
srp_rsp->req_lim_delta = __constant_cpu_to_be32(ioctx->req_lim_delta);
srp_rsp->tag = tag;
srp_rsp->status = status;
@@ -1563,8 +1562,7 @@ static int srpt_build_tskmgmt_rsp(struct srpt_rdma_ch *ch,
memset(srp_rsp, 0, sizeof *srp_rsp);
srp_rsp->opcode = SRP_RSP;
srp_rsp->req_lim_delta
= __constant_cpu_to_be32(ioctx->req_lim_delta + 1);
srp_rsp->req_lim_delta = __constant_cpu_to_be32(ioctx->req_lim_delta);
srp_rsp->tag = tag;
if (rsp_code != SRP_TSK_MGMT_SUCCESS) {
@@ -1850,9 +1848,9 @@ static void srpt_process_rcv_completion(struct ib_cq *cq,
* Note: Although this has not yet been observed during tests, at least in
* theory it is possible that the srpt_get_send_ioctx() call invoked by
* srpt_handle_new_iu() fails. This is possible because the req_lim_delta
* value in each response is set to one, and it is possible that this response
* makes the initiator send a new request before the send completion for that
* response has been processed. This could e.g. happen if the call to
* value in each response is set to at least one, and it is possible that this
* response makes the initiator send a new request before the send completion
* for that response has been processed. This could e.g. happen if the call to
* srpt_put_send_iotcx() is delayed because of a higher priority interrupt or
* if IB retransmission causes generation of the send completion to be
* delayed. Incoming information units for which srpt_get_send_ioctx() fails

View File

@@ -224,7 +224,7 @@ struct srpt_tsk_mgmt {
* @n_rdma_ius: Number of elements in the rdma_ius array.
* @n_rdma:
* @n_rbuf: Number of data buffers in the received SRP command.
* @req_lim_delta: one less than the req_lim_delta value field in the latest
* @req_lim_delta: Value of the req_lim_delta value field in the latest
* SRP response sent.
* @tsk_mgmt:
*/
@@ -283,7 +283,7 @@ enum rdma_ch_state {
* @max_ti_iu_len: maximum target-to-initiator information unit length.
* @req_lim: request limit: maximum number of requests that may be sent
* by the initiator without having received a response.
* @req_lim_delta: one less than the req_lim_delta value that will be included
* @req_lim_delta: One less than the req_lim_delta value that will be included
* in the next reply sent to the initiator. See also the SRP
* credit algorithm in the SRP spec.
* @spinlock: Protects free_list.