diff options
author | Sowmini Varadhan <sowmini.varadhan@oracle.com> | 2018-02-15 10:49:34 -0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-02-16 16:04:16 -0500 |
commit | 28190752c709272de3c2b6b092029da3f1614c5a (patch) | |
tree | 8c7e82c1a1d17cba40eb942f85e21ae75c90ea19 /net | |
parent | ea8994cb0118993da179af836cc72a583d75dc4b (diff) | |
download | linux-28190752c709272de3c2b6b092029da3f1614c5a.tar.bz2 |
sock: permit SO_ZEROCOPY on PF_RDS socket
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>
Diffstat (limited to 'net')
-rw-r--r-- | net/core/sock.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/net/core/sock.c b/net/core/sock.c index e90d461748f0..a1fa4a548f1b 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -1049,18 +1049,21 @@ set_rcvbuf: 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; |