Skip to content

Commit

Permalink
net-tcp_bbr: v2: Fix missing ECT markings on retransmits for BBRv2
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 a necessary fix for BBRv2, which when using
ECN expects ECT to be set even on retransmitted packets and ACKs.
Currently CCAs like BBRv2 which can use ECN but don't "need" it
do 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>
  • Loading branch information
Adithya Abraham Philip authored and xanmod committed Jul 19, 2021
1 parent f8506cd commit 01c7795
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 @@ -368,6 +368,7 @@ static inline void tcp_dec_quickack_mode(struct sock *sk,
#define TCP_ECN_QUEUE_CWR 2
#define TCP_ECN_DEMAND_CWR 4
#define TCP_ECN_SEEN 8
#define TCP_ECN_ECT_PERMANENT 16

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

tp->fast_ack_mode = min_t(u32, 0x2U, bbr_fast_ack_mode);

if ((tp->ecn_flags & TCP_ECN_OK) && bbr_ecn_enable)
tp->ecn_flags |= TCP_ECN_ECT_PERMANENT;
}

/* Core TCP stack informs us that the given skb was just marked lost. */
Expand Down
3 changes: 2 additions & 1 deletion net/ipv4/tcp_output.c
Expand Up @@ -377,7 +377,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 01c7795

Please sign in to comment.