Commit 583fa214 authored by Shuhei Matsumoto's avatar Shuhei Matsumoto Committed by Tomasz Zawadzki
Browse files

lib/nvme: Add two public APIs to get ANA group ID and ANA state of the namespace



Add spdk_nvme_ns_get_ana_group_id() and spdk_nvme_ns_get_ana_state()
to getthe ANA group ID and the ANA state of the given namespace,
respectively.

Signed-off-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Id5f1f7ee488a1eb2a7a77f9986a3bb89146628e0
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4354


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarAleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: default avatarMonica Kenguva <monica.kenguva@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
parent cc2b6962
Loading
Loading
Loading
Loading
+30 −0
Original line number Diff line number Diff line
@@ -2334,6 +2334,36 @@ enum spdk_nvme_ns_flags {
 */
uint32_t spdk_nvme_ns_get_flags(struct spdk_nvme_ns *ns);

/**
 * Get the ANA group ID for the given namespace.
 *
 * This function should be called only if spdk_nvme_ctrlr_is_log_page_supported() returns
 * true for the controller and log page ID SPDK_NVME_LOG_ASYMMETRIC_NAMESPACE_ACCESS.
 *
 * This function is thread safe and can be called at any point while the controller
 * is attached to the SPDK NVMe driver.
 *
 * \param ns Namespace to query.
 *
 * \return the ANA group ID for the given namespace.
 */
uint32_t spdk_nvme_ns_get_ana_group_id(const struct spdk_nvme_ns *ns);

/**
 * Get the ANA state for the given namespace.
 *
 * This function should be called only if spdk_nvme_ctrlr_is_log_page_supported() returns
 * true for the controller and log page ID SPDK_NVME_LOG_ASYMMETRIC_NAMESPACE_ACCESS.
 *
 * This function is thread safe and can be called at any point while the controller
 * is attached to the SPDK NVMe driver.
 *
 * \param ns Namespace to query.
 *
 * \return the ANA state for the given namespace.
 */
enum spdk_nvme_ana_state spdk_nvme_ns_get_ana_state(const struct spdk_nvme_ns *ns);

/**
 * Restart the SGL walk to the specified offset when the command has scattered payloads.
 *
+11 −0
Original line number Diff line number Diff line
@@ -397,6 +397,17 @@ spdk_nvme_ns_get_csi(const struct spdk_nvme_ns *ns) {
	return ns->csi;
}

uint32_t
spdk_nvme_ns_get_ana_group_id(const struct spdk_nvme_ns *ns)
{
	return ns->ana_group_id;
}

enum spdk_nvme_ana_state
spdk_nvme_ns_get_ana_state(const struct spdk_nvme_ns *ns) {
	return ns->ana_state;
}

int nvme_ns_construct(struct spdk_nvme_ns *ns, uint32_t id,
		      struct spdk_nvme_ctrlr *ctrlr)
{
+2 −0
Original line number Diff line number Diff line
@@ -111,6 +111,8 @@
	spdk_nvme_ns_get_uuid;
	spdk_nvme_ns_get_csi;
	spdk_nvme_ns_get_flags;
	spdk_nvme_ns_get_ana_group_id;
	spdk_nvme_ns_get_ana_state;

	spdk_nvme_ns_cmd_write;
	spdk_nvme_ns_cmd_writev;