diff --git a/lib/nvme/nvme_tcp.c b/lib/nvme/nvme_tcp.c index ee4177e72..aaf56ebb9 100644 --- a/lib/nvme/nvme_tcp.c +++ b/lib/nvme/nvme_tcp.c @@ -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", diff --git a/module/sock/posix/posix.c b/module/sock/posix/posix.c index 5c4cfa095..7602a7dd7 100644 --- a/module/sock/posix/posix.c +++ b/module/sock/posix/posix.c @@ -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) {