Commit aa1d0398 authored by Konrad Sztyber's avatar Konrad Sztyber Committed by Jim Harris
Browse files

nvmf: zero-copy enable flag in transport opts



It makes it possible for the user to specify whether a transport should
try to use zero-copy to execute requests when possible.

Signed-off-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I40a92b0d7a6707f4c9292795f380846acb227200
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/10780


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent 39b7e10f
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -6035,6 +6035,7 @@ abort_timeout_sec | Optional | number | Abort execution timeout value
no_wr_batching              | Optional | boolean | Disable work requests batching (RDMA only)
control_msg_num             | Optional | number  | The number of control messages per poll group (TCP only)
disable_mappable_bar0       | Optional | boolean | disable client mmap() of BAR0 (VFIO-USER only)
zcopy                       | Optional | boolean | Use zero-copy operations if the underlying bdev supports them

#### Example

+2 −0
Original line number Diff line number Diff line
@@ -114,6 +114,8 @@ struct spdk_nvmf_transport_opts {
	 */
	size_t opts_size;
	uint32_t acceptor_poll_rate;
	/* Use zero-copy operations if the underlying bdev supports them */
	bool zcopy;
};

struct spdk_nvmf_listen_opts {
+5 −0
Original line number Diff line number Diff line
@@ -3695,10 +3695,15 @@ nvmf_ctrlr_process_io_fused_cmd(struct spdk_nvmf_request *req, struct spdk_bdev
bool
nvmf_ctrlr_use_zcopy(struct spdk_nvmf_request *req)
{
	struct spdk_nvmf_transport *transport = req->qpair->transport;
	struct spdk_nvmf_ns *ns;

	req->zcopy_phase = NVMF_ZCOPY_PHASE_NONE;

	if (!transport->opts.zcopy) {
		return false;
	}

	if (nvmf_qpair_is_admin_queue(req->qpair)) {
		/* Admin queue */
		return false;
+4 −0
Original line number Diff line number Diff line
@@ -1928,6 +1928,10 @@ static const struct spdk_json_object_decoder nvmf_rpc_create_transport_decoder[]
		"abort_timeout_sec", offsetof(struct nvmf_rpc_create_transport_ctx, opts.abort_timeout_sec),
		spdk_json_decode_uint32, true
	},
	{
		"zcopy", offsetof(struct nvmf_rpc_create_transport_ctx, opts.zcopy),
		spdk_json_decode_bool, true
	},
	{
		"tgt_name", offsetof(struct nvmf_rpc_create_transport_ctx, tgt_name),
		spdk_json_decode_string, true
+2 −0
Original line number Diff line number Diff line
@@ -114,6 +114,7 @@ nvmf_transport_dump_opts(struct spdk_nvmf_transport *transport, struct spdk_json
	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);
	spdk_json_write_named_bool(w, "zcopy", opts->zcopy);

	if (transport->ops->dump_opts) {
		transport->ops->dump_opts(transport, w);
@@ -182,6 +183,7 @@ static void nvmf_transport_opts_copy(struct spdk_nvmf_transport_opts *opts,
	SET_FIELD(association_timeout);
	SET_FIELD(transport_specific);
	SET_FIELD(acceptor_poll_rate);
	SET_FIELD(zcopy);

	/* 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. */
Loading