Commit 6db68e37 authored by Ziye Yang's avatar Ziye Yang Committed by Jim Harris
Browse files

uring: Fix the zcopy error msg for if socket is not added into group



In the master branch, always see the following error msg if
ZEROCOPY send is enabled:

"Unexpected cmsg level or type!"

The root cause is that we do not correctly call the zcopy handling,
and this patch fixes this issue.

When socket is not added into the group, there is no uring queue
initialized. so we can still use the recvmsg on ERRQUEUE to address
this.

Signed-off-by: default avatarZiye Yang <ziye.yang@intel.com>
Change-Id: Id9b98f1a2eb5bb6957cbfdf72c922daf385c17a6
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16689


Community-CI: Mellanox Build Bot
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 428b3078
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -1604,6 +1604,7 @@ uring_sock_flush(struct spdk_sock *_sock)
	int flags = sock->zcopy_send_flags;
	int retval;
	bool is_zcopy = false;
	struct spdk_uring_task *task = &sock->errqueue_task;

	/* Can't flush from within a callback or we end up with recursive calls */
	if (_sock->cb_cnt > 0) {
@@ -1646,8 +1647,15 @@ uring_sock_flush(struct spdk_sock *_sock)
	}

#ifdef SPDK_ZEROCOPY
	/* At least do once to check zero copy case */
	if (sock->zcopy && !TAILQ_EMPTY(&_sock->pending_reqs)) {
		_sock_check_zcopy(_sock, 0);
		retval = recvmsg(sock->fd, &task->msg, MSG_ERRQUEUE);
		if (retval < 0) {
			if (errno == EWOULDBLOCK || errno == EAGAIN) {
				return rc;
			}
		}
		_sock_check_zcopy(_sock, retval);;
	}
#endif