Skip to content

Commit

Permalink
sock: permit SO_ZEROCOPY on PF_RDS socket
Browse files Browse the repository at this point in the history
allow the application to set SO_ZEROCOPY on the underlying sk
of a PF_RDS socket

Signed-off-by: Sowmini Varadhan <sowmini.varadhan@oracle.com>
Acked-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Sowmini Varadhan authored and David S. Miller committed Feb 16, 2018
1 parent ea8994c commit 2819075
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions net/core/sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -1049,18 +1049,21 @@ int sock_setsockopt(struct socket *sock, int level, int optname,
break;

case SO_ZEROCOPY:
if (sk->sk_family != PF_INET && sk->sk_family != PF_INET6)
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;
else if (sk->sk_protocol != IPPROTO_TCP)
ret = -ENOTSUPP;
else if (sk->sk_state != TCP_CLOSE)
ret = -EBUSY;
else if (val < 0 || val > 1)
ret = -EINVAL;
else
sock_valbool_flag(sk, SOCK_ZEROCOPY, valbool);
break;

}
if (!ret) {
if (val < 0 || val > 1)
ret = -EINVAL;
else
sock_valbool_flag(sk, SOCK_ZEROCOPY, valbool);
break;
}
default:
ret = -ENOPROTOOPT;
break;
Expand Down

0 comments on commit 2819075

Please sign in to comment.