From: Neal Cardwell <ncardwell.kernel@gmail.com>
To: Alexei Starovoitov <ast@kernel.org>
Cc: netdev@vger.kernel.org, Neal Cardwell <ncardwell@google.com>,
Yuchung Cheng <ycheng@google.com>, Kevin Yang <yyd@google.com>,
Eric Dumazet <edumazet@google.com>,
Lawrence Brakmo <brakmo@fb.com>
Subject: [PATCH bpf-next v2 2/5] tcp: simplify EBPF TCP_CONGESTION to always init CC
Date: Thu, 10 Sep 2020 15:20:53 -0400 [thread overview]
Message-ID: <20200910192053.2884884-3-ncardwell.kernel@gmail.com> (raw)
In-Reply-To: <20200910192053.2884884-1-ncardwell.kernel@gmail.com>
From: Neal Cardwell <ncardwell@google.com>
Now that the previous patch ensures we don't initialize the congestion
control twice, when EBPF sets the congestion control algorithm at
connection establishment we can simplify the code by simply
initializing the congestion control module at that time.
Signed-off-by: Neal Cardwell <ncardwell@google.com>
Acked-by: Yuchung Cheng <ycheng@google.com>
Acked-by: Kevin Yang <yyd@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Lawrence Brakmo <brakmo@fb.com>
---
net/core/filter.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/net/core/filter.c b/net/core/filter.c
index 47eef9a0be6a..067f6759a68f 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -4313,8 +4313,6 @@ static const struct bpf_func_proto bpf_get_socket_uid_proto = {
.arg1_type = ARG_PTR_TO_CTX,
};
-#define SOCKOPT_CC_REINIT (1 << 0)
-
static int _bpf_setsockopt(struct sock *sk, int level, int optname,
char *optval, int optlen, u32 flags)
{
@@ -4449,13 +4447,12 @@ static int _bpf_setsockopt(struct sock *sk, int level, int optname,
sk->sk_prot->setsockopt == tcp_setsockopt) {
if (optname == TCP_CONGESTION) {
char name[TCP_CA_NAME_MAX];
- bool reinit = flags & SOCKOPT_CC_REINIT;
strncpy(name, optval, min_t(long, optlen,
TCP_CA_NAME_MAX-1));
name[TCP_CA_NAME_MAX-1] = 0;
ret = tcp_set_congestion_control(sk, name, false,
- reinit, true);
+ true, true);
} else {
struct inet_connection_sock *icsk = inet_csk(sk);
struct tcp_sock *tp = tcp_sk(sk);
@@ -4652,8 +4649,6 @@ BPF_CALL_5(bpf_sock_ops_setsockopt, struct bpf_sock_ops_kern *, bpf_sock,
int, level, int, optname, char *, optval, int, optlen)
{
u32 flags = 0;
- if (bpf_sock->op > BPF_SOCK_OPS_NEEDS_ECN)
- flags |= SOCKOPT_CC_REINIT;
return _bpf_setsockopt(bpf_sock->sk, level, optname, optval, optlen,
flags);
}
--
2.28.0.526.ge36021eeef-goog
next prev parent reply other threads:[~2020-09-10 19:21 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-10 19:20 [PATCH bpf-next v2 0/5] tcp: increase flexibility of EBPF congestion control initialization Neal Cardwell
2020-09-10 19:20 ` [PATCH bpf-next v2 1/5] tcp: only init congestion control if not initialized already Neal Cardwell
2020-09-10 19:42 ` Neal Cardwell
2020-09-10 19:20 ` Neal Cardwell [this message]
-- strict thread matches above, loose matches on Subject: below --
2020-09-10 14:04 [PATCH bpf-next v2 0/5] tcp: increase flexibility of EBPF congestion control initialization Neal Cardwell
2020-09-10 14:04 ` [PATCH bpf-next v2 2/5] tcp: simplify EBPF TCP_CONGESTION to always init CC Neal Cardwell
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=20200910192053.2884884-3-ncardwell.kernel@gmail.com \
--to=ncardwell.kernel@gmail.com \
--cc=ast@kernel.org \
--cc=brakmo@fb.com \
--cc=edumazet@google.com \
--cc=ncardwell@google.com \
--cc=netdev@vger.kernel.org \
--cc=ycheng@google.com \
--cc=yyd@google.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).