Skip to content

Commit

Permalink
net-tcp_bbr: v3: ensure ECN-enabled BBR flows set ECT on retransmits
Browse files Browse the repository at this point in the history
Adds a new flag TCP_ECN_ECT_PERMANENT that is used by CCAs to
indicate that retransmitted packets and pure ACKs must have the
ECT bit set. This is necessary for BBR, which when using
ECN expects ECT to be set even on retransmitted packets and ACKs.

Previous to this addition of TCP_ECN_ECT_PERMANENT, CCAs which can use
ECN but don't "need" it did not have a way to indicate that ECT should
be set on retransmissions/ACKs.

Signed-off-by: Adithya Abraham Philip <abrahamphilip@google.com>
Signed-off-by: Neal Cardwell <ncardwell@google.com>
Change-Id: I8b048eaab35e136fe6501ef6cd89fd9faa15e6d2
Signed-off-by: Alexandre Frade <kernel@xanmod.org>
  • Loading branch information
Adithya Abraham Philip authored and xanmod committed Aug 16, 2023
1 parent 8e2c994 commit 9ea1c2d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions include/net/tcp.h
Expand Up @@ -376,6 +376,7 @@ static inline void tcp_dec_quickack_mode(struct sock *sk,
#define TCP_ECN_DEMAND_CWR 4
#define TCP_ECN_SEEN 8
#define TCP_ECN_LOW 16
#define TCP_ECN_ECT_PERMANENT 32

enum tcp_tw_status {
TCP_TW_SUCCESS = 0,
Expand Down
3 changes: 3 additions & 0 deletions net/ipv4/tcp_bbr.c
Expand Up @@ -2151,6 +2151,9 @@ static void bbr_init(struct sock *sk)
bbr->plb.pause_until = 0;

tp->fast_ack_mode = bbr_fast_ack_mode ? 1 : 0;

if (bbr_can_use_ecn(sk))
tp->ecn_flags |= TCP_ECN_ECT_PERMANENT;
}

/* BBR marks the current round trip as a loss round. */
Expand Down
3 changes: 2 additions & 1 deletion net/ipv4/tcp_output.c
Expand Up @@ -381,7 +381,8 @@ static void tcp_ecn_send(struct sock *sk, struct sk_buff *skb,
th->cwr = 1;
skb_shinfo(skb)->gso_type |= SKB_GSO_TCP_ECN;
}
} else if (!tcp_ca_needs_ecn(sk)) {
} else if (!(tp->ecn_flags & TCP_ECN_ECT_PERMANENT) &&
!tcp_ca_needs_ecn(sk)) {
/* ACK or retransmitted segment: clear ECT|CE */
INET_ECN_dontxmit(sk);
}
Expand Down

0 comments on commit 9ea1c2d

Please sign in to comment.