Commit 86865969 authored by Alexey Marchuk's avatar Alexey Marchuk Committed by Tomasz Zawadzki
Browse files

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: default avatarAlexey Marchuk <alexeymar@mellanox.com>
Signed-off-by: default avatarOr Gerlitz <ogerlitz@mellanox.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4211


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent f0d8396e
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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",
+5 −8
Original line number Diff line number Diff line
@@ -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;
	}

	sock = posix_sock_alloc(fd, enable_zero_copy);
	if (sock == NULL) {