iser: fix posting of receive descriptors
The old code is effectively always posting iser_conn->min_posted_rx
descriptors, since it is
if (outstanding + iser_conn->min_posted_rx <= iser_conn->qp_max_recv_dtos) {
if(iser_conn->qp_max_recv_dtos - outstanding > iser_conn->min_posted_rx)
count = iser_conn->min_posted_rx;
else
count = iser_conn->qp_max_recv_dtos - outstanding;
which is equivalent to
if(iser_conn->qp_max_recv_dtos - outstanding >= iser_conn->min_posted_rx)
if(iser_conn->qp_max_recv_dtos - outstanding > iser_conn->min_posted_rx)
count = iser_conn->min_posted_rx;
else
count = iser_conn->min_posted_rx;
So the "if" is redundant and the "min_posted_rx" is actually behaving more
like a _maximum_ number of posted descriptors in one iser_post_recvm.
Fix it with the (presumably) intended logic and remove a goto along
the way.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
+9
-15
@@ -1028,7 +1028,7 @@ iser_rcv_completion(struct iser_rx_desc *rx_desc,
|
|||||||
struct iser_conn *iser_conn)
|
struct iser_conn *iser_conn)
|
||||||
{
|
{
|
||||||
struct iscsi_in_pdu *in = NULL;
|
struct iscsi_in_pdu *in = NULL;
|
||||||
int outstanding, count = 0, err;
|
int empty, err;
|
||||||
struct iscsi_context *iscsi = iser_conn->cma_id->context;
|
struct iscsi_context *iscsi = iser_conn->cma_id->context;
|
||||||
|
|
||||||
in = iscsi_malloc(iscsi, sizeof(*in));
|
in = iscsi_malloc(iscsi, sizeof(*in));
|
||||||
@@ -1096,23 +1096,17 @@ nop_target:
|
|||||||
* for the posted rx bufs refcount to become zero handles everything */
|
* for the posted rx bufs refcount to become zero handles everything */
|
||||||
iser_conn->post_recv_buf_count--;
|
iser_conn->post_recv_buf_count--;
|
||||||
|
|
||||||
if ((unsigned char *)rx_desc == iser_conn->login_resp_buf)
|
if ((unsigned char *)rx_desc != iser_conn->login_resp_buf) {
|
||||||
goto receive;
|
empty = iser_conn->qp_max_recv_dtos - iser_conn->post_recv_buf_count;
|
||||||
|
if (empty >= iser_conn->min_posted_rx) {
|
||||||
outstanding = iser_conn->post_recv_buf_count;
|
err = iser_post_recvm(iser_conn, empty);
|
||||||
if (outstanding + iser_conn->min_posted_rx <= iser_conn->qp_max_recv_dtos) {
|
if (err) {
|
||||||
if(iser_conn->qp_max_recv_dtos - outstanding > iser_conn->min_posted_rx)
|
err = -1;
|
||||||
count = iser_conn->min_posted_rx;
|
goto error;
|
||||||
else
|
}
|
||||||
count = iser_conn->qp_max_recv_dtos - outstanding;
|
|
||||||
err = iser_post_recvm(iser_conn, count);
|
|
||||||
if (err) {
|
|
||||||
err = -1;
|
|
||||||
goto error;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
receive:
|
|
||||||
err = iscsi_process_pdu(iscsi, in);
|
err = iscsi_process_pdu(iscsi, in);
|
||||||
|
|
||||||
error:
|
error:
|
||||||
|
|||||||
Reference in New Issue
Block a user