sock/posix: Don't return if zcopy is disabled
When socket is being created and zcopy is disabled by the config, we can return from posix_sock_alloc function before we try to set quick_ack Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com> Change-Id: I6670b8337e70ec12b18a5e6753674fbef9e95648 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6382 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Community-CI: Mellanox Build Bot Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
04474fec32
commit
0d3ad99929
@ -2,7 +2,7 @@
|
|||||||
* BSD LICENSE
|
* BSD LICENSE
|
||||||
*
|
*
|
||||||
* Copyright (c) Intel Corporation. All rights reserved.
|
* Copyright (c) Intel Corporation. All rights reserved.
|
||||||
* Copyright (c) 2020 Mellanox Technologies LTD. All rights reserved.
|
* Copyright (c) 2020, 2021 Mellanox Technologies LTD. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@ -327,15 +327,13 @@ posix_sock_alloc(int fd, bool enable_zero_copy)
|
|||||||
#if defined(SPDK_ZEROCOPY)
|
#if defined(SPDK_ZEROCOPY)
|
||||||
flag = 1;
|
flag = 1;
|
||||||
|
|
||||||
if (!enable_zero_copy || !g_spdk_posix_sock_impl_opts.enable_zerocopy_send) {
|
if (enable_zero_copy && g_spdk_posix_sock_impl_opts.enable_zerocopy_send) {
|
||||||
return sock;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Try to turn on zero copy sends */
|
/* Try to turn on zero copy sends */
|
||||||
rc = setsockopt(sock->fd, SOL_SOCKET, SO_ZEROCOPY, &flag, sizeof(flag));
|
rc = setsockopt(sock->fd, SOL_SOCKET, SO_ZEROCOPY, &flag, sizeof(flag));
|
||||||
if (rc == 0) {
|
if (rc == 0) {
|
||||||
sock->zcopy = true;
|
sock->zcopy = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__linux__)
|
#if defined(__linux__)
|
||||||
|
Loading…
Reference in New Issue
Block a user