Commit 63c5e51e authored by Evgeniy Kochetov's avatar Evgeniy Kochetov Committed by Jim Harris
Browse files

sock: Add sock_impl option to disable receive pipe



Receive pipe reduces number of system calls and gives significant
performance improvement with kernel TCP stack and relatively small IO
sizes. With user space TCP/IP implementations there are no system
calls and double buffering introduced by pipe has negative impact on
performance. Receive pipe remains enabled by default.

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


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 59b5ba5c
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -107,6 +107,9 @@ Added `uring` based socket implementation, the code is located in module/sock/ur
available in Linux which requires kernel version is greater than 5.4.3. Currently, our CI pool added the uring
based socket tests for iSCSI target and also the tests for SPDK NVMe-oF tcp transport.

Added `enable_recv_pipe` socket layer option to allow disabling of double buffering on receive.
New option is used only in posix implementation.

### vhost

The function `spdk_vhost_blk_get_dev` has been removed.
+5 −2
Original line number Diff line number Diff line
@@ -6585,7 +6585,8 @@ Example response:
  "id": 1,
  "result": {
    "recv_buf_size": 2097152,
    "send_buf_size": 2097152
    "send_buf_size": 2097152,
    "enable_recv_pipe": true
  }
}
~~~
@@ -6601,6 +6602,7 @@ Name | Optional | Type | Description
impl_name               | Required | string      | Name of socket implementation, e.g. posix
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

### Response

@@ -6618,7 +6620,8 @@ Example request:
  "params": {
    "impl_name": "posix",
    "recv_buf_size": 2097152,
    "send_buf_size": 2097152
    "send_buf_size": 2097152,
    "enable_recv_pipe": false
  }
}
~~~
+5 −0
Original line number Diff line number Diff line
@@ -97,6 +97,11 @@ struct spdk_sock_impl_opts {
	 * Size of sock send buffer. Used by posix socket module.
	 */
	uint32_t send_buf_size;

	/**
	 * Enable or disable receive pipe. Used by posix socket module.
	 */
	bool enable_recv_pipe;
};

/**
+1 −0
Original line number Diff line number Diff line
@@ -775,6 +775,7 @@ spdk_sock_write_config_json(struct spdk_json_write_ctx *w)
			spdk_json_write_named_string(w, "impl_name", impl->name);
			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_object_end(w);
			spdk_json_write_object_end(w);
		} else {
+5 −0
Original line number Diff line number Diff line
@@ -73,6 +73,7 @@ rpc_sock_impl_get_options(struct spdk_jsonrpc_request *request,
	spdk_json_write_object_begin(w);
	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_object_end(w);
	spdk_jsonrpc_end_result(request, w);
	free(impl_name);
@@ -98,6 +99,10 @@ static const struct spdk_json_object_decoder rpc_sock_impl_set_opts_decoders[] =
		"send_buf_size", offsetof(struct spdk_rpc_sock_impl_set_opts, sock_opts.send_buf_size),
		spdk_json_decode_uint32, true
	},
	{
		"enable_recv_pipe", offsetof(struct spdk_rpc_sock_impl_set_opts, sock_opts.enable_recv_pipe),
		spdk_json_decode_bool, true
	},
};

static void
Loading