From cfe2d76db2c54fdc998d0f7bf5e9f5b2551deee9 Mon Sep 17 00:00:00 2001 From: Konrad Sztyber Date: Wed, 13 Jul 2022 13:39:05 +0200 Subject: [PATCH] sock: remove zerocopy_threshold from spdk_sock Now that spdk_sock has impl_opts, we no longer need to store a copy of impl_opts.zerocopy_threshold in spdk_sock. Signed-off-by: Konrad Sztyber Change-Id: I96377e330351b1afb57811578acfadf05d53f49c Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/13660 Tested-by: SPDK CI Jenkins Reviewed-by: Ben Walker Reviewed-by: Jim Harris Reviewed-by: Aleksey Marchuk Reviewed-by: Dong Yi Community-CI: Broadcom CI Community-CI: Mellanox Build Bot --- include/spdk_internal/sock.h | 3 +-- lib/sock/sock.c | 11 ----------- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/include/spdk_internal/sock.h b/include/spdk_internal/sock.h index dae79f455..22f1785ef 100644 --- a/include/spdk_internal/sock.h +++ b/include/spdk_internal/sock.h @@ -39,7 +39,6 @@ struct spdk_sock { int cb_cnt; spdk_sock_cb cb_fn; void *cb_arg; - uint32_t zerocopy_threshold; struct { uint8_t closed : 1; uint8_t reserved : 7; @@ -302,7 +301,7 @@ end: #if defined(MSG_ZEROCOPY) /* if data size < zerocopy_threshold, remove MSG_ZEROCOPY flag */ - if (total < _sock->zerocopy_threshold && flags != NULL) { + if (total < _sock->impl_opts.zerocopy_threshold && flags != NULL) { *flags = *flags & (~MSG_ZEROCOPY); } #endif diff --git a/lib/sock/sock.c b/lib/sock/sock.c index 75e3ff43d..ac9d4d65a 100644 --- a/lib/sock/sock.c +++ b/lib/sock/sock.c @@ -310,8 +310,6 @@ spdk_sock_connect_ext(const char *ip, int port, char *_impl_name, struct spdk_so struct spdk_sock *sock; struct spdk_sock_opts opts_local; const char *impl_name = NULL; - struct spdk_sock_impl_opts impl_opts = {}; - size_t len; if (opts == NULL) { SPDK_ERRLOG("the opts should not be NULL pointer\n"); @@ -339,9 +337,6 @@ spdk_sock_connect_ext(const char *ip, int port, char *_impl_name, struct spdk_so TAILQ_INIT(&sock->queued_reqs); TAILQ_INIT(&sock->pending_reqs); - len = sizeof(struct spdk_sock_impl_opts); - spdk_sock_impl_get_opts(impl->name, &impl_opts, &len); - sock->zerocopy_threshold = impl_opts.zerocopy_threshold; return sock; } } @@ -403,8 +398,6 @@ struct spdk_sock * spdk_sock_accept(struct spdk_sock *sock) { struct spdk_sock *new_sock; - struct spdk_sock_impl_opts impl_opts = {}; - size_t len; new_sock = sock->net_impl->accept(sock); if (new_sock != NULL) { @@ -414,10 +407,6 @@ spdk_sock_accept(struct spdk_sock *sock) new_sock->net_impl = sock->net_impl; TAILQ_INIT(&new_sock->queued_reqs); TAILQ_INIT(&new_sock->pending_reqs); - - len = sizeof(struct spdk_sock_impl_opts); - spdk_sock_impl_get_opts(sock->net_impl->name, &impl_opts, &len); - new_sock->zerocopy_threshold = impl_opts.zerocopy_threshold; } return new_sock;