Commit 647afdec authored by Ben Walker's avatar Ben Walker Committed by Jim Harris
Browse files

Revert "nvme: small code cleanup for nvme_transport_ctrlr_scan"



This reverts commit 6129e78d.

When the initiator sends the discovery log page, if the log page
exceeds the size of its data buffer, it will break it up into
multiple log page commands with appropriate offsets. However,
supporting offsets in log pages is an optional feature in NVMe
and reported by the EDLP bit in the identify data.

This commit changed the discovery process to no longer send an
identify command prior to doing the discovery log page command,
so the values in the identify data are always 0. If the discovery
log page exceeds the size of the data buffer (4k), it will then
fail to send the second log page with an offset because it
believes the controller does not support the feature.

Revert this change to fix it. An identify should always be sent
as part of the discovery process. A test case is included in a
follow up patch the demonstrates the bug.

Reported-by: default avatarZahra Khatami <zahra.k.khatami@oracle.com>
Reported-by: default avatarAkshay Shah <akshay.shah@oracle.com>

Change-Id: Iefd512a7521e0fea90541b3eb547671cfa816ea6
Signed-off-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/466819


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarPaul Luse <paul.e.luse@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
parent 43a713f9
Loading
Loading
Loading
Loading
+14 −14
Original line number Diff line number Diff line
@@ -1428,8 +1428,6 @@ nvme_rdma_ctrlr_scan(struct spdk_nvme_probe_ctx *probe_ctx,
		return -1;
	}

	/* Direct attach through spdk_nvme_connect() API */
	if (direct_connect == true) {
	/* get the cdata info */
	rc = nvme_ctrlr_cmd_identify(discovery_ctrlr, SPDK_NVME_IDENTIFY_CTRLR, 0, 0,
				     &discovery_ctrlr->cdata, sizeof(discovery_ctrlr->cdata),
@@ -1444,6 +1442,8 @@ nvme_rdma_ctrlr_scan(struct spdk_nvme_probe_ctx *probe_ctx,
		return -ENXIO;
	}

	/* Direct attach through spdk_nvme_connect() API */
	if (direct_connect == true) {
		/* Set the ready state to skip the normal init process */
		discovery_ctrlr->state = NVME_CTRLR_STATE_READY;
		nvme_ctrlr_connected(probe_ctx, discovery_ctrlr);
+18 −14
Original line number Diff line number Diff line
@@ -311,8 +311,6 @@ nvme_tcp_ctrlr_scan(struct spdk_nvme_probe_ctx *probe_ctx,
		return -1;
	}

	/* Direct attach through spdk_nvme_connect() API */
	if (direct_connect == true) {
	/* get the cdata info */
	status.done = false;
	rc = nvme_ctrlr_cmd_identify(discovery_ctrlr, SPDK_NVME_IDENTIFY_CTRLR, 0, 0,
@@ -323,10 +321,16 @@ nvme_tcp_ctrlr_scan(struct spdk_nvme_probe_ctx *probe_ctx,
		return rc;
	}

		if (spdk_nvme_wait_for_completion(discovery_ctrlr->adminq, &status)) {
	while (status.done == false) {
		spdk_nvme_qpair_process_completions(discovery_ctrlr->adminq, 0);
	}
	if (spdk_nvme_cpl_is_error(&status.cpl)) {
		SPDK_ERRLOG("nvme_identify_controller failed!\n");
		return -ENXIO;
	}

	/* Direct attach through spdk_nvme_connect() API */
	if (direct_connect == true) {
		/* Set the ready state to skip the normal init process */
		discovery_ctrlr->state = NVME_CTRLR_STATE_READY;
		nvme_ctrlr_connected(probe_ctx, discovery_ctrlr);