--- v6
+++ v7
@@ -20,7 +20,7 @@
4 files changed, 166 insertions(+), 3 deletions(-)
diff --git a/drivers/nvme/hw/qedn/qedn.h b/drivers/nvme/hw/qedn/qedn.h
-index 185604967193..d3b8fabbcf23 100644
+index a83eccf9bfab..286d2f984a41 100644
--- a/drivers/nvme/hw/qedn/qedn.h
+++ b/drivers/nvme/hw/qedn/qedn.h
@@ -41,6 +41,8 @@
@@ -32,7 +32,7 @@
/* Protocol defines */
#define QEDN_MAX_IO_SIZE QED_NVMETCP_MAX_IO_SIZE
#define QEDN_MAX_PDU_SIZE 0x80000 /* 512KB */
-@@ -95,6 +97,8 @@
+@@ -91,6 +93,8 @@
/* Timeouts and delay constants */
#define QEDN_WAIT_CON_ESTABLSH_TMO 10000 /* 10 seconds */
#define QEDN_RLS_CONS_TMO 5000 /* 5 sec */
@@ -41,7 +41,7 @@
enum qedn_state {
QEDN_STATE_CORE_PROBED = 0,
-@@ -177,7 +181,9 @@ struct qedn_ctx {
+@@ -173,7 +177,9 @@ struct qedn_ctx {
};
enum qedn_task_flags {
@@ -51,7 +51,7 @@
};
struct qedn_task_ctx {
-@@ -326,6 +332,8 @@ struct qedn_conn_ctx {
+@@ -321,6 +327,8 @@ struct qedn_conn_ctx {
struct list_head active_task_list;
atomic_t num_active_tasks;
atomic_t num_active_fw_tasks;
@@ -61,10 +61,10 @@
/* Connection resources - turned on to indicate what resource was
* allocated, to that it can later be released.
diff --git a/drivers/nvme/hw/qedn/qedn_conn.c b/drivers/nvme/hw/qedn/qedn_conn.c
-index 101372192374..976ee6feb740 100644
+index e2da6a33acef..5fd6483f5287 100644
--- a/drivers/nvme/hw/qedn/qedn_conn.c
+++ b/drivers/nvme/hw/qedn/qedn_conn.c
-@@ -602,6 +602,11 @@ static int qedn_handle_icresp(struct qedn_conn_ctx *conn_ctx)
+@@ -612,6 +612,11 @@ static int qedn_handle_icresp(struct qedn_conn_ctx *conn_ctx)
return rc;
}
@@ -76,7 +76,7 @@
/* Slowpath EQ Callback */
int qedn_event_cb(void *context, u8 fw_event_code, void *event_ring_data)
{
-@@ -661,6 +666,7 @@ int qedn_event_cb(void *context, u8 fw_event_code, void *event_ring_data)
+@@ -673,6 +678,7 @@ int qedn_event_cb(void *context, u8 fw_event_code, void *event_ring_data)
}
break;
@@ -84,7 +84,7 @@
case NVMETCP_EVENT_TYPE_ASYN_TERMINATE_DONE:
if (conn_ctx->state != CONN_STATE_WAIT_FOR_DESTROY_DONE)
pr_err("CID=0x%x - ASYN_TERMINATE_DONE: Unexpected connection state %u\n",
-@@ -669,6 +675,19 @@ int qedn_event_cb(void *context, u8 fw_event_code, void *event_ring_data)
+@@ -681,6 +687,19 @@ int qedn_event_cb(void *context, u8 fw_event_code, void *event_ring_data)
queue_work(qctrl->sp_wq, &conn_ctx->sp_wq_entry);
break;
@@ -104,7 +104,7 @@
default:
pr_err("CID=0x%x - Recv Unknown Event %u\n", conn_ctx->fw_cid, fw_event_code);
break;
-@@ -802,9 +821,116 @@ static int qedn_prep_and_offload_queue(struct qedn_conn_ctx *conn_ctx)
+@@ -816,9 +835,116 @@ static int qedn_prep_and_offload_queue(struct qedn_conn_ctx *conn_ctx)
return -EINVAL;
}
@@ -223,22 +223,28 @@
void qedn_destroy_connection(struct qedn_conn_ctx *conn_ctx)
diff --git a/drivers/nvme/hw/qedn/qedn_main.c b/drivers/nvme/hw/qedn/qedn_main.c
-index 119a3e7d2daa..abd0388b8f0f 100644
+index d4e2a1bfa5fb..d2f8124a8267 100644
--- a/drivers/nvme/hw/qedn/qedn_main.c
+++ b/drivers/nvme/hw/qedn/qedn_main.c
-@@ -249,6 +249,11 @@ static int qedn_setup_ctrl(struct nvme_tcp_ofld_ctrl *ctrl)
+@@ -252,12 +252,17 @@ static int qedn_setup_ctrl(struct nvme_tcp_ofld_ctrl *ctrl)
+
static int qedn_release_ctrl(struct nvme_tcp_ofld_ctrl *ctrl)
{
- struct qedn_ctrl *qctrl = (struct qedn_ctrl *)ctrl->private_data;
+ struct nvme_ctrl *nctrl = &ctrl->nctrl;
-+
+ struct qedn_ctrl *qctrl;
+
+ qctrl = (struct qedn_ctrl *)ctrl->private_data;
+ if (!qctrl)
+ return -ENODEV;
+
+ if (nctrl->state == NVME_CTRL_CONNECTING ||
+ nctrl->state == NVME_CTRL_RESETTING)
+ return 0;
-
++
if (test_and_clear_bit(LLH_FILTER, &qctrl->agg_state) &&
qctrl->llh_filter) {
-@@ -324,6 +329,7 @@ static int qedn_create_queue(struct nvme_tcp_ofld_queue *queue, int qid,
+ qedn_dec_llh_filter(qctrl->qedn, qctrl->llh_filter);
+@@ -322,6 +327,7 @@ static int qedn_create_queue(struct nvme_tcp_ofld_queue *queue, int qid,
qedn_set_pdu_params(conn_ctx);
init_waitqueue_head(&conn_ctx->conn_waitq);
@@ -247,10 +253,10 @@
atomic_set(&conn_ctx->destroy_conn_indicator, 0);
diff --git a/drivers/nvme/hw/qedn/qedn_task.c b/drivers/nvme/hw/qedn/qedn_task.c
-index 919a98b0bbbb..525effdef0bb 100644
+index 5be93264df48..2ac41b251292 100644
--- a/drivers/nvme/hw/qedn/qedn_task.c
+++ b/drivers/nvme/hw/qedn/qedn_task.c
-@@ -327,6 +327,17 @@ void qedn_return_active_tasks(struct qedn_conn_ctx *conn_ctx)
+@@ -316,6 +316,17 @@ void qedn_return_active_tasks(struct qedn_conn_ctx *conn_ctx)
/* Return tasks that aren't "Used by FW" to the pool */
list_for_each_entry_safe(qedn_task, task_tmp,
&conn_ctx->active_task_list, entry) {
@@ -268,7 +274,7 @@
qedn_clear_task(conn_ctx, qedn_task);
num_returned_tasks++;
}
-@@ -664,7 +675,8 @@ void qedn_io_work_cq(struct qedn_ctx *qedn, struct nvmetcp_fw_cqe *cqe)
+@@ -653,7 +664,8 @@ void qedn_io_work_cq(struct qedn_ctx *qedn, struct nvmetcp_fw_cqe *cqe)
return;
if (likely(cqe->cqe_type == NVMETCP_FW_CQE_TYPE_NORMAL)) {
@@ -278,7 +284,7 @@
switch (cqe->task_type) {
case NVMETCP_TASK_TYPE_HOST_WRITE:
-@@ -705,6 +717,17 @@ void qedn_io_work_cq(struct qedn_ctx *qedn, struct nvmetcp_fw_cqe *cqe)
+@@ -694,6 +706,17 @@ void qedn_io_work_cq(struct qedn_ctx *qedn, struct nvmetcp_fw_cqe *cqe)
pr_info("Could not identify task type\n");
}
} else {