On 5/14/25 3:56 PM, chia-yu.chang@nokia-bell-labs.com wrote:
@@ -603,7 +614,23 @@ static bool tcp_accecn_process_option(struct tcp_sock *tp, unsigned int i; u8 *ptr;
- if (tcp_accecn_opt_fail_recv(tp))
return false;
- if (!(flag & FLAG_SLOWPATH) || !tp->rx_opt.accecn) {
if (!tp->saw_accecn_opt) {
/* Too late to enable after this point due to
* potential counter wraps
*/
if (tp->bytes_sent >= (1 << 23) - 1) {
u8 fail_mode = TCP_ACCECN_OPT_FAIL_RECV;
tp->saw_accecn_opt = TCP_ACCECN_OPT_FAIL_SEEN;
tcp_accecn_fail_mode_set(tp, fail_mode);
Similar code above, possibly an helper could be used.
}
return false;
}
- if (estimate_ecnfield) { u8 ecnfield = estimate_ecnfield - 1;
@@ -619,6 +646,13 @@ static bool tcp_accecn_process_option(struct tcp_sock *tp, order1 = (ptr[0] == TCPOPT_ACCECN1); ptr += 2;
- if (tp->saw_accecn_opt < TCP_ACCECN_OPT_COUNTER_SEEN) {
tp->saw_accecn_opt = tcp_accecn_option_init(skb,
tp->rx_opt.accecn);
if (tp->saw_accecn_opt == TCP_ACCECN_OPT_FAIL_SEEN)
tcp_accecn_fail_mode_set(tp, TCP_ACCECN_OPT_FAIL_RECV);
- }
- res = !!estimate_ecnfield; for (i = 0; i < 3; i++) { if (optlen < TCPOLEN_ACCECN_PERFIELD)
@@ -6481,10 +6515,25 @@ static bool tcp_validate_incoming(struct sock *sk, struct sk_buff *skb, */ if (th->syn) { 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;
if (tp->rx_opt.accecn &&
tp->saw_accecn_opt < TCP_ACCECN_OPT_COUNTER_SEEN) {
u8 offset = tp->rx_opt.accecn;
u8 opt_demand;
u8 saw_opt;
saw_opt = tcp_accecn_option_init(skb, offset);
tp->saw_accecn_opt = saw_opt;
if (tp->saw_accecn_opt ==
TCP_ACCECN_OPT_FAIL_SEEN) {
u8 fail_mode = TCP_ACCECN_OPT_FAIL_RECV;
tcp_accecn_fail_mode_set(tp, fail_mode);
}
opt_demand = max_t(u8, 1,
tp->accecn_opt_demand);
tp->accecn_opt_demand = opt_demand;
}}
Too many indentation levels, please move into a separate helper
/P