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: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/10059
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Changpeng Liu 2021-10-29 21:57:44 +08:00
parent fa9e703f4f
commit 46b355c0ef
3 changed files with 14 additions and 4 deletions

View File

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

View File

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

View File

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