Skip to content

Commit ced6823

Browse files
wdebruijdavem330
authored andcommitted
sock: remove zerocopy sockopt restriction on closed tcp state
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> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 29d1df7 commit ced6823

File tree

2 files changed

+0
-7
lines changed

2 files changed

+0
-7
lines changed

Documentation/networking/msg_zerocopy.rst

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,6 @@ this flag, a process must first signal intent by setting a socket option:
7272
if (setsockopt(fd, SOL_SOCKET, SO_ZEROCOPY, &one, sizeof(one)))
7373
error(1, errno, "setsockopt zerocopy");
7474

75-
Setting the socket option only works when the socket is in its initial
76-
(TCP_CLOSED) state. Trying to set the option for a socket returned by accept(),
77-
for example, will lead to an EBUSY error. In this case, the option should be set
78-
to the listening socket and it will be inherited by the accepted sockets.
79-
8075
Transmission
8176
------------
8277

net/core/sock.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1052,8 +1052,6 @@ int sock_setsockopt(struct socket *sock, int level, int optname,
10521052
if (sk->sk_family == PF_INET || sk->sk_family == PF_INET6) {
10531053
if (sk->sk_protocol != IPPROTO_TCP)
10541054
ret = -ENOTSUPP;
1055-
else if (sk->sk_state != TCP_CLOSE)
1056-
ret = -EBUSY;
10571055
} else if (sk->sk_family != PF_RDS) {
10581056
ret = -ENOTSUPP;
10591057
}

0 commit comments

Comments
 (0)