mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
bpf: Add support for changing congestion control
Added support for changing congestion control for SOCK_OPS bpf programs through the setsockopt bpf helper function. It also adds a new SOCK_OPS op, BPF_SOCK_OPS_NEEDS_ECN, that is needed for congestion controls, like dctcp, that need to enable ECN in the SYN packets. Signed-off-by: Lawrence Brakmo <brakmo@fb.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
d9925368a6
commit
91b5b21c7c
7 changed files with 58 additions and 17 deletions
|
@ -316,7 +316,8 @@ static void tcp_ecn_send_synack(struct sock *sk, struct sk_buff *skb)
|
|||
TCP_SKB_CB(skb)->tcp_flags &= ~TCPHDR_CWR;
|
||||
if (!(tp->ecn_flags & TCP_ECN_OK))
|
||||
TCP_SKB_CB(skb)->tcp_flags &= ~TCPHDR_ECE;
|
||||
else if (tcp_ca_needs_ecn(sk))
|
||||
else if (tcp_ca_needs_ecn(sk) ||
|
||||
tcp_bpf_ca_needs_ecn(sk))
|
||||
INET_ECN_xmit(sk);
|
||||
}
|
||||
|
||||
|
@ -324,8 +325,9 @@ static void tcp_ecn_send_synack(struct sock *sk, struct sk_buff *skb)
|
|||
static void tcp_ecn_send_syn(struct sock *sk, struct sk_buff *skb)
|
||||
{
|
||||
struct tcp_sock *tp = tcp_sk(sk);
|
||||
bool bpf_needs_ecn = tcp_bpf_ca_needs_ecn(sk);
|
||||
bool use_ecn = sock_net(sk)->ipv4.sysctl_tcp_ecn == 1 ||
|
||||
tcp_ca_needs_ecn(sk);
|
||||
tcp_ca_needs_ecn(sk) || bpf_needs_ecn;
|
||||
|
||||
if (!use_ecn) {
|
||||
const struct dst_entry *dst = __sk_dst_get(sk);
|
||||
|
@ -339,7 +341,7 @@ static void tcp_ecn_send_syn(struct sock *sk, struct sk_buff *skb)
|
|||
if (use_ecn) {
|
||||
TCP_SKB_CB(skb)->tcp_flags |= TCPHDR_ECE | TCPHDR_CWR;
|
||||
tp->ecn_flags = TCP_ECN_OK;
|
||||
if (tcp_ca_needs_ecn(sk))
|
||||
if (tcp_ca_needs_ecn(sk) || bpf_needs_ecn)
|
||||
INET_ECN_xmit(sk);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue