Commit 326a15a7 authored by Daniel Verkamp's avatar Daniel Verkamp Committed by Benjamin Walker
Browse files

nvmf: simplify nvmf_connect_continue() cleanup



Let the calling function handle the tx_desc if nvmf_connect_continue()
fails.

Change-Id: I25a8cbc4c3be0608bcec8db2fb8c50e55fbe3e8c
Signed-off-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
parent 8836a17f
Loading
Loading
Loading
Loading
+9 −12
Original line number Diff line number Diff line
@@ -784,7 +784,7 @@ nvmf_init_conn_properites(struct spdk_nvmf_conn *conn,

}

static void
static int
nvmf_connect_continue(struct spdk_nvmf_conn *conn,
		      struct nvme_qp_tx_desc *tx_desc)
{
@@ -797,7 +797,7 @@ nvmf_connect_continue(struct spdk_nvmf_conn *conn,

	if (tx_desc == NULL) {
		SPDK_TRACELOG(SPDK_TRACE_DEBUG, " tx_desc does not exist!\n");
		return;
		return -1;
	}

	req = &tx_desc->req_state;
@@ -843,16 +843,10 @@ nvmf_connect_continue(struct spdk_nvmf_conn *conn,
	ret = spdk_nvmf_send_response(conn, req);
	if (ret) {
		SPDK_ERRLOG("Unable to send aq qp tx descriptor\n");
		goto connect_error;
		return ret;
	}
	return;

connect_error:
	/* recover the tx_desc */
	if (tx_desc != NULL) {
		tx_desc->rx_desc = NULL;
		nvmf_deactive_tx_desc(tx_desc);
	}
	return 0;
}

static int
@@ -890,7 +884,7 @@ nvmf_process_connect(struct spdk_nvmf_conn *conn,
		}
		req->data = rx_desc->bb;
		req->length = sgl->nvmf_sgl.length;
		nvmf_connect_continue(conn, tx_desc);
		return nvmf_connect_continue(conn, tx_desc);
	} else if (sgl->nvmf_sgl.type == SPDK_NVME_SGL_TYPE_KEYED_DATA_BLOCK &&
		   (sgl->nvmf_sgl.subtype == SPDK_NVME_SGL_SUBTYPE_ADDRESS ||
		    sgl->nvmf_sgl.subtype == SPDK_NVME_SGL_SUBTYPE_INVALIDATE_KEY)) {
@@ -1151,7 +1145,10 @@ static int nvmf_cq_event_handler(struct spdk_nvmf_conn *conn)
				}
			} else if (req->pending == NVMF_PENDING_CONNECT) {
				req->pending = NVMF_PENDING_NONE;
				nvmf_connect_continue(conn, tx_desc);
				if (nvmf_connect_continue(conn, tx_desc)) {
					SPDK_ERRLOG("nvmf_connect_continue() failed\n");
					goto handler_error;
				}
			}
			break;