|
|
586cba |
From cb6dc39a5e5d2d981b4b1e983042b3fbb529d5d1 Mon Sep 17 00:00:00 2001
|
|
|
586cba |
From: Leonardo Bras <leobras@redhat.com>
|
|
|
586cba |
Date: Thu, 4 Aug 2022 04:10:43 -0300
|
|
|
586cba |
Subject: [PATCH 06/11] QIOChannelSocket: Add support for MSG_ZEROCOPY + IPV6
|
|
|
586cba |
MIME-Version: 1.0
|
|
|
586cba |
Content-Type: text/plain; charset=UTF-8
|
|
|
586cba |
Content-Transfer-Encoding: 8bit
|
|
|
586cba |
|
|
|
586cba |
RH-Author: Leonardo Brás <leobras@redhat.com>
|
|
|
586cba |
RH-MergeRequest: 111: zero-copy-send fixes & improvements
|
|
|
586cba |
RH-Commit: [6/6] 2eb1aba8ebf267a6f67cfba2e489dc88619c7fd4 (LeoBras/centos-qemu-kvm)
|
|
|
586cba |
RH-Bugzilla: 2107466
|
|
|
586cba |
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
586cba |
RH-Acked-by: Thomas Huth <thuth@redhat.com>
|
|
|
586cba |
RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
|
|
|
586cba |
|
|
|
586cba |
For using MSG_ZEROCOPY, there are two steps:
|
|
|
586cba |
1 - io_writev() the packet, which enqueues the packet for sending, and
|
|
|
586cba |
2 - io_flush(), which gets confirmation that all packets got correctly sent
|
|
|
586cba |
|
|
|
586cba |
Currently, if MSG_ZEROCOPY is used to send packets over IPV6, no error will
|
|
|
586cba |
be reported in (1), but it will fail in the first time (2) happens.
|
|
|
586cba |
|
|
|
586cba |
This happens because (2) currently checks for cmsg_level & cmsg_type
|
|
|
586cba |
associated with IPV4 only, before reporting any error.
|
|
|
586cba |
|
|
|
586cba |
Add checks for cmsg_level & cmsg_type associated with IPV6, and thus enable
|
|
|
586cba |
support for MSG_ZEROCOPY + IPV6
|
|
|
586cba |
|
|
|
586cba |
Fixes: 2bc58ffc29 ("QIOChannelSocket: Implement io_writev zero copy flag & io_flush for CONFIG_LINUX")
|
|
|
586cba |
Signed-off-by: Leonardo Bras <leobras@redhat.com>
|
|
|
586cba |
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
|
|
|
586cba |
(cherry picked from commit 5258a7e2c0677d16e9e1d06845f60171adf0b290)
|
|
|
586cba |
Signed-off-by: Leonardo Bras <leobras@redhat.com>
|
|
|
586cba |
---
|
|
|
586cba |
io/channel-socket.c | 4 ++--
|
|
|
586cba |
1 file changed, 2 insertions(+), 2 deletions(-)
|
|
|
586cba |
|
|
|
586cba |
diff --git a/io/channel-socket.c b/io/channel-socket.c
|
|
|
586cba |
index eb7baa2184..efd5f60808 100644
|
|
|
586cba |
--- a/io/channel-socket.c
|
|
|
586cba |
+++ b/io/channel-socket.c
|
|
|
586cba |
@@ -747,8 +747,8 @@ static int qio_channel_socket_flush(QIOChannel *ioc,
|
|
|
586cba |
}
|
|
|
586cba |
|
|
|
586cba |
cm = CMSG_FIRSTHDR(&msg;;
|
|
|
586cba |
- if (cm->cmsg_level != SOL_IP &&
|
|
|
586cba |
- cm->cmsg_type != IP_RECVERR) {
|
|
|
586cba |
+ if (cm->cmsg_level != SOL_IP && cm->cmsg_type != IP_RECVERR &&
|
|
|
586cba |
+ cm->cmsg_level != SOL_IPV6 && cm->cmsg_type != IPV6_RECVERR) {
|
|
|
586cba |
error_setg_errno(errp, EPROTOTYPE,
|
|
|
586cba |
"Wrong cmsg in errqueue");
|
|
|
586cba |
return -1;
|
|
|
586cba |
--
|
|
|
586cba |
2.31.1
|
|
|
586cba |
|