Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'io_uring-6.1-2022-10-22' of git://git.kernel.dk/linux

Pull io_uring follow-up from Jens Axboe:
"Currently the zero-copy has automatic fallback to normal transmit, and
it was decided that it'd be cleaner to return an error instead if the
socket type doesn't support it.

Zero-copy does work with UDP and TCP, it's more of a future proofing
kind of thing (eg for samba)"

* tag 'io_uring-6.1-2022-10-22' of git://git.kernel.dk/linux:
io_uring/net: fail zc sendmsg when unsupported by socket
io_uring/net: fail zc send when unsupported by socket
net: flag sockets supporting msghdr originated zerocopy

+7
+1
include/linux/net.h
··· 41 41 #define SOCK_NOSPACE 2 42 42 #define SOCK_PASSCRED 3 43 43 #define SOCK_PASSSEC 4 44 + #define SOCK_SUPPORT_ZC 5 44 45 45 46 #ifndef ARCH_HAS_SOCKET_TYPES 46 47 /**
+4
io_uring/net.c
··· 1056 1056 sock = sock_from_file(req->file); 1057 1057 if (unlikely(!sock)) 1058 1058 return -ENOTSOCK; 1059 + if (!test_bit(SOCK_SUPPORT_ZC, &sock->flags)) 1060 + return -EOPNOTSUPP; 1059 1061 1060 1062 msg.msg_name = NULL; 1061 1063 msg.msg_control = NULL; ··· 1153 1151 sock = sock_from_file(req->file); 1154 1152 if (unlikely(!sock)) 1155 1153 return -ENOTSOCK; 1154 + if (!test_bit(SOCK_SUPPORT_ZC, &sock->flags)) 1155 + return -EOPNOTSUPP; 1156 1156 1157 1157 if (req_has_async_data(req)) { 1158 1158 kmsg = req->async_data;
+1
net/ipv4/tcp.c
··· 457 457 WRITE_ONCE(sk->sk_sndbuf, READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_wmem[1])); 458 458 WRITE_ONCE(sk->sk_rcvbuf, READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_rmem[1])); 459 459 460 + set_bit(SOCK_SUPPORT_ZC, &sk->sk_socket->flags); 460 461 sk_sockets_allocated_inc(sk); 461 462 } 462 463 EXPORT_SYMBOL(tcp_init_sock);
+1
net/ipv4/udp.c
··· 1624 1624 { 1625 1625 skb_queue_head_init(&udp_sk(sk)->reader_queue); 1626 1626 sk->sk_destruct = udp_destruct_sock; 1627 + set_bit(SOCK_SUPPORT_ZC, &sk->sk_socket->flags); 1627 1628 return 0; 1628 1629 } 1629 1630