nvmf: change the function signature of spdk_nvmf_tgt_create

This is necessary to allow the spdk_nvmf_tgt structure to evolve over
time without having to further change the target API.

Change-Id: Ib0f0f9b1f190913feff0229c96df4e84b1bf35f7
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/465363
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Anil Veerabhadrappa <anil.veerabhadrappa@broadcom.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
This commit is contained in:
Seth Howell 2019-08-15 13:51:08 -07:00 committed by Jim Harris
parent 0ac5050624
commit 7d6d95db3c
5 changed files with 16 additions and 7 deletions

View File

@ -2,6 +2,12 @@
## v19.10: (Upcoming Release)
### nvmf
The `spdk_nvmf_tgt_create` function now accepts an object of type `spdk_nvmf_target_opts`
as its only parameter. This new structure contains the max_subsystems parameter previously
passed into that function.
### nvme
Added `no_shn_notification` to NVMe controller initialization options, users can enable

View File

@ -114,11 +114,11 @@ struct spdk_nvmf_transport_poll_group_stat {
/**
* Construct an NVMe-oF target.
*
* \param max_subsystems the maximum number of subsystems allowed by the target.
* \param opts a pointer to an spdk_nvmf_target_opts structure.
*
* \return a pointer to a NVMe-oF target on success, or NULL on failure.
*/
struct spdk_nvmf_tgt *spdk_nvmf_tgt_create(uint32_t max_subsystems);
struct spdk_nvmf_tgt *spdk_nvmf_tgt_create(struct spdk_nvmf_target_opts *opts);
typedef void (spdk_nvmf_tgt_destroy_done_fn)(void *ctx, int status);

View File

@ -186,6 +186,7 @@ spdk_nvmf_parse_nvmf_tgt(void)
{
int rc;
int using_deprecated_options;
struct spdk_nvmf_target_opts opts = { 0 };
if (!g_spdk_nvmf_tgt_max_subsystems) {
using_deprecated_options = spdk_nvmf_parse_tgt_max_subsystems();
@ -207,7 +208,8 @@ spdk_nvmf_parse_nvmf_tgt(void)
}
}
g_spdk_nvmf_tgt = spdk_nvmf_tgt_create(g_spdk_nvmf_tgt_max_subsystems);
opts.max_subsystems = g_spdk_nvmf_tgt_max_subsystems;
g_spdk_nvmf_tgt = spdk_nvmf_tgt_create(&opts);
g_spdk_nvmf_tgt_max_subsystems = 0;

View File

@ -219,7 +219,7 @@ spdk_nvmf_tgt_destroy_poll_group_qpairs(struct spdk_nvmf_poll_group *group)
}
struct spdk_nvmf_tgt *
spdk_nvmf_tgt_create(uint32_t max_subsystems)
spdk_nvmf_tgt_create(struct spdk_nvmf_target_opts *opts)
{
struct spdk_nvmf_tgt *tgt;
@ -228,10 +228,10 @@ spdk_nvmf_tgt_create(uint32_t max_subsystems)
return NULL;
}
if (!max_subsystems) {
if (!opts || !opts->max_subsystems) {
tgt->max_subsystems = SPDK_NVMF_DEFAULT_MAX_SUBSYSTEMS;
} else {
tgt->max_subsystems = max_subsystems;
tgt->max_subsystems = opts->max_subsystems;
}
tgt->discovery_genctr = 0;

View File

@ -264,12 +264,13 @@ static void
create_transport_test(void)
{
const struct spdk_nvmf_transport_ops *ops = NULL;
struct spdk_nvmf_target_opts tgt_opts = { 0 };
struct spdk_nvmf_transport_opts opts = { 0 };
allocate_threads(8);
set_thread(0);
g_nvmf_tgt = spdk_nvmf_tgt_create(2);
g_nvmf_tgt = spdk_nvmf_tgt_create(&tgt_opts);
SPDK_CU_ASSERT_FATAL(g_nvmf_tgt != NULL);
ops = spdk_nvmf_get_transport_ops((enum spdk_nvme_transport_type) SPDK_NVMF_TRTYPE_FC);