sock/posix: Enable send zero copy for client sockets
In NVME TCP initiator zero copy is enabled for IO qpairs and disabled for admin qpairs Change-Id: Ibdf521dccde9b95ec5dd15a5eb2baed8fcf8b88e Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com> Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com> Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4211 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>
This commit is contained in:
parent
f0d8396e7a
commit
86865969ff
@ -1736,6 +1736,7 @@ nvme_tcp_ctrlr_connect_qpair(struct spdk_nvme_ctrlr *ctrlr, struct spdk_nvme_qpa
|
||||
opts.opts_size = sizeof(opts);
|
||||
spdk_sock_get_default_opts(&opts);
|
||||
opts.priority = ctrlr->trid.priority;
|
||||
opts.zcopy = !nvme_qpair_is_admin_queue(qpair);
|
||||
tqpair->sock = spdk_sock_connect_ext(ctrlr->trid.traddr, port, NULL, &opts);
|
||||
if (!tqpair->sock) {
|
||||
SPDK_ERRLOG("sock connection error of tqpair=%p with addr=%s, port=%ld\n",
|
||||
|
@ -418,6 +418,8 @@ posix_sock_create(const char *ip, int port,
|
||||
int rc, sz;
|
||||
bool enable_zero_copy = true;
|
||||
|
||||
assert(opts != NULL);
|
||||
|
||||
if (ip == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
@ -479,7 +481,7 @@ retry:
|
||||
}
|
||||
|
||||
#if defined(SO_PRIORITY)
|
||||
if (opts != NULL && opts->priority) {
|
||||
if (opts->priority) {
|
||||
rc = setsockopt(fd, SOL_SOCKET, SO_PRIORITY, &opts->priority, sizeof val);
|
||||
if (rc != 0) {
|
||||
close(fd);
|
||||
@ -554,13 +556,8 @@ retry:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (type == SPDK_SOCK_CREATE_LISTEN) {
|
||||
/* Only enable zero copy for non-loopback sockets. */
|
||||
enable_zero_copy = opts->zcopy && !sock_is_loopback(fd);
|
||||
} else if (type == SPDK_SOCK_CREATE_CONNECT) {
|
||||
/* Disable zero copy for client sockets until support is added */
|
||||
enable_zero_copy = false;
|
||||
}
|
||||
/* Only enable zero copy for non-loopback sockets. */
|
||||
enable_zero_copy = opts->zcopy && !sock_is_loopback(fd);
|
||||
|
||||
sock = posix_sock_alloc(fd, enable_zero_copy);
|
||||
if (sock == NULL) {
|
||||
|
Loading…
Reference in New Issue
Block a user