[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAF=yD-JVSyCH_whLTpko0zwOyDsoEv2nuTRYf2e1uBAwwMRhig@mail.gmail.com>
Date: Wed, 17 Jan 2018 19:03:53 -0500
From: Willem de Bruijn <willemdebruijn.kernel@...il.com>
To: Sowmini Varadhan <sowmini.varadhan@...cle.com>
Cc: Network Development <netdev@...r.kernel.org>,
David Miller <davem@...emloft.net>, rds-devel@....oracle.com,
santosh.shilimkar@...cle.com
Subject: Re: [PATCH RFC net-next 4/6] sock: permit SO_ZEROCOPY on PF_RDS socket
On Wed, Jan 17, 2018 at 7:20 AM, Sowmini Varadhan
<sowmini.varadhan@...cle.com> wrote:
> allow the application to set SO_ZEROCOPY on the underlying sk
> of a PF_RDS socket
>
> Signed-off-by: Sowmini Varadhan <sowmini.varadhan@...cle.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);
}
Powered by blists - more mailing lists