Commit 46b355c0 authored by Changpeng Liu's avatar Changpeng Liu
Browse files

nvme: add an API to check existing transport type is fabric or not



We already provides the API `spdk_nvme_ctrlr_is_fabrics` to return
input controller is fabrics controller or not, but it needs a controller
data structure as the input, so here we add another API to do the same
thing and it takes the transport type as the input, with this change,
both nvme and nvmf library can use the API.

Also we should treat UINT8_MAX(255) as valid fabrics transport type.

Change-Id: Ib62e7d3eca3da1ddb1a4cc55b0b62e274522f1ce
Signed-off-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/10059


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent fa9e703f
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -2,6 +2,11 @@

## v22.01: (Upcoming Release)

### nvme

API `spdk_nvme_trtype_is_fabrics` was added to return existing transport type
is fabric or not.

### bdev

The parameter `retry_count` of the RPC `bdev_nvme_set_options` was deprecated and will be
+8 −0
Original line number Diff line number Diff line
@@ -387,6 +387,14 @@ enum spdk_nvme_transport_type {
	SPDK_NVME_TRANSPORT_CUSTOM = 4096,
};

static inline bool spdk_nvme_trtype_is_fabrics(enum spdk_nvme_transport_type trtype)
{
	/* We always define non-fabrics trtypes outside of the 8-bit range
	 * of NVMe-oF trtype.
	 */
	return trtype <= UINT8_MAX;
}

/* typedef added for coding style reasons */
typedef enum spdk_nvme_transport_type spdk_nvme_transport_type_t;

+1 −4
Original line number Diff line number Diff line
@@ -5039,10 +5039,7 @@ spdk_nvme_ctrlr_is_fabrics(struct spdk_nvme_ctrlr *ctrlr)
{
	assert(ctrlr);

	/* We always define non-fabrics trtypes outside of the 8-bit range
	 * of NVMe-oF trtype.
	 */
	return ctrlr->trid.trtype < UINT8_MAX;
	return spdk_nvme_trtype_is_fabrics(ctrlr->trid.trtype);
}

int