Commit 248c547d authored by Karl Bonde Torp's avatar Karl Bonde Torp Committed by Tomasz Zawadzki
Browse files

nvmf/tcp: add option for selecting a sock impl



Add the `sock_impl` parameter to the
`nvmf_subsystem_add_listener` RPC.
This allows a user to specify which sock_impl to use for the listener.
This only has an effect if `secure_channel` is not set.

Additionally, give an error if the user attempts to reuse a listener
with a different sock_impl.

Change-Id: I523d32722213237cdce39a0efb94388a6cc8b0b6
Signed-off-by: default avatarKarl Bonde Torp <k.torp@samsung.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/23862


Reviewed-by: default avatarJim Harris <jim.harris@samsung.com>
Community-CI: Mellanox Build Bot
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
parent 2d30d9f8
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -8349,6 +8349,7 @@ nqn | Required | string | Subsystem NQN
tgt_name                | Optional | string      | Parent NVMe-oF target name.
listen_address          | Required | object      | @ref rpc_nvmf_listen_address object
secure_channel          | Optional | bool        | Whether all connections immediately attempt to establish a secure channel
sock_impl               | Optional | string      | The socket implementation to use for the listener

#### listen_address {#rpc_nvmf_listen_address}

+8 −2
Original line number Diff line number Diff line
@@ -147,8 +147,10 @@ struct spdk_nvmf_listen_opts {
	 */
	enum spdk_nvme_ana_state ana_state;

	/* The socket implementation to use for the listener. */
	char *sock_impl;
} __attribute__((packed));
SPDK_STATIC_ASSERT(sizeof(struct spdk_nvmf_listen_opts) == 24, "Incorrect size");
SPDK_STATIC_ASSERT(sizeof(struct spdk_nvmf_listen_opts) == 32, "Incorrect size");

/**
 * Initialize listen options
@@ -768,8 +770,12 @@ struct spdk_nvmf_listener_opts {

	/* Asymmetric namespace access state */
	enum spdk_nvme_ana_state ana_state;

	/* The socket implementation to use for the listener. */
	char *sock_impl;

} __attribute__((packed));
SPDK_STATIC_ASSERT(sizeof(struct spdk_nvmf_listener_opts) == 16, "Incorrect size");
SPDK_STATIC_ASSERT(sizeof(struct spdk_nvmf_listener_opts) == 24, "Incorrect size");

/**
 * Initialize options structure for listener creation.
+1 −1
Original line number Diff line number Diff line
@@ -214,7 +214,7 @@ struct spdk_nvmf_poll_group {
struct spdk_nvmf_listener {
	struct spdk_nvme_transport_id	trid;
	uint32_t			ref;

	char				*sock_impl;
	TAILQ_ENTRY(spdk_nvmf_listener)	link;
};

+2 −2
Original line number Diff line number Diff line
@@ -6,8 +6,8 @@
SPDK_ROOT_DIR := $(abspath $(CURDIR)/../..)
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk

SO_VER := 18
SO_MINOR := 1
SO_VER := 19
SO_MINOR := 0

C_SRCS = ctrlr.c ctrlr_discovery.c ctrlr_bdev.c \
	 subsystem.c nvmf.c nvmf_rpc.c transport.c tcp.c \
+6 −1
Original line number Diff line number Diff line
@@ -714,6 +714,10 @@ nvmf_write_subsystem_config_json(struct spdk_json_write_ctx *w,

		spdk_json_write_named_bool(w, "secure_channel", listener->opts.secure_channel);

		if (listener->opts.sock_impl) {
			spdk_json_write_named_string(w, "sock_impl", listener->opts.sock_impl);
		}

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

@@ -796,11 +800,12 @@ nvmf_listen_opts_copy(struct spdk_nvmf_listen_opts *opts,
	SET_FIELD(transport_specific);
	SET_FIELD(secure_channel);
	SET_FIELD(ana_state);
	SET_FIELD(sock_impl);
#undef SET_FIELD

	/* Do not remove this statement, you should always update this statement when you adding a new field,
	 * and do not forget to add the SET_FIELD statement for your added field. */
	SPDK_STATIC_ASSERT(sizeof(struct spdk_nvmf_listen_opts) == 24, "Incorrect size");
	SPDK_STATIC_ASSERT(sizeof(struct spdk_nvmf_listen_opts) == 32, "Incorrect size");
}

void
Loading