Skip to content

Commit

Permalink
net-tcp_bbr: v2: adjust skb tx.in_flight upon split in tcp_fragment()
Browse files Browse the repository at this point in the history
When we fragment an skb that has already been sent, we need to update
the tx.in_flight for the first skb in the resulting pair ("buff").

Because we were not updating the tx.in_flight, the tx.in_flight value
was inconsistent with the pcount of the "buff" skb (tx.in_flight would
be too high). That meant that if the "buff" skb was lost, then
bbr2_inflight_hi_from_lost_skb() would calculate an inflight_hi value
that is too high. This could result in longer queues and higher packet
loss.

Packetdrill testing verified that without this commit, when the second
half of an skb is SACKed and then later the first half of that skb is
marked lost, the calculated inflight_hi was incorrect.

Effort: net-tcp_bbr
Origin-9xx-SHA1: 385f1ddc610798fab2837f9f372857438b25f874
Change-Id: I617f8cab4e9be7a0b8e8d30b047bf8645393354d
  • Loading branch information
nealcardwell authored and xanmod committed Jun 28, 2021
1 parent 579c6a9 commit 3556006
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion net/ipv4/tcp_output.c
Expand Up @@ -1534,7 +1534,7 @@ int tcp_fragment(struct sock *sk, enum tcp_queue tcp_queue,
{
struct tcp_sock *tp = tcp_sk(sk);
struct sk_buff *buff;
int nsize, old_factor;
int nsize, old_factor, inflight_prev;
long limit;
int nlen;
u8 flags;
Expand Down Expand Up @@ -1613,6 +1613,15 @@ int tcp_fragment(struct sock *sk, enum tcp_queue tcp_queue,

if (diff)
tcp_adjust_pcount(sk, skb, diff);

/* Set buff tx.in_flight as if buff were sent by itself. */
inflight_prev = TCP_SKB_CB(skb)->tx.in_flight - old_factor;
if (WARN_ONCE(inflight_prev < 0,
"inconsistent: tx.in_flight: %u old_factor: %d",
TCP_SKB_CB(skb)->tx.in_flight, old_factor))
inflight_prev = 0;
TCP_SKB_CB(buff)->tx.in_flight = inflight_prev +
tcp_skb_pcount(buff);
}

/* Link BUFF into the send queue. */
Expand Down

0 comments on commit 3556006

Please sign in to comment.