Commit 29f31a90 authored by Evgeniy Kochetov's avatar Evgeniy Kochetov Committed by Jim Harris
Browse files

sock: Add sock_impl option to disable zero copy on send



Zero copy send can cause performance degradation with small
payloads. This patch adds an option to disable it if required. By
default zero copy is enabled.

Signed-off-by: default avatarEvgeniy Kochetov <evgeniik@mellanox.com>
Change-Id: I14f2b21ad375e770cb08f850360898bac675b351
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/3344


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
parent 63c5e51e
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -110,6 +110,9 @@ based socket tests for iSCSI target and also the tests for SPDK NVMe-oF tcp tran
Added `enable_recv_pipe` socket layer option to allow disabling of double buffering on receive.
New option is used only in posix implementation.

Added `enable_zerocopy_send` socket layer option to allow disabling of zero copy flow on send.
New option is used only in posix implementation.

### vhost

The function `spdk_vhost_blk_get_dev` has been removed.
+3 −0
Original line number Diff line number Diff line
@@ -6587,6 +6587,7 @@ Example response:
    "recv_buf_size": 2097152,
    "send_buf_size": 2097152,
    "enable_recv_pipe": true
    "enable_zerocopy_send": true
  }
}
~~~
@@ -6603,6 +6604,7 @@ impl_name | Required | string | Name of socket implementation
recv_buf_size           | Optional | number      | Size of socket receive buffer in bytes
send_buf_size           | Optional | number      | Size of socket send buffer in bytes
enable_recv_pipe        | Optional | boolean     | Enable or disable receive pipe
enable_zerocopy_send    | Optional | boolean     | Enable or disable zero copy on send

### Response

@@ -6622,6 +6624,7 @@ Example request:
    "recv_buf_size": 2097152,
    "send_buf_size": 2097152,
    "enable_recv_pipe": false
    "enable_zerocopy_send": true
  }
}
~~~
+5 −0
Original line number Diff line number Diff line
@@ -102,6 +102,11 @@ struct spdk_sock_impl_opts {
	 * Enable or disable receive pipe. Used by posix socket module.
	 */
	bool enable_recv_pipe;

	/**
	 * Enable or disable use of zero copy flow on send. Used by posix socket module.
	 */
	bool enable_zerocopy_send;
};

/**
+1 −0
Original line number Diff line number Diff line
@@ -776,6 +776,7 @@ spdk_sock_write_config_json(struct spdk_json_write_ctx *w)
			spdk_json_write_named_uint32(w, "recv_buf_size", opts.recv_buf_size);
			spdk_json_write_named_uint32(w, "send_buf_size", opts.send_buf_size);
			spdk_json_write_named_bool(w, "enable_recv_pipe", opts.enable_recv_pipe);
			spdk_json_write_named_bool(w, "enable_zerocopy_send", opts.enable_zerocopy_send);
			spdk_json_write_object_end(w);
			spdk_json_write_object_end(w);
		} else {
+5 −0
Original line number Diff line number Diff line
@@ -74,6 +74,7 @@ rpc_sock_impl_get_options(struct spdk_jsonrpc_request *request,
	spdk_json_write_named_uint32(w, "recv_buf_size", sock_opts.recv_buf_size);
	spdk_json_write_named_uint32(w, "send_buf_size", sock_opts.send_buf_size);
	spdk_json_write_named_bool(w, "enable_recv_pipe", sock_opts.enable_recv_pipe);
	spdk_json_write_named_bool(w, "enable_zerocopy_send", sock_opts.enable_zerocopy_send);
	spdk_json_write_object_end(w);
	spdk_jsonrpc_end_result(request, w);
	free(impl_name);
@@ -103,6 +104,10 @@ static const struct spdk_json_object_decoder rpc_sock_impl_set_opts_decoders[] =
		"enable_recv_pipe", offsetof(struct spdk_rpc_sock_impl_set_opts, sock_opts.enable_recv_pipe),
		spdk_json_decode_bool, true
	},
	{
		"enable_zerocopy_send", offsetof(struct spdk_rpc_sock_impl_set_opts, sock_opts.enable_zerocopy_send),
		spdk_json_decode_bool, true
	},
};

static void
Loading