* [PATCH net-next] sock: remove zerocopy sockopt restriction on closed tcp state
@ 2018-03-14 16:49 Willem de Bruijn
2018-03-14 16:52 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Willem de Bruijn @ 2018-03-14 16:49 UTC (permalink / raw)
To: netdev; +Cc: soheil, kou, Willem de Bruijn
From: Willem de Bruijn <willemb@google.com>
Socket option SO_ZEROCOPY determines whether the kernel ignores or
processes flag MSG_ZEROCOPY on subsequent send calls. This to avoid
changing behavior for legacy processes.
Limiting the state change to closed sockets is annoying with passive
sockets and not necessary for correctness. Once created, zerocopy skbs
are processed based on their private state, not this socket flag.
Remove the constraint.
Signed-off-by: Willem de Bruijn <willemb@google.com>
---
Documentation/networking/msg_zerocopy.rst | 5 -----
net/core/sock.c | 2 --
2 files changed, 7 deletions(-)
diff --git a/Documentation/networking/msg_zerocopy.rst b/Documentation/networking/msg_zerocopy.rst
index 291a01264967..fe46d4867e2d 100644
--- a/Documentation/networking/msg_zerocopy.rst
+++ b/Documentation/networking/msg_zerocopy.rst
@@ -72,11 +72,6 @@ this flag, a process must first signal intent by setting a socket option:
if (setsockopt(fd, SOL_SOCKET, SO_ZEROCOPY, &one, sizeof(one)))
error(1, errno, "setsockopt zerocopy");
-Setting the socket option only works when the socket is in its initial
-(TCP_CLOSED) state. Trying to set the option for a socket returned by accept(),
-for example, will lead to an EBUSY error. In this case, the option should be set
-to the listening socket and it will be inherited by the accepted sockets.
-
Transmission
------------
diff --git a/net/core/sock.c b/net/core/sock.c
index 27f218bba43f..a8962d912895 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -1052,8 +1052,6 @@ int sock_setsockopt(struct socket *sock, int level, int optname,
if (sk->sk_family == PF_INET || sk->sk_family == PF_INET6) {
if (sk->sk_protocol != IPPROTO_TCP)
ret = -ENOTSUPP;
- else if (sk->sk_state != TCP_CLOSE)
- ret = -EBUSY;
} else if (sk->sk_family != PF_RDS) {
ret = -ENOTSUPP;
}
--
2.16.2.804.g6dcf76e118-goog
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net-next] sock: remove zerocopy sockopt restriction on closed tcp state
2018-03-14 16:49 [PATCH net-next] sock: remove zerocopy sockopt restriction on closed tcp state Willem de Bruijn
@ 2018-03-14 16:52 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2018-03-14 16:52 UTC (permalink / raw)
To: willemdebruijn.kernel; +Cc: netdev, soheil, kou, willemb
From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Date: Wed, 14 Mar 2018 12:49:19 -0400
> From: Willem de Bruijn <willemb@google.com>
>
> Socket option SO_ZEROCOPY determines whether the kernel ignores or
> processes flag MSG_ZEROCOPY on subsequent send calls. This to avoid
> changing behavior for legacy processes.
>
> Limiting the state change to closed sockets is annoying with passive
> sockets and not necessary for correctness. Once created, zerocopy skbs
> are processed based on their private state, not this socket flag.
>
> Remove the constraint.
>
> Signed-off-by: Willem de Bruijn <willemb@google.com>
Applied, thanks Willem.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-03-14 16:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-14 16:49 [PATCH net-next] sock: remove zerocopy sockopt restriction on closed tcp state Willem de Bruijn
2018-03-14 16:52 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).