sock/uring: Add the support for enable_quickack

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: If908173600b7803dcf0e130f185dfdaec70c71c5
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4148
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Ziye Yang 2020-09-11 01:22:24 +08:00 committed by Tomasz Zawadzki
parent 2c80fce02d
commit ebb903d46e
2 changed files with 19 additions and 1 deletions

View File

@ -109,7 +109,7 @@ struct spdk_sock_impl_opts {
bool enable_zerocopy_send; bool enable_zerocopy_send;
/** /**
* Enable or disable quick ACK. Used by posix socket module. * Enable or disable quick ACK. Used by posix and uring socket modules.
*/ */
bool enable_quickack; bool enable_quickack;
}; };

View File

@ -103,6 +103,7 @@ static struct spdk_sock_impl_opts g_spdk_uring_sock_impl_opts = {
.recv_buf_size = MIN_SO_RCVBUF_SIZE, .recv_buf_size = MIN_SO_RCVBUF_SIZE,
.send_buf_size = MIN_SO_SNDBUF_SIZE, .send_buf_size = MIN_SO_SNDBUF_SIZE,
.enable_recv_pipe = true, .enable_recv_pipe = true,
.enable_quickack = false,
}; };
#define SPDK_URING_SOCK_REQUEST_IOV(req) ((struct iovec *)((uint8_t *)req + sizeof(struct spdk_sock_request))) #define SPDK_URING_SOCK_REQUEST_IOV(req) ((struct iovec *)((uint8_t *)req + sizeof(struct spdk_sock_request)))
@ -334,6 +335,10 @@ static struct spdk_uring_sock *
uring_sock_alloc(int fd) uring_sock_alloc(int fd)
{ {
struct spdk_uring_sock *sock; struct spdk_uring_sock *sock;
#if defined(__linux__)
int flag;
int rc;
#endif
sock = calloc(1, sizeof(*sock)); sock = calloc(1, sizeof(*sock));
if (sock == NULL) { if (sock == NULL) {
@ -342,6 +347,17 @@ uring_sock_alloc(int fd)
} }
sock->fd = fd; sock->fd = fd;
#if defined(__linux__)
flag = 1;
if (g_spdk_uring_sock_impl_opts.enable_quickack) {
rc = setsockopt(sock->fd, IPPROTO_TCP, TCP_QUICKACK, &flag, sizeof(flag));
if (rc != 0) {
SPDK_ERRLOG("quickack was failed to set\n");
}
}
#endif
return sock; return sock;
} }
@ -1308,6 +1324,7 @@ uring_sock_impl_get_opts(struct spdk_sock_impl_opts *opts, size_t *len)
GET_FIELD(recv_buf_size); GET_FIELD(recv_buf_size);
GET_FIELD(send_buf_size); GET_FIELD(send_buf_size);
GET_FIELD(enable_recv_pipe); GET_FIELD(enable_recv_pipe);
GET_FIELD(enable_quickack);
#undef GET_FIELD #undef GET_FIELD
#undef FIELD_OK #undef FIELD_OK
@ -1335,6 +1352,7 @@ uring_sock_impl_set_opts(const struct spdk_sock_impl_opts *opts, size_t len)
SET_FIELD(recv_buf_size); SET_FIELD(recv_buf_size);
SET_FIELD(send_buf_size); SET_FIELD(send_buf_size);
SET_FIELD(enable_recv_pipe); SET_FIELD(enable_recv_pipe);
SET_FIELD(enable_quickack);
#undef SET_FIELD #undef SET_FIELD
#undef FIELD_OK #undef FIELD_OK