|
|
e91cda |
From 4c41675adc85891f6605bc94aaa1baf7f7dd67e7 Mon Sep 17 00:00:00 2001
|
|
|
e91cda |
From: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
e91cda |
Date: Wed, 10 Oct 2018 13:27:49 +0100
|
|
|
e91cda |
Subject: [PATCH 2/6] iser: fix posting of receive descriptors
|
|
|
e91cda |
|
|
|
e91cda |
RH-Author: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
e91cda |
Message-id: <20181010132749.7381-1-pbonzini@redhat.com>
|
|
|
e91cda |
Patchwork-id: 82566
|
|
|
e91cda |
O-Subject: [RHEL8 libiscsi PATCH 2/6] iser: fix posting of receive descriptors
|
|
|
e91cda |
Bugzilla: 1634541
|
|
|
e91cda |
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
|
|
|
e91cda |
RH-Acked-by: Thomas Huth <thuth@redhat.com>
|
|
|
e91cda |
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
e91cda |
|
|
|
e91cda |
The old code is effectively always posting iser_conn->min_posted_rx
|
|
|
e91cda |
descriptors, since it is
|
|
|
e91cda |
|
|
|
e91cda |
if (outstanding + iser_conn->min_posted_rx <= iser_conn->qp_max_recv_dtos) {
|
|
|
e91cda |
if(iser_conn->qp_max_recv_dtos - outstanding > iser_conn->min_posted_rx)
|
|
|
e91cda |
count = iser_conn->min_posted_rx;
|
|
|
e91cda |
else
|
|
|
e91cda |
count = iser_conn->qp_max_recv_dtos - outstanding;
|
|
|
e91cda |
|
|
|
e91cda |
which is equivalent to
|
|
|
e91cda |
|
|
|
e91cda |
if(iser_conn->qp_max_recv_dtos - outstanding >= iser_conn->min_posted_rx)
|
|
|
e91cda |
if(iser_conn->qp_max_recv_dtos - outstanding > iser_conn->min_posted_rx)
|
|
|
e91cda |
count = iser_conn->min_posted_rx;
|
|
|
e91cda |
else
|
|
|
e91cda |
count = iser_conn->min_posted_rx;
|
|
|
e91cda |
|
|
|
e91cda |
So the "if" is redundant and the "min_posted_rx" is actually behaving more
|
|
|
e91cda |
like a _maximum_ number of posted descriptors in one iser_post_recvm.
|
|
|
e91cda |
Fix it with the (presumably) intended logic and remove a goto along
|
|
|
e91cda |
the way.
|
|
|
e91cda |
|
|
|
e91cda |
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
e91cda |
(cherry picked from commit f0fcee72c477dea57f0a50887b7368ba6d4ec33b)
|
|
|
e91cda |
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
|
|
e91cda |
---
|
|
|
e91cda |
lib/iser.c | 24 +++++++++---------------
|
|
|
e91cda |
1 file changed, 9 insertions(+), 15 deletions(-)
|
|
|
e91cda |
|
|
|
e91cda |
diff --git a/lib/iser.c b/lib/iser.c
|
|
|
e91cda |
index 4b314be..e5c8435 100644
|
|
|
e91cda |
--- a/lib/iser.c
|
|
|
e91cda |
+++ b/lib/iser.c
|
|
|
e91cda |
@@ -1021,7 +1021,7 @@ iser_rcv_completion(struct iser_rx_desc *rx_desc,
|
|
|
e91cda |
struct iser_conn *iser_conn)
|
|
|
e91cda |
{
|
|
|
e91cda |
struct iscsi_in_pdu *in = NULL;
|
|
|
e91cda |
- int outstanding, count = 0, err;
|
|
|
e91cda |
+ int empty, err;
|
|
|
e91cda |
struct iscsi_context *iscsi = iser_conn->cma_id->context;
|
|
|
e91cda |
|
|
|
e91cda |
in = iscsi_malloc(iscsi, sizeof(*in));
|
|
|
e91cda |
@@ -1089,23 +1089,17 @@ nop_target:
|
|
|
e91cda |
* for the posted rx bufs refcount to become zero handles everything */
|
|
|
e91cda |
iser_conn->post_recv_buf_count--;
|
|
|
e91cda |
|
|
|
e91cda |
- if ((unsigned char *)rx_desc == iser_conn->login_resp_buf)
|
|
|
e91cda |
- goto receive;
|
|
|
e91cda |
-
|
|
|
e91cda |
- outstanding = iser_conn->post_recv_buf_count;
|
|
|
e91cda |
- if (outstanding + iser_conn->min_posted_rx <= iser_conn->qp_max_recv_dtos) {
|
|
|
e91cda |
- if(iser_conn->qp_max_recv_dtos - outstanding > iser_conn->min_posted_rx)
|
|
|
e91cda |
- count = iser_conn->min_posted_rx;
|
|
|
e91cda |
- else
|
|
|
e91cda |
- count = iser_conn->qp_max_recv_dtos - outstanding;
|
|
|
e91cda |
- err = iser_post_recvm(iser_conn, count);
|
|
|
e91cda |
- if (err) {
|
|
|
e91cda |
- err = -1;
|
|
|
e91cda |
- goto error;
|
|
|
e91cda |
+ if ((unsigned char *)rx_desc != iser_conn->login_resp_buf) {
|
|
|
e91cda |
+ empty = iser_conn->qp_max_recv_dtos - iser_conn->post_recv_buf_count;
|
|
|
e91cda |
+ if (empty >= iser_conn->min_posted_rx) {
|
|
|
e91cda |
+ err = iser_post_recvm(iser_conn, empty);
|
|
|
e91cda |
+ if (err) {
|
|
|
e91cda |
+ err = -1;
|
|
|
e91cda |
+ goto error;
|
|
|
e91cda |
+ }
|
|
|
e91cda |
}
|
|
|
e91cda |
}
|
|
|
e91cda |
|
|
|
e91cda |
-receive:
|
|
|
e91cda |
err = iscsi_process_pdu(iscsi, in);
|
|
|
e91cda |
|
|
|
e91cda |
error:
|
|
|
e91cda |
--
|
|
|
e91cda |
1.8.3.1
|
|
|
e91cda |
|