All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pavel Begunkov <asml.silence@gmail.com>
To: netdev@vger.kernel.org
Cc: Jakub Kicinski <kuba@kernel.org>,
	"David S . Miller" <davem@davemloft.net>,
	io-uring@vger.kernel.org,
	John Fastabend <john.fastabend@gmail.com>,
	asml.silence@gmail.com, Stefan Metzmacher <metze@samba.org>
Subject: [PATCH net 4/4] net: also flag accepted sockets supporting msghdr originated zerocopy
Date: Thu, 27 Oct 2022 00:25:59 +0100	[thread overview]
Message-ID: <d8869997f50c23e8446b4c35e3800ebe4bc8e92f.1666825799.git.asml.silence@gmail.com> (raw)
In-Reply-To: <cover.1666825799.git.asml.silence@gmail.com>

From: Stefan Metzmacher <metze@samba.org>

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>
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
---
 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.38.0


  parent reply	other threads:[~2022-10-26 23:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-26 23:25 [PATCH net 0/4] a few corrections for SOCK_SUPPORT_ZC Pavel Begunkov
2022-10-26 23:25 ` [PATCH net 1/4] udp: advertise ipv6 udp support for msghdr::ubuf_info Pavel Begunkov
2022-10-26 23:25 ` [PATCH net 2/4] net: remove SOCK_SUPPORT_ZC from sockmap Pavel Begunkov
2022-10-26 23:25 ` [PATCH net 3/4] net/ulp: remove SOCK_SUPPORT_ZC from tls sockets Pavel Begunkov
2022-10-26 23:25 ` Pavel Begunkov [this message]
2022-10-29  4:50 ` [PATCH net 0/4] a few corrections for SOCK_SUPPORT_ZC patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d8869997f50c23e8446b4c35e3800ebe4bc8e92f.1666825799.git.asml.silence@gmail.com \
    --to=asml.silence@gmail.com \
    --cc=davem@davemloft.net \
    --cc=io-uring@vger.kernel.org \
    --cc=john.fastabend@gmail.com \
    --cc=kuba@kernel.org \
    --cc=metze@samba.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.