Commit df43debd authored by Sagi Grimberg's avatar Sagi Grimberg Committed by Nicholas Bellinger

iser-target: Unite error completion handler for RX and TX

As a pre-step to a single CQ, we unite the error completion
handlers to a single handler.

This patch does not change any functionality.
Signed-off-by: default avatarSagi Grimberg <sagig@mellanox.com>
Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
parent 68a86dee
...@@ -2014,40 +2014,38 @@ isert_send_completion(struct iser_tx_desc *tx_desc, ...@@ -2014,40 +2014,38 @@ isert_send_completion(struct iser_tx_desc *tx_desc,
} }
static void static void
isert_cq_tx_comp_err(struct iser_tx_desc *tx_desc, struct isert_conn *isert_conn) isert_cq_comp_err(void *desc, struct isert_conn *isert_conn, bool tx)
{ {
if (tx) {
struct ib_device *ib_dev = isert_conn->conn_cm_id->device; struct ib_device *ib_dev = isert_conn->conn_cm_id->device;
struct isert_cmd *isert_cmd = tx_desc->isert_cmd; struct isert_cmd *isert_cmd;
isert_cmd = ((struct iser_tx_desc *)desc)->isert_cmd;
if (!isert_cmd) if (!isert_cmd)
isert_unmap_tx_desc(tx_desc, ib_dev); isert_unmap_tx_desc(desc, ib_dev);
else else
isert_completion_put(tx_desc, isert_cmd, ib_dev, true); isert_completion_put(desc, isert_cmd, ib_dev, true);
} atomic_dec(&isert_conn->post_send_buf_count);
} else {
isert_conn->post_recv_buf_count--;
}
static void if (isert_conn->post_recv_buf_count == 0 &&
isert_cq_rx_comp_err(struct isert_conn *isert_conn) atomic_read(&isert_conn->post_send_buf_count) == 0) {
{
struct iscsi_conn *conn = isert_conn->conn; struct iscsi_conn *conn = isert_conn->conn;
if (isert_conn->post_recv_buf_count)
return;
if (conn->sess) { if (conn->sess) {
target_sess_cmd_list_set_waiting(conn->sess->se_sess); target_sess_cmd_list_set_waiting(conn->sess->se_sess);
target_wait_for_sess_cmds(conn->sess->se_sess); target_wait_for_sess_cmds(conn->sess->se_sess);
} }
while (atomic_read(&isert_conn->post_send_buf_count))
msleep(3000);
mutex_lock(&isert_conn->conn_mutex); mutex_lock(&isert_conn->conn_mutex);
isert_conn_terminate(isert_conn); isert_conn_terminate(isert_conn);
mutex_unlock(&isert_conn->conn_mutex); mutex_unlock(&isert_conn->conn_mutex);
iscsit_cause_connection_reinstatement(isert_conn->conn, 0); iscsit_cause_connection_reinstatement(isert_conn->conn, 0);
complete(&isert_conn->conn_wait_comp_err); complete(&isert_conn->conn_wait_comp_err);
}
} }
static void static void
...@@ -2073,10 +2071,8 @@ isert_cq_tx_work(struct work_struct *work) ...@@ -2073,10 +2071,8 @@ isert_cq_tx_work(struct work_struct *work)
pr_debug("TX wc.status: 0x%08x\n", wc.status); pr_debug("TX wc.status: 0x%08x\n", wc.status);
pr_debug("TX wc.vendor_err: 0x%08x\n", wc.vendor_err); pr_debug("TX wc.vendor_err: 0x%08x\n", wc.vendor_err);
if (wc.wr_id != ISER_FASTREG_LI_WRID) { if (wc.wr_id != ISER_FASTREG_LI_WRID)
atomic_dec(&isert_conn->post_send_buf_count); isert_cq_comp_err(tx_desc, isert_conn, true);
isert_cq_tx_comp_err(tx_desc, isert_conn);
}
} }
} }
...@@ -2118,8 +2114,7 @@ isert_cq_rx_work(struct work_struct *work) ...@@ -2118,8 +2114,7 @@ isert_cq_rx_work(struct work_struct *work)
pr_debug("RX wc.vendor_err: 0x%08x\n", pr_debug("RX wc.vendor_err: 0x%08x\n",
wc.vendor_err); wc.vendor_err);
} }
isert_conn->post_recv_buf_count--; isert_cq_comp_err(rx_desc, isert_conn, false);
isert_cq_rx_comp_err(isert_conn);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment