Skip to content

Commit 9cd8b6c

Browse files
yuchungchengdavem330
authored andcommitted
tcp: account total lost packets properly
The retransmission refactoring patch 6869897 ("tcp: simplify tcp_mark_skb_lost") does not properly update the total lost packet counter which may break the policer mode in BBR. This patch fixes it. Fixes: 6869897 ("tcp: simplify tcp_mark_skb_lost") Reported-by: Neal Cardwell <[email protected]> Signed-off-by: Yuchung Cheng <[email protected]> Signed-off-by: Neal Cardwell <[email protected]> Signed-off-by: Eric Dumazet <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 223b32d commit 9cd8b6c

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

net/ipv4/tcp_input.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,6 +1020,14 @@ static void tcp_verify_retransmit_hint(struct tcp_sock *tp, struct sk_buff *skb)
10201020
tp->retransmit_skb_hint = skb;
10211021
}
10221022

1023+
/* Sum the number of packets on the wire we have marked as lost, and
1024+
* notify the congestion control module that the given skb was marked lost.
1025+
*/
1026+
static void tcp_notify_skb_loss_event(struct tcp_sock *tp, const struct sk_buff *skb)
1027+
{
1028+
tp->lost += tcp_skb_pcount(skb);
1029+
}
1030+
10231031
void tcp_mark_skb_lost(struct sock *sk, struct sk_buff *skb)
10241032
{
10251033
__u8 sacked = TCP_SKB_CB(skb)->sacked;
@@ -1036,10 +1044,12 @@ void tcp_mark_skb_lost(struct sock *sk, struct sk_buff *skb)
10361044
tp->retrans_out -= tcp_skb_pcount(skb);
10371045
NET_ADD_STATS(sock_net(sk), LINUX_MIB_TCPLOSTRETRANSMIT,
10381046
tcp_skb_pcount(skb));
1047+
tcp_notify_skb_loss_event(tp, skb);
10391048
}
10401049
} else {
10411050
tp->lost_out += tcp_skb_pcount(skb);
10421051
TCP_SKB_CB(skb)->sacked |= TCPCB_LOST;
1052+
tcp_notify_skb_loss_event(tp, skb);
10431053
}
10441054
}
10451055

0 commit comments

Comments
 (0)