diff options
author | Yuchung Cheng <ycheng@google.com> | 2018-04-18 02:18:47 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-04-19 13:05:16 -0400 |
commit | a77fa0104abd4348b9ae06ab0afe218ceb2455ea (patch) | |
tree | eee8f314ed38200cf7a9525ead4bc4bcc5a9bd7a /net/ipv4/tcp_input.c | |
parent | bef5767f37cfe42b1cf1ae60f01cfb4e16a7a2b8 (diff) |
tcp: new helper to calculate newly delivered
Add new helper tcp_newly_delivered() to prepare the ECN accounting change.
Signed-off-by: Yuchung Cheng <ycheng@google.com>
Reviewed-by: Neal Cardwell <ncardwell@google.com>
Reviewed-by: Soheil Hassas Yeganeh <soheil@google.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp_input.c')
-rw-r--r-- | net/ipv4/tcp_input.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 2499248d4a67..01cce28f90ca 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
@@ -3496,6 +3496,16 @@ static void tcp_xmit_recovery(struct sock *sk, int rexmit) | |||
3496 | tcp_xmit_retransmit_queue(sk); | 3496 | tcp_xmit_retransmit_queue(sk); |
3497 | } | 3497 | } |
3498 | 3498 | ||
3499 | /* Returns the number of packets newly acked or sacked by the current ACK */ | ||
3500 | static u32 tcp_newly_delivered(struct sock *sk, u32 prior_delivered, int flag) | ||
3501 | { | ||
3502 | struct tcp_sock *tp = tcp_sk(sk); | ||
3503 | u32 delivered; | ||
3504 | |||
3505 | delivered = tp->delivered - prior_delivered; | ||
3506 | return delivered; | ||
3507 | } | ||
3508 | |||
3499 | /* This routine deals with incoming acks, but not outgoing ones. */ | 3509 | /* This routine deals with incoming acks, but not outgoing ones. */ |
3500 | static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag) | 3510 | static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag) |
3501 | { | 3511 | { |
@@ -3619,7 +3629,7 @@ static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag) | |||
3619 | if ((flag & FLAG_FORWARD_PROGRESS) || !(flag & FLAG_NOT_DUP)) | 3629 | if ((flag & FLAG_FORWARD_PROGRESS) || !(flag & FLAG_NOT_DUP)) |
3620 | sk_dst_confirm(sk); | 3630 | sk_dst_confirm(sk); |
3621 | 3631 | ||
3622 | delivered = tp->delivered - delivered; /* freshly ACKed or SACKed */ | 3632 | delivered = tcp_newly_delivered(sk, delivered, flag); |
3623 | lost = tp->lost - lost; /* freshly marked lost */ | 3633 | lost = tp->lost - lost; /* freshly marked lost */ |
3624 | rs.is_ack_delayed = !!(flag & FLAG_ACK_MAYBE_DELAYED); | 3634 | rs.is_ack_delayed = !!(flag & FLAG_ACK_MAYBE_DELAYED); |
3625 | tcp_rate_gen(sk, delivered, lost, is_sack_reneg, sack_state.rate); | 3635 | tcp_rate_gen(sk, delivered, lost, is_sack_reneg, sack_state.rate); |
@@ -3629,9 +3639,11 @@ static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag) | |||
3629 | 3639 | ||
3630 | no_queue: | 3640 | no_queue: |
3631 | /* If data was DSACKed, see if we can undo a cwnd reduction. */ | 3641 | /* If data was DSACKed, see if we can undo a cwnd reduction. */ |
3632 | if (flag & FLAG_DSACKING_ACK) | 3642 | if (flag & FLAG_DSACKING_ACK) { |
3633 | tcp_fastretrans_alert(sk, prior_snd_una, is_dupack, &flag, | 3643 | tcp_fastretrans_alert(sk, prior_snd_una, is_dupack, &flag, |
3634 | &rexmit); | 3644 | &rexmit); |
3645 | tcp_newly_delivered(sk, delivered, flag); | ||
3646 | } | ||
3635 | /* If this ack opens up a zero window, clear backoff. It was | 3647 | /* If this ack opens up a zero window, clear backoff. It was |
3636 | * being used to time the probes, and is probably far higher than | 3648 | * being used to time the probes, and is probably far higher than |
3637 | * it needs to be for normal retransmission. | 3649 | * it needs to be for normal retransmission. |
@@ -3655,6 +3667,7 @@ old_ack: | |||
3655 | &sack_state); | 3667 | &sack_state); |
3656 | tcp_fastretrans_alert(sk, prior_snd_una, is_dupack, &flag, | 3668 | tcp_fastretrans_alert(sk, prior_snd_una, is_dupack, &flag, |
3657 | &rexmit); | 3669 | &rexmit); |
3670 | tcp_newly_delivered(sk, delivered, flag); | ||
3658 | tcp_xmit_recovery(sk, rexmit); | 3671 | tcp_xmit_recovery(sk, rexmit); |
3659 | } | 3672 | } |
3660 | 3673 | ||