Commit 9412a837 authored by Shuhei Matsumoto's avatar Shuhei Matsumoto Committed by Jim Harris
Browse files

nvmf/fc: Use STAILQ for pending_data_buf_queue



This is a small performance optimization and an effor to unify I/O
buffer management further among transports.

it is ensured that the request is the first of STAILQ when
nvmf_fc_request_execute() completes successfully.

Hence change TAILQ_REMOVE to STAILQ_REMOVE_HEAD for the case.

Signed-off-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: If982842bf53ba00426a854a18eaadf8a1b8d642d
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/466676


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarAnil Veerabhadrappa <anil.veerabhadrappa@broadcom.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarBroadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
parent 6c8b2972
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -1137,7 +1137,7 @@ nvmf_fc_req_in_pending(struct spdk_nvmf_fc_request *fc_req)
{
	struct spdk_nvmf_fc_request *tmp = NULL;

	TAILQ_FOREACH(tmp, &fc_req->fc_conn->pending_data_buf_queue, pending_link) {
	STAILQ_FOREACH(tmp, &fc_req->fc_conn->pending_data_buf_queue, pending_link) {
		if (tmp == fc_req) {
			return true;
		}
@@ -1258,7 +1258,8 @@ spdk_nvmf_fc_request_abort(struct spdk_nvmf_fc_request *fc_req, bool send_abts,
		SPDK_DEBUGLOG(SPDK_LOG_NVMF_FC, "Abort req when getting buffers.\n");
	} else if (nvmf_fc_req_in_pending(fc_req)) {
		/* Remove from pending */
		TAILQ_REMOVE(&fc_req->fc_conn->pending_data_buf_queue, fc_req, pending_link);
		STAILQ_REMOVE(&fc_req->fc_conn->pending_data_buf_queue, fc_req,
			      spdk_nvmf_fc_request, pending_link);
		goto complete;
	} else {
		/* Should never happen */
@@ -1453,7 +1454,7 @@ nvmf_fc_hwqp_handle_request(struct spdk_nvmf_fc_hwqp *hwqp, struct spdk_nvmf_fc_

	nvmf_fc_record_req_trace_point(fc_req, SPDK_NVMF_FC_REQ_INIT);
	if (nvmf_fc_request_execute(fc_req)) {
		TAILQ_INSERT_TAIL(&fc_conn->pending_data_buf_queue, fc_req, pending_link);
		STAILQ_INSERT_TAIL(&fc_conn->pending_data_buf_queue, fc_req, pending_link);
	}

	return 0;
@@ -1630,10 +1631,10 @@ spdk_nvmf_fc_hwqp_process_pending_reqs(struct spdk_nvmf_fc_hwqp *hwqp)
	int budget = 64;

	TAILQ_FOREACH(fc_conn, &hwqp->connection_list, link) {
		TAILQ_FOREACH_SAFE(fc_req, &fc_conn->pending_data_buf_queue, pending_link, tmp) {
		STAILQ_FOREACH_SAFE(fc_req, &fc_conn->pending_data_buf_queue, pending_link, tmp) {
			if (!nvmf_fc_request_execute(fc_req)) {
				/* Succesfuly posted, Delete from pending. */
				TAILQ_REMOVE(&fc_conn->pending_data_buf_queue, fc_req, pending_link);
				STAILQ_REMOVE_HEAD(&fc_conn->pending_data_buf_queue, pending_link);
			}

			if (budget) {
+1 −1
Original line number Diff line number Diff line
@@ -357,7 +357,7 @@ nvmf_fc_ls_new_connection(struct spdk_nvmf_fc_association *assoc, uint16_t qid,
	 */
	spdk_nvmf_fc_create_trid(&fc_conn->trid, tgtport->fc_nodename.u.wwn,
				 tgtport->fc_portname.u.wwn);
	TAILQ_INIT(&fc_conn->pending_data_buf_queue);
	STAILQ_INIT(&fc_conn->pending_data_buf_queue);

	return fc_conn;
}
+2 −2
Original line number Diff line number Diff line
@@ -227,7 +227,7 @@ struct spdk_nvmf_fc_conn {
	uint16_t cur_fc_rw_depth;

	/* requests that are waiting to obtain xchg/buffer */
	TAILQ_HEAD(, spdk_nvmf_fc_request) pending_data_buf_queue;
	STAILQ_HEAD(, spdk_nvmf_fc_request) pending_data_buf_queue;

	struct spdk_nvmf_fc_association *fc_assoc;

@@ -351,7 +351,7 @@ struct spdk_nvmf_fc_request {
	uint32_t s_id;
	uint32_t d_id;
	TAILQ_ENTRY(spdk_nvmf_fc_request) link;
	TAILQ_ENTRY(spdk_nvmf_fc_request) pending_link;
	STAILQ_ENTRY(spdk_nvmf_fc_request) pending_link;
	TAILQ_HEAD(, spdk_nvmf_fc_caller_ctx) abort_cbs;
};