Commit f9db32ec authored by Daniel Verkamp's avatar Daniel Verkamp
Browse files

nvmf: remove double immediate completion handling



The "immediate completion" cases in spdk_nvmf_request_exec() already
call spdk_nvmf_request_complete(), so the ret == 1 case in nvmf_recv()
is bogus.

Also fix a couple of spdk_nvmf_request_complete() calls in
nvmf_process_admin_cmd() that should be handled by its caller.

Change-Id: I41b865d5e6e7fec08087faf9c6f3da3b057a5fb2
Signed-off-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
parent bfa9931b
Loading
Loading
Loading
Loading
+0 −14
Original line number Diff line number Diff line
@@ -513,20 +513,6 @@ static int nvmf_recv(struct spdk_nvmf_conn *conn, struct ibv_wc *wc)
			SPDK_ERRLOG("Command execution failed\n");
			goto recv_error;
		}

		if (ret == 1) {
			/*
			 * Immediate completion.
			 * Re-post rx_desc and re-queue tx_desc here,
			 * there is not a delayed posting because of
			 * command processing.
			 */
			nvmf_deactive_tx_desc(tx_desc);
			if (nvmf_post_rdma_recv(conn, rx_desc)) {
				SPDK_ERRLOG("Unable to re-post aq rx descriptor\n");
				return -1;
			}
		}
	}

drop_recv:
+4 −3
Original line number Diff line number Diff line
@@ -150,13 +150,13 @@ nvmf_process_admin_cmd(struct nvmf_request *req)
			}
			nsdata = spdk_nvme_ns_get_data(ns);
			memcpy(req->data, (char *)nsdata, sizeof(struct spdk_nvme_ns_data));
			spdk_nvmf_request_complete(req);
			rc = 1;
		} else if (cmd->cdw10 == 1) {
			/* identify controller */
			SPDK_TRACELOG(SPDK_TRACE_NVMF, "Identify Controller\n");
			/* pull from virtual controller context */
			memcpy(req->data, (char *)&session->vcdata, sizeof(struct spdk_nvme_ctrlr_data));
			spdk_nvmf_request_complete(req);
			rc = 1;
		} else {
			SPDK_TRACELOG(SPDK_TRACE_NVMF, "Identify Namespace List\n");
			response->status.sc = SPDK_NVME_SC_INVALID_OPCODE;
@@ -538,7 +538,8 @@ nvmf_process_fabrics_command(struct nvmf_request *req)
	default:
		SPDK_TRACELOG(SPDK_TRACE_DEBUG, "recv capsule header type invalid [%x]!\n",
			      cap_hdr->fctype);
		return 1; /* skip, do nothing */
		req->rsp->nvme_cpl.status.sc = SPDK_NVME_SC_INVALID_OPCODE;
		return spdk_nvmf_request_complete(req);
	}
}