> -----Original Message----- > From: Eric Dumazet <eduma...@google.com> > Sent: Wednesday, June 25, 2025 10:05 AM > To: Chia-Yu Chang (Nokia) <chia-yu.ch...@nokia-bell-labs.com> > Cc: pab...@redhat.com; linux-doc@vger.kernel.org; cor...@lwn.net; > ho...@kernel.org; dsah...@kernel.org; kun...@amazon.com; > b...@vger.kernel.org; net...@vger.kernel.org; dave.t...@gmail.com; > j...@mojatatu.com; k...@kernel.org; step...@networkplumber.org; > xiyou.wangc...@gmail.com; j...@resnulli.us; da...@davemloft.net; > andrew+net...@lunn.ch; donald.hun...@gmail.com; a...@fiberby.net; > liuhang...@gmail.com; sh...@kernel.org; linux-kselft...@vger.kernel.org; > i...@kernel.org; ncardw...@google.com; Koen De Schepper (Nokia) > <koen.de_schep...@nokia-bell-labs.com>; g.wh...@cablelabs.com; > ingemar.s.johans...@ericsson.com; mirja.kuehlew...@ericsson.com; > chesh...@apple.com; rs.i...@gmx.at; jason_living...@comcast.com; > vidhi_g...@apple.com > 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.ch...@nokia-bell-labs.com> wrote: > > > > From: Ilpo Järvinen <i...@kernel.org> > > [...] > > --- 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