diff --git a/CHANGELOG.md b/CHANGELOG.md index 6511253199..d6f0c45902 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -63,6 +63,8 @@ Added new functions `spdk_nvme_ctrlr_write_boot_partition`, `spdk_nvme_ctrlr_read_boot_partition_start` and `spdk_nvme_ctrlr_read_boot_partition_poll` to write and read the boot partitions of a controller. +Added `spdk_nvme_ctrlr_get_opts` to retrieve the current controller options. + ### dpdk Updated DPDK submodule to DPDK 21.08. diff --git a/include/spdk/nvme.h b/include/spdk/nvme.h index 83f38f6858..0c48640672 100644 --- a/include/spdk/nvme.h +++ b/include/spdk/nvme.h @@ -142,7 +142,7 @@ struct spdk_nvme_ctrlr_opts { /** * The host NQN to use when connecting to NVMe over Fabrics controllers. * - * Unused for local PCIe-attached NVMe devices. + * If empty, a default value will be used. */ char hostnqn[SPDK_NVMF_NQN_MAX_LEN + 1]; @@ -324,6 +324,13 @@ bool spdk_nvme_ctrlr_is_fabrics(struct spdk_nvme_ctrlr *ctrlr); void spdk_nvme_ctrlr_get_default_ctrlr_opts(struct spdk_nvme_ctrlr_opts *opts, size_t opts_size); +/* + * Get the options in use for a given controller. + * + * \param ctrlr Opaque handle to NVMe controller. + */ +const struct spdk_nvme_ctrlr_opts *spdk_nvme_ctrlr_get_opts(struct spdk_nvme_ctrlr *ctrlr); + /** * Reason for qpair disconnect at the transport layer. * diff --git a/lib/nvme/nvme_ctrlr.c b/lib/nvme/nvme_ctrlr.c index 0b067c5649..ff705a45fa 100644 --- a/lib/nvme/nvme_ctrlr.c +++ b/lib/nvme/nvme_ctrlr.c @@ -234,6 +234,12 @@ spdk_nvme_ctrlr_get_default_ctrlr_opts(struct spdk_nvme_ctrlr_opts *opts, size_t #undef SET_FIELD } +const struct spdk_nvme_ctrlr_opts * +spdk_nvme_ctrlr_get_opts(struct spdk_nvme_ctrlr *ctrlr) +{ + return &ctrlr->opts; +} + /** * This function will be called when the process allocates the IO qpair. * Note: the ctrlr_lock must be held when calling this function. diff --git a/lib/nvme/spdk_nvme.map b/lib/nvme/spdk_nvme.map index deff6ebbcd..048879ce72 100644 --- a/lib/nvme/spdk_nvme.map +++ b/lib/nvme/spdk_nvme.map @@ -33,6 +33,7 @@ spdk_nvme_ctrlr_is_discovery; spdk_nvme_ctrlr_is_fabrics; spdk_nvme_ctrlr_get_default_ctrlr_opts; + spdk_nvme_ctrlr_get_opts; spdk_nvme_ctrlr_set_trid; spdk_nvme_ctrlr_reset_subsystem; spdk_nvme_ctrlr_reset;