Commit be6a01ef authored by Jonathan Teh's avatar Jonathan Teh Committed by Tomasz Zawadzki
Browse files

nvmf: Allow configurable controller ID range



Add {min,max}_cntlid to spdk_nvmf_subsystem, defaulting to 1 and
0xFFEF, respectively, and add nvmf_subsystem_set_cntlid_range() to
allow the controller range to be configured in the range [min_cntlid,
max_cntlid].

Also add {min,max}_cntlid to the nvmf_create_subsystem RPC to allow
the controller ID range to be specified when creating an nvmf
subsystem.

Signed-off-by: default avatarJonathan Teh <jonathan.teh@mayadata.io>
Change-Id: I936db3bb0c9a38569063a6fd3c11df262dfad776
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7322


Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: default avatarAleksey Marchuk <alexeymar@mellanox.com>
parent acca0749
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -7,6 +7,10 @@
Remove the probe_cb parameter in spdk_idxd_probe function. And remove the definition
of spdk_idxd_probe_cb function pointer. It should be implemented in idxd_user.c.

### nvmf

Added `min_cntlid` and `max_cntlid` to `nvmf_create_subsystem` to limit the controller ID range.

## v21.04:

### accel
+2 −0
Original line number Diff line number Diff line
@@ -5911,6 +5911,8 @@ model_number | Optional | string | Model number of virtual contr
max_namespaces          | Optional | number      | Maximum number of namespaces that can be attached to the subsystem. Default: 0 (Unlimited)
allow_any_host          | Optional | boolean     | Allow any host (`true`) or enforce allowed host list (`false`). Default: `false`.
ana_reporting           | Optional | boolean     | Enable ANA reporting feature (default: `false`).
min_cntlid              | Optional | number      | Minimum controller ID. Default: 1
max_cntlid              | Optional | number      | Maximum controller ID. Default: 0xffef

### Example

+18 −0
Original line number Diff line number Diff line
@@ -844,6 +844,24 @@ struct spdk_nvmf_ns *spdk_nvmf_subsystem_get_ns(struct spdk_nvmf_subsystem *subs
 */
uint32_t spdk_nvmf_subsystem_get_max_namespaces(const struct spdk_nvmf_subsystem *subsystem);

/**
 * Get the minimum controller ID allowed in a subsystem.
 *
 * \param subsystem Subsystem to query.
 *
 * \return Minimum controller ID allowed in the subsystem.
 */
uint16_t spdk_nvmf_subsystem_get_min_cntlid(const struct spdk_nvmf_subsystem *subsystem);

/**
 * Get the maximum controller ID allowed in a subsystem.
 *
 * \param subsystem Subsystem to query.
 *
 * \return Maximum controller ID allowed in the subsystem.
 */
uint16_t spdk_nvmf_subsystem_get_max_cntlid(const struct spdk_nvmf_subsystem *subsystem);

/**
 * Get a namespace's NSID.
 *
+1 −1
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@ SPDK_ROOT_DIR := $(abspath $(CURDIR)/../..)
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk

SO_VER := 8
SO_MINOR := 0
SO_MINOR := 1

C_SRCS = ctrlr.c ctrlr_discovery.c ctrlr_bdev.c \
	 subsystem.c nvmf.c nvmf_rpc.c transport.c tcp.c
+3 −0
Original line number Diff line number Diff line
@@ -450,6 +450,9 @@ nvmf_write_subsystem_config_json(struct spdk_json_write_ctx *w,
		spdk_json_write_named_uint32(w, "max_namespaces", max_namespaces);
	}

	spdk_json_write_named_uint32(w, "min_cntlid", spdk_nvmf_subsystem_get_min_cntlid(subsystem));
	spdk_json_write_named_uint32(w, "max_cntlid", spdk_nvmf_subsystem_get_max_cntlid(subsystem));

	/*     } "params" */
	spdk_json_write_object_end(w);

Loading