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: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/365916
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Daniel Verkamp 2017-06-16 12:32:25 -07:00 committed by Jim Harris
parent a4381cfe31
commit 65ff7a63d2

View File

@ -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;
}