On 7/4/25 10:53 AM, chia-yu.chang@nokia-bell-labs.com wrote:
@@ -375,7 +379,8 @@ struct tcp_sock { u8 compressed_ack; u8 dup_ack_counter:2, tlp_retrans:1, /* TLP is a retransmission */
unused:5;
syn_ect_snt:2, /* AccECN ECT memory, only */syn_ect_rcv:2; /* ... needed durign 3WHS + first seqno */
Minor nit: typo above: durign -> during
+/* Infer the ECT value our SYN arrived with from the echoed ACE field */ +static inline int tcp_accecn_extract_syn_ect(u8 ace) {
- tp->received_ce = 0;
- tp->received_ce_pending = 0;
- /* Below is an excerpt from Tables 2 of the AccECN spec:
* +================================+========================+* | Echoed ACE field | Received ECT values of |* | AE CWR ECE | our SYN arrived with |* +================================+========================+* | 0 1 0 | Not-ECT |* | 0 1 1 | ECT(1) |* | 1 0 0 | ECT(0) |* | 1 1 0 | CE |* +================================+========================+*/- if (ace & 0x1)
return INET_ECN_ECT_1;- if (!(ace & 0x2))
return INET_ECN_ECT_0;- if (ace & 0x4)
return INET_ECN_CE;- return INET_ECN_NOT_ECT;
Nit: implementing the above with a static array lookup would probably make the code simpler/more clear
+/* Used to form the ACE flags for SYN/ACK */ +static inline u16 tcp_accecn_reflector_flags(u8 ect) +{
- /* TCP ACE flags of SYN/ACK are set based on IP-ECN codepoint received
* from SYN. Below is an excerpt from Table 2 of the AccECN spec:* +====================+====================================+* | IP-ECN codepoint | Respective ACE falgs on SYN/ACK |* | received on SYN | AE CWR ECE |* +====================+====================================+* | Not-ECT | 0 1 0 |* | ECT(1) | 0 1 1 |* | ECT(0) | 1 0 0 |* | CE | 1 1 0 |* +====================+====================================+*/- u32 flags = ect + 2;
- if (ect == 3)
flags++;- return FIELD_PREP(TCPHDR_ACE, flags);
Same here.
+}
- wire_ace = tp->received_ce + TCP_ACCECN_CEP_INIT_OFFSET;
- th->ece = !!(wire_ace & 0x1);
- th->cwr = !!(wire_ace & 0x2);
- th->ae = !!(wire_ace & 0x4);
+/* AccECN specificaiton, 3.1.2: If a TCP server that implements AccECN
Minor nit: typo above: specificaiton -> specification
Otherwise LGTM,
Acked-by: Paolo Abeni pabeni@redhat.com