On Fri, Jul 18, 2025 at 04:20:29PM +0200, chia-yu.chang@nokia-bell-labs.com wrote:
@@ -549,4 +589,16 @@ tcp_ecn_make_synack(const struct request_sock *req, struct tcphdr *th) th->ece = 1; } +static inline bool tcp_accecn_option_beacon_check(const struct sock *sk) +{
- u32 ecn_beacon = READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_ecn_option_beacon);
- struct tcp_sock *tp = tcp_sk(sk);
Hi Chia-Yu Chang,
This is not a full review, but I have observed a minor problem with this patch.
Commit e9d9da91548b ("tcp: preserve const qualifier in tcp_sk()") updated tcp_sk so that, as it's subject says, the const qualifier of it's argument is preserved.
But here sk is not const while tp is not.
I think the solution here is to make tp const.
const struct tcp_sock *tp = tcp_sk(sk);
Flagged by GCC 15.1.0 and Clang 20.1.8 allmodconfig builds.
- if (!ecn_beacon)
return false;
- return tcp_stamp_us_delta(tp->tcp_mstamp, tp->accecn_opt_tstamp) * ecn_beacon >=
(tp->srtt_us >> 3);
+}
#endif /* _LINUX_TCP_ECN_H */