diff mbox series

[1/1] net: also flag accepted sockets supporting msghdr originated zerocopy

Message ID 8c1ce5e77d3ec52c94d8bd1269ea1bb900c42019.1666704904.git.metze@samba.org (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series [1/1] net: also flag accepted sockets supporting msghdr originated zerocopy | expand

Checks

Context Check Description
netdev/tree_selection success Guessed tree name to be net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 3 this patch: 3
netdev/cc_maintainers warning 5 maintainers not CCed: dsahern@kernel.org davem@davemloft.net yoshfuji@linux-ipv6.org edumazet@google.com pabeni@redhat.com
netdev/build_clang success Errors and warnings before: 5 this patch: 5
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 3 this patch: 3
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Stefan Metzmacher Oct. 25, 2022, 1:36 p.m. UTC
Without this only the client initiated tcp sockets have SOCK_SUPPORT_ZC.
The listening socket on the server also has it, but the accepted
connections didn't, which meant IORING_OP_SEND[MSG]_ZC will always
fails with -EOPNOTSUPP.

Fixes: e993ffe3da4b ("net: flag sockets supporting msghdr originated zerocopy")
Cc: <stable@vger.kernel.org> # 6.0
CC: Pavel Begunkov <asml.silence@gmail.com>
Cc: Jakub Kicinski <kuba@kernel.org>
CC: Jens Axboe <axboe@kernel.dk>
Link: https://lore.kernel.org/io-uring/20221024141503.22b4e251@kernel.org/T/#m38aa19b0b825758fb97860a38ad13122051f9dda
Signed-off-by: Stefan Metzmacher <metze@samba.org>
---
 net/ipv4/af_inet.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Pavel Begunkov Oct. 25, 2022, 2:47 p.m. UTC | #1
On 10/25/22 14:36, Stefan Metzmacher wrote:
> Without this only the client initiated tcp sockets have SOCK_SUPPORT_ZC.
> The listening socket on the server also has it, but the accepted
> connections didn't, which meant IORING_OP_SEND[MSG]_ZC will always
> fails with -EOPNOTSUPP.

Jakub pointed out a bunch of places yesterday that we have to
consider. I'll pick it up and resend with the rest. Thanks


> Fixes: e993ffe3da4b ("net: flag sockets supporting msghdr originated zerocopy")
> Cc: <stable@vger.kernel.org> # 6.0
> CC: Pavel Begunkov <asml.silence@gmail.com>
> Cc: Jakub Kicinski <kuba@kernel.org>
> CC: Jens Axboe <axboe@kernel.dk>
> Link: https://lore.kernel.org/io-uring/20221024141503.22b4e251@kernel.org/T/#m38aa19b0b825758fb97860a38ad13122051f9dda
> Signed-off-by: Stefan Metzmacher <metze@samba.org>
> ---
>   net/ipv4/af_inet.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
> index 3dd02396517d..4728087c42a5 100644
> --- a/net/ipv4/af_inet.c
> +++ b/net/ipv4/af_inet.c
> @@ -754,6 +754,8 @@ int inet_accept(struct socket *sock, struct socket *newsock, int flags,
>   		  (TCPF_ESTABLISHED | TCPF_SYN_RECV |
>   		  TCPF_CLOSE_WAIT | TCPF_CLOSE)));
>   
> +	if (test_bit(SOCK_SUPPORT_ZC, &sock->flags))
> +		set_bit(SOCK_SUPPORT_ZC, &newsock->flags);
>   	sock_graft(sk2, newsock);
>   
>   	newsock->state = SS_CONNECTED;
diff mbox series

Patch

diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index 3dd02396517d..4728087c42a5 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -754,6 +754,8 @@  int inet_accept(struct socket *sock, struct socket *newsock, int flags,
 		  (TCPF_ESTABLISHED | TCPF_SYN_RECV |
 		  TCPF_CLOSE_WAIT | TCPF_CLOSE)));
 
+	if (test_bit(SOCK_SUPPORT_ZC, &sock->flags))
+		set_bit(SOCK_SUPPORT_ZC, &newsock->flags);
 	sock_graft(sk2, newsock);
 
 	newsock->state = SS_CONNECTED;