Message ID | 20201201000339.3310760-2-prankgup@fb.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | BPF |
Headers | show |
Series | Add support to set window_clamp from bpf setsockops | expand |
Context | Check | Description |
---|---|---|
netdev/cover_letter | success | Link |
netdev/fixes_present | success | Link |
netdev/patch_count | success | Link |
netdev/tree_selection | success | Clearly marked for bpf-next |
netdev/subject_prefix | success | Link |
netdev/source_inline | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Link |
netdev/module_param | success | Was 0 now: 0 |
netdev/build_32bit | success | Errors and warnings before: 45 this patch: 45 |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/verify_fixes | success | Link |
netdev/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 14 lines checked |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 45 this patch: 45 |
netdev/header_inline | success | Link |
netdev/stable | success | Stable not CCed |
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 >
From: Prankur Gupta <prankgup@fb.com>
No reason in particular.
Updated the code (patch v2) to have logic as tcp setsockopt for tCP_WINDOW_CLAMP.
PS: First time trying git send-em,ail, pleas elet me know if this is not the right way to reply.
On Tue, Dec 1, 2020 at 12:24 PM Prankur gupta <prankgup@fb.com> wrote: > > From: Prankur Gupta <prankgup@fb.com> > > No reason in particular. > Updated the code (patch v2) to have logic as tcp setsockopt for tCP_WINDOW_CLAMP. > > PS: First time trying git send-em,ail, pleas elet me know if this is not the right way to reply. I use send-email for sending patches only, I reply from Gmail or Thunderbird (from work account). The latter has a plain text mode, while Outlook doesn't. But also, you need to add v2 to each patch, not just cover letter. You can do that when using `git format-patch --subject-prefix='PATCH v2 bpf-next' ...`.
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; + else + tp->window_clamp = + max_t(int, val, + SOCK_MIN_RCVBUF / 2); + break; default: ret = -EINVAL; }
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(+)