> -----Original Message----- > From: Eric Dumazet <edumazet@xxxxxxxxxx> > Sent: Wednesday, June 25, 2025 10:05 AM > To: Chia-Yu Chang (Nokia) <chia-yu.chang@xxxxxxxxxxxxxxxxxxx> > Cc: pabeni@xxxxxxxxxx; linux-doc@xxxxxxxxxxxxxxx; corbet@xxxxxxx; horms@xxxxxxxxxx; dsahern@xxxxxxxxxx; kuniyu@xxxxxxxxxx; bpf@xxxxxxxxxxxxxxx; netdev@xxxxxxxxxxxxxxx; dave.taht@xxxxxxxxx; jhs@xxxxxxxxxxxx; kuba@xxxxxxxxxx; stephen@xxxxxxxxxxxxxxxxxx; xiyou.wangcong@xxxxxxxxx; jiri@xxxxxxxxxxx; davem@xxxxxxxxxxxxx; andrew+netdev@xxxxxxx; donald.hunter@xxxxxxxxx; ast@xxxxxxxxxxx; liuhangbin@xxxxxxxxx; shuah@xxxxxxxxxx; linux-kselftest@xxxxxxxxxxxxxxx; ij@xxxxxxxxxx; ncardwell@xxxxxxxxxx; Koen De Schepper (Nokia) <koen.de_schepper@xxxxxxxxxxxxxxxxxxx>; g.white@xxxxxxxxxxxxx; ingemar.s.johansson@xxxxxxxxxxxx; mirja.kuehlewind@xxxxxxxxxxxx; cheshire@xxxxxxxxx; rs.ietf@xxxxxx; Jason_Livingood@xxxxxxxxxxx; vidhi_goel@xxxxxxxxx > Subject: Re: [PATCH v9 net-next 06/15] tcp: accecn: add AccECN rx byte counters > > > CAUTION: This is an external email. Please be very careful when clicking links or opening attachments. See the URL nok.it/ext for additional information. > > > > On Sat, Jun 21, 2025 at 12:37 PM <chia-yu.chang@xxxxxxxxxxxxxxxxxxx> wrote: > > > > From: Ilpo Järvinen <ij@xxxxxxxxxx> > > [...] > > --- a/net/ipv4/tcp_input.c > > +++ b/net/ipv4/tcp_input.c > > @@ -6013,8 +6013,17 @@ static void tcp_urg(struct sock *sk, struct sk_buff *skb, const struct tcphdr *t > > } > > } > > > > +void tcp_ecn_received_counters_payload(struct sock *sk, > > + const struct sk_buff *skb) { > > + const struct tcphdr *th = (const struct tcphdr *)skb->data; > > + > > + tcp_ecn_received_counters(sk, skb, skb->len - th->doff * 4); } > > + > > /* Updates Accurate ECN received counters from the received IP ECN > > field */ -void tcp_ecn_received_counters(struct sock *sk, const struct > > sk_buff *skb) > > +void tcp_ecn_received_counters(struct sock *sk, const struct sk_buff *skb, > > + u32 payload_len) > > { > > u8 ecnfield = TCP_SKB_CB(skb)->ip_dsfield & INET_ECN_MASK; > > u8 is_ce = INET_ECN_is_ce(ecnfield); @@ -6034,6 +6043,9 @@ > > void tcp_ecn_received_counters(struct sock *sk, const struct sk_buff *skb) > > tp->received_ce += pcount; > > tp->received_ce_pending = min(tp->received_ce_pending + pcount, > > 0xfU); > > + > > + if (payload_len > 0) > > + tp->received_ecn_bytes[ecnfield - 1] += > > + payload_len; > > } > > } > > > > @@ -6307,7 +6319,7 @@ void tcp_rcv_established(struct sock *sk, struct sk_buff *skb) > > flag |= __tcp_replace_ts_recent(tp, > > > > delta); > > > > - tcp_ecn_received_counters(sk, skb); > > + tcp_ecn_received_counters(sk, skb, 0); > > > > /* We know that such packets are checksummed > > * on entry. > > @@ -6353,7 +6365,8 @@ void tcp_rcv_established(struct sock *sk, struct sk_buff *skb) > > /* Bulk data transfer: receiver */ > > tcp_cleanup_skb(skb); > > __skb_pull(skb, tcp_header_len); > > - tcp_ecn_received_counters(sk, skb); > > + tcp_ecn_received_counters(sk, skb, > > + len - > > + tcp_header_len); > > eaten = tcp_queue_rcv(sk, skb, &fragstolen); > > > > tcp_event_data_recv(sk, skb); @@ -6400,7 > > +6413,7 @@ void tcp_rcv_established(struct sock *sk, struct sk_buff *skb) > > tcp_accecn_third_ack(sk, skb, tp->syn_ect_snt); > > tcp_fast_path_on(tp); > > } > > - tcp_ecn_received_counters(sk, skb); > > + tcp_ecn_received_counters_payload(sk, skb); > > I missed this from a prior patch, but is it expected to account bytes even if the packet is dropped ? > Hi Eric, What I know is that packets will be acoounted after validation. So, if one packet is discarded due to tcp_validate_incoming(), it will NOT be counted in the AccECN counters. Best regards, Chia-Yu