On 5/14/25 3:56 PM, chia-yu.ch...@nokia-bell-labs.com wrote:
> @@ -6450,8 +6480,12 @@ static bool tcp_validate_incoming(struct sock *sk, 
> struct sk_buff *skb,
>        * RFC 5961 4.2 : Send a challenge ack
>        */
>       if (th->syn) {
> -             if (tcp_ecn_mode_accecn(tp))
> +             if (tcp_ecn_mode_accecn(tp)) {
> +                     u8 opt_demand = max_t(u8, 1, tp->accecn_opt_demand);
> +
>                       accecn_reflector = true;
> +                     tp->accecn_opt_demand = opt_demand;

There is similar code to update accecn_opt_demand above, possibly worth
an helper.

> @@ -1237,12 +1253,16 @@ static unsigned int tcp_established_options(struct 
> sock *sk, struct sk_buff *skb
>       }
>  
>       if (tcp_ecn_mode_accecn(tp) &&
> -         sock_net(sk)->ipv4.sysctl_tcp_ecn_option) {
> +         sock_net(sk)->ipv4.sysctl_tcp_ecn_option &&
> +         (sock_net(sk)->ipv4.sysctl_tcp_ecn_option >= TCP_ECN_OPTION_FULL ||
> +          tp->accecn_opt_demand ||
> +          tcp_accecn_option_beacon_check(sk))) {
>               int saving = opts->num_sack_blocks > 0 ? 2 : 0;
>               int remaining = MAX_TCP_OPTION_SPACE - size;
>  
>               opts->ecn_bytes = tp->received_ecn_bytes;
> -             size += tcp_options_fit_accecn(opts, tp->accecn_minlen,
> +             size += tcp_options_fit_accecn(opts,
> +                                            tp->accecn_minlen,
>                                              remaining,
>                                              saving);

Please avoid unneeded white-space only changes.

/P



Reply via email to