Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

tcp: accecn: AccECN needs to know delivered bytes

AccECN byte counter estimation requires delivered bytes
which can be calculated while processing SACK blocks and
cumulative ACK. The delivered bytes will be used to estimate
the byte counters between AccECN option (on ACKs w/o the
option).

Accurate ECN does not depend on SACK to function; however,
the calculation would be more accurate if SACK were there.

Signed-off-by: Ilpo Järvinen <ij@kernel.org>
Signed-off-by: Chia-Yu Chang <chia-yu.chang@nokia-bell-labs.com>
Acked-by: Paolo Abeni <pabeni@redhat.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Link: https://patch.msgid.link/20250916082434.100722-5-chia-yu.chang@nokia-bell-labs.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>

authored by

Ilpo Järvinen and committed by
Paolo Abeni
a92543d5 9a011277

+12 -2
+12 -2
net/ipv4/tcp_input.c
··· 1050 1050 u64 last_sackt; 1051 1051 u32 reord; 1052 1052 u32 sack_delivered; 1053 + u32 delivered_bytes; 1053 1054 int flag; 1054 1055 unsigned int mss_now; 1055 1056 struct rate_sample *rate; ··· 1412 1411 static u8 tcp_sacktag_one(struct sock *sk, 1413 1412 struct tcp_sacktag_state *state, u8 sacked, 1414 1413 u32 start_seq, u32 end_seq, 1415 - int dup_sack, int pcount, 1414 + int dup_sack, int pcount, u32 plen, 1416 1415 u64 xmit_time) 1417 1416 { 1418 1417 struct tcp_sock *tp = tcp_sk(sk); ··· 1472 1471 tp->sacked_out += pcount; 1473 1472 /* Out-of-order packets delivered */ 1474 1473 state->sack_delivered += pcount; 1474 + state->delivered_bytes += plen; 1475 1475 } 1476 1476 1477 1477 /* D-SACK. We can detect redundant retransmission in S|R and plain R ··· 1509 1507 * tcp_highest_sack_seq() when skb is highest_sack. 1510 1508 */ 1511 1509 tcp_sacktag_one(sk, state, TCP_SKB_CB(skb)->sacked, 1512 - start_seq, end_seq, dup_sack, pcount, 1510 + start_seq, end_seq, dup_sack, pcount, skb->len, 1513 1511 tcp_skb_timestamp_us(skb)); 1514 1512 tcp_rate_skb_delivered(sk, skb, state->rate); 1515 1513 ··· 1794 1792 TCP_SKB_CB(skb)->end_seq, 1795 1793 dup_sack, 1796 1794 tcp_skb_pcount(skb), 1795 + skb->len, 1797 1796 tcp_skb_timestamp_us(skb)); 1798 1797 tcp_rate_skb_delivered(sk, skb, state->rate); 1799 1798 if (TCP_SKB_CB(skb)->sacked & TCPCB_SACKED_ACKED) ··· 3303 3300 3304 3301 if (sacked & TCPCB_SACKED_ACKED) { 3305 3302 tp->sacked_out -= acked_pcount; 3303 + /* snd_una delta covers these skbs */ 3304 + sack->delivered_bytes -= skb->len; 3306 3305 } else if (tcp_is_sack(tp)) { 3307 3306 tcp_count_delivered(tp, acked_pcount, ece_ack); 3308 3307 if (!tcp_skb_spurious_retrans(tp, skb)) ··· 3401 3396 if (before(reord, prior_fack)) 3402 3397 tcp_check_sack_reordering(sk, reord, 0); 3403 3398 } 3399 + 3400 + sack->delivered_bytes = (skb ? 3401 + TCP_SKB_CB(skb)->seq : tp->snd_una) - 3402 + prior_snd_una; 3404 3403 } else if (skb && rtt_update && sack_rtt_us >= 0 && 3405 3404 sack_rtt_us > tcp_stamp_us_delta(tp->tcp_mstamp, 3406 3405 tcp_skb_timestamp_us(skb))) { ··· 3867 3858 sack_state.first_sackt = 0; 3868 3859 sack_state.rate = &rs; 3869 3860 sack_state.sack_delivered = 0; 3861 + sack_state.delivered_bytes = 0; 3870 3862 3871 3863 /* We very likely will need to access rtx queue. */ 3872 3864 prefetch(sk->tcp_rtx_queue.rb_node);