Commit 65ff7a63 authored by Daniel Verkamp's avatar Daniel Verkamp Committed by Jim Harris
Browse files

nvme: special case TRID comparison for PCIe



PCIe transport IDs are a non-standard extension to the NVMe-oF transport
address, and they only use the transport type and address fields of the
structure.  Add a special case so that the rest of the fields are
ignored for PCIe addresses.  All other transport types are NVMe-oF
addresses and should compare all fields.

Change-Id: I45ed143ea1712d17c6de8082677deeefd395c8a2
Signed-off-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/365916


Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent a4381cfe
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -597,12 +597,17 @@ spdk_nvme_transport_id_compare(const struct spdk_nvme_transport_id *trid1,
		return cmp;
	}

	cmp = cmp_int(trid1->adrfam, trid2->adrfam);
	cmp = strcasecmp(trid1->traddr, trid2->traddr);
	if (cmp) {
		return cmp;
	}

	cmp = strcasecmp(trid1->traddr, trid2->traddr);
	if (trid1->trtype == SPDK_NVME_TRANSPORT_PCIE) {
		/* PCIe transport ID only uses trtype and traddr */
		return 0;
	}

	cmp = cmp_int(trid1->adrfam, trid2->adrfam);
	if (cmp) {
		return cmp;
	}