Skip to contentSkip to conversation

Allow UDP cmsghdrs through io_uring

PATCH Superseded Victor Stewart 2 participants 3 messages Dec 13, 2020 – Dec 14, 2020

Subsystems (4)

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 Allow UDP cmsghdrs through io_uring

here we go, figured it out. sorry about that.

This patch adds PROTO_CMSG_DATA_ONLY to inet_dgram_ops and inet6_dgram_ops so that UDP_SEGMENT (GSO) and UDP_GRO can be used through io_uring.

GSO and GRO are vital to bring QUIC servers on par with TCP throughputs, and together offer a higher throughput gain than io_uring alone (rate of data transit
considering), thus io_uring is presently the lesser performance choice.

RE http://vger.kernel.org/lpc_net2018_talks/willemdebruijn-lpc2018-udpgso-paper-DRAFT-1.pdf,
GSO is about +~63% and GRO +~82%.

this patch closes that loophole.

net/ipv4/af_inet.c  | 1 +
net/ipv6/af_inet6.c | 1 +
net/socket.c        | 8 +++++---
3 files changed, 7 insertions(+), 3 deletions(-)
#1 lore raw

PATCH v3 1/1 Allow UDP cmsghdrs through io_uring

---
 net/ipv4/af_inet.c  | 1 +
 net/ipv6/af_inet6.c | 1 +
 net/socket.c        | 8 +++++---
 3 files changed, 7 insertions(+), 3 deletions(-)
net/ipv4/af_inet.c +1 -0
index b7260c8cef2e..c9fd5e7cfd6e 100644
@@ -1052,6 +1052,7 @@ EXPORT_SYMBOL(inet_stream_ops);
 
 const struct proto_ops inet_dgram_ops = {
 	.family		   = PF_INET,
+	.flags		   = PROTO_CMSG_DATA_ONLY,
 	.owner		   = THIS_MODULE,
 	.release	   = inet_release,
 	.bind		   = inet_bind,
net/ipv6/af_inet6.c +1 -0
index e648fbebb167..560f45009d06 100644
@@ -695,6 +695,7 @@ const struct proto_ops inet6_stream_ops = {
 
 const struct proto_ops inet6_dgram_ops = {
 	.family		   = PF_INET6,
+	.flags		   = PROTO_CMSG_DATA_ONLY,
 	.owner		   = THIS_MODULE,
 	.release	   = inet6_release,
 	.bind		   = inet6_bind,
net/socket.c +5 -3
index 6e6cccc2104f..6995835d6355 100644
@@ -2416,9 +2416,11 @@ static int ___sys_sendmsg(struct socket *sock, struct user_msghdr __user *msg,
 long __sys_sendmsg_sock(struct socket *sock, struct msghdr *msg,
 			unsigned int flags)
 {
-	/* disallow ancillary data requests from this path */
-	if (msg->msg_control || msg->msg_controllen)
-		return -EINVAL;
+	if (msg->msg_control || msg->msg_controllen) {
+		/* disallow ancillary data reqs unless cmsg is plain data */
+		if (!(sock->ops->flags & PROTO_CMSG_DATA_ONLY))
+			return -EINVAL;
+	}
 
 	return ____sys_sendmsg(sock, msg, flags, NULL, 0);
 }
Signature · 1 line
2.26.2
#2 lore raw
In reply to Victor Stewart
Quoted 4 lines · Victor Stewart

here we go, figured it out. sorry about that.

This patch adds PROTO_CMSG_DATA_ONLY to inet_dgram_ops and inet6_dgram_ops so that UDP_SEGMENT (GSO) and UDP_GRO can be used through io_uring.

The v3 patch doesn't have "Signed-off-by". You can see all the checks on patchwork:
https://patchwork.kernel.org/project/netdevbpf/patch/[email protected]/

For patches to netdev, please include the target. Here it should be net-next:
https://www.kernel.org/doc/Documentation/networking/netdev-FAQ.txt
git format-patch --subject-prefix='PATCH net-next v4' ...

Also, since this patch affects udp, it's preferred to include "udp: " in your commit's subject line. In other words, the v4 of this patch should look like the following:

[PATCH net-next v2] udp: allow UDP cmsghdrs through io_uring

Thank you

Quoted 15 lines

GSO and GRO are vital to bring QUIC servers on par with TCP throughputs, and together offer a higher throughput gain than io_uring alone (rate of data transit
considering), thus io_uring is presently the lesser performance choice.

RE http://vger.kernel.org/lpc_net2018_talks/willemdebruijn-lpc2018-udpgso-paper-DRAFT-1.pdf,
GSO is about +~63% and GRO +~82%.

this patch closes that loophole.

net/ipv4/af_inet.c  | 1 +
net/ipv6/af_inet6.c | 1 +
net/socket.c        | 8 +++++---
3 files changed, 7 insertions(+), 3 deletions(-)