nvmf: deduplicate transport dump opts
Signed-off-by: Jacek Kalwas <jacek.kalwas@intel.com> Change-Id: I2ce20f18597314df80e5f49ece72272f9bb6e414 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9353 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com> Community-CI: Mellanox Build Bot Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
parent
296ae15fd7
commit
220bcf7d74
@ -605,25 +605,7 @@ spdk_nvmf_tgt_write_config_json(struct spdk_json_write_ctx *w, struct spdk_nvmf_
|
||||
TAILQ_FOREACH(transport, &tgt->transports, link) {
|
||||
spdk_json_write_object_begin(w);
|
||||
spdk_json_write_named_string(w, "method", "nvmf_create_transport");
|
||||
|
||||
spdk_json_write_named_object_begin(w, "params");
|
||||
spdk_json_write_named_string(w, "trtype", transport->ops->name);
|
||||
spdk_json_write_named_uint32(w, "max_queue_depth", transport->opts.max_queue_depth);
|
||||
spdk_json_write_named_uint32(w, "max_io_qpairs_per_ctrlr",
|
||||
transport->opts.max_qpairs_per_ctrlr - 1);
|
||||
spdk_json_write_named_uint32(w, "in_capsule_data_size", transport->opts.in_capsule_data_size);
|
||||
spdk_json_write_named_uint32(w, "max_io_size", transport->opts.max_io_size);
|
||||
spdk_json_write_named_uint32(w, "io_unit_size", transport->opts.io_unit_size);
|
||||
spdk_json_write_named_uint32(w, "max_aq_depth", transport->opts.max_aq_depth);
|
||||
spdk_json_write_named_uint32(w, "num_shared_buffers", transport->opts.num_shared_buffers);
|
||||
spdk_json_write_named_uint32(w, "buf_cache_size", transport->opts.buf_cache_size);
|
||||
spdk_json_write_named_bool(w, "dif_insert_or_strip", transport->opts.dif_insert_or_strip);
|
||||
if (transport->ops->dump_opts) {
|
||||
transport->ops->dump_opts(transport, w);
|
||||
}
|
||||
spdk_json_write_named_uint32(w, "abort_timeout_sec", transport->opts.abort_timeout_sec);
|
||||
spdk_json_write_object_end(w);
|
||||
|
||||
nvmf_transport_dump_opts(transport, w, true);
|
||||
spdk_json_write_object_end(w);
|
||||
}
|
||||
|
||||
|
@ -389,6 +389,8 @@ struct spdk_nvmf_subsystem_listener *nvmf_subsystem_find_listener(
|
||||
struct spdk_nvmf_listener *nvmf_transport_find_listener(
|
||||
struct spdk_nvmf_transport *transport,
|
||||
const struct spdk_nvme_transport_id *trid);
|
||||
void nvmf_transport_dump_opts(struct spdk_nvmf_transport *transport, struct spdk_json_write_ctx *w,
|
||||
bool named);
|
||||
void nvmf_subsystem_set_ana_state(struct spdk_nvmf_subsystem *subsystem,
|
||||
const struct spdk_nvme_transport_id *trid,
|
||||
enum spdk_nvme_ana_state ana_state, uint32_t anagrpid,
|
||||
|
@ -1958,33 +1958,6 @@ rpc_nvmf_create_transport(struct spdk_jsonrpc_request *request,
|
||||
}
|
||||
SPDK_RPC_REGISTER("nvmf_create_transport", rpc_nvmf_create_transport, SPDK_RPC_RUNTIME)
|
||||
|
||||
static void
|
||||
dump_nvmf_transport(struct spdk_json_write_ctx *w, struct spdk_nvmf_transport *transport)
|
||||
{
|
||||
const struct spdk_nvmf_transport_opts *opts = spdk_nvmf_get_transport_opts(transport);
|
||||
|
||||
spdk_json_write_object_begin(w);
|
||||
|
||||
spdk_json_write_named_string(w, "trtype", spdk_nvmf_get_transport_name(transport));
|
||||
spdk_json_write_named_uint32(w, "max_queue_depth", opts->max_queue_depth);
|
||||
spdk_json_write_named_uint32(w, "max_io_qpairs_per_ctrlr", opts->max_qpairs_per_ctrlr - 1);
|
||||
spdk_json_write_named_uint32(w, "in_capsule_data_size", opts->in_capsule_data_size);
|
||||
spdk_json_write_named_uint32(w, "max_io_size", opts->max_io_size);
|
||||
spdk_json_write_named_uint32(w, "io_unit_size", opts->io_unit_size);
|
||||
spdk_json_write_named_uint32(w, "max_aq_depth", opts->max_aq_depth);
|
||||
spdk_json_write_named_uint32(w, "num_shared_buffers", opts->num_shared_buffers);
|
||||
spdk_json_write_named_uint32(w, "buf_cache_size", opts->buf_cache_size);
|
||||
spdk_json_write_named_bool(w, "dif_insert_or_strip", opts->dif_insert_or_strip);
|
||||
|
||||
if (transport->ops->dump_opts) {
|
||||
transport->ops->dump_opts(transport, w);
|
||||
}
|
||||
|
||||
spdk_json_write_named_uint32(w, "abort_timeout_sec", opts->abort_timeout_sec);
|
||||
|
||||
spdk_json_write_object_end(w);
|
||||
}
|
||||
|
||||
struct rpc_get_transport {
|
||||
char *tgt_name;
|
||||
};
|
||||
@ -2024,7 +1997,7 @@ rpc_nvmf_get_transports(struct spdk_jsonrpc_request *request,
|
||||
spdk_json_write_array_begin(w);
|
||||
transport = spdk_nvmf_transport_get_first(tgt);
|
||||
while (transport) {
|
||||
dump_nvmf_transport(w, transport);
|
||||
nvmf_transport_dump_opts(transport, w, false);
|
||||
transport = spdk_nvmf_transport_get_next(transport);
|
||||
}
|
||||
spdk_json_write_array_end(w);
|
||||
|
@ -96,6 +96,33 @@ spdk_nvmf_get_transport_opts(struct spdk_nvmf_transport *transport)
|
||||
return &transport->opts;
|
||||
}
|
||||
|
||||
void
|
||||
nvmf_transport_dump_opts(struct spdk_nvmf_transport *transport, struct spdk_json_write_ctx *w,
|
||||
bool named)
|
||||
{
|
||||
const struct spdk_nvmf_transport_opts *opts = spdk_nvmf_get_transport_opts(transport);
|
||||
|
||||
named ? spdk_json_write_named_object_begin(w, "params") : spdk_json_write_object_begin(w);
|
||||
|
||||
spdk_json_write_named_string(w, "trtype", spdk_nvmf_get_transport_name(transport));
|
||||
spdk_json_write_named_uint32(w, "max_queue_depth", opts->max_queue_depth);
|
||||
spdk_json_write_named_uint32(w, "max_io_qpairs_per_ctrlr", opts->max_qpairs_per_ctrlr - 1);
|
||||
spdk_json_write_named_uint32(w, "in_capsule_data_size", opts->in_capsule_data_size);
|
||||
spdk_json_write_named_uint32(w, "max_io_size", opts->max_io_size);
|
||||
spdk_json_write_named_uint32(w, "io_unit_size", opts->io_unit_size);
|
||||
spdk_json_write_named_uint32(w, "max_aq_depth", opts->max_aq_depth);
|
||||
spdk_json_write_named_uint32(w, "num_shared_buffers", opts->num_shared_buffers);
|
||||
spdk_json_write_named_uint32(w, "buf_cache_size", opts->buf_cache_size);
|
||||
spdk_json_write_named_bool(w, "dif_insert_or_strip", opts->dif_insert_or_strip);
|
||||
|
||||
if (transport->ops->dump_opts) {
|
||||
transport->ops->dump_opts(transport, w);
|
||||
}
|
||||
|
||||
spdk_json_write_named_uint32(w, "abort_timeout_sec", opts->abort_timeout_sec);
|
||||
spdk_json_write_object_end(w);
|
||||
}
|
||||
|
||||
spdk_nvme_transport_type_t
|
||||
spdk_nvmf_get_transport_type(struct spdk_nvmf_transport *transport)
|
||||
{
|
||||
|
@ -128,6 +128,8 @@ DEFINE_STUB(spdk_nvmf_subsystem_get_type, enum spdk_nvmf_subtype,
|
||||
(struct spdk_nvmf_subsystem *subsystem), 0);
|
||||
DEFINE_STUB(spdk_nvmf_subsystem_get_first, struct spdk_nvmf_subsystem *,
|
||||
(struct spdk_nvmf_tgt *tgt), NULL);
|
||||
DEFINE_STUB_V(nvmf_transport_dump_opts, (struct spdk_nvmf_transport *transport,
|
||||
struct spdk_json_write_ctx *w, bool named));
|
||||
|
||||
struct spdk_io_channel {
|
||||
struct spdk_thread *thread;
|
||||
|
Loading…
Reference in New Issue
Block a user