On Wed, Jan 17, 2018 at 7:20 AM, Sowmini Varadhan <sowmini.varad...@oracle.com> wrote: > allow the application to set SO_ZEROCOPY on the underlying sk > of a PF_RDS socket > > Signed-off-by: Sowmini Varadhan <sowmini.varad...@oracle.com> > --- > net/core/sock.c | 7 +++++++ > 1 files changed, 7 insertions(+), 0 deletions(-) > > diff --git a/net/core/sock.c b/net/core/sock.c > index 4f52677..f0f44b0 100644 > --- a/net/core/sock.c > +++ b/net/core/sock.c > @@ -1049,6 +1049,13 @@ int sock_setsockopt(struct socket *sock, int level, > int optname, > break; > > case SO_ZEROCOPY: > + if (sk->sk_family == PF_RDS) { > + if (val < 0 || val > 1) > + ret = -EINVAL; > + else > + sock_valbool_flag(sk, SOCK_ZEROCOPY, valbool); > + break; > + }
Let's integrate this in the existing logic. Perhaps something like 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_protocol != PF_RDS) { ret = -ENOTSUPP; } if (!ret) { if (val < 0 || val > 1) ret = -EINVAL; else sock_valbool_flag(sk, SOCK_ZEROCOPY, valbool); }