bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexei Starovoitov <alexei.starovoitov@gmail.com>
To: Prankur gupta <prankgup@fb.com>
Cc: bpf <bpf@vger.kernel.org>, Kernel Team <kernel-team@fb.com>,
	Network Development <netdev@vger.kernel.org>
Subject: Re: [PATCH bpf-next 1/2] bpf: Adds support for setting window clamp
Date: Mon, 30 Nov 2020 17:34:03 -0800	[thread overview]
Message-ID: <CAADnVQJK=s5aovsKoQT=qF1novjM4VMyZCGG_6BEenQQWPbTQw@mail.gmail.com> (raw)
In-Reply-To: <20201201000339.3310760-2-prankgup@fb.com>

On Mon, Nov 30, 2020 at 4:07 PM Prankur gupta <prankgup@fb.com> wrote:
>
> Adds a new bpf_setsockopt for TCP sockets, TCP_BPF_WINDOW_CLAMP,
> which sets the maximum receiver window size. It will be useful for
> limiting receiver window based on RTT.
>
> Signed-off-by: Prankur gupta <prankgup@fb.com>
> ---
>  net/core/filter.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/net/core/filter.c b/net/core/filter.c
> index 2ca5eecebacf..cb006962b677 100644
> --- a/net/core/filter.c
> +++ b/net/core/filter.c
> @@ -4910,6 +4910,14 @@ static int _bpf_setsockopt(struct sock *sk, int level, int optname,
>                                 tp->notsent_lowat = val;
>                                 sk->sk_write_space(sk);
>                                 break;
> +                       case TCP_WINDOW_CLAMP:
> +                               if (val <= 0)
> +                                       ret = -EINVAL;

Why zero is not allowed?
Normal setsockopt() allows it.

> +                               else
> +                                       tp->window_clamp =
> +                                               max_t(int, val,
> +                                                     SOCK_MIN_RCVBUF / 2);
> +                               break;
>                         default:
>                                 ret = -EINVAL;
>                         }
> --
> 2.24.1
>

  reply	other threads:[~2020-12-01  1:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-01  0:03 [PATCH bpf-next 0/2] Add support to set window_clamp from bpf setsockops Prankur gupta
2020-12-01  0:03 ` [PATCH bpf-next 1/2] bpf: Adds support for setting window clamp Prankur gupta
2020-12-01  1:34   ` Alexei Starovoitov [this message]
2020-12-01 20:22     ` [PATCH bpf-next 0/2] Add support to set window_clamp from bpf setsockops Prankur gupta
2020-12-02  1:30       ` Andrii Nakryiko
2020-12-01  0:03 ` [PATCH bpf-next 2/2] selftests/bpf: Add Userspace tests for TCP_WINDOW_CLAMP Prankur gupta
2020-12-01 16:43 [PATCH v2 bpf-next 0/2] Add support to set window_clamp from bpf setsockops Prankur gupta
2020-12-01 16:43 ` [PATCH bpf-next 1/2] bpf: Adds support for setting window clamp Prankur gupta
2020-12-02  2:14   ` Alexei Starovoitov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAADnVQJK=s5aovsKoQT=qF1novjM4VMyZCGG_6BEenQQWPbTQw@mail.gmail.com' \
    --to=alexei.starovoitov@gmail.com \
    --cc=bpf@vger.kernel.org \
    --cc=kernel-team@fb.com \
    --cc=netdev@vger.kernel.org \
    --cc=prankgup@fb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).