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 <konrad.sztyber@intel.com>
Change-Id: I96377e330351b1afb57811578acfadf05d53f49c
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/13660
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
Reviewed-by: Dong Yi <dongx.yi@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
This commit is contained in:
Konrad Sztyber 2022-07-13 13:39:05 +02:00
parent 50afaf1ee8
commit cfe2d76db2
2 changed files with 1 additions and 13 deletions

View File

@ -39,7 +39,6 @@ struct spdk_sock {
int cb_cnt; int cb_cnt;
spdk_sock_cb cb_fn; spdk_sock_cb cb_fn;
void *cb_arg; void *cb_arg;
uint32_t zerocopy_threshold;
struct { struct {
uint8_t closed : 1; uint8_t closed : 1;
uint8_t reserved : 7; uint8_t reserved : 7;
@ -302,7 +301,7 @@ end:
#if defined(MSG_ZEROCOPY) #if defined(MSG_ZEROCOPY)
/* if data size < zerocopy_threshold, remove MSG_ZEROCOPY flag */ /* 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); *flags = *flags & (~MSG_ZEROCOPY);
} }
#endif #endif

View File

@ -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 *sock;
struct spdk_sock_opts opts_local; struct spdk_sock_opts opts_local;
const char *impl_name = NULL; const char *impl_name = NULL;
struct spdk_sock_impl_opts impl_opts = {};
size_t len;
if (opts == NULL) { if (opts == NULL) {
SPDK_ERRLOG("the opts should not be NULL pointer\n"); 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->queued_reqs);
TAILQ_INIT(&sock->pending_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; return sock;
} }
} }
@ -403,8 +398,6 @@ struct spdk_sock *
spdk_sock_accept(struct spdk_sock *sock) spdk_sock_accept(struct spdk_sock *sock)
{ {
struct spdk_sock *new_sock; struct spdk_sock *new_sock;
struct spdk_sock_impl_opts impl_opts = {};
size_t len;
new_sock = sock->net_impl->accept(sock); new_sock = sock->net_impl->accept(sock);
if (new_sock != NULL) { if (new_sock != NULL) {
@ -414,10 +407,6 @@ spdk_sock_accept(struct spdk_sock *sock)
new_sock->net_impl = sock->net_impl; new_sock->net_impl = sock->net_impl;
TAILQ_INIT(&new_sock->queued_reqs); TAILQ_INIT(&new_sock->queued_reqs);
TAILQ_INIT(&new_sock->pending_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; return new_sock;