public inbox for [email protected]
 help / color / mirror / Atom feed
* [PATCH 1/1] net: also flag accepted sockets supporting msghdr originated zerocopy
       [not found] <[email protected]>
@ 2022-10-25 13:36 ` Stefan Metzmacher
  2022-10-25 14:47   ` Pavel Begunkov
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Metzmacher @ 2022-10-25 13:36 UTC (permalink / raw)
  To: io-uring, netdev
  Cc: Stefan Metzmacher, stable, Pavel Begunkov, Jakub Kicinski,
	Jens Axboe

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: <[email protected]> # 6.0
CC: Pavel Begunkov <[email protected]>
Cc: Jakub Kicinski <[email protected]>
CC: Jens Axboe <[email protected]>
Link: https://lore.kernel.org/io-uring/[email protected]/T/#m38aa19b0b825758fb97860a38ad13122051f9dda
Signed-off-by: Stefan Metzmacher <[email protected]>
---
 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;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/1] net: also flag accepted sockets supporting msghdr originated zerocopy
  2022-10-25 13:36 ` [PATCH 1/1] net: also flag accepted sockets supporting msghdr originated zerocopy Stefan Metzmacher
@ 2022-10-25 14:47   ` Pavel Begunkov
  0 siblings, 0 replies; 2+ messages in thread
From: Pavel Begunkov @ 2022-10-25 14:47 UTC (permalink / raw)
  To: Stefan Metzmacher, io-uring, netdev; +Cc: stable, Jakub Kicinski, Jens Axboe

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: <[email protected]> # 6.0
> CC: Pavel Begunkov <[email protected]>
> Cc: Jakub Kicinski <[email protected]>
> CC: Jens Axboe <[email protected]>
> Link: https://lore.kernel.org/io-uring/[email protected]/T/#m38aa19b0b825758fb97860a38ad13122051f9dda
> Signed-off-by: Stefan Metzmacher <[email protected]>
> ---
>   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;

-- 
Pavel Begunkov

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-10-25 14:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <[email protected]>
2022-10-25 13:36 ` [PATCH 1/1] net: also flag accepted sockets supporting msghdr originated zerocopy Stefan Metzmacher
2022-10-25 14:47   ` Pavel Begunkov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox