nvme: add spdk_nvme_ctrlr_is_fabrics()
We map the SPDK_NVME_TRANSPORT_* values directly to the NVMe-oF trtype values. Since PCIe isn't Fabrics, we choose 256 which is outside of the 8-bit trtype range of values. So we can just check if trtype >= 256 to determine if the trid is for fabrics or not. This is preferable to checking PCIE || VFIOUSER in case additional non-fabrics transport types are added in the future. I considered taking a trid as the parameter instead, but went this route since it is consistent with the existing spdk_nvme_ctrlr_is_discovery(). Signed-off-by: Jim Harris <james.r.harris@intel.com> Change-Id: Ib62ff4d30549b2324486c81f2dce67f0f1741e9b Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8077 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Community-CI: Mellanox Build Bot Reviewed-by: Ziye Yang <ziye.yang@intel.com> Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
This commit is contained in:
parent
d6f6ffd274
commit
9f5e3c99f2
@ -297,6 +297,15 @@ struct spdk_nvme_accel_fn_table {
|
||||
*/
|
||||
bool spdk_nvme_ctrlr_is_discovery(struct spdk_nvme_ctrlr *ctrlr);
|
||||
|
||||
/**
|
||||
* Indicate whether a ctrlr handle is associated with a fabrics controller.
|
||||
*
|
||||
* \param ctrlr Opaque handle to NVMe controller.
|
||||
*
|
||||
* \return true if a fabrics controller, else false.
|
||||
*/
|
||||
bool spdk_nvme_ctrlr_is_fabrics(struct spdk_nvme_ctrlr *ctrlr);
|
||||
|
||||
/**
|
||||
* Get the default options for the creation of a specific NVMe controller.
|
||||
*
|
||||
|
@ -4230,6 +4230,17 @@ spdk_nvme_ctrlr_is_discovery(struct spdk_nvme_ctrlr *ctrlr)
|
||||
strlen(SPDK_NVMF_DISCOVERY_NQN));
|
||||
}
|
||||
|
||||
bool
|
||||
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;
|
||||
}
|
||||
|
||||
int
|
||||
spdk_nvme_ctrlr_security_receive(struct spdk_nvme_ctrlr *ctrlr, uint8_t secp,
|
||||
uint16_t spsp, uint8_t nssf, void *payload, size_t size)
|
||||
|
@ -30,6 +30,7 @@
|
||||
spdk_nvme_pcie_set_hotplug_filter;
|
||||
|
||||
spdk_nvme_ctrlr_is_discovery;
|
||||
spdk_nvme_ctrlr_is_fabrics;
|
||||
spdk_nvme_ctrlr_get_default_ctrlr_opts;
|
||||
spdk_nvme_ctrlr_set_trid;
|
||||
spdk_nvme_ctrlr_reset_subsystem;
|
||||
|
Loading…
Reference in New Issue
Block a user