[PATCH net-next 0/1] AccECN packetdrill selftest series

STALE237d

Revision v1 of 2 in this series.

15 messages, 3 authors, 2026-01-19 · open the first message on its own page

[PATCH net-next 0/1] AccECN packetdrill selftest series

From: <hidden>
Date: 2026-01-08 15:58:24

From: Chia-Yu Chang <redacted>

Hello,

Please find the v1 AccECN packetdrill selftest patch series, which
includes several test cases used to verify the functionality of
Accurate ECN spec (RFC9768) under a variety of conditions.

The used packetdrill is commit 6f2116af6b7e1936a53e80ab31b77f74abda1aaa
of the branch: https://github.com/minuscat/packetdrill_accecn

Best regards,
Chia-Yu

Chia-Yu Chang (1):
  selftests/net: Add packetdrill packetdrill cases

 .../close-local-close-then-remote-fin.pkt     | 25 +++++++
 .../accecn/counters/3rd-ack-lost-data-ce.pkt  | 22 ++++++
 .../accecn/counters/delivered-2ndlargeack.pkt | 25 +++++++
 .../delivered-falseoverflow-detect.pkt        | 31 ++++++++
 .../accecn/counters/delivered-largeack.pkt    | 24 +++++++
 .../accecn/counters/delivered-largeack2.pkt   | 25 +++++++
 .../accecn/counters/delivered-maxack.pkt      | 25 +++++++
 .../accecn/counters/delivered-updates.pkt     | 70 +++++++++++++++++++
 .../accecn/counters/ecn-field-updates-opt.pkt | 35 ++++++++++
 .../accecn/counters/noprogress.pkt            | 27 +++++++
 .../counters/sack-space-grab-with-ts.pkt      | 39 +++++++++++
 .../accecn/counters/sack-space-grab.pkt       | 28 ++++++++
 .../accecn/counters/tsnoprogress.pkt          | 26 +++++++
 .../accecn/counters/tsprogress.pkt            | 25 +++++++
 .../accecn/fallback/acc_ecn_disabled.pkt      | 14 ++++
 .../accecn/fallback/accecn-to-rfc3168.pkt     | 18 +++++
 .../fallback/client_accecn_options_drop.pkt   | 34 +++++++++
 .../fallback/client_accecn_options_lost.pkt   | 38 ++++++++++
 .../net/packetdrill/accecn/fallback/ecn3.pkt  | 12 ++++
 .../accecn/fallback/ipflags-drop.pkt          | 14 ++++
 .../accecn/fallback/listen-opt-drop.pkt       | 16 +++++
 .../accecn/fallback/multiple_syn_ack_drop.pkt | 28 ++++++++
 .../accecn/fallback/multiple_syn_drop.pkt     | 18 +++++
 .../accecn/fallback/negotiation-bleach.pkt    | 23 ++++++
 .../accecn/fallback/rfc3168-to-fallback.pkt   | 18 +++++
 .../accecn/fallback/rfc3168-to-rfc3168.pkt    | 18 +++++
 .../syn_ace_flags_acked_after_retransmit.pkt  | 18 +++++
 .../accecn/fallback/syn_ace_flags_drop.pkt    | 16 +++++
 ...n_ack_ace_flags_acked_after_retransmit.pkt | 27 +++++++
 .../fallback/syn_ack_ace_flags_drop.pkt       | 27 +++++++
 .../negotiation/3rd-ack-after-synack-rxmt.pkt | 19 +++++
 .../accecn/negotiation/3rd-dups.pkt           | 26 +++++++
 .../negotiation/accecn_then_notecn_syn.pkt    | 28 ++++++++
 .../negotiation/clientside-disabled.pkt       | 12 ++++
 .../negotiation/negotiation-connect.pkt       | 23 ++++++
 .../accecn/negotiation/negotiation-listen.pkt | 26 +++++++
 .../negotiation/negotiation-noopt-connect.pkt | 23 ++++++
 .../negotiation/negotiation-optenable.pkt     | 23 ++++++
 .../negotiation/no-ecn-after-acc-ecn.pkt      | 20 ++++++
 .../packetdrill/accecn/negotiation/noopt.pkt  | 27 +++++++
 .../negotiation/notecn_then_accecn_syn.pkt    | 28 ++++++++
 .../serverside-accecn-disabled1.pkt           | 20 ++++++
 .../serverside-accecn-disabled2.pkt           | 20 ++++++
 .../accecn/negotiation/serverside-broken.pkt  | 19 +++++
 .../negotiation/serverside-ecn-disabled.pkt   | 19 +++++
 .../accecn/negotiation/serverside-only.pkt    | 18 +++++
 .../accecn/negotiation/synack-rexmit.pkt      | 15 ++++
 .../accecn/negotiation/synack-rxmt.pkt        | 25 +++++++
 .../reflector/2nd-data-as-first-connect.pkt   | 30 ++++++++
 .../accecn/reflector/2nd-data-as-first.pkt    | 24 +++++++
 .../3rd-ack-ce-updates-received_ce.pkt        | 18 +++++
 .../packetdrill/accecn/reflector/syn-ce.pkt   | 13 ++++
 .../packetdrill/accecn/reflector/syn-ect0.pkt | 13 ++++
 .../packetdrill/accecn/reflector/syn-ect1.pkt | 13 ++++
 .../synack-ce-updates-delivered-ce.pkt        | 22 ++++++
 .../accecn/reflector/synack-ce.pkt            | 28 ++++++++
 .../accecn/reflector/synack-ect0.pkt          | 24 +++++++
 .../accecn/reflector/synack-ect1.pkt          | 24 +++++++
 58 files changed, 1366 insertions(+)
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/close/close-local-close-then-remote-fin.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/counters/3rd-ack-lost-data-ce.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/counters/delivered-2ndlargeack.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/counters/delivered-falseoverflow-detect.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/counters/delivered-largeack.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/counters/delivered-largeack2.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/counters/delivered-maxack.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/counters/delivered-updates.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/counters/ecn-field-updates-opt.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/counters/noprogress.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/counters/sack-space-grab-with-ts.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/counters/sack-space-grab.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/counters/tsnoprogress.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/counters/tsprogress.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/fallback/acc_ecn_disabled.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/fallback/accecn-to-rfc3168.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/fallback/client_accecn_options_drop.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/fallback/client_accecn_options_lost.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/fallback/ecn3.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/fallback/ipflags-drop.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/fallback/listen-opt-drop.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/fallback/multiple_syn_ack_drop.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/fallback/multiple_syn_drop.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/fallback/negotiation-bleach.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/fallback/rfc3168-to-fallback.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/fallback/rfc3168-to-rfc3168.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/fallback/syn_ace_flags_acked_after_retransmit.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/fallback/syn_ace_flags_drop.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/fallback/syn_ack_ace_flags_acked_after_retransmit.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/fallback/syn_ack_ace_flags_drop.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/negotiation/3rd-ack-after-synack-rxmt.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/negotiation/3rd-dups.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/negotiation/accecn_then_notecn_syn.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/negotiation/clientside-disabled.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/negotiation/negotiation-connect.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/negotiation/negotiation-listen.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/negotiation/negotiation-noopt-connect.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/negotiation/negotiation-optenable.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/negotiation/no-ecn-after-acc-ecn.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/negotiation/noopt.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/negotiation/notecn_then_accecn_syn.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/negotiation/serverside-accecn-disabled1.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/negotiation/serverside-accecn-disabled2.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/negotiation/serverside-broken.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/negotiation/serverside-ecn-disabled.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/negotiation/serverside-only.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/negotiation/synack-rexmit.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/negotiation/synack-rxmt.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/reflector/2nd-data-as-first-connect.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/reflector/2nd-data-as-first.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/reflector/3rd-ack-ce-updates-received_ce.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/reflector/syn-ce.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/reflector/syn-ect0.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/reflector/syn-ect1.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/reflector/synack-ce-updates-delivered-ce.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/reflector/synack-ce.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/reflector/synack-ect0.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/reflector/synack-ect1.pkt

-- 
2.34.1

[PATCH net-next 1/1] selftests/net: Add packetdrill packetdrill cases

From: <hidden>
Date: 2026-01-08 15:58:29

From: Chia-Yu Chang <redacted>

Linux Accurate ECN test sets using ACE counters and AccECN options to
cover several scenarios: Connection teardown, different ACK conditions,
counter wrapping, SACK space grabbing, fallback schemes, negotiation
retransmission/reorder/loss, AccECN option drop/loss, different
handshake reflectors, data with marking, and different sysctl values.

Co-developed-by: Ilpo Järvinen <ij@kernel.org>
Signed-off-by: Ilpo Järvinen <ij@kernel.org>
Co-developed-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: Neal Cardwell <ncardwell@google.com>
---
 .../close-local-close-then-remote-fin.pkt     | 25 +++++++
 .../accecn/counters/3rd-ack-lost-data-ce.pkt  | 22 ++++++
 .../accecn/counters/delivered-2ndlargeack.pkt | 25 +++++++
 .../delivered-falseoverflow-detect.pkt        | 31 ++++++++
 .../accecn/counters/delivered-largeack.pkt    | 24 +++++++
 .../accecn/counters/delivered-largeack2.pkt   | 25 +++++++
 .../accecn/counters/delivered-maxack.pkt      | 25 +++++++
 .../accecn/counters/delivered-updates.pkt     | 70 +++++++++++++++++++
 .../accecn/counters/ecn-field-updates-opt.pkt | 35 ++++++++++
 .../accecn/counters/noprogress.pkt            | 27 +++++++
 .../counters/sack-space-grab-with-ts.pkt      | 39 +++++++++++
 .../accecn/counters/sack-space-grab.pkt       | 28 ++++++++
 .../accecn/counters/tsnoprogress.pkt          | 26 +++++++
 .../accecn/counters/tsprogress.pkt            | 25 +++++++
 .../accecn/fallback/acc_ecn_disabled.pkt      | 14 ++++
 .../accecn/fallback/accecn-to-rfc3168.pkt     | 18 +++++
 .../fallback/client_accecn_options_drop.pkt   | 34 +++++++++
 .../fallback/client_accecn_options_lost.pkt   | 38 ++++++++++
 .../net/packetdrill/accecn/fallback/ecn3.pkt  | 12 ++++
 .../accecn/fallback/ipflags-drop.pkt          | 14 ++++
 .../accecn/fallback/listen-opt-drop.pkt       | 16 +++++
 .../accecn/fallback/multiple_syn_ack_drop.pkt | 28 ++++++++
 .../accecn/fallback/multiple_syn_drop.pkt     | 18 +++++
 .../accecn/fallback/negotiation-bleach.pkt    | 23 ++++++
 .../accecn/fallback/rfc3168-to-fallback.pkt   | 18 +++++
 .../accecn/fallback/rfc3168-to-rfc3168.pkt    | 18 +++++
 .../syn_ace_flags_acked_after_retransmit.pkt  | 18 +++++
 .../accecn/fallback/syn_ace_flags_drop.pkt    | 16 +++++
 ...n_ack_ace_flags_acked_after_retransmit.pkt | 27 +++++++
 .../fallback/syn_ack_ace_flags_drop.pkt       | 27 +++++++
 .../negotiation/3rd-ack-after-synack-rxmt.pkt | 19 +++++
 .../accecn/negotiation/3rd-dups.pkt           | 26 +++++++
 .../negotiation/accecn_then_notecn_syn.pkt    | 28 ++++++++
 .../negotiation/clientside-disabled.pkt       | 12 ++++
 .../negotiation/negotiation-connect.pkt       | 23 ++++++
 .../accecn/negotiation/negotiation-listen.pkt | 26 +++++++
 .../negotiation/negotiation-noopt-connect.pkt | 23 ++++++
 .../negotiation/negotiation-optenable.pkt     | 23 ++++++
 .../negotiation/no-ecn-after-acc-ecn.pkt      | 20 ++++++
 .../packetdrill/accecn/negotiation/noopt.pkt  | 27 +++++++
 .../negotiation/notecn_then_accecn_syn.pkt    | 28 ++++++++
 .../serverside-accecn-disabled1.pkt           | 20 ++++++
 .../serverside-accecn-disabled2.pkt           | 20 ++++++
 .../accecn/negotiation/serverside-broken.pkt  | 19 +++++
 .../negotiation/serverside-ecn-disabled.pkt   | 19 +++++
 .../accecn/negotiation/serverside-only.pkt    | 18 +++++
 .../accecn/negotiation/synack-rexmit.pkt      | 15 ++++
 .../accecn/negotiation/synack-rxmt.pkt        | 25 +++++++
 .../reflector/2nd-data-as-first-connect.pkt   | 30 ++++++++
 .../accecn/reflector/2nd-data-as-first.pkt    | 24 +++++++
 .../3rd-ack-ce-updates-received_ce.pkt        | 18 +++++
 .../packetdrill/accecn/reflector/syn-ce.pkt   | 13 ++++
 .../packetdrill/accecn/reflector/syn-ect0.pkt | 13 ++++
 .../packetdrill/accecn/reflector/syn-ect1.pkt | 13 ++++
 .../synack-ce-updates-delivered-ce.pkt        | 22 ++++++
 .../accecn/reflector/synack-ce.pkt            | 28 ++++++++
 .../accecn/reflector/synack-ect0.pkt          | 24 +++++++
 .../accecn/reflector/synack-ect1.pkt          | 24 +++++++
 58 files changed, 1366 insertions(+)
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/close/close-local-close-then-remote-fin.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/counters/3rd-ack-lost-data-ce.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/counters/delivered-2ndlargeack.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/counters/delivered-falseoverflow-detect.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/counters/delivered-largeack.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/counters/delivered-largeack2.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/counters/delivered-maxack.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/counters/delivered-updates.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/counters/ecn-field-updates-opt.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/counters/noprogress.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/counters/sack-space-grab-with-ts.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/counters/sack-space-grab.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/counters/tsnoprogress.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/counters/tsprogress.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/fallback/acc_ecn_disabled.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/fallback/accecn-to-rfc3168.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/fallback/client_accecn_options_drop.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/fallback/client_accecn_options_lost.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/fallback/ecn3.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/fallback/ipflags-drop.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/fallback/listen-opt-drop.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/fallback/multiple_syn_ack_drop.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/fallback/multiple_syn_drop.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/fallback/negotiation-bleach.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/fallback/rfc3168-to-fallback.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/fallback/rfc3168-to-rfc3168.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/fallback/syn_ace_flags_acked_after_retransmit.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/fallback/syn_ace_flags_drop.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/fallback/syn_ack_ace_flags_acked_after_retransmit.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/fallback/syn_ack_ace_flags_drop.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/negotiation/3rd-ack-after-synack-rxmt.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/negotiation/3rd-dups.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/negotiation/accecn_then_notecn_syn.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/negotiation/clientside-disabled.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/negotiation/negotiation-connect.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/negotiation/negotiation-listen.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/negotiation/negotiation-noopt-connect.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/negotiation/negotiation-optenable.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/negotiation/no-ecn-after-acc-ecn.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/negotiation/noopt.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/negotiation/notecn_then_accecn_syn.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/negotiation/serverside-accecn-disabled1.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/negotiation/serverside-accecn-disabled2.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/negotiation/serverside-broken.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/negotiation/serverside-ecn-disabled.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/negotiation/serverside-only.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/negotiation/synack-rexmit.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/negotiation/synack-rxmt.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/reflector/2nd-data-as-first-connect.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/reflector/2nd-data-as-first.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/reflector/3rd-ack-ce-updates-received_ce.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/reflector/syn-ce.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/reflector/syn-ect0.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/reflector/syn-ect1.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/reflector/synack-ce-updates-delivered-ce.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/reflector/synack-ce.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/reflector/synack-ect0.pkt
 create mode 100644 tools/testing/selftests/net/packetdrill/accecn/reflector/synack-ect1.pkt
diff --git a/tools/testing/selftests/net/packetdrill/accecn/close/close-local-close-then-remote-fin.pkt b/tools/testing/selftests/net/packetdrill/accecn/close/close-local-close-then-remote-fin.pkt
new file mode 100644
index 000000000000..ec7d5f541350
--- /dev/null
+++ b/tools/testing/selftests/net/packetdrill/accecn/close/close-local-close-then-remote-fin.pkt
@@ -0,0 +1,25 @@
+// Test basic connection teardown where local process closes first:
+// the local process calls close() first, so we send a FIN, and receive an ACK.
+// Then we receive a FIN and ACK it.
+
+`../../common/defaults.sh
+sysctl -q net.ipv4.tcp_ecn=3
+sysctl -q net.ipv4.tcp_ecn_option=0
+`
+
+    0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
+ +.01...0.011 connect(3, ..., ...) = 0
+   +0 > [noecn] SEWA 0:0(0) <...>
+   +0 < [ect1] SW. 0:0(0) ack 1 win 32768 <mss 1000,nop,wscale 6,nop,nop,sackOK>
+   +0 > [ect0] EW. 1:1(0) ack 1
+
+   +0 write(3, ..., 1000) = 1000
+   +0 > [ect0] P5. 1:1001(1000) ack 1
+   +0 < [ect0] .5 1:1(0) ack 1001 win 257
+
+   +0 close(3) = 0
+   +0 > [ect0] F5. 1001:1001(0) ack 1
+   +0 < [ect0] .5 1:1(0) ack 1002 win 257
+
+   +0 < [ect0] F5. 1:1(0) ack 1002 win 257
+   +0 > [ect0] . 1002:1002(0) ack 2
diff --git a/tools/testing/selftests/net/packetdrill/accecn/counters/3rd-ack-lost-data-ce.pkt b/tools/testing/selftests/net/packetdrill/accecn/counters/3rd-ack-lost-data-ce.pkt
new file mode 100644
index 000000000000..a043748c0c70
--- /dev/null
+++ b/tools/testing/selftests/net/packetdrill/accecn/counters/3rd-ack-lost-data-ce.pkt
@@ -0,0 +1,22 @@
+// 3rd ACK lost, CE for the first data segment
+
+`../../common/defaults.sh
+sysctl -q net.ipv4.tcp_ecn=3
+`
+
+    0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
+   +0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
+   +0 bind(3, ..., ...) = 0
+   +0 listen(3, 1) = 0
+
++0.05 < SEWA 0:0(0) win 32767 <mss 1050,nop,nop,sackOK,nop,wscale 8>
++.002 > SW. 0:0(0) ack 1 <mss 1460,ECN e1b 1 ceb 0 e0b 1,nop,nop,nop,sackOK,nop,wscale 8>
+// 3rd ACK lost
++0.05 < [ce] EAP. 1:1001(1000) ack 1 win 264 <ECN e0b 1 ceb 0 e1b 1,nop>
++.002 > [ect0] WA. 1:1(0) ack 1001 <ECN e1b 1 ceb 1000 e0b 1,nop>
++.002 accept(3, ..., ...) = 4
+
++0.01 %{ assert tcpi_delivered_ce == 0, tcpi_delivered_ce }%
+
++0.05 < [ce] EAP. 1001:2001(1000) ack 1 win 264 <ECN e0b 1 ceb 0 e1b 1,nop>
++.001 > [ect0] EWA. 1:1(0) ack 2001 <ECN e1b 1 ceb 2000 e0b 1 ,nop>
diff --git a/tools/testing/selftests/net/packetdrill/accecn/counters/delivered-2ndlargeack.pkt b/tools/testing/selftests/net/packetdrill/accecn/counters/delivered-2ndlargeack.pkt
new file mode 100644
index 000000000000..63c42dab51aa
--- /dev/null
+++ b/tools/testing/selftests/net/packetdrill/accecn/counters/delivered-2ndlargeack.pkt
@@ -0,0 +1,25 @@
+// Test a large ACK (> ACE field max)
+
+`../../common/defaults.sh
+sysctl -q net.ipv4.tcp_ecn=3
+sysctl -q net.ipv4.tcp_ecn_option=0
+`
+
+    0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
+   +0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
+   +0 bind(3, ..., ...) = 0
+   +0 listen(3, 1) = 0
+
+   +0 < SEWA 0:0(0) win 32792 <mss 1460,nop,nop,sackOK,nop,wscale 8>
++.002 > SW. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK,nop,wscale 8>
++0.05 < [ect0] W. 1:1(0) ack 1 win 264
++.002 accept(3, ..., ...) = 4
+
++0.01 %{ assert tcpi_delivered_ce == 0, tcpi_delivered_ce }%
+
++0.01 write(4, ..., 14600) = 14600
++.002 > [ect0] P.5 1:14601(14600) ack 1
++0.05 < [ect0] .5 1:1(0) ack 1461 win 264
++0.05 < [ect0] .5 1:1(0) ack 14601 win 264
+
++0.01 %{ assert tcpi_delivered_ce == 8, tcpi_delivered_ce }%
diff --git a/tools/testing/selftests/net/packetdrill/accecn/counters/delivered-falseoverflow-detect.pkt b/tools/testing/selftests/net/packetdrill/accecn/counters/delivered-falseoverflow-detect.pkt
new file mode 100644
index 000000000000..8d050d8c1949
--- /dev/null
+++ b/tools/testing/selftests/net/packetdrill/accecn/counters/delivered-falseoverflow-detect.pkt
@@ -0,0 +1,31 @@
+// Test false overflow detection with option used to rule out overflow
+
+`../../common/defaults.sh
+sysctl -q net.ipv4.tcp_ecn=3
+`
+
+    0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
+   +0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
+   +0 bind(3, ..., ...) = 0
+   +0 listen(3, 1) = 0
+
+   +0 < SEWA 0:0(0) win 32792 <mss 1460,nop,nop,sackOK,nop,wscale 8>
++.002 > SW. 0:0(0) ack 1 <mss 1460,ECN e1b 1 ceb 0 e0b 1,nop,nop,nop,sackOK,nop,wscale 8>
++0.05 < [ect0] W. 1:1(0) ack 1 win 264 <ECN e0b 1 ceb 0 e1b 1,nop>
++.002 accept(3, ..., ...) = 4
+
++0.01 %{ assert tcpi_delivered_ce == 0, tcpi_delivered_ce }%
+
+// Stop sending option to allow easier testing
++0 `sysctl -q net.ipv4.tcp_ecn_option=0`
+
++0.002 write(4, ..., 14600) = 14600
++.002 > [ect0] P.5 1:14601(14600) ack 1
+
++0.05 < [ect0] .5 1:1(0) ack 1460 win 264 <ECN e0b 1461 ceb 0 e1b 1,nop>
++0.05 < [ect0] .5 1:1(0) ack 14601 win 264 <ECN e0b 14601 ceb 0 e1b 1,nop>
+
++0.01 %{
+assert tcpi_delivered_ce == 0, tcpi_delivered_ce
+assert tcpi_delivered_e0_bytes == 14600, tcpi_delivered_e0_bytes
+}%
diff --git a/tools/testing/selftests/net/packetdrill/accecn/counters/delivered-largeack.pkt b/tools/testing/selftests/net/packetdrill/accecn/counters/delivered-largeack.pkt
new file mode 100644
index 000000000000..ae6db89c36b2
--- /dev/null
+++ b/tools/testing/selftests/net/packetdrill/accecn/counters/delivered-largeack.pkt
@@ -0,0 +1,24 @@
+// Test a large ACK (> ACE field max)
+
+`../../common/defaults.sh
+sysctl -q net.ipv4.tcp_ecn=3
+sysctl -q net.ipv4.tcp_ecn_option=0
+`
+
+    0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
+   +0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
+   +0 bind(3, ..., ...) = 0
+   +0 listen(3, 1) = 0
+
+   +0 < SEWA 0:0(0) win 32792 <mss 1460,nop,nop,sackOK,nop,wscale 8>
++.002 > SW. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK,nop,wscale 8>
++0.05 < [ect0] W. 1:1(0) ack 1 win 264
++.002 accept(3, ..., ...) = 4
+
++0.01 %{ assert tcpi_delivered_ce == 0, tcpi_delivered_ce }%
+
++0.01 write(4, ..., 14600) = 14600
++.002 > [ect0] P.5 1:14601(14600) ack 1
++0.05 < [ect0] .5 1:1(0) ack 14601 win 264
+
++0.01 %{ assert tcpi_delivered_ce == 0, tcpi_delivered_ce }%
diff --git a/tools/testing/selftests/net/packetdrill/accecn/counters/delivered-largeack2.pkt b/tools/testing/selftests/net/packetdrill/accecn/counters/delivered-largeack2.pkt
new file mode 100644
index 000000000000..71e27dbc9491
--- /dev/null
+++ b/tools/testing/selftests/net/packetdrill/accecn/counters/delivered-largeack2.pkt
@@ -0,0 +1,25 @@
+// Test a large ACK (> ACE field max)
+
+`../../common/defaults.sh
+sysctl -q net.ipv4.tcp_ecn=3
+sysctl -q net.ipv4.tcp_ecn_option=0
+`
+
+    0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
+   +0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
+   +0 bind(3, ..., ...) = 0
+   +0 listen(3, 1) = 0
+
+   +0 < SEWA 0:0(0) win 32792 <mss 1460,nop,nop,sackOK,nop,wscale 8>
++.002 > SW. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK,nop,wscale 8>
++0.05 < [ect0] W. 1:1(0) ack 1 win 264
++.002 accept(3, ..., ...) = 4
+
++0.01 %{ assert tcpi_delivered_ce == 0, tcpi_delivered_ce }%
+
++0.01 write(4, ..., 14600) = 14600
++.002 > [ect0] P.5 1:14601(14600) ack 1
+  // Fake CE
++0.05 < [ect0] .6 1:1(0) ack 14601 win 264
+
++0.01 %{ assert tcpi_delivered_ce == 1, tcpi_delivered_ce }%
diff --git a/tools/testing/selftests/net/packetdrill/accecn/counters/delivered-maxack.pkt b/tools/testing/selftests/net/packetdrill/accecn/counters/delivered-maxack.pkt
new file mode 100644
index 000000000000..93a64e5bf5c4
--- /dev/null
+++ b/tools/testing/selftests/net/packetdrill/accecn/counters/delivered-maxack.pkt
@@ -0,0 +1,25 @@
+// Test a large ACK (at ACE field max delta)
+
+`../../common/defaults.sh
+sysctl -q net.ipv4.tcp_ecn=3
+sysctl -q net.ipv4.tcp_ecn_option=0
+`
+
+    0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
+   +0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
+   +0 bind(3, ..., ...) = 0
+   +0 listen(3, 1) = 0
+
+   +0 < SEWA 0:0(0) win 32792 <mss 1460,nop,nop,sackOK,nop,wscale 8>
++.002 > SW. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK,nop,wscale 8>
++0.05 < [ect0] W. 1:1(0) ack 1 win 264
++.002 accept(3, ..., ...) = 4
+
++0.01 %{ assert tcpi_delivered_ce == 0, tcpi_delivered_ce }%
+
++0.01 write(4, ..., 14600) = 14600
++.002 > [ect0] P.5 1:14601(14600) ack 1
+  // Fake CE
++0.05 < [ect0] .4 1:1(0) ack 14601 win 264
+
++0.01 %{ assert tcpi_delivered_ce == 7, tcpi_delivered_ce }%
diff --git a/tools/testing/selftests/net/packetdrill/accecn/counters/delivered-updates.pkt b/tools/testing/selftests/net/packetdrill/accecn/counters/delivered-updates.pkt
new file mode 100644
index 000000000000..2803df569010
--- /dev/null
+++ b/tools/testing/selftests/net/packetdrill/accecn/counters/delivered-updates.pkt
@@ -0,0 +1,70 @@
+// Test basic AccECN CEP/CEB/E0B/E1B functionality & CEP wrapping
+
+`../../common/defaults.sh
+sysctl -q net.ipv4.tcp_ecn=3
+`
+
+    0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
+   +0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
+   +0 bind(3, ..., ...) = 0
+   +0 listen(3, 1) = 0
+
+   +0 < SEWA 0:0(0) win 32792 <mss 1050,nop,nop,sackOK,nop,wscale 8>
++.002 > SW. 0:0(0) ack 1 <mss 1460,ECN e1b 1 ceb 0 e0b 1,nop,nop,nop,sackOK,nop,wscale 8>
++0.05 < [ect0] W. 1:1(0) ack 1 win 264 <ECN e0b 1 ceb 0 e1b 1,nop>
++.002 accept(3, ..., ...) = 4
+
++0.01 %{
+assert tcpi_delivered_ce == 0, tcpi_delivered_ce
+assert tcpi_delivered_ce_bytes == 0, tcpi_delivered_ce_bytes
+}%
+
++0.01 write(4, ..., 1000) = 1000
++.002 > [ect0] EAP. 1:1001(1000) ack 1 <ECN e1b 1 ceb 0 e0b 1,nop>
+  // Fake CE
++0.05 < [ect0] WA. 1:1(0) ack 1001 win 264 <ECN e0b 1 ceb 1000 e1b 1,nop>
+
++0.01 %{
+assert tcpi_delivered_ce == 1, tcpi_delivered_ce
+assert tcpi_delivered_ce_bytes == 1000, tcpi_delivered_ce_bytes
+}%
+
++0.01 write(4, ..., 1000) = 1000
++.002 > [ect0] EAP. 1001:2001(1000) ack 1 <ECN e1b 1 ceb 0 e0b 1,nop>
+  // Fake ect0
++0.05 < [ect0] WA. 1:1(0) ack 2001 win 264 <ECN e0b 1001 ceb 1000 e1b 1,nop>
+
++0.01 %{
+assert tcpi_delivered_ce == 1, tcpi_delivered_ce
+assert tcpi_delivered_e0_bytes == 1000, tcpi_delivered_e0_bytes
+}%
+
++0.01 write(4, ..., 1000) = 1000
++.002 > [ect0] EAP. 2001:3001(1000) ack 1 <ECN e1b 1 ceb 0 e0b 1,nop>
+  // Fake ce
++0.05 < [ect0] EWA. 1:1(0) ack 3001 win 264 <ECN e0b 1001 ceb 2000 e1b 1,nop>
+
++0.01 %{
+assert tcpi_delivered_ce == 2, tcpi_delivered_ce
+assert tcpi_delivered_ce_bytes == 2000, tcpi_delivered_ce_bytes
+}%
+
++0.01 write(4, ..., 1000) = 1000
++.002 > [ect0] EAP. 3001:4001(1000) ack 1 <ECN e1b 1 ceb 0 e0b 1,nop>
+  // Fake ect1
++0.05 < [ect0] EWA. 1:1(0) ack 4001 win 264 <ECN e0b 1001 ceb 2000 e1b 1001,nop>
+
++0.01 %{
+assert tcpi_delivered_ce == 2, tcpi_delivered_ce
+assert tcpi_delivered_e1_bytes == 1000, tcpi_delivered_e1_bytes
+}%
+
++0.01 write(4, ..., 1000) = 1000
++.002 > [ect0] EAP. 4001:5001(1000) ack 1 <ECN e1b 1 ceb 0 e0b 1,nop>
+  // Fake ce
++0.05 < [ect0] . 1:1(0) ack 5001 win 264 <ECN e0b 1001 ceb 3000 e1b 1001,nop>
+
++0.01 %{
+assert tcpi_delivered_ce == 3, tcpi_delivered_ce
+assert tcpi_delivered_ce_bytes == 3000, tcpi_delivered_ce_bytes
+}%
diff --git a/tools/testing/selftests/net/packetdrill/accecn/counters/ecn-field-updates-opt.pkt b/tools/testing/selftests/net/packetdrill/accecn/counters/ecn-field-updates-opt.pkt
new file mode 100644
index 000000000000..a7d5eae360c2
--- /dev/null
+++ b/tools/testing/selftests/net/packetdrill/accecn/counters/ecn-field-updates-opt.pkt
@@ -0,0 +1,35 @@
+// Test basic AccECN CEP/CEB/E0B/E1B functionality & CEP wrapping
+
+`../../common/defaults.sh
+sysctl -q net.ipv4.tcp_ecn=3
+`
+
+    0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
+   +0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
+   +0 bind(3, ..., ...) = 0
+   +0 listen(3, 1) = 0
+
+   +0 < SEWA 0:0(0) win 32792 <mss 1050,nop,nop,sackOK,nop,wscale 8>
++.002 > SW. 0:0(0) ack 1 <mss 1460,ECN e1b 1 ceb 0 e0b 1,nop,nop,nop,sackOK,nop,wscale 8>
++0.05 < [ect0] W. 1:1(0) ack 1 win 257 <ECN e0b 1 ceb 0 e1b 1,nop>
++.002 accept(3, ..., ...) = 4
+
++0.05 < [ce] EAP. 1:1001(1000) ack 1 win 257 <ECN e0b 1 ceb 0 e1b 1,nop>
++.002 > [ect0] WA. 1:1(0) ack 1001 <ECN e1b 1 ceb 1000 e0b 1,nop>
+   +0 read(4, ..., 1000) = 1000
+
++0.05 < [ect0] EAP. 1001:2001(1000) ack 1 win 257 <ECN e0b 1 ceb 0 e1b 1,nop>
++.002 > [ect0] WA. 1:1(0) ack 2001 <ECN e1b 1 ceb 1000 e0b 1001,nop>
+   +0 read(4, ..., 1000) = 1000
+
++0.05 < [ce] EAP. 2001:3001(1000) ack 1 win 257 <ECN e0b 1 ceb 0 e1b 1,nop>
++.002 > [ect0] EWA. 1:1(0) ack 3001 <ECN e1b 1 ceb 2000 e0b 1001,nop>
+   +0 read(4, ..., 1000) = 1000
+
++0.05 < [ect1] EAP. 3001:4001(1000) ack 1 win 257 <ECN e0b 1 ceb 0 e1b 1,nop>
++.002 > [ect0] EWA. 1:1(0) ack 4001 <ECN e1b 1001 ceb 2000 e0b 1001,nop>
+   +0 read(4, ..., 1000) = 1000
+
++0.05 < [ce] EAP. 4001:5001(1000) ack 1 win 257 <ECN e0b 1 ceb 0 e1b 1,nop>
++.002 > [ect0] . 1:1(0) ack 5001 <ECN e1b 1001 ceb 3000 e0b 1001,nop>
+   +0 read(4, ..., 1000) = 1000
diff --git a/tools/testing/selftests/net/packetdrill/accecn/counters/noprogress.pkt b/tools/testing/selftests/net/packetdrill/accecn/counters/noprogress.pkt
new file mode 100644
index 000000000000..c1287372b582
--- /dev/null
+++ b/tools/testing/selftests/net/packetdrill/accecn/counters/noprogress.pkt
@@ -0,0 +1,27 @@
+// Test no progress filtering
+
+`../../common/defaults.sh
+sysctl -q net.ipv4.tcp_ecn=3
+`
+
+    0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
+   +0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
+   +0 bind(3, ..., ...) = 0
+   +0 listen(3, 1) = 0
+
+   +0 < SEWA 0:0(0) win 32792 <mss 1050,nop,nop,sackOK,nop,wscale 8>
++.002 > SW. 0:0(0) ack 1 <mss 1460,ECN e1b 1 ceb 0 e0b 1,nop,nop,nop,sackOK,nop,wscale 8>
++0.05 < [ect0] W. 1:1(0) ack 1 win 264 <ECN e0b 1 ceb 0 e1b 1,nop>
++.002 accept(3, ..., ...) = 4
+
++0.01 %{ assert tcpi_delivered_ce == 0, tcpi_delivered_ce }%
+
++0.01 write(4, ..., 1000) = 1000
++.002 > [ect0] EAP. 1:1001(1000) ack 1 <ECN e1b 1 ceb 0 e0b 1,nop>
+  // Fake CE and claim no progress
++0.05 < [ect0] WA. 1:1(0) ack 1 win 264 <ECN e0b 1 ceb 1000 e1b 1,nop>
+
++0.01 %{
+assert tcpi_delivered_ce == 0, tcpi_delivered_ce
+assert tcpi_delivered_ce_bytes == 0, tcpi_delivered_ce_bytes
+}%
diff --git a/tools/testing/selftests/net/packetdrill/accecn/counters/sack-space-grab-with-ts.pkt b/tools/testing/selftests/net/packetdrill/accecn/counters/sack-space-grab-with-ts.pkt
new file mode 100644
index 000000000000..087467a729c8
--- /dev/null
+++ b/tools/testing/selftests/net/packetdrill/accecn/counters/sack-space-grab-with-ts.pkt
@@ -0,0 +1,39 @@
+// Test SACK space grab to fit AccECN option
+--tcp_ts_tick_usecs=1000
+
+`../../common/defaults.sh
+sysctl -q net.ipv4.tcp_ecn=3
+`
+
+    0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
+   +0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
+   +0 bind(3, ..., ...) = 0
+   +0 listen(3, 1) = 0
+
+   +0 < SEWA 0:0(0) win 32792 <mss 1050,sackOK,TS val 1 ecr 0,nop,wscale 8>
++.002 > SW. 0:0(0) ack 1 <mss 1460,sackOK,TS val 100 ecr 1,ECN e1b 1 ceb 0 e0b 1,nop,nop,wscale 8>
++0.05 < [ect0] W. 1:1(0) ack 1 win 264 <nop,nop,TS val 2 ecr 100,ECN e0b 1 ceb 0 e1b 1,nop>
++.002 accept(3, ..., ...) = 4
+
+// One SACK block should allow all 3 AccECN fields:
++.01 < [ect1] EAP. 1001:2001(1000) ack 1 win 264 <nop,nop,TS val 3 ecr 100>
++0.002 > [ect0] EA. 1:1(0) ack 1 <nop,nop,TS val 160 ecr 2,ECN e1b 1001 ceb 0 e0b 1,nop,nop,nop,sack 1001:2001>
+
+// Two SACK blocks should fit w/ AccECN if we only need to use 2 AccECN fields: check ect1 arriving.
++.01 < [ect1] EAP. 3001:4001(1000) ack 1 win 264 <nop,nop,TS val 4 ecr 100>
++0.002 > [ect0] EA. 1:1(0) ack 1 <nop,nop,TS val 172 ecr 2,ECN e1b 2001 ceb 0,nop,nop,sack 3001:4001 1001:2001>
+
+// Two SACK blocks should fit w/ AccECN if we only need to use 2 AccECN fields: check CE arriving.
++.01 < [ce] EAP. 5001:6001(1000) ack 1 win 264 <nop,nop,TS val 5 ecr 100>
++0.002 > [ect0] WA. 1:1(0) ack 1 <nop,nop,TS val 184 ecr 2,ECN e1b 2001 ceb 1000,nop,nop,sack 5001:6001 3001:4001>
+
+// Check that DSACK works, using 2 SACK blocks in total, if we only need to use 2 AccECN fields: check ect1 arriving.
++.01 < [ect1] EAP. 5001:6001(1000) ack 1 win 264 <nop,nop,TS val 5 ecr 100>
++0.002 > [ect0] WA. 1:1(0) ack 1 <nop,nop,TS val 196 ecr 2,ECN e1b 3001 ceb 1000,nop,nop,sack 5001:6001 5001:6001>
+
+// Check the case where the AccECN option doesn't fit, because sending ect0
+// with order 1 would rquire 3 AccECN fields,
+// and TS (12 bytes) + 2 SACK blocks (20 bytes) + 3 AccECN fields (2 + 3*3 bytes) > 40 bytes.
+// That's OK; Linux TCP AccECN is optimized for the ECT1 case, not ECT0.
++.01 < [ect0] EAP. 6001:7001(1000) ack 1 win 264 <nop,nop,TS val 5 ecr 100>
++0.002 > [ect0] WA. 1:1(0) ack 1 <nop,nop,TS val 204 ecr 2,nop,nop,sack 5001:7001 3001:4001 1001:2001>
diff --git a/tools/testing/selftests/net/packetdrill/accecn/counters/sack-space-grab.pkt b/tools/testing/selftests/net/packetdrill/accecn/counters/sack-space-grab.pkt
new file mode 100644
index 000000000000..9ec1f1353a35
--- /dev/null
+++ b/tools/testing/selftests/net/packetdrill/accecn/counters/sack-space-grab.pkt
@@ -0,0 +1,28 @@
+// Test SACK space grab to fit AccECN option
+--tcp_ts_tick_usecs=1000
+
+`../../common/defaults.sh
+sysctl -q net.ipv4.tcp_ecn=3
+`
+
+    0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
+   +0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
+   +0 bind(3, ..., ...) = 0
+   +0 listen(3, 1) = 0
+
+   +0 < SEWA 0:0(0) win 32792 <mss 1050,nop,nop,sackOK,nop,wscale 8>
++.002 > SW. 0:0(0) ack 1 <mss 1460,ECN e1b 1 ceb 0 e0b 1,nop,nop,nop,sackOK,nop,wscale 8>
++0.05 < [ect0] W. 1:1(0) ack 1 win 264 <ECN e0b 1 ceb 0 e1b 1,nop>
++.002 accept(3, ..., ...) = 4
+
++.01 < [ect1] EAP. 1001:2001(1000) ack 1 win 264
++0.002 > [ect0] EA. 1:1(0) ack 1 <ECN e1b 1001 ceb 0 e0b 1,nop,nop,nop,sack 1001:2001>
++.01 < [ect0] EAP. 3001:4001(1000) ack 1 win 264
++0.002 > [ect0] EA. 1:1(0) ack 1 <ECN e1b 1001 ceb 0 e0b 1001,nop,nop,nop,sack 3001:4001 1001:2001>
++.01 < [ce] EAP. 5001:6001(1000) ack 1 win 264
++0.002 > [ect0] WA. 1:1(0) ack 1 <ECN e1b 1001 ceb 1000 e0b 1001,nop,nop,nop,sack 5001:6001 3001:4001 1001:2001>
+// DSACK works?
++.01 < [ect0] EAP. 5001:6001(1000) ack 1 win 264
++0.002 > [ect0] WA. 1:1(0) ack 1 <ECN e1b 1001 ceb 1000 e0b 2001,nop,nop,nop,sack 5001:6001 5001:6001 3001:4001>
++.01 < [ect1] EAP. 6001:7001(1000) ack 1 win 264
++0.002 > [ect0] WA. 1:1(0) ack 1 <ECN e1b 2001 ceb 1000 e0b 2001,nop,nop,nop,sack 5001:7001 3001:4001 1001:2001>
diff --git a/tools/testing/selftests/net/packetdrill/accecn/counters/tsnoprogress.pkt b/tools/testing/selftests/net/packetdrill/accecn/counters/tsnoprogress.pkt
new file mode 100644
index 000000000000..2f748f42154d
--- /dev/null
+++ b/tools/testing/selftests/net/packetdrill/accecn/counters/tsnoprogress.pkt
@@ -0,0 +1,26 @@
+// Test TS progress filtering
+--tcp_ts_tick_usecs=1000
+--tolerance_usecs=7000
+
+`../../common/defaults.sh
+sysctl -q net.ipv4.tcp_ecn=3
+`
+
+    0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
+   +0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
+   +0 bind(3, ..., ...) = 0
+   +0 listen(3, 1) = 0
+
+   +0 < SEWA 0:0(0) win 32792 <mss 1050,sackOK,TS val 1 ecr 0,nop,wscale 8>
++.002 > SW. 0:0(0) ack 1 <mss 1460,sackOK,TS val 10 ecr 1,ECN e1b 1 ceb 0 e0b 1,nop,nop,wscale 8>
++0.05 < [ect0] W. 1:1(0) ack 1 win 264 <nop,nop,TS val 2 ecr 10>
++.002 accept(3, ..., ...) = 4
+
++0.01 %{ assert tcpi_delivered_ce == 0, tcpi_delivered_ce }%
+
++0.01 write(4, ..., 1000) = 1000
++.002 > [ect0] EAP. 1:1001(1000) ack 1 <nop,nop,TS val 83 ecr 2>
+  // Fake CE and claim no progress
++0.05 < [ect0] WA. 1:1(0) ack 1 win 264 <nop,nop,TS val 2 ecr 83>
+
++0.01 %{ assert tcpi_delivered_ce == 0, tcpi_delivered_ce }%
diff --git a/tools/testing/selftests/net/packetdrill/accecn/counters/tsprogress.pkt b/tools/testing/selftests/net/packetdrill/accecn/counters/tsprogress.pkt
new file mode 100644
index 000000000000..f8c3d9862d16
--- /dev/null
+++ b/tools/testing/selftests/net/packetdrill/accecn/counters/tsprogress.pkt
@@ -0,0 +1,25 @@
+// Test TS progress filtering
+--tcp_ts_tick_usecs=1000
+
+`../../common/defaults.sh
+sysctl -q net.ipv4.tcp_ecn=3
+`
+
+    0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
+   +0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
+   +0 bind(3, ..., ...) = 0
+   +0 listen(3, 1) = 0
+
+   +0 < SEWA 0:0(0) win 32792 <mss 1050,sackOK,TS val 1 ecr 0,nop,wscale 8>
++.002 > SW. 0:0(0) ack 1 <mss 1460,sackOK,TS val 10 ecr 1,ECN e1b 1 ceb 0 e0b 1,nop,nop,wscale 8>
++0.05 < [ect0] W. 1:1(0) ack 1 win 264 <nop,nop,TS val 2 ecr 10>
++.002 accept(3, ..., ...) = 4
+
++0.01 %{ assert tcpi_delivered_ce == 0, tcpi_delivered_ce }%
+
++0.01 write(4, ..., 1000) = 1000
++.002 > [ect0] EAP. 1:1001(1000) ack 1 <nop,nop,TS val 83 ecr 2>
+  // Fake CE and claim no progress
++0.05 < [ect0] WA. 1:1(0) ack 1 win 264 <nop,nop,TS val 3 ecr 83>
+
++0.01 %{ assert tcpi_delivered_ce == 1, tcpi_delivered_ce }%
diff --git a/tools/testing/selftests/net/packetdrill/accecn/fallback/acc_ecn_disabled.pkt b/tools/testing/selftests/net/packetdrill/accecn/fallback/acc_ecn_disabled.pkt
new file mode 100644
index 000000000000..d3a6a0ff6e09
--- /dev/null
+++ b/tools/testing/selftests/net/packetdrill/accecn/fallback/acc_ecn_disabled.pkt
@@ -0,0 +1,14 @@
+// Test that when accurate ECN is disabled,
+// client uses RFC3168 ECN for SYN
+
+`../../common/defaults.sh
+sysctl -q net.ipv4.tcp_ecn=1
+`
+
+    0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 4
++.002 ... 0.052 connect(4, ..., ...) = 0
+
++.002 > [noecn] SEW 0:0(0) <mss 1460,sackOK,TS val 100 ecr 0,nop,wscale 8>
++0.05 < [noecn] S. 0:0(0) ack 1 win 32767 <mss 1460,sackOK,nop,nop,nop,wscale 8>
++.002 > [noecn] . 1:1(0) ack 1
+
diff --git a/tools/testing/selftests/net/packetdrill/accecn/fallback/accecn-to-rfc3168.pkt b/tools/testing/selftests/net/packetdrill/accecn/fallback/accecn-to-rfc3168.pkt
new file mode 100644
index 000000000000..c26262934e37
--- /dev/null
+++ b/tools/testing/selftests/net/packetdrill/accecn/fallback/accecn-to-rfc3168.pkt
@@ -0,0 +1,18 @@
+// Test AccECN -> RFC3168 fallback when sysctl asks for RFC3168 ECN
+
+`../../common/defaults.sh
+sysctl -q net.ipv4.tcp_ecn=1
+`
+
+    0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
+   +0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
+   +0 bind(3, ..., ...) = 0
+   +0 listen(3, 1) = 0
+
+   +0 < SEWA 0:0(0) win 32792 <mss 1050,nop,nop,sackOK,nop,wscale 8>
++.002 > SE. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK,nop,wscale 8>
++0.05 < . 1:1(0) ack 1 win 320
++.002 accept(3, ..., ...) = 4
+
++0.01 write(4, ..., 1000) = 1000
++.002 > [ect0] P. 1:1001(1000) ack 1
diff --git a/tools/testing/selftests/net/packetdrill/accecn/fallback/client_accecn_options_drop.pkt b/tools/testing/selftests/net/packetdrill/accecn/fallback/client_accecn_options_drop.pkt
new file mode 100644
index 000000000000..5a1a2d151277
--- /dev/null
+++ b/tools/testing/selftests/net/packetdrill/accecn/fallback/client_accecn_options_drop.pkt
@@ -0,0 +1,34 @@
+// Client negotiates AccECN and starts sending
+// AccECN option in last ACK and data segments
+// Middlebox drops AccECN option and client
+// reverts to ACE flags only
+
+`../../common/defaults.sh
+sysctl -q net.ipv4.tcp_ecn=3
+sysctl -q net.ipv4.tcp_ecn_option=2
+sysctl -q net.ipv4.tcp_ecn_option_beacon=1
+`
+
+    0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
+   +0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
+   +0 bind(3, ..., ...) = 0
+   +0 listen(3, 1) = 0
+
+   +0 < SEWA 0:0(0) win 32792 <mss 1050,nop,nop,sackOK,nop,wscale 8>
++.002 > SW. 0:0(0) ack 1 <mss 1460,ECN e1b 1 ceb 0 e0b 1,nop,nop,nop,sackOK,nop,wscale 8>
++0.05 < [ect0] W. 1:1(0) ack 1 win 257 <ECN e0b 1 ceb 0 e1b 1,nop>
++.002 accept(3, ..., ...) = 4
+
++0.05 < [ect0] EAP. 1:1001(1000) ack 1 win 257 <ECN e0b 1 ceb 0 e1b 1,nop>
++.002 > [ect0] EA. 1:1(0) ack 1001 <ECN e1b 1 ceb 0 e0b 1001,nop>
+   +0 read(4, ..., 1000) = 1000
+
++0.05 < [ect0] EAP. 1:1001(1000) ack 1 win 257 <ECN e0b 1 ceb 0 e1b 1,nop>
++.002 > [ect0] EA. 1:1(0) ack 1001 <ECN e1b 1 ceb 0 e0b 2001,nop,nop,nop,sack 1:1001>
+
++0.05 < [ect0] EAP. 1:1001(1000) ack 1 win 257 <ECN e0b 1 ceb 0 e1b 1,nop>
++.002 > [ect0] EA. 1:1(0) ack 1001 <nop,nop,sack 1:1001>
+
++0.05 < [ect0] EAP. 1001:2001(1000) ack 1 win 257 <ECN e0b 1 ceb 0 e1b 1,nop>
++.002 > [ect0] EA. 1:1(0) ack 2001
+   +0 read(4, ..., 1000) = 1000
diff --git a/tools/testing/selftests/net/packetdrill/accecn/fallback/client_accecn_options_lost.pkt b/tools/testing/selftests/net/packetdrill/accecn/fallback/client_accecn_options_lost.pkt
new file mode 100644
index 000000000000..6ce9042e11c2
--- /dev/null
+++ b/tools/testing/selftests/net/packetdrill/accecn/fallback/client_accecn_options_lost.pkt
@@ -0,0 +1,38 @@
+// Client negotiates AccECN and starts sending
+// AccECN option in last ACK and data segments
+// Middlebox accepts AccECN option but some packets
+// are lost due to congestion. Client should
+// continue to send AccECN option
+
+`../../common/defaults.sh
+sysctl -q net.ipv4.tcp_ecn=3
+sysctl -q net.ipv4.tcp_ecn_option=2
+`
+
++0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 4
++.002 ... 0.052 connect(4, ..., ...) = 0
+
++.002 > [noecn] SEWA 0:0(0) <mss 1460,sackOK,TS val 100 ecr 0,nop,wscale 8>
++0.05 < [ect0] SW. 0:0(0) ack 1 win 32767 <mss 1024,ECN e0b 1 ceb 0 e1b 1,nop,nop,nop,sackOK,nop,wscale 8>
++.002 > [ect0] A. 1:1(0) ack 1 <ECN e1b 1 ceb 0 e0b 1,nop>
+
+// Send
++0.01 write(4, ..., 3000) = 3000
++.002 > [ect0] .5 1:1013(1012) ack 1 <ECN e1b 1 ceb 0 e0b 1,nop>
++.002 > [ect0] P.5 1013:2025(1012) ack 1 <ECN e1b 1 ceb 0 e0b 1,nop>
++.002 > [ect0] P.5 2025:3001(976) ack 1 <ECN e1b 1 ceb 0 e0b 1,nop>
+
+// First two segments were lost due to congestion as SACK was
+// received acknowledging 3rd segment
++0.1 < [ect0] .5 1:1(0) ack 1 win 264 <ECN e1b 1 ceb 0 e0b 977,nop,nop,nop,sack 2025:3001>
+
+// Since data with option was SACKed, we can
+// continue to use AccECN option for the rest of
+// the connection. This one is a rexmt
++.02~+0.5 > [ect0] .5 1:1013(1012) ack 1 <ECN e1b 1 ceb 0 e0b 1,nop>
++0.1 < [ect0] .5 1:1(0) ack 3001 win 264 <ECN e1b 1 ceb 0 e0b 3000,nop>
+
+// Send new data, it should contain AccECN option
++0.01 write(4, ..., 2000) = 2000
++.002 > [ect0] .5 3001:4013(1012) ack 1 <ECN e1b 1 ceb 0 e0b 1,nop>
++.002 > [ect0] P.5 4013:5001(988) ack 1 <ECN e1b 1 ceb 0 e0b 1,nop>
diff --git a/tools/testing/selftests/net/packetdrill/accecn/fallback/ecn3.pkt b/tools/testing/selftests/net/packetdrill/accecn/fallback/ecn3.pkt
new file mode 100644
index 000000000000..3a6f5c5a02ce
--- /dev/null
+++ b/tools/testing/selftests/net/packetdrill/accecn/fallback/ecn3.pkt
@@ -0,0 +1,12 @@
+// Test that tcp_ecn=4 uses RFC3168 ECN for SYN
+
+`../../common/defaults.sh
+sysctl -q net.ipv4.tcp_ecn=4
+`
+
+    0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 4
++.002 ... 0.05 connect(4, ..., ...) = 0
+
++.002 > SEW 0:0(0) <mss 1460,sackOK,TS val 100 ecr 0,nop,wscale 8>
++0.05 < S. 0:0(0) ack 1 win 32767 <mss 1460,nop,nop,sackOK,nop,wscale 8>
++.002 > . 1:1(0) ack 1
diff --git a/tools/testing/selftests/net/packetdrill/accecn/fallback/ipflags-drop.pkt b/tools/testing/selftests/net/packetdrill/accecn/fallback/ipflags-drop.pkt
new file mode 100644
index 000000000000..2f9de0f71fe9
--- /dev/null
+++ b/tools/testing/selftests/net/packetdrill/accecn/fallback/ipflags-drop.pkt
@@ -0,0 +1,14 @@
+// Test IP flags drop
+--tolerance_usecs=50000
+
+`../../common/defaults.sh
+sysctl -q net.ipv4.tcp_ecn=3
+`
+
+    0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 4
++.002 ... 1.1 connect(4, ..., ...) = 0
+
++.002 > SEWA 0:0(0) <mss 1460,sackOK,TS val 100 ecr 0,nop,wscale 8>
++.02 ~ +1.1 > SEWA 0:0(0) <mss 1460,sackOK,TS val 100 ecr 0,nop,wscale 8>
++0.05 < S. 0:0(0) ack 1 win 32767 <mss 1460,nop,nop,sackOK,nop,wscale 8>
++.002 > [noecn] . 1:1(0) ack 1
diff --git a/tools/testing/selftests/net/packetdrill/accecn/fallback/listen-opt-drop.pkt b/tools/testing/selftests/net/packetdrill/accecn/fallback/listen-opt-drop.pkt
new file mode 100644
index 000000000000..38273576eced
--- /dev/null
+++ b/tools/testing/selftests/net/packetdrill/accecn/fallback/listen-opt-drop.pkt
@@ -0,0 +1,16 @@
+// SYN/ACK option drop test
+
+`../../common/defaults.sh
+sysctl -q net.ipv4.tcp_ecn=3
+`
+
+    0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
+   +0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
+   +0 bind(3, ..., ...) = 0
+   +0 listen(3, 1) = 0
+
+   +0 < SEWA 0:0(0) win 32792 <mss 1050,nop,nop,sackOK,nop,wscale 8>
++.002 > SW. 0:0(0) ack 1 <mss 1460,ECN e1b 1 ceb 0 e0b 1,nop,nop,nop,sackOK,nop,wscale 8>
++.02 ~+2 > SW. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK,nop,wscale 8>
++.02 ~+5 > S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK,nop,wscale 8>
++.02 ~+8 > S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK,nop,wscale 8>
diff --git a/tools/testing/selftests/net/packetdrill/accecn/fallback/multiple_syn_ack_drop.pkt b/tools/testing/selftests/net/packetdrill/accecn/fallback/multiple_syn_ack_drop.pkt
new file mode 100644
index 000000000000..acb19cb323a5
--- /dev/null
+++ b/tools/testing/selftests/net/packetdrill/accecn/fallback/multiple_syn_ack_drop.pkt
@@ -0,0 +1,28 @@
+// Test that SYN-ACK with ACE flags and without
+// ACE flags got dropped. Although we disable ECN,
+// we shouldn't consider this as blackholed as
+// these are dropped due to congestion
+
+`../../common/defaults.sh
+sysctl -q net.ipv4.tcp_ecn=3
+sysctl -q net.ipv4.tcp_ecn_option=2
+`
+
++0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
++0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
++0 bind(3, ..., ...) = 0
++0 listen(3, 1) = 0
+
++0 < [noecn] SEWA 0:0(0) win 32792 <mss 1460,nop,nop,sackOK,nop,wscale 8>
++.002 > [noecn] SW. 0:0(0) ack 1 <mss 1460,ECN e1b 1 ceb 0 e0b 1,nop,nop,nop,sackOK,nop,wscale 8>
+
+// Retransmit SYN-ACK without option
++1~+1.1 > [noecn] SW. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK,nop,wscale 8>
+
+// SYN-ACK maybe getting blackholed, disable ECN
++2~+2.2 > [noecn] S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK,nop,wscale 8>
++4~+4.4 > [noecn] S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK,nop,wscale 8>
+
+// Received an ACK after sending 3rd retransmission, not a blackhole
++0.1 < [noecn] . 1:1(0) ack 1 win 320
++.002 accept(3, ..., ...) = 4
diff --git a/tools/testing/selftests/net/packetdrill/accecn/fallback/multiple_syn_drop.pkt b/tools/testing/selftests/net/packetdrill/accecn/fallback/multiple_syn_drop.pkt
new file mode 100644
index 000000000000..2fe03d1c83a2
--- /dev/null
+++ b/tools/testing/selftests/net/packetdrill/accecn/fallback/multiple_syn_drop.pkt
@@ -0,0 +1,18 @@
+// Test that SYN with ACE flags and without
+// ACE flags got dropped. Although we disable
+// ECN, we shouldn't consider this as blackholed
+// as these are dropped due to congestion
+
+`../../common/defaults.sh
+sysctl -q net.ipv4.tcp_ecn=3
+`
+
+    0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 4
++.002 ... 3.1 connect(4, ..., ...) = 0
+
++.002 > [noecn] SEWA 0:0(0) <mss 1460,sackOK,TS val 100 ecr 0,nop,wscale 8> 
++.02~+1.1 > [noecn] SEWA 0:0(0) <mss 1460,sackOK,TS val 100 ecr 0,nop,wscale 8>
++.02~+1.1 > [noecn] S 0:0(0) <mss 1460,sackOK,TS val 100 ecr 0,nop,wscale 8>
++.02~+1.1 > [noecn] S 0:0(0) <mss 1460,sackOK,TS val 100 ecr 0,nop,wscale 8>
++0.1 < [noecn] S. 0:0(0) ack 1 win 32767 <mss 1460,nop,nop,sackOK,nop,wscale 8>
++0~+0.01 > [noecn] . 1:1(0) ack 1
diff --git a/tools/testing/selftests/net/packetdrill/accecn/fallback/negotiation-bleach.pkt b/tools/testing/selftests/net/packetdrill/accecn/fallback/negotiation-bleach.pkt
new file mode 100644
index 000000000000..9435f8c4f03f
--- /dev/null
+++ b/tools/testing/selftests/net/packetdrill/accecn/fallback/negotiation-bleach.pkt
@@ -0,0 +1,23 @@
+// Test AccECN flags bleach
+
+`../../common/defaults.sh
+sysctl -q net.ipv4.tcp_ecn=3
+`
+
+    0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
+   +0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
+   +0 bind(3, ..., ...) = 0
+   +0 listen(3, 1) = 0
+
+   +0 < SEWA 0:0(0) win 32792 <mss 1050,nop,nop,sackOK,nop,wscale 8>
++.002 > SW. 0:0(0) ack 1 <mss 1460,ECN e1b 1 ceb 0 e0b 1,nop,nop,nop,sackOK,nop,wscale 8>
++0.05 < [ect0] . 1:1(0) ack 1 win 320 <ECN e0b 1 ceb 0 e1b 1,nop>
++.002 accept(3, ..., ...) = 4
+
++0.01 %{ assert tcpi_delivered_ce == 0, tcpi_delivered_ce }%
+
++0.01 write(4, ..., 1000) = 1000
++.002 > [noecn] EAP. 1:1001(1000) ack 1 <ECN e1b 1 ceb 0 e0b 1,nop>
++0.05 < [ect0] EAP. 1:1(0) ack 1001 win 320
+
++0.01 %{ assert tcpi_delivered_ce == 0, tcpi_delivered_ce }%
diff --git a/tools/testing/selftests/net/packetdrill/accecn/fallback/rfc3168-to-fallback.pkt b/tools/testing/selftests/net/packetdrill/accecn/fallback/rfc3168-to-fallback.pkt
new file mode 100644
index 000000000000..51c3559de6e1
--- /dev/null
+++ b/tools/testing/selftests/net/packetdrill/accecn/fallback/rfc3168-to-fallback.pkt
@@ -0,0 +1,18 @@
+// Test RFC3168 fallback when sysctl asks for AccECN
+
+`../../common/defaults.sh
+sysctl -q net.ipv4.tcp_ecn=3
+`
+
+    0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
+   +0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
+   +0 bind(3, ..., ...) = 0
+   +0 listen(3, 1) = 0
+
+   +0 < SEW 0:0(0) win 32792 <mss 1050,nop,nop,sackOK,nop,wscale 8>
++.002 > SE. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK,nop,wscale 8>
++0.05 < . 1:1(0) ack 1 win 320
++.002 accept(3, ..., ...) = 4
+
++0.01 write(4, ..., 1000) = 1000
++.002 > [ect0] P. 1:1001(1000) ack 1
diff --git a/tools/testing/selftests/net/packetdrill/accecn/fallback/rfc3168-to-rfc3168.pkt b/tools/testing/selftests/net/packetdrill/accecn/fallback/rfc3168-to-rfc3168.pkt
new file mode 100644
index 000000000000..905c62e408df
--- /dev/null
+++ b/tools/testing/selftests/net/packetdrill/accecn/fallback/rfc3168-to-rfc3168.pkt
@@ -0,0 +1,18 @@
+// Test RFC3168 ECN when sysctl asks for RFC3168 ECN
+
+`../../common/defaults.sh
+sysctl -q net.ipv4.tcp_ecn=1
+`
+
+    0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
+   +0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
+   +0 bind(3, ..., ...) = 0
+   +0 listen(3, 1) = 0
+
+   +0 < SEW 0:0(0) win 32792 <mss 1050,nop,nop,sackOK,nop,wscale 8>
++.002 > SE. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK,nop,wscale 8>
++0.05 < . 1:1(0) ack 1 win 320
++.002 accept(3, ..., ...) = 4
+
++0.01 write(4, ..., 1000) = 1000
++.002 > [ect0] P. 1:1001(1000) ack 1
diff --git a/tools/testing/selftests/net/packetdrill/accecn/fallback/syn_ace_flags_acked_after_retransmit.pkt b/tools/testing/selftests/net/packetdrill/accecn/fallback/syn_ace_flags_acked_after_retransmit.pkt
new file mode 100644
index 000000000000..9eaa8db924a9
--- /dev/null
+++ b/tools/testing/selftests/net/packetdrill/accecn/fallback/syn_ace_flags_acked_after_retransmit.pkt
@@ -0,0 +1,18 @@
+// Test that SYN with ACE flags was Acked
+// after 2nd retransmission. In this case,
+// since we got SYN-ACK that supports Accurate
+// ECN, we consider this as successful negotiation
+
+`../../common/defaults.sh
+sysctl -q net.ipv4.tcp_ecn=3
+`
+
+    0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 4
++.002 ... 2.1 connect(4, ..., ...) = 0
+
++.002 > [noecn] SEWA 0:0(0) <mss 1460,sackOK,TS val 100 ecr 0,nop,wscale 8>
++1~+1.1 > [noecn] SEWA 0:0(0) <mss 1460,sackOK,TS val 100 ecr 0,nop,wscale 8>
++1~+1.1 > [noecn] S 0:0(0) <mss 1460,sackOK,TS val 100 ecr 0,nop,wscale 8>
+
++0.1 < [noecn] SW. 0:0(0) ack 1 win 32767 <mss 1016,ECN e0b 1 ceb 0 e1b 1,nop,nop,nop,sackOK,nop,wscale 8>
++0~+0.01 > [ect0] W. 1:1(0) ack 1 <ECN e1b 1 ceb 0 e0b 1,nop>
diff --git a/tools/testing/selftests/net/packetdrill/accecn/fallback/syn_ace_flags_drop.pkt b/tools/testing/selftests/net/packetdrill/accecn/fallback/syn_ace_flags_drop.pkt
new file mode 100644
index 000000000000..b9ddf0426c3b
--- /dev/null
+++ b/tools/testing/selftests/net/packetdrill/accecn/fallback/syn_ace_flags_drop.pkt
@@ -0,0 +1,16 @@
+// Test that SYN with ACE flags got dropped
+// We retry one more time with ACE and then
+// fallback to disabled ECN
+
+`../../common/defaults.sh
+sysctl -q net.ipv4.tcp_ecn=3
+`
+
+    0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 4
++.002 ... 2.1 connect(4, ..., ...) = 0
+
++.002 > [noecn] SEWA 0:0(0) <mss 1460,sackOK,TS val 100 ecr 0,nop,wscale 8>
++1~+1.1 > [noecn] SEWA 0:0(0) <mss 1460,sackOK,TS val 100 ecr 0,nop,wscale 8>
++1~+1.1 > [noecn] S 0:0(0) <mss 1460,sackOK,TS val 100 ecr 0,nop,wscale 8>
++0.1 < [noecn] S. 0:0(0) ack 1 win 32767 <mss 1460,nop,nop,sackOK,nop,wscale 8>
++0~+0.01 > [noecn] . 1:1(0) ack 1
diff --git a/tools/testing/selftests/net/packetdrill/accecn/fallback/syn_ack_ace_flags_acked_after_retransmit.pkt b/tools/testing/selftests/net/packetdrill/accecn/fallback/syn_ack_ace_flags_acked_after_retransmit.pkt
new file mode 100644
index 000000000000..bf66a2dcd0d5
--- /dev/null
+++ b/tools/testing/selftests/net/packetdrill/accecn/fallback/syn_ack_ace_flags_acked_after_retransmit.pkt
@@ -0,0 +1,27 @@
+// Test that SYN-ACK with ACE flags was Acked
+// after 2nd retransmission. In this case,
+// since we got the last ACK that supports Accurate
+// ECN, we consider this as successful negotiation
+
+`../../common/defaults.sh
+sysctl -q net.ipv4.tcp_ecn=3
+sysctl -q net.ipv4.tcp_ecn_option=2
+`
+
++0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
++0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
++0 bind(3, ..., ...) = 0
++0 listen(3, 1) = 0
+
++0 < [noecn] SEWA 0:0(0) win 32792 <mss 1460,nop,nop,sackOK,nop,wscale 8>
++.002 > [noecn] SW. 0:0(0) ack 1 <mss 1460,ECN e1b 1 ceb 0 e0b 1,nop,nop,nop,sackOK,nop,wscale 8>
+
+// Retransmit SYN-ACK without option
++1~+1.1 > [noecn] SW. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK,nop,wscale 8>
+
+// SYN-ACK maybe getting blackholed, disable ECN
++2~+2.2 > [noecn] S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK,nop,wscale 8>
+
+// Received an ACK with ACE flags, state should be set to negotiation succeeded
++0.1 < [noecn] W. 1:1(0) ack 1 win 320 <ECN e0b 1 ceb 0 e1b 1,nop>
++.002 accept(3, ..., ...) = 4
diff --git a/tools/testing/selftests/net/packetdrill/accecn/fallback/syn_ack_ace_flags_drop.pkt b/tools/testing/selftests/net/packetdrill/accecn/fallback/syn_ack_ace_flags_drop.pkt
new file mode 100644
index 000000000000..a05ba4d190a8
--- /dev/null
+++ b/tools/testing/selftests/net/packetdrill/accecn/fallback/syn_ack_ace_flags_drop.pkt
@@ -0,0 +1,27 @@
+// Test that SYN-ACK with ACE flags got dropped
+// We retry one more time with ACE and then
+// fallback to disabled ECN
+
+`../../common/defaults.sh
+sysctl -q net.ipv4.tcp_ecn=3
+sysctl -q net.ipv4.tcp_ecn_option=2
+`
+
++0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
++0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
++0 bind(3, ..., ...) = 0
++0 listen(3, 1) = 0
+
++0 < [noecn] SEWA 0:0(0) win 32792 <mss 1460,nop,nop,sackOK,nop,wscale 8>
++.002 > [noecn] SW. 0:0(0) ack 1 <mss 1460,ECN e1b 1 ceb 0 e0b 1,nop,nop,nop,sackOK,nop,wscale 8>
+
+// Retransmit SYN-ACK without option
++1~+1.1 > [noecn] SW. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK,nop,wscale 8>
+
+// SYN-ACK maybe getting blackholed, disable ECN
++2~+2.2 > [noecn] S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK,nop,wscale 8>
+
+// Received an ACK with no ACE flags, state should be set to blackholed
++0.1 < [noecn] . 1:1(0) ack 1 win 320
++0 accept(3, ..., ...) = 4
+
diff --git a/tools/testing/selftests/net/packetdrill/accecn/negotiation/3rd-ack-after-synack-rxmt.pkt b/tools/testing/selftests/net/packetdrill/accecn/negotiation/3rd-ack-after-synack-rxmt.pkt
new file mode 100644
index 000000000000..ce50bee20db4
--- /dev/null
+++ b/tools/testing/selftests/net/packetdrill/accecn/negotiation/3rd-ack-after-synack-rxmt.pkt
@@ -0,0 +1,19 @@
+// Test 3rd ACK flags when SYN-ACK is rexmitted
+
+`../../common/defaults.sh
+sysctl -q net.ipv4.tcp_ecn=3
+`
+
+    0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 4
++.002 ... 0.052 connect(4, ..., ...) = 0
+
++.002 > [noecn] SEWA 0:0(0) <mss 1460,sackOK,TS val 100 ecr 0,nop,wscale 8>
++0.05 < [noecn] SW. 0:0(0) ack 1 win 32767 <mss 1460,ECN e0b 1 ceb 0 e1b 1,nop,nop,nop,sackOK,nop,wscale 8>
++.002 > [ect0] W. 1:1(0) ack 1 <ECN e1b 1 ceb 0 e0b 1,nop>
+
++0.1 < [ect0] S. 0:0(0) ack 1 win 32767 <mss 1460,nop,nop,sackOK,nop,wscale 8>
+
+// Our code currently sends a challenge ACK
+// when it receives a SYN in ESTABLISHED state
+// based on the latest SYN
++.002 > [ect0] A. 1:1(0) ack 1 <ECN e1b 1 ceb 0 e0b 1,nop>
diff --git a/tools/testing/selftests/net/packetdrill/accecn/negotiation/3rd-dups.pkt b/tools/testing/selftests/net/packetdrill/accecn/negotiation/3rd-dups.pkt
new file mode 100644
index 000000000000..4399d904b634
--- /dev/null
+++ b/tools/testing/selftests/net/packetdrill/accecn/negotiation/3rd-dups.pkt
@@ -0,0 +1,26 @@
+// Test SYN/ACK rexmit triggered 3rd ACK duplicate + CE on first data seg
+
+`../../common/defaults.sh
+sysctl -q net.ipv4.tcp_ecn=3
+`
+
+    0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
+   +0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
+   +0 bind(3, ..., ...) = 0
+   +0 listen(3, 1) = 0
+
+   +0 < SEWA 0:0(0) win 32792 <mss 1050,nop,nop,sackOK,nop,wscale 8>
++.002 > SW. 0:0(0) ack 1 <mss 1460,ECN e1b 1 ceb 0 e0b 1,nop,nop,nop,sackOK,nop,wscale 8>
+
+// SYN/ACK rexmitted => two 3rd ACKs in-flight
++1.0~+1.1 > SW. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK,nop,wscale 8>
+// Delivered 1st 3rd ACK
++0.05 < [ect0] W. 1:1(0) ack 1 win 257 <ECN e0b 1 ceb 0 e1b 1,nop>
++.002 accept(3, ..., ...) = 4
+
+// Duplicate 3rd ACK delivered
++1.05 < [ect0] W. 1:1(0) ack 1 win 257 <ECN e0b 1 ceb 0 e1b 1,nop>
+
++0.05 < [ce] EAP. 1:1001(1000) ack 1 win 257 <ECN e0b 1 ceb 0 e1b 1,nop>
++.002 > [ect0] WA. 1:1(0) ack 1001 <ECN e1b 1 ceb 1000 e0b 1,nop>
+   +0 read(4, ..., 1000) = 1000
diff --git a/tools/testing/selftests/net/packetdrill/accecn/negotiation/accecn_then_notecn_syn.pkt b/tools/testing/selftests/net/packetdrill/accecn/negotiation/accecn_then_notecn_syn.pkt
new file mode 100644
index 000000000000..7da7f7601ca2
--- /dev/null
+++ b/tools/testing/selftests/net/packetdrill/accecn/negotiation/accecn_then_notecn_syn.pkt
@@ -0,0 +1,28 @@
+// Test that SYN-ACK with ACE flags and without
+// ACE flags got dropped. Although we disable ECN,
+// we shouldn't consider this as blackholed as
+// these are dropped due to congestion
+
+`../../common/defaults.sh
+sysctl -q net.ipv4.tcp_ecn=3
+sysctl -q net.ipv4.tcp_ecn_option=2
+`
+
++0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
++0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
++0 bind(3, ..., ...) = 0
++0 listen(3, 1) = 0
+
++0 < [ect0] SEWA 0:0(0) win 32792 <mss 1460,nop,nop,sackOK,nop,wscale 8>
++.002 > [noecn] SA. 0:0(0) ack 1 <mss 1460,ECN e1b 1 ceb 0 e0b 1,nop,nop,nop,sackOK,nop,wscale 8>
+
+// Retransmit SYN
++0.1 < [noecn] S 0:0(0) win 32792 <mss 1460,nop,nop,sackOK,nop,wscale 8>
++.002 > [noecn] SW. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK,nop,wscale 8>
+
++0.1 < [noecn] W. 1:1(0) ack 1 win 320 <ECN e0b 1 ceb 0 e1b 1,nop>
++.002 accept(3, ..., ...) = 4
+
+// Write with AccECN option but with ip-noecn since we received one SYN with ACE=0
++0.01 write(4, ..., 100) = 100
++.002 > [noecn] P5. 1:101(100) ack 1 <ECN e1b 1 ceb 0 e0b 1,nop>
diff --git a/tools/testing/selftests/net/packetdrill/accecn/negotiation/clientside-disabled.pkt b/tools/testing/selftests/net/packetdrill/accecn/negotiation/clientside-disabled.pkt
new file mode 100644
index 000000000000..e1fa77c18a72
--- /dev/null
+++ b/tools/testing/selftests/net/packetdrill/accecn/negotiation/clientside-disabled.pkt
@@ -0,0 +1,12 @@
+// AccECN sysctl server-side only, no ECN/AccECN
+
+`../../common/defaults.sh
+sysctl -q net.ipv4.tcp_ecn=5
+`
+
+    0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 4
++.002 ... 0.052 connect(4, ..., ...) = 0
+
++.002 > S 0:0(0) <mss 1460,sackOK,TS val 100 ecr 0,nop,wscale 8>
++0.05 < S. 0:0(0) ack 1 win 32767 <mss 1460,sackOK,nop,nop,nop,wscale 8>
++.002 > . 1:1(0) ack 1
diff --git a/tools/testing/selftests/net/packetdrill/accecn/negotiation/negotiation-connect.pkt b/tools/testing/selftests/net/packetdrill/accecn/negotiation/negotiation-connect.pkt
new file mode 100644
index 000000000000..a8eb14435712
--- /dev/null
+++ b/tools/testing/selftests/net/packetdrill/accecn/negotiation/negotiation-connect.pkt
@@ -0,0 +1,23 @@
+// Test basic AccECN negotiation
+
+`../../common/defaults.sh
+sysctl -q net.ipv4.tcp_ecn=3
+`
+
+    0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 4
++.002 ... 0.052 connect(4, ..., ...) = 0
+
++.002 > SEWA 0:0(0) <mss 1460,sackOK,TS val 100 ecr 0,nop,wscale 8>
++0.05 < SW. 0:0(0) ack 1 win 32767 <mss 1460,ECN e0b 1 ceb 0 e1b 1,nop,nop,nop,sackOK,nop,wscale 8>
++.002 > [ect0] W. 1:1(0) ack 1 <ECN e1b 1 ceb 0 e0b 1,nop>
+
++0.01 write(4, ..., 1000) = 1000
++.002 > [ect0] EAP. 1:1001(1000) ack 1 <ECN e1b 1 ceb 0 e0b 1,nop>
++.05 < [ect0] EAP. 1:1(0) ack 1001 win 256 <ECN e0b 1001 ceb 0 e1b 0,nop>
+
++0.01 %{ assert tcpi_delivered_ce == 0, tcpi_delivered_ce }%
+
++0.01 write(4, ..., 1000) = 1000
++.002 > [ect0] EAP. 1001:2001(1000) ack 1 <ECN e1b 1 ceb 0 e0b 1,nop>
+
++0.01 %{ assert tcpi_delivered_ce == 0, tcpi_delivered_ce }%
diff --git a/tools/testing/selftests/net/packetdrill/accecn/negotiation/negotiation-listen.pkt b/tools/testing/selftests/net/packetdrill/accecn/negotiation/negotiation-listen.pkt
new file mode 100644
index 000000000000..60d56208cb1d
--- /dev/null
+++ b/tools/testing/selftests/net/packetdrill/accecn/negotiation/negotiation-listen.pkt
@@ -0,0 +1,26 @@
+// Test basic AccECN negotiation
+
+`../../common/defaults.sh
+sysctl -q net.ipv4.tcp_ecn=3
+`
+
+    0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
+   +0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
+   +0 bind(3, ..., ...) = 0
+   +0 listen(3, 1) = 0
+
+   +0 < SEWA 0:0(0) win 32792 <mss 1050,nop,nop,sackOK,nop,wscale 8>
++.002 > SW. 0:0(0) ack 1 <mss 1460,ECN e1b 1 ceb 0 e0b 1,nop,nop,nop,sackOK,nop,wscale 8>
++0.05 < [ect0] W. 1:1(0) ack 1 win 320 <ECN e0b 1 ceb 0 e1b 1,nop>
++.002 accept(3, ..., ...) = 4
+
++0.01 %{ assert tcpi_delivered_ce == 0, tcpi_delivered_ce }%
+
++0.01 write(4, ..., 1000) = 1000
++.002 > [ect0] EAP. 1:1001(1000) ack 1 <ECN e1b 1 ceb 0 e0b 1,nop>
++0.05 < [ect0] EAP. 1:1(0) ack 1001 win 320
+
++0.01 %{ assert tcpi_delivered_ce == 0, tcpi_delivered_ce }%
+
++0.01 write(4, ..., 1000) = 1000
++.002 > [ect0] EAP. 1001:2001(1000) ack 1 <ECN e1b 1 ceb 0 e0b 1,nop>
diff --git a/tools/testing/selftests/net/packetdrill/accecn/negotiation/negotiation-noopt-connect.pkt b/tools/testing/selftests/net/packetdrill/accecn/negotiation/negotiation-noopt-connect.pkt
new file mode 100644
index 000000000000..7c5f1d6ba770
--- /dev/null
+++ b/tools/testing/selftests/net/packetdrill/accecn/negotiation/negotiation-noopt-connect.pkt
@@ -0,0 +1,23 @@
+// Test basic AccECN negotiation without option
+
+`../../common/defaults.sh
+sysctl -q net.ipv4.tcp_ecn=3
+`
+
+    0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 4
++.002 ... 0.052 connect(4, ..., ...) = 0
+
++.002 > SEWA 0:0(0) <mss 1460,sackOK,TS val 100 ecr 0,nop,wscale 8>
++0.05 < SW. 0:0(0) ack 1 win 32767 <mss 1460,nop,nop,sackOK,nop,wscale 8>
++.002 > [ect0] W. 1:1(0) ack 1
+
++0.01 write(4, ..., 1000) = 1000
++.002 > [ect0] EAP. 1:1001(1000) ack 1
++.05 < [ect0] EAP. 1:1(0) ack 1001 win 256
+
++0.01 %{ assert tcpi_delivered_ce == 0, tcpi_delivered_ce }%
+
++0.01 write(4, ..., 1000) = 1000
++.002 > [ect0] EAP. 1001:2001(1000) ack 1
+
++0.01 %{ assert tcpi_delivered_ce == 0, tcpi_delivered_ce }%
diff --git a/tools/testing/selftests/net/packetdrill/accecn/negotiation/negotiation-optenable.pkt b/tools/testing/selftests/net/packetdrill/accecn/negotiation/negotiation-optenable.pkt
new file mode 100644
index 000000000000..44ac0f82c13f
--- /dev/null
+++ b/tools/testing/selftests/net/packetdrill/accecn/negotiation/negotiation-optenable.pkt
@@ -0,0 +1,23 @@
+// Test basic AccECN negotiation, late option enable
+
+`../../common/defaults.sh
+sysctl -q net.ipv4.tcp_ecn=3
+`
+
+    0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 4
++.002 ... 0.052 connect(4, ..., ...) = 0
+
++.002 > SEWA 0:0(0) <mss 1460,sackOK,TS val 100 ecr 0,nop,wscale 8>
++0.05 < SW. 0:0(0) ack 1 win 32767 <mss 1460,nop,nop,sackOK,nop,wscale 8>
++.002 > [ect0] W. 1:1(0) ack 1
+
++0.01 write(4, ..., 1000) = 1000
++.002 > [ect0] EAP. 1:1001(1000) ack 1
++.05 < [ect0] EAP. 1:1(0) ack 1001 win 256 <ECN e0b 1001 ceb 0 e1b 1,nop>
+
++0.01 %{ assert tcpi_delivered_ce == 0, tcpi_delivered_ce }%
+
++0.01 write(4, ..., 1000) = 1000
++.002 > [ect0] EAP. 1001:2001(1000) ack 1 <ECN e1b 1 ceb 0 e0b 1,nop>
+
++0.01 %{ assert tcpi_delivered_ce == 0, tcpi_delivered_ce }%
diff --git a/tools/testing/selftests/net/packetdrill/accecn/negotiation/no-ecn-after-acc-ecn.pkt b/tools/testing/selftests/net/packetdrill/accecn/negotiation/no-ecn-after-acc-ecn.pkt
new file mode 100644
index 000000000000..ba37a1799398
--- /dev/null
+++ b/tools/testing/selftests/net/packetdrill/accecn/negotiation/no-ecn-after-acc-ecn.pkt
@@ -0,0 +1,20 @@
+// Test client behavior on receiving a non ECN SYN-ACK
+// after receiving an AccECN SYN-ACK and moving to
+// ESTABLISHED state
+
+`../../common/defaults.sh
+sysctl -q net.ipv4.tcp_ecn=3
+sysctl -q net.ipv4.tcp_ecn_option=2
+`
+
+    0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 4
++.002 ... 0.052 connect(4, ..., ...) = 0
+
++.002 > [noecn] SEWA 0:0(0) <mss 1460,sackOK,TS val 100 ecr 0,nop,wscale 8>
+// Receive an AccECN SYN-ACK and move to ESTABLISHED
++0.05 < [noecn] SW. 0:0(0) ack 1 win 32767 <mss 1460,ECN e0b 1 ceb 0 e1b 1,nop,nop,nop,sackOK,nop,wscale 8>
++.002 > [ect0] W. 1:1(0) ack 1 <ECN e1b 1 ceb 0 e0b 1,nop>
+
+// Receive a non ECN SYN-ACK and send a challenge ACK with ACE feedback
++0.1 < [noecn] S. 0:0(0) ack 1 win 32767 <mss 1460,nop,nop,sackOK,nop,wscale 8>
++.002 > [ect0] W. 1:1(0) ack 1 <ECN e1b 1 ceb 0 e0b 1,nop>
diff --git a/tools/testing/selftests/net/packetdrill/accecn/negotiation/noopt.pkt b/tools/testing/selftests/net/packetdrill/accecn/negotiation/noopt.pkt
new file mode 100644
index 000000000000..66985d9a16df
--- /dev/null
+++ b/tools/testing/selftests/net/packetdrill/accecn/negotiation/noopt.pkt
@@ -0,0 +1,27 @@
+// Test basic AccECN negotiation with option off using sysctl
+
+`../../common/defaults.sh
+sysctl -q net.ipv4.tcp_ecn=3
+sysctl -q net.ipv4.tcp_ecn_option=0
+`
+
+    0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
+   +0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
+   +0 bind(3, ..., ...) = 0
+   +0 listen(3, 1) = 0
+
+   +0 < SEWA 0:0(0) win 32792 <mss 1050,nop,nop,sackOK,nop,wscale 8>
++.002 > SW. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK,nop,wscale 8>
++0.05 < [ect0] W. 1:1(0) ack 1 win 320 <ECN e0b 1 ceb 0 e1b 1,nop>
++.002 accept(3, ..., ...) = 4
+
++0.01 %{ assert tcpi_delivered_ce == 0, tcpi_delivered_ce }%
+
++0.01 write(4, ..., 1000) = 1000
++.002 > [ect0] EAP. 1:1001(1000) ack 1
++0.05 < [ect0] EAP. 1:1(0) ack 1001 win 320
+
++0.01 %{ assert tcpi_delivered_ce == 0, tcpi_delivered_ce }%
+
++0.01 write(4, ..., 1000) = 1000
++.002 > [ect0] EAP. 1001:2001(1000) ack 1
diff --git a/tools/testing/selftests/net/packetdrill/accecn/negotiation/notecn_then_accecn_syn.pkt b/tools/testing/selftests/net/packetdrill/accecn/negotiation/notecn_then_accecn_syn.pkt
new file mode 100644
index 000000000000..13cdd041045a
--- /dev/null
+++ b/tools/testing/selftests/net/packetdrill/accecn/negotiation/notecn_then_accecn_syn.pkt
@@ -0,0 +1,28 @@
+// Test that SYN-ACK with ACE flags and without
+// ACE flags got dropped. Although we disable ECN,
+// we shouldn't consider this as blackholed as
+// these are dropped due to congestion
+
+`../../common/defaults.sh
+sysctl -q net.ipv4.tcp_ecn=3
+sysctl -q net.ipv4.tcp_ecn_option=2
+`
+
++0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
++0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
++0 bind(3, ..., ...) = 0
++0 listen(3, 1) = 0
+
++0 < [noecn] S 0:0(0) win 32792 <mss 1460,nop,nop,sackOK,nop,wscale 8>
++.002 > [noecn] S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK,nop,wscale 8>
+
+// Retransmit SYN
++0.1 < [ect0] SEWA 0:0(0) win 32792 <mss 1460,nop,nop,sackOK,nop,wscale 8>
++.002 > [noecn] S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK,nop,wscale 8>
+
++0.1 < [noecn] . 1:1(0) ack 1 win 320
++.002 accept(3, ..., ...) = 4
+
+// Write with AccECN option but with ip-noecn since we received one SYN with ACE=0
++0.01 write(4, ..., 100) = 100
++.002 > [noecn] P. 1:101(100) ack 1
diff --git a/tools/testing/selftests/net/packetdrill/accecn/negotiation/serverside-accecn-disabled1.pkt b/tools/testing/selftests/net/packetdrill/accecn/negotiation/serverside-accecn-disabled1.pkt
new file mode 100644
index 000000000000..718d3c540397
--- /dev/null
+++ b/tools/testing/selftests/net/packetdrill/accecn/negotiation/serverside-accecn-disabled1.pkt
@@ -0,0 +1,20 @@
+// Test against classic ECN server
+// Not-ECT on SYN and server sets 1|0|1 (AE is unused for classic ECN)
+
+`../../common/defaults.sh
+sysctl -q net.ipv4.tcp_ecn=3
+`
+
+    0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 4
++.002 ... 0.052 connect(4, ..., ...) = 0
+
++.002 > [noecn] SEWA 0:0(0) <mss 1460,sackOK,TS val 100 ecr 0,nop,wscale 8>
++0.05 < [noecn] SEA. 0:0(0) ack 1 win 32767 <mss 1460,sackOK,TS val 700 ecr 100,nop,wscale 8>
++.002 > [ect0] W. 1:1(0) ack 1 <nop, nop, TS val 200 ecr 700>
+
++0 write(4, ..., 100) = 100
++.002 > [ect0] P.5 1:101(100) ack 1 <nop,nop,TS val 300 ecr 700>
++0 close(4) = 0
+
++.002 > [ect0] F.5 101:101(0) ack 1 <nop,nop,TS val 400 ecr 700>
++0.1 < [noecn] R. 1:1(0) ack 102 win 4242
diff --git a/tools/testing/selftests/net/packetdrill/accecn/negotiation/serverside-accecn-disabled2.pkt b/tools/testing/selftests/net/packetdrill/accecn/negotiation/serverside-accecn-disabled2.pkt
new file mode 100644
index 000000000000..6a0a1096c29f
--- /dev/null
+++ b/tools/testing/selftests/net/packetdrill/accecn/negotiation/serverside-accecn-disabled2.pkt
@@ -0,0 +1,20 @@
+// Test against classic ECN server
+// Not-ECT on SYN and server sets 0|0|1
+
+`../../common/defaults.sh
+sysctl -q net.ipv4.tcp_ecn=3
+`
+
+    0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 4
++.002 ... 0.052 connect(4, ..., ...) = 0
+
++.002 > [noecn] SEWA 0:0(0) <mss 1460,sackOK,TS val 100 ecr 0,nop,wscale 8>
++0.05 < [noecn] SE. 0:0(0) ack 1 win 32767 <mss 1460,sackOK,TS val 700 ecr 100,nop,wscale 8>
++.002 > [noecn] . 1:1(0) ack 1 <nop, nop, TS val 200 ecr 700>
+
++0 write(4, ..., 100) = 100
++.002 > [ect0] P. 1:101(100) ack 1 <nop,nop,TS val 300 ecr 700>
++0 close(4) = 0
+
++0 > [noecn] F. 101:101(0) ack 1 <...>
++0.1 < R. 1:1(0) ack 102 win 4242
diff --git a/tools/testing/selftests/net/packetdrill/accecn/negotiation/serverside-broken.pkt b/tools/testing/selftests/net/packetdrill/accecn/negotiation/serverside-broken.pkt
new file mode 100644
index 000000000000..145a612f6cf4
--- /dev/null
+++ b/tools/testing/selftests/net/packetdrill/accecn/negotiation/serverside-broken.pkt
@@ -0,0 +1,19 @@
+// Test against broken server (1|1|1)
+
+`../../common/defaults.sh
+sysctl -q net.ipv4.tcp_ecn=3
+`
+
+    0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 4
++.002 ... 0.052 connect(4, ..., ...) = 0
+
++.002 > [noecn] SEWA 0:0(0) <mss 1460,sackOK,TS val 100 ecr 0,nop,wscale 8>
++0.05 < [noecn] SEWA. 0:0(0) ack 1 win 32767 <mss 1460,sackOK,TS val 700 ecr 100,nop,wscale 8>
++.002 > [noecn] . 1:1(0) ack 1 <nop, nop, TS val 200 ecr 700>
+
++0 write(4, ..., 100) = 100
++.002 > [noecn] P. 1:101(100) ack 1 <nop,nop,TS val 300 ecr 700>
++0 close(4) = 0
+
++.002 > [noecn] F. 101:101(0) ack 1 <...>
++0.1 < [noecn] R. 1:1(0) ack 102 win 4242
diff --git a/tools/testing/selftests/net/packetdrill/accecn/negotiation/serverside-ecn-disabled.pkt b/tools/testing/selftests/net/packetdrill/accecn/negotiation/serverside-ecn-disabled.pkt
new file mode 100644
index 000000000000..32a6584b43c6
--- /dev/null
+++ b/tools/testing/selftests/net/packetdrill/accecn/negotiation/serverside-ecn-disabled.pkt
@@ -0,0 +1,19 @@
+// Test against Non ECN server (0|0|0)
+
+`../../common/defaults.sh
+sysctl -q net.ipv4.tcp_ecn=3
+`
+
+    0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 4
++.002 ... 0.052 connect(4, ..., ...) = 0
+
++.002 > [noecn] SEWA 0:0(0) <mss 1460,sackOK,TS val 100 ecr 0,nop,wscale 8>
++0.05 < [noecn] S. 0:0(0) ack 1 win 32767 <mss 1460,sackOK,TS val 700 ecr 100,nop,wscale 8>
++.002 > [noecn] . 1:1(0) ack 1 <nop, nop, TS val 200 ecr 700>
+
++0 write(4, ..., 100) = 100
++.002 > [noecn] P. 1:101(100) ack 1 <nop,nop,TS val 300 ecr 700>
++0 close(4) = 0
+
++.002 > [noecn] F. 101:101(0) ack 1 <nop,nop,TS val 400 ecr 700>
++0.1 < [noecn] R. 1:1(0) ack 102 win 4242
diff --git a/tools/testing/selftests/net/packetdrill/accecn/negotiation/serverside-only.pkt b/tools/testing/selftests/net/packetdrill/accecn/negotiation/serverside-only.pkt
new file mode 100644
index 000000000000..cc141caa8ea1
--- /dev/null
+++ b/tools/testing/selftests/net/packetdrill/accecn/negotiation/serverside-only.pkt
@@ -0,0 +1,18 @@
+// Test AccECN with sysctl set to server-side only
+
+`../../common/defaults.sh
+sysctl -q net.ipv4.tcp_ecn=5
+`
+
+    0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
+   +0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
+   +0 bind(3, ..., ...) = 0
+   +0 listen(3, 1) = 0
+
+   +0 < SEWA 0:0(0) win 32792 <mss 1050,nop,nop,sackOK,nop,wscale 8>
++.002 > SW. 0:0(0) ack 1 <mss 1460,ECN e1b 1 ceb 0 e0b 1,nop,nop,nop,sackOK,nop,wscale 8>
++0.05 < [ect0] W. 1:1(0) ack 1 win 320 <ECN e0b 1 ceb 0 e1b 1,nop>
++.002 accept(3, ..., ...) = 4
+
++0.01 write(4, ..., 1000) = 1000
++.002 > [ect0] EAP. 1:1001(1000) ack 1 <ECN e1b 1 ceb 0 e0b 1,nop>
diff --git a/tools/testing/selftests/net/packetdrill/accecn/negotiation/synack-rexmit.pkt b/tools/testing/selftests/net/packetdrill/accecn/negotiation/synack-rexmit.pkt
new file mode 100644
index 000000000000..d19b22c4523a
--- /dev/null
+++ b/tools/testing/selftests/net/packetdrill/accecn/negotiation/synack-rexmit.pkt
@@ -0,0 +1,15 @@
+// Test 3rd ACK flags when SYN-ACK is rexmitted
+
+`../../common/defaults.sh
+sysctl -q net.ipv4.tcp_ecn=3
+`
+
+    0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 4
++.002 ... 0.052 connect(4, ..., ...) = 0
+
++.002 > SEWA 0:0(0) <mss 1460,sackOK,TS val 100 ecr 0,nop,wscale 8>
++0.05 < SW. 0:0(0) ack 1 win 32767 <mss 1460,ECN e0b 1 ceb 0 e1b 1,nop,nop,nop,sackOK,nop,wscale 8>
++.002 > [ect0] W. 1:1(0) ack 1 <ECN e1b 1 ceb 0 e0b 1,nop>
+
++0.05 < SW. 0:0(0) ack 1 win 32767 <mss 1460,ECN e0b 1 ceb 0 e1b 1,nop,nop,nop,sackOK,nop,wscale 8>
++.002 > [ect0] W. 1:1(0) ack 1 <ECN e1b 1 ceb 0 e0b 1,nop>
diff --git a/tools/testing/selftests/net/packetdrill/accecn/negotiation/synack-rxmt.pkt b/tools/testing/selftests/net/packetdrill/accecn/negotiation/synack-rxmt.pkt
new file mode 100644
index 000000000000..3acf91c417d6
--- /dev/null
+++ b/tools/testing/selftests/net/packetdrill/accecn/negotiation/synack-rxmt.pkt
@@ -0,0 +1,25 @@
+// Test that we retransmit SYN-ACK with ACE and without
+// AccECN options after
+// SYN-ACK was lost and TCP moved to TCPS_SYN_RECEIVED
+
+`../../common/defaults.sh
+sysctl -q net.ipv4.tcp_ecn=3
+sysctl -q net.ipv4.tcp_ecn_option=2
+`
+
++0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
++0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
++0 bind(3, ..., ...) = 0
++0 listen(3, 1) = 0
+
++0 < [noecn] SEWA 0:0(0) win 32792 <mss 1460,nop,nop,sackOK,nop,wscale 8>
++.002 > [noecn] SW. 0:0(0) ack 1 <mss 1460,ECN e1b 1 ceb 0 e0b 1,nop,nop,nop,sackOK,nop,wscale 8>
+
+// Retransmit SYN-ACK without option
++1~+1.1 > [noecn] SW. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK,nop,wscale 8>
++0.1 < [noecn] W. 1:1(0) ack 1 win 320 <ECN e0b 1 ceb 0 e1b 1,nop>
++.002 accept(3, ..., ...) = 4
+
+// We try to write with AccECN option
++0.01 write(4, ..., 100) = 100
++.002 > [ect0] P5. 1:101(100) ack 1 <ECN e1b 1 ceb 0 e0b 1,nop>
diff --git a/tools/testing/selftests/net/packetdrill/accecn/reflector/2nd-data-as-first-connect.pkt b/tools/testing/selftests/net/packetdrill/accecn/reflector/2nd-data-as-first-connect.pkt
new file mode 100644
index 000000000000..0571203e086f
--- /dev/null
+++ b/tools/testing/selftests/net/packetdrill/accecn/reflector/2nd-data-as-first-connect.pkt
@@ -0,0 +1,30 @@
+// 3rd ACK + 1st data segment lost, 2nd data segments with ce
+
+`../../common/defaults.sh
+sysctl -q net.ipv4.tcp_ecn=3
+`
+
+    0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 4
++.002 ... 0.052 connect(4, ..., ...) = 0
+
++.002 > [noecn] SEWA 0:0(0) <mss 1460,sackOK,TS val 100 ecr 0,nop,wscale 8>
++0.05 < [noecn] SW. 0:0(0) ack 1 win 32767 <mss 1016,ECN e0b 1 ceb 0 e1b 1,nop,nop,nop,sackOK,nop,wscale 8>
+// 3rd ACK lost
++.002 > [ect0] W. 1:1(0) ack 1 <ECN e1b 1 ceb 0 e0b 1,nop>
+
++0.01 write(4, ..., 2000) = 2000
+// 1st data segment lost + 2nd gets CE
++.002 > [ect0] .5 1:1005(1004) ack 1 <ECN e1b 1 ceb 0 e0b 1,nop>
++.000 > [ect0] P.5 1005:2001(996) ack 1 <ECN e1b 1 ceb 0 e0b 1, nop>
++0.05 < [ect0] .6 1:1(0) ack 1 win 264 <ECN e0b 1 ceb 996 e1b 1,nop,nop,nop,sack 1005:2001>
+
++0.01 %{ assert tcpi_delivered_ce == 1, tcpi_delivered_ce }%
+
++0.002~+0.1 > [ect0] .5 1:1005(1004) ack 1 <ECN e1b 1 ceb 0 e0b 1,nop>
++.05 < [ect0] .6 1:1(0) ack 2001 win 264 <ECN e0b 1005 ceb 996 e1b 1,nop>
+
++0.01 write(4, ..., 1000) = 1000
++0~+0.002 > [ect0] P.5 2001:3001(1000) ack 1 <ECN e1b 1 ceb 0 e0b 1,nop>
+
++0.1 < [ect0] .5 1:1001(1000) ack 3001 win 264 <ECN e0b 1 ceb 0 e1b 1,nop>
++0~+0.01 > [ect0] .5 3001:3001(0) ack 1001 <ECN e1b 1 ceb 0 e0b 1001,nop>
diff --git a/tools/testing/selftests/net/packetdrill/accecn/reflector/2nd-data-as-first.pkt b/tools/testing/selftests/net/packetdrill/accecn/reflector/2nd-data-as-first.pkt
new file mode 100644
index 000000000000..512a90c9b8c6
--- /dev/null
+++ b/tools/testing/selftests/net/packetdrill/accecn/reflector/2nd-data-as-first.pkt
@@ -0,0 +1,24 @@
+// 3rd ACK + 1st data segment lost, data segments with ce
+
+`../../common/defaults.sh
+sysctl -q net.ipv4.tcp_ecn=3
+`
+
+    0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
+   +0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
+   +0 bind(3, ..., ...) = 0
+   +0 listen(3, 1) = 0
+
++0.05 < SEWA 0:0(0) win 32767 <mss 1460,nop,nop,sackOK,nop,wscale 8>
++.002 > SW. 0:0(0) ack 1 <mss 1460,ECN e1b 1 ceb 0 e0b 1,nop,nop,nop,sackOK,nop,wscale 8>
+// 3rd ACK lost
+// 1st data segment lost
++0.05 < [ce] EAP. 1001:2001(1000) ack 1 win 264 <ECN e0b 1 ceb 0 e1b 1,nop>
++.002 > [ect0] WA. 1:1(0) ack 1 <ECN e1b 1 ceb 1000 e0b 1,nop,nop,nop,sack 1001:2001>
++.002 accept(3, ..., ...) = 4
+
++0.2 < [ce] EAP. 1:1001(1000) ack 1 win 264 <ECN e0b 1 ceb 0 e1b 1,nop>
++.001 > [ect0] EWA. 1:1(0) ack 2001 <ECN e1b 1 ceb 2000 e0b 1,nop>
+
++0.05 < [ce] EAP. 2001:3001(1000) ack 1 win 264
++.001 > [ect0] . 1:1(0) ack 3001 <ECN e1b 1 ceb 3000 e0b 1,nop>
diff --git a/tools/testing/selftests/net/packetdrill/accecn/reflector/3rd-ack-ce-updates-received_ce.pkt b/tools/testing/selftests/net/packetdrill/accecn/reflector/3rd-ack-ce-updates-received_ce.pkt
new file mode 100644
index 000000000000..4ca63fd1831b
--- /dev/null
+++ b/tools/testing/selftests/net/packetdrill/accecn/reflector/3rd-ack-ce-updates-received_ce.pkt
@@ -0,0 +1,18 @@
+// Third ACK CE increases r.cep
+
+`../../common/defaults.sh
+sysctl -q net.ipv4.tcp_ecn=3
+`
+
+    0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
+   +0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
+   +0 bind(3, ..., ...) = 0
+   +0 listen(3, 1) = 0
+
++0.05 < SEWA 0:0(0) win 32767 <mss 1050,nop,nop,sackOK,nop,wscale 8>
++.002 > SW. 0:0(0) ack 1 <mss 1460,ECN e1b 1 ceb 0 e0b 1,nop,nop,nop,sackOK,nop,wscale 8>
++0.05 < [ce] W. 1:1(0) ack 1 win 264 <ECN e0b 1 ceb 0 e1b 1,nop>
++.002 accept(3, ..., ...) = 4
+
++0.01 write(4, ..., 1000) = 1000
++.002 > [ect0] WAP. 1:1001(1000) ack 1 <ECN e1b 1 ceb 0 e0b 1,nop>
diff --git a/tools/testing/selftests/net/packetdrill/accecn/reflector/syn-ce.pkt b/tools/testing/selftests/net/packetdrill/accecn/reflector/syn-ce.pkt
new file mode 100644
index 000000000000..0fdf387aa1ee
--- /dev/null
+++ b/tools/testing/selftests/net/packetdrill/accecn/reflector/syn-ce.pkt
@@ -0,0 +1,13 @@
+// Test AccECN ECN field reflector in SYNACK
+
+`../../common/defaults.sh
+sysctl -q net.ipv4.tcp_ecn=3
+`
+
+    0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
+   +0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
+   +0 bind(3, ..., ...) = 0
+   +0 listen(3, 1) = 0
+
+   +0 < [ce] SEWA 0:0(0) win 32792 <mss 1050,nop,nop,sackOK,nop,wscale 8>
++.002 > SWA. 0:0(0) ack 1 <mss 1460,ECN e1b 1 ceb 0 e0b 1,nop,nop,nop,sackOK,nop,wscale 8>
diff --git a/tools/testing/selftests/net/packetdrill/accecn/reflector/syn-ect0.pkt b/tools/testing/selftests/net/packetdrill/accecn/reflector/syn-ect0.pkt
new file mode 100644
index 000000000000..951bf9eea7b5
--- /dev/null
+++ b/tools/testing/selftests/net/packetdrill/accecn/reflector/syn-ect0.pkt
@@ -0,0 +1,13 @@
+// Test AccECN ECN field reflector in SYNACK
+
+`../../common/defaults.sh
+sysctl -q net.ipv4.tcp_ecn=3
+`
+
+    0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
+   +0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
+   +0 bind(3, ..., ...) = 0
+   +0 listen(3, 1) = 0
+
+   +0 < [ect0] SEWA 0:0(0) win 32792 <mss 1050,nop,nop,sackOK,nop,wscale 8>
++.002 > SA. 0:0(0) ack 1 <mss 1460,ECN e1b 1 ceb 0 e0b 1,nop,nop,nop,sackOK,nop,wscale 8>
diff --git a/tools/testing/selftests/net/packetdrill/accecn/reflector/syn-ect1.pkt b/tools/testing/selftests/net/packetdrill/accecn/reflector/syn-ect1.pkt
new file mode 100644
index 000000000000..ff6f3293a774
--- /dev/null
+++ b/tools/testing/selftests/net/packetdrill/accecn/reflector/syn-ect1.pkt
@@ -0,0 +1,13 @@
+// Test AccECN ECN field reflector in SYNACK
+
+`../../common/defaults.sh
+sysctl -q net.ipv4.tcp_ecn=3
+`
+
+    0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
+   +0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
+   +0 bind(3, ..., ...) = 0
+   +0 listen(3, 1) = 0
+
+   +0 < [ect1] SEWA 0:0(0) win 32792 <mss 1050,nop,nop,sackOK,nop,wscale 8>
++.002 > SEW. 0:0(0) ack 1 <mss 1460,ECN e1b 1 ceb 0 e0b 1,nop,nop,nop,sackOK,nop,wscale 8>
diff --git a/tools/testing/selftests/net/packetdrill/accecn/reflector/synack-ce-updates-delivered-ce.pkt b/tools/testing/selftests/net/packetdrill/accecn/reflector/synack-ce-updates-delivered-ce.pkt
new file mode 100644
index 000000000000..b497ba9c6935
--- /dev/null
+++ b/tools/testing/selftests/net/packetdrill/accecn/reflector/synack-ce-updates-delivered-ce.pkt
@@ -0,0 +1,22 @@
+// Reflected SYNACK CE mark increases delivered_ce
+
+`../../common/defaults.sh
+sysctl -q net.ipv4.tcp_ecn=3
+sysctl -q net.ipv4.tcp_ecn_fallback=0
+`
+
+    0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
+   +0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
+   +0 bind(3, ..., ...) = 0
+   +0 listen(3, 1) = 0
+
++0.05 < SEWA 0:0(0) win 32767 <mss 1050,nop,nop,sackOK,nop,wscale 8>
++.002 > SW. 0:0(0) ack 1 <mss 1460,ECN e1b 1 ceb 0 e0b 1,nop,nop,nop,sackOK,nop,wscale 8>
+// Fake ce for prev, ECT validator must be disabled for this to work
++0.05 < [ect0] WA. 1:1(0) ack 1 win 264 <ECN e0b 1 ceb 0 e1b 1,nop>
++.002 accept(3, ..., ...) = 4
+
++0.01 %{ assert tcpi_delivered_ce == 1, tcpi_delivered_ce }%
+
++0.01 write(4, ..., 1000) = 1000
++.002 > [ect0] EAP. 1:1001(1000) ack 1 <ECN e1b 1 ceb 0 e0b 1,nop>
diff --git a/tools/testing/selftests/net/packetdrill/accecn/reflector/synack-ce.pkt b/tools/testing/selftests/net/packetdrill/accecn/reflector/synack-ce.pkt
new file mode 100644
index 000000000000..53cd0e9473b4
--- /dev/null
+++ b/tools/testing/selftests/net/packetdrill/accecn/reflector/synack-ce.pkt
@@ -0,0 +1,28 @@
+// Test SYNACK CE & received_ce update
+
+`../../common/defaults.sh
+sysctl -q net.ipv4.tcp_ecn=3
+sysctl -q net.ipv4.tcp_ecn_option=2
+`
+
+    0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 4
++.002 ... 0.052 connect(4, ..., ...) = 0
+
++.002 > [noecn] SEWA 0:0(0) <mss 1460,sackOK,TS val 100 ecr 0,nop,wscale 8>
++0.05 < [ce] SW. 0:0(0) ack 1 win 32767 <mss 1460,ECN e0b 1 ceb 0 e1b 1,nop,nop,nop,sackOK,nop,wscale 8>
++.002 > [ect0] WA. 1:1(0) ack 1 <ECN e1b 1 ceb 0 e0b 1,nop>
+
++0.01 write(4, ..., 100) = 100
++.002 > [ect0] P.6 1:101(100) ack 1 <ECN e1b 1 ceb 0 e0b 1,nop>
++0.05 < [ect0] P.5 1:101(100) ack 101 win 256 <ECN e0b 101 ceb 0 e1b 1,nop>
++.002 > [ect0] .6  101:101(0) ack 101 <ECN e1b 1 ceb 0 e0b 101,nop>
+
++0.01 write(4, ..., 100) = 100
++.002 > [ect0] P.6 101:201(100) ack 101 <ECN e1b 1 ceb 0 e0b 101,nop>
+
++0.1  < [ect1] P.5 201:301(100) ack 201 win 256 <ECN e0b 101 ceb 0 e1b 1,nop>
++.002 > [ect0] .6 201:201(0) ack 101 <ECN e1b 101 ceb 0 e0b 101,nop,nop,nop,sack 201:301>
+
++0.01 < [ce] .6 401:501(100) ack 201 win 256 <ECN e0b 101 ceb 0 e1b 1,nop>
++.002 > [ect0] .7 201:201(0) ack 101 <ECN e1b 101 ceb 100 e0b 101,nop,nop,nop,sack 401:501 201:301>
+
diff --git a/tools/testing/selftests/net/packetdrill/accecn/reflector/synack-ect0.pkt b/tools/testing/selftests/net/packetdrill/accecn/reflector/synack-ect0.pkt
new file mode 100644
index 000000000000..27355e27c55d
--- /dev/null
+++ b/tools/testing/selftests/net/packetdrill/accecn/reflector/synack-ect0.pkt
@@ -0,0 +1,24 @@
+// Test SYN=0 reflector
+
+`../../common/defaults.sh
+sysctl -q net.ipv4.tcp_ecn=3
+`
+
+    0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 4
++.002 ... 0.052 connect(4, ..., ...) = 0
+
++.002 > SEWA 0:0(0) <mss 1460,sackOK,TS val 100 ecr 0,nop,wscale 8>
++0.05 < [ect0] SW. 0:0(0) ack 1 win 32767 <mss 1460,ECN e0b 1 ceb 0 e1b 1,nop,nop,nop,sackOK,nop,wscale 8>
++.002 > [ect0] A. 1:1(0) ack 1 <ECN e1b 1 ceb 0 e0b 1,nop>
+
++0.01 write(4, ..., 100) = 100
++.002 > [ect0] P.5 1:101(100) ack 1 <ECN e1b 1 ceb 0 e0b 1,nop>
++0.05 < [ect0] P.5 1:1(0) ack 101 win 256 <ECN e0b 101 ceb 0 e1b 1,nop>
+
++0.01 < [ect0] P.5 1:101(100) ack 101 win 256 <ECN e0b 1 ceb 0 e1b 1,nop>
++.002 > [ect0] .5 101:101(0) ack 101 <ECN e1b 1 ceb 0 e0b 101,nop>
++0 read(4, ..., 100) = 100
+
++0 close(4) = 0
++0 > F.5 101:101(0) ack 101 <...>
++0.1 < R. 101:101(0) ack 102 win 4242
diff --git a/tools/testing/selftests/net/packetdrill/accecn/reflector/synack-ect1.pkt b/tools/testing/selftests/net/packetdrill/accecn/reflector/synack-ect1.pkt
new file mode 100644
index 000000000000..5d8e29143ac5
--- /dev/null
+++ b/tools/testing/selftests/net/packetdrill/accecn/reflector/synack-ect1.pkt
@@ -0,0 +1,24 @@
+// Test SYN=0 reflector
+
+`../../common/defaults.sh
+sysctl -q net.ipv4.tcp_ecn=3
+`
+
+    0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 4
++.002 ... 0.052 connect(4, ..., ...) = 0
+
++.002 > SEWA 0:0(0) <mss 1460,sackOK,TS val 100 ecr 0,nop,wscale 8>
++0.05 < [ect1] SW. 0:0(0) ack 1 win 32767 <mss 1460,ECN e0b 1 ceb 0 e1b 1,nop,nop,nop,sackOK,nop,wscale 8>
++.002 > [ect0] EW. 1:1(0) ack 1 <ECN e1b 1 ceb 0 e0b 1,nop>
+
++0.01 write(4, ..., 100) = 100
++.002 > [ect0] P.5 1:101(100) ack 1 <ECN e1b 1 ceb 0 e0b 1,nop>
++0.05 < [ect1] P.5 1:1(0) ack 101 win 256 <ECN e0b 101 ceb 0 e1b 1,nop>
+
++0.01 < [ect1] P.5 1:101(100) ack 101 win 256 <ECN e0b 1 ceb 0 e1b 1,nop>
++.002 > [ect0] .5 101:101(0) ack 101 <ECN e1b 101 ceb 0 e0b 1,nop>
++0 read(4, ..., 100) = 100
+
++0 close(4) = 0
++0 > F5. 101:101(0) ack 101 <...>
++0.1 < R. 101:101(0) ack 102 win 4242
-- 
2.34.1

Re: [PATCH net-next 1/1] selftests/net: Add packetdrill packetdrill cases

From: Neal Cardwell <ncardwell@google.com>
Date: 2026-01-08 22:47:08

On Thu, Jan 8, 2026 at 10:58 AM [off-list ref] wrote:
From: Chia-Yu Chang <redacted>

Linux Accurate ECN test sets using ACE counters and AccECN options to
cover several scenarios: Connection teardown, different ACK conditions,
counter wrapping, SACK space grabbing, fallback schemes, negotiation
retransmission/reorder/loss, AccECN option drop/loss, different
handshake reflectors, data with marking, and different sysctl values.

Co-developed-by: Ilpo Järvinen <ij@kernel.org>
Signed-off-by: Ilpo Järvinen <ij@kernel.org>
Co-developed-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: Neal Cardwell <ncardwell@google.com>
---
Chia-Yu, thank you for posting the packetdrill tests.

A couple thoughts:

(1) These tests are using the experimental AccECN packetdrill support
that is not in mainline packetdrill yet. Can you please share the
github URL for the version of packetdrill you used? I will work on
merging the appropriate experimental AccECN packetdrill support into
the Google packetdrill mainline branch.

(2) The last I heard, the tools/testing/selftests/net/packetdrill/
infrastructure does not run tests in subdirectories of that
packetdrill/ directory, and that is why all the tests in
tools/testing/selftests/net/packetdrill/ are in a single directory.
When you run these tests, do all the tests actually get run? Just
wanted to check this. :-)

Thanks!
neal

Re: [PATCH net-next 1/1] selftests/net: Add packetdrill packetdrill cases

From: Neal Cardwell <ncardwell@google.com>
Date: 2026-01-08 22:48:09

On Thu, Jan 8, 2026 at 5:46 PM Neal Cardwell [off-list ref] wrote:
On Thu, Jan 8, 2026 at 10:58 AM [off-list ref] wrote:
quoted
From: Chia-Yu Chang <redacted>

Linux Accurate ECN test sets using ACE counters and AccECN options to
cover several scenarios: Connection teardown, different ACK conditions,
counter wrapping, SACK space grabbing, fallback schemes, negotiation
retransmission/reorder/loss, AccECN option drop/loss, different
handshake reflectors, data with marking, and different sysctl values.

Co-developed-by: Ilpo Järvinen <ij@kernel.org>
Signed-off-by: Ilpo Järvinen <ij@kernel.org>
Co-developed-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: Neal Cardwell <ncardwell@google.com>
---
A third note:

(3)

Re: [PATCH net-next 1/1] selftests/net: Add packetdrill packetdrill cases

From: Neal Cardwell <ncardwell@google.com>
Date: 2026-01-08 22:50:13

On Thu, Jan 8, 2026 at 5:47 PM Neal Cardwell [off-list ref] wrote:
On Thu, Jan 8, 2026 at 5:46 PM Neal Cardwell [off-list ref] wrote:
quoted
On Thu, Jan 8, 2026 at 10:58 AM [off-list ref] wrote:
quoted
From: Chia-Yu Chang <redacted>

Linux Accurate ECN test sets using ACE counters and AccECN options to
cover several scenarios: Connection teardown, different ACK conditions,
counter wrapping, SACK space grabbing, fallback schemes, negotiation
retransmission/reorder/loss, AccECN option drop/loss, different
handshake reflectors, data with marking, and different sysctl values.

Co-developed-by: Ilpo Järvinen <ij@kernel.org>
Signed-off-by: Ilpo Järvinen <ij@kernel.org>
Co-developed-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: Neal Cardwell <ncardwell@google.com>
---
[apologies for the premature send due to accidental shift-of-focus...]

A third note:

(3) the patch title seems to have a typo; it is currently:
  selftests/net: Add packetdrill packetdrill cases

I would suggest something like:
  selftests/net: packetdrill: add TCP Accurate ECN cases

Thanks!
neal

Re: [PATCH net-next 1/1] selftests/net: Add packetdrill packetdrill cases

From: Neal Cardwell <ncardwell@google.com>
Date: 2026-01-08 23:20:59

On Thu, Jan 8, 2026 at 5:46 PM Neal Cardwell [off-list ref] wrote:
On Thu, Jan 8, 2026 at 10:58 AM [off-list ref] wrote:
quoted
From: Chia-Yu Chang <redacted>

Linux Accurate ECN test sets using ACE counters and AccECN options to
cover several scenarios: Connection teardown, different ACK conditions,
counter wrapping, SACK space grabbing, fallback schemes, negotiation
retransmission/reorder/loss, AccECN option drop/loss, different
handshake reflectors, data with marking, and different sysctl values.

Co-developed-by: Ilpo Järvinen <ij@kernel.org>
Signed-off-by: Ilpo Järvinen <ij@kernel.org>
Co-developed-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: Neal Cardwell <ncardwell@google.com>
---
Chia-Yu, thank you for posting the packetdrill tests.

A couple thoughts:

(1) These tests are using the experimental AccECN packetdrill support
that is not in mainline packetdrill yet. Can you please share the
github URL for the version of packetdrill you used? I will work on
merging the appropriate experimental AccECN packetdrill support into
the Google packetdrill mainline branch.
Oh, for that part I see you mentioned this already in the cover letter:

  The used packetdrill is commit 6f2116af6b7e1936a53e80ab31b77f74abda1aaa
  of the branch: https://github.com/minuscat/packetdrill_accecn

Thanks!
neal

RE: [PATCH net-next 1/1] selftests/net: Add packetdrill packetdrill cases

From: Chia-Yu Chang (Nokia) <hidden>
Date: 2026-01-09 08:53:19

---Original Message-----
From: Neal Cardwell <ncardwell@google.com>
Sent: Friday, January 9, 2026 12:21 AM
To: Chia-Yu Chang (Nokia) <redacted>
Cc: pabeni@redhat.com; edumazet@google.com; parav@nvidia.com; linux-doc@vger.kernel.org; corbet@lwn.net; horms@kernel.org; dsahern@kernel.org; kuniyu@google.com; bpf@vger.kernel.org; netdev@vger.kernel.org; dave.taht@gmail.com; jhs@mojatatu.com; kuba@kernel.org; stephen@networkplumber.org; xiyou.wangcong@gmail.com; jiri@resnulli.us; davem@davemloft.net; andrew+netdev@lunn.ch; donald.hunter@gmail.com; ast@fiberby.net; liuhangbin@gmail.com; shuah@kernel.org; linux-kselftest@vger.kernel.org; ij@kernel.org; Koen De Schepper (Nokia) <redacted>; g.white@cablelabs.com; ingemar.s.johansson@ericsson.com; mirja.kuehlewind@ericsson.com; cheshire <redacted>; rs.ietf@gmx.at; Jason_Livingood@comcast.com; Vidhi Goel <redacted>; Willem de Bruijn <willemb@google.com>
Subject: Re: [PATCH net-next 1/1] selftests/net: Add packetdrill packetdrill cases


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 Thu, Jan 8, 2026 at 5:46 PM Neal Cardwell [off-list ref] wrote:
quoted
On Thu, Jan 8, 2026 at 10:58 AM [off-list ref] wrote:
quoted
From: Chia-Yu Chang <redacted>

Linux Accurate ECN test sets using ACE counters and AccECN options
to cover several scenarios: Connection teardown, different ACK
conditions, counter wrapping, SACK space grabbing, fallback schemes,
negotiation retransmission/reorder/loss, AccECN option drop/loss,
different handshake reflectors, data with marking, and different sysctl values.

Co-developed-by: Ilpo Järvinen <ij@kernel.org>
Signed-off-by: Ilpo Järvinen <ij@kernel.org>
Co-developed-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: Neal Cardwell <ncardwell@google.com>
---
Chia-Yu, thank you for posting the packetdrill tests.

A couple thoughts:

(1) These tests are using the experimental AccECN packetdrill support
that is not in mainline packetdrill yet. Can you please share the
github URL for the version of packetdrill you used? I will work on
merging the appropriate experimental AccECN packetdrill support into
the Google packetdrill mainline branch.
Oh, for that part I see you mentioned this already in the cover letter:

  The used packetdrill is commit 6f2116af6b7e1936a53e80ab31b77f74abda1aaa
  of the branch: https://github.com/minuscat/packetdrill_accecn

Thanks!
neal
Hi Neal,

You're right, I will change the tile into "selftests/net: Add AccECN packetdrill cases"
And this packetdrill is forked from branch "l4s-packetdrill-2022-08-21-v1"  of https://github.com/google/bbr.git

If you would like me to test on newer packetdrill, feel free to let me know.

Thanks.
Chia-Yu

RE: [PATCH net-next 1/1] selftests/net: Add packetdrill packetdrill cases

From: Chia-Yu Chang (Nokia) <hidden>
Date: 2026-01-14 10:49:50

-----Original Message-----
From: Neal Cardwell <ncardwell@google.com> 
Sent: Thursday, January 8, 2026 11:47 PM
To: Chia-Yu Chang (Nokia) <redacted>
Cc: pabeni@redhat.com; edumazet@google.com; parav@nvidia.com; linux-doc@vger.kernel.org; corbet@lwn.net; horms@kernel.org; dsahern@kernel.org; kuniyu@google.com; bpf@vger.kernel.org; netdev@vger.kernel.org; dave.taht@gmail.com; jhs@mojatatu.com; kuba@kernel.org; stephen@networkplumber.org; xiyou.wangcong@gmail.com; jiri@resnulli.us; davem@davemloft.net; andrew+netdev@lunn.ch; donald.hunter@gmail.com; ast@fiberby.net; liuhangbin@gmail.com; shuah@kernel.org; linux-kselftest@vger.kernel.org; ij@kernel.org; Koen De Schepper (Nokia) <redacted>; g.white@cablelabs.com; ingemar.s.johansson@ericsson.com; mirja.kuehlewind@ericsson.com; cheshire <redacted>; rs.ietf@gmx.at; Jason_Livingood@comcast.com; Vidhi Goel <redacted>; Willem de Bruijn <willemb@google.com>
Subject: Re: [PATCH net-next 1/1] selftests/net: Add packetdrill packetdrill cases


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 Thu, Jan 8, 2026 at 10:58 AM [off-list ref] wrote:
quoted
From: Chia-Yu Chang <redacted>

Linux Accurate ECN test sets using ACE counters and AccECN options to 
cover several scenarios: Connection teardown, different ACK 
conditions, counter wrapping, SACK space grabbing, fallback schemes, 
negotiation retransmission/reorder/loss, AccECN option drop/loss, 
different handshake reflectors, data with marking, and different sysctl values.

Co-developed-by: Ilpo Järvinen <ij@kernel.org>
Signed-off-by: Ilpo Järvinen <ij@kernel.org>
Co-developed-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: Neal Cardwell <ncardwell@google.com>
---
Chia-Yu, thank you for posting the packetdrill tests.

A couple thoughts:

(1) These tests are using the experimental AccECN packetdrill support that is not in mainline packetdrill yet. Can you please share the github URL for the version of packetdrill you used? I will work on merging the appropriate experimental AccECN packetdrill support into the Google packetdrill mainline branch.

(2) The last I heard, the tools/testing/selftests/net/packetdrill/
infrastructure does not run tests in subdirectories of that packetdrill/ directory, and that is why all the tests in tools/testing/selftests/net/packetdrill/ are in a single directory.
When you run these tests, do all the tests actually get run? Just wanted to check this. :-)

Thanks!
neal
Hi Neal,

Regards (2), I will put all ACCECN cases in the tools/testing/selftests/net/packetdrill/
But I would like to include another script to avoid running these AccECN tests one-by-one manually, does it make sense to you?
Thanks.

Chia-Yu

RE: [PATCH net-next 1/1] selftests/net: Add packetdrill packetdrill cases

From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Date: 2026-01-14 16:06:07

Chia-Yu Chang (Nokia) wrote:
quoted
-----Original Message-----
From: Neal Cardwell <ncardwell@google.com> 
Sent: Thursday, January 8, 2026 11:47 PM
To: Chia-Yu Chang (Nokia) <redacted>
Cc: pabeni@redhat.com; edumazet@google.com; parav@nvidia.com; linux-doc@vger.kernel.org; corbet@lwn.net; horms@kernel.org; dsahern@kernel.org; kuniyu@google.com; bpf@vger.kernel.org; netdev@vger.kernel.org; dave.taht@gmail.com; jhs@mojatatu.com; kuba@kernel.org; stephen@networkplumber.org; xiyou.wangcong@gmail.com; jiri@resnulli.us; davem@davemloft.net; andrew+netdev@lunn.ch; donald.hunter@gmail.com; ast@fiberby.net; liuhangbin@gmail.com; shuah@kernel.org; linux-kselftest@vger.kernel.org; ij@kernel.org; Koen De Schepper (Nokia) <redacted>; g.white@cablelabs.com; ingemar.s.johansson@ericsson.com; mirja.kuehlewind@ericsson.com; cheshire <redacted>; rs.ietf@gmx.at; Jason_Livingood@comcast.com; Vidhi Goel <redacted>; Willem de Bruijn <willemb@google.com>
Subject: Re: [PATCH net-next 1/1] selftests/net: Add packetdrill packetdrill cases


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 Thu, Jan 8, 2026 at 10:58 AM [off-list ref] wrote:
quoted
From: Chia-Yu Chang <redacted>

Linux Accurate ECN test sets using ACE counters and AccECN options to 
cover several scenarios: Connection teardown, different ACK 
conditions, counter wrapping, SACK space grabbing, fallback schemes, 
negotiation retransmission/reorder/loss, AccECN option drop/loss, 
different handshake reflectors, data with marking, and different sysctl values.

Co-developed-by: Ilpo Järvinen <ij@kernel.org>
Signed-off-by: Ilpo Järvinen <ij@kernel.org>
Co-developed-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: Neal Cardwell <ncardwell@google.com>
---
Chia-Yu, thank you for posting the packetdrill tests.

A couple thoughts:

(1) These tests are using the experimental AccECN packetdrill support that is not in mainline packetdrill yet. Can you please share the github URL for the version of packetdrill you used? I will work on merging the appropriate experimental AccECN packetdrill support into the Google packetdrill mainline branch.

(2) The last I heard, the tools/testing/selftests/net/packetdrill/
infrastructure does not run tests in subdirectories of that packetdrill/ directory, and that is why all the tests in tools/testing/selftests/net/packetdrill/ are in a single directory.
When you run these tests, do all the tests actually get run? Just wanted to check this. :-)

Thanks!
neal
Hi Neal,

Regards (2), I will put all ACCECN cases in the tools/testing/selftests/net/packetdrill/
But I would like to include another script to avoid running these AccECN tests one-by-one manually, does it make sense to you?
Thanks.
All scripts under tools/testing/selftests/net/packetdrill are already
picked up for automated testing in kselftests:

https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit/?id=8a405552fd3b

RE: [PATCH net-next 1/1] selftests/net: Add packetdrill packetdrill cases

From: Chia-Yu Chang (Nokia) <hidden>
Date: 2026-01-14 16:13:00

-----Original Message-----
From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Sent: Wednesday, January 14, 2026 3:18 PM
To: Chia-Yu Chang (Nokia) <redacted>; Neal Cardwell <ncardwell@google.com>
Cc: pabeni@redhat.com; edumazet@google.com; parav@nvidia.com; linux-doc@vger.kernel.org; corbet@lwn.net; horms@kernel.org; dsahern@kernel.org; kuniyu@google.com; bpf@vger.kernel.org; netdev@vger.kernel.org; dave.taht@gmail.com; jhs@mojatatu.com; kuba@kernel.org; stephen@networkplumber.org; xiyou.wangcong@gmail.com; jiri@resnulli.us; davem@davemloft.net; andrew+netdev@lunn.ch; donald.hunter@gmail.com; ast@fiberby.net; liuhangbin@gmail.com; shuah@kernel.org; linux-kselftest@vger.kernel.org; ij@kernel.org; Koen De Schepper (Nokia) <redacted>; g.white@cablelabs.com; ingemar.s.johansson@ericsson.com; mirja.kuehlewind@ericsson.com; cheshire <redacted>; rs.ietf@gmx.at; Jason_Livingood@comcast.com; Vidhi Goel <redacted>; Willem de Bruijn <willemb@google.com>
Subject: RE: [PATCH net-next 1/1] selftests/net: Add packetdrill packetdrill cases

[You don't often get email from willemdebruijn.kernel@gmail.com. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]

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.



Chia-Yu Chang (Nokia) wrote:
quoted
quoted
-----Original Message-----
From: Neal Cardwell <ncardwell@google.com>
Sent: Thursday, January 8, 2026 11:47 PM
To: Chia-Yu Chang (Nokia) <redacted>
Cc: pabeni@redhat.com; edumazet@google.com; parav@nvidia.com;
linux-doc@vger.kernel.org; corbet@lwn.net; horms@kernel.org;
dsahern@kernel.org; kuniyu@google.com; bpf@vger.kernel.org;
netdev@vger.kernel.org; dave.taht@gmail.com; jhs@mojatatu.com;
kuba@kernel.org; stephen@networkplumber.org;
xiyou.wangcong@gmail.com; jiri@resnulli.us; davem@davemloft.net;
andrew+netdev@lunn.ch; donald.hunter@gmail.com; ast@fiberby.net;
liuhangbin@gmail.com; shuah@kernel.org;
linux-kselftest@vger.kernel.org; ij@kernel.org; Koen De Schepper
(Nokia) [off-list ref];
g.white@cablelabs.com; ingemar.s.johansson@ericsson.com;
mirja.kuehlewind@ericsson.com; cheshire [off-list ref];
rs.ietf@gmx.at; Jason_Livingood@comcast.com; Vidhi Goel
[off-list ref]; Willem de Bruijn [off-list ref]
Subject: Re: [PATCH net-next 1/1] selftests/net: Add packetdrill
packetdrill cases


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 Thu, Jan 8, 2026 at 10:58 AM [off-list ref] wrote:
quoted
From: Chia-Yu Chang <redacted>

Linux Accurate ECN test sets using ACE counters and AccECN options
to cover several scenarios: Connection teardown, different ACK
conditions, counter wrapping, SACK space grabbing, fallback
schemes, negotiation retransmission/reorder/loss, AccECN option
drop/loss, different handshake reflectors, data with marking, and different sysctl values.

Co-developed-by: Ilpo Järvinen <ij@kernel.org>
Signed-off-by: Ilpo Järvinen <ij@kernel.org>
Co-developed-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: Neal Cardwell <ncardwell@google.com>
---
Chia-Yu, thank you for posting the packetdrill tests.

A couple thoughts:

(1) These tests are using the experimental AccECN packetdrill support that is not in mainline packetdrill yet. Can you please share the github URL for the version of packetdrill you used? I will work on merging the appropriate experimental AccECN packetdrill support into the Google packetdrill mainline branch.

(2) The last I heard, the tools/testing/selftests/net/packetdrill/
infrastructure does not run tests in subdirectories of that packetdrill/ directory, and that is why all the tests in tools/testing/selftests/net/packetdrill/ are in a single directory.
When you run these tests, do all the tests actually get run? Just
wanted to check this. :-)

Thanks!
neal
Hi Neal,

Regards (2), I will put all ACCECN cases in the
tools/testing/selftests/net/packetdrill/
But I would like to include another script to avoid running these AccECN tests one-by-one manually, does it make sense to you?
Thanks.
All scripts under tools/testing/selftests/net/packetdrill are already picked up for automated testing in kselftests:

https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit/?id=8a405552fd3b
OK, I was using ksft_runner.sh to run all 58 AccECN case one-by-one.

But since run_kselftest.sh can accept multiple "-t" arguments, so I will not commit another script with similar functionlaities but just rename all AccECN case with tcp_accecn in the prefix.

Thanks.

Chia-Yu

Re: [PATCH net-next 1/1] selftests/net: Add packetdrill packetdrill cases

From: Neal Cardwell <ncardwell@google.com>
Date: 2026-01-18 16:11:00

On Thu, Jan 8, 2026 at 5:46 PM Neal Cardwell [off-list ref] wrote:
On Thu, Jan 8, 2026 at 10:58 AM [off-list ref] wrote:
quoted
From: Chia-Yu Chang <redacted>

Linux Accurate ECN test sets using ACE counters and AccECN options to
cover several scenarios: Connection teardown, different ACK conditions,
counter wrapping, SACK space grabbing, fallback schemes, negotiation
retransmission/reorder/loss, AccECN option drop/loss, different
handshake reflectors, data with marking, and different sysctl values.

Co-developed-by: Ilpo Järvinen <ij@kernel.org>
Signed-off-by: Ilpo Järvinen <ij@kernel.org>
Co-developed-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: Neal Cardwell <ncardwell@google.com>
---
Chia-Yu, thank you for posting the packetdrill tests.

A couple thoughts:

(1) These tests are using the experimental AccECN packetdrill support
that is not in mainline packetdrill yet. Can you please share the
github URL for the version of packetdrill you used? I will work on
merging the appropriate experimental AccECN packetdrill support into
the Google packetdrill mainline branch.
An update on the 3 patches at:

https://github.com/google/packetdrill/pull/96

(1) I have merged the following patch into the google packetdrill repo
to facilitate testing of the AccECN patch series:

"net-test: packetdrill: add Accurate ECN (AccECN) option support"
https://github.com/google/packetdrill/pull/96/changes/f6861f888bc7f1e08026de4825519a95504d1047

(2) The following patch I did not yet merge, because it proposes to
add an odd number of u32 fields to tcp_info, so AFAICT leaves a 4-byte
padding hole at the end of tcp_info:

  net-test: packetdrill: Support AccECN counters through tcpi
  https://github.com/google/packetdrill/pull/96/changes/f43649c87a2aa79a33a78111d3d7e5f027d13a7f

I think we'll need to tweak the AccECN kernel patch series so that it
does not leave a 4-byte padding hole at the end of tcp_info, then
update this packetdrill patch to match the kernel patch.

Let's come up with another useful u32 field we can add to the tcp_info
struct, so that the kernel patch doesn't add a padding hole at the end
of tcp_info.

One idea would be to add another field to represent newer options and
connection features that are enabled. AFAICT all 8 bits of the
tcpi_options field have been used, so we can't use more bits in that
field. I'd suggest we add a u32 tcpi_more_options field before the
tcpi_received_ce field, so we can encode other useful info, like:

+ 1 bit to indicate whether AccECN was negotiated (this can go in a
separate patch)

+ 1 bit to indicate whether TCP_NODELAY was set (since forgetting to
use TCP_NODELAY is a classic cause of performance problems; again this
can go in a separate patch)

(And there will be future bits of info we want to add...)

Also, regarding the comment in this line:
  __u32   tcpi_received_ce;    /* # of CE marks received */

That comment is ambiguous, since it doesn't indicate whether it's
counting (potentially LRO/GRO) skbs or TCP segments. I would suggest
clarifying that this is counting segments:

__u32   tcpi_received_ce;    /* # of CE marked segments received */

(3) The following patch I did not merge, because I'd like to migrate
to having all packetdrill tests for the Linux kernel reside in one
place, in the Linux kernel source tree (not the Google packetdrill
repo):

  net-test: add TCP Accurate ECN cases
  https://github.com/google/packetdrill/pull/96/changes/fe4c7293ea640a4c81178b6c88744d7a5d209fd6

Thanks!
neal

RE: [PATCH net-next 1/1] selftests/net: Add packetdrill packetdrill cases

From: Chia-Yu Chang (Nokia) <hidden>
Date: 2026-01-18 22:56:22

-----Original Message-----
From: Neal Cardwell <ncardwell@google.com>
Sent: Sunday, January 18, 2026 5:11 PM
To: Chia-Yu Chang (Nokia) <redacted>
Cc: pabeni@redhat.com; edumazet@google.com; parav@nvidia.com; linux-doc@vger.kernel.org; corbet@lwn.net; horms@kernel.org; dsahern@kernel.org; kuniyu@google.com; bpf@vger.kernel.org; netdev@vger.kernel.org; dave.taht@gmail.com; jhs@mojatatu.com; kuba@kernel.org; stephen@networkplumber.org; xiyou.wangcong@gmail.com; jiri@resnulli.us; davem@davemloft.net; andrew+netdev@lunn.ch; donald.hunter@gmail.com; ast@fiberby.net; liuhangbin@gmail.com; shuah@kernel.org; linux-kselftest@vger.kernel.org; ij@kernel.org; Koen De Schepper (Nokia) <redacted>; g.white@cablelabs.com; ingemar.s.johansson@ericsson.com; mirja.kuehlewind@ericsson.com; cheshire <redacted>; rs.ietf@gmx.at; Jason_Livingood@comcast.com; Vidhi Goel <redacted>; Willem de Bruijn <willemb@google.com>
Subject: Re: [PATCH net-next 1/1] selftests/net: Add packetdrill packetdrill cases


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 Thu, Jan 8, 2026 at 5:46 PM Neal Cardwell [off-list ref] wrote:
quoted
On Thu, Jan 8, 2026 at 10:58 AM [off-list ref] wrote:
quoted
From: Chia-Yu Chang <redacted>

Linux Accurate ECN test sets using ACE counters and AccECN options
to cover several scenarios: Connection teardown, different ACK
conditions, counter wrapping, SACK space grabbing, fallback schemes,
negotiation retransmission/reorder/loss, AccECN option drop/loss,
different handshake reflectors, data with marking, and different sysctl values.

Co-developed-by: Ilpo Järvinen <ij@kernel.org>
Signed-off-by: Ilpo Järvinen <ij@kernel.org>
Co-developed-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: Neal Cardwell <ncardwell@google.com>
---
Chia-Yu, thank you for posting the packetdrill tests.

A couple thoughts:

(1) These tests are using the experimental AccECN packetdrill support
that is not in mainline packetdrill yet. Can you please share the
github URL for the version of packetdrill you used? I will work on
merging the appropriate experimental AccECN packetdrill support into
the Google packetdrill mainline branch.
An update on the 3 patches at:

https://github.com/google/packetdrill/pull/96

(1) I have merged the following patch into the google packetdrill repo to facilitate testing of the AccECN patch series:

"net-test: packetdrill: add Accurate ECN (AccECN) option support"
https://github.com/google/packetdrill/pull/96/changes/f6861f888bc7f1e08026de4825519a95504d1047

(2) The following patch I did not yet merge, because it proposes to add an odd number of u32 fields to tcp_info, so AFAICT leaves a 4-byte padding hole at the end of tcp_info:

  net-test: packetdrill: Support AccECN counters through tcpi
  https://github.com/google/packetdrill/pull/96/changes/f43649c87a2aa79a33a78111d3d7e5f027d13a7f

I think we'll need to tweak the AccECN kernel patch series so that it does not leave a 4-byte padding hole at the end of tcp_info, then update this packetdrill patch to match the kernel patch.

Let's come up with another useful u32 field we can add to the tcp_info struct, so that the kernel patch doesn't add a padding hole at the end of tcp_info.

One idea would be to add another field to represent newer options and connection features that are enabled. AFAICT all 8 bits of the tcpi_options field have been used, so we can't use more bits in that field. I'd suggest we add a u32 tcpi_more_options field before the tcpi_received_ce field, so we can encode other useful info, like:

+ 1 bit to indicate whether AccECN was negotiated (this can go in a
separate patch)

+ 1 bit to indicate whether TCP_NODELAY was set (since forgetting to
use TCP_NODELAY is a classic cause of performance problems; again this can go in a separate patch)

(And there will be future bits of info we want to add...)

Also, regarding the comment in this line:
  __u32   tcpi_received_ce;    /* # of CE marks received */

That comment is ambiguous, since it doesn't indicate whether it's counting (potentially LRO/GRO) skbs or TCP segments. I would suggest clarifying that this is counting segments:

__u32   tcpi_received_ce;    /* # of CE marked segments received */
Hi Neal,

Related to these 32-bit hole, two extra entries are added into b40671b5ee588c8a61b2d0eacbad32ffc57e9a8f of net-next, and one straightforward way is to apply these changes also in tcp.h of packetdrill (This is my miss).

+       __u16   tcpi_accecn_fail_mode;
+       __u16   tcpi_accecn_opt_seen;

But I would prefer to update this, because tcpi_accecn_fail_mode and tcpi_accecn_opt_seen overall just needs 8 bits (i.e., 4 bits for tcpi_accecn_fail_mode and 2 bits for tcpi_accecn_opt_seen).

So, maybe we could add u16 tcpi_more_options before tcpi_received_ce and change tcpi_accecn_fail_mode and tcpi_accecn_opt_seen both into u8.
Within tcpi_more_options, add one bit related to TCP_NODELAY as you said.
And within tcpi_accecn_opt_seen, add one bit related to whether AccECN was negotiated as you said, then we can leave more unused bits in tcpi_more_options.

Another thought is to use a single u32 before tcpi_received_ce, in which 4 bits for tcpi_accecn_fail_mode, 2 bits for tcpi_accecn_opt_seen, 26 bits for tcpi_more_options.

What do you think?

And I will update the comment of tcpi_received_ce, thanks for the comments.

Chia-Yu
(3) The following patch I did not merge, because I'd like to migrate to having all packetdrill tests for the Linux kernel reside in one place, in the Linux kernel source tree (not the Google packetdrill
repo):

  net-test: add TCP Accurate ECN cases
  https://github.com/google/packetdrill/pull/96/changes/fe4c7293ea640a4c81178b6c88744d7a5d209fd6

Thanks!
neal
Chia-Yu

-----Original Message-----
From: Neal Cardwell <ncardwell@google.com>
Sent: Sunday, January 18, 2026 5:11 PM
To: Chia-Yu Chang (Nokia) <redacted>
Cc: pabeni@redhat.com; edumazet@google.com; parav@nvidia.com; linux-doc@vger.kernel.org; corbet@lwn.net; horms@kernel.org; dsahern@kernel.org; kuniyu@google.com; bpf@vger.kernel.org; netdev@vger.kernel.org; dave.taht@gmail.com; jhs@mojatatu.com; kuba@kernel.org; stephen@networkplumber.org; xiyou.wangcong@gmail.com; jiri@resnulli.us; davem@davemloft.net; andrew+netdev@lunn.ch; donald.hunter@gmail.com; ast@fiberby.net; liuhangbin@gmail.com; shuah@kernel.org; linux-kselftest@vger.kernel.org; ij@kernel.org; Koen De Schepper (Nokia) <redacted>; g.white@cablelabs.com; ingemar.s.johansson@ericsson.com; mirja.kuehlewind@ericsson.com; cheshire <redacted>; rs.ietf@gmx.at; Jason_Livingood@comcast.com; Vidhi Goel <redacted>; Willem de Bruijn <willemb@google.com>
Subject: Re: [PATCH net-next 1/1] selftests/net: Add packetdrill packetdrill cases


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 Thu, Jan 8, 2026 at 5:46 PM Neal Cardwell [off-list ref] wrote:
On Thu, Jan 8, 2026 at 10:58 AM [off-list ref] wrote:
quoted
From: Chia-Yu Chang <redacted>

Linux Accurate ECN test sets using ACE counters and AccECN options
to cover several scenarios: Connection teardown, different ACK
conditions, counter wrapping, SACK space grabbing, fallback schemes,
negotiation retransmission/reorder/loss, AccECN option drop/loss,
different handshake reflectors, data with marking, and different sysctl values.

Co-developed-by: Ilpo Järvinen <ij@kernel.org>
Signed-off-by: Ilpo Järvinen <ij@kernel.org>
Co-developed-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: Neal Cardwell <ncardwell@google.com>
---
Chia-Yu, thank you for posting the packetdrill tests.

A couple thoughts:

(1) These tests are using the experimental AccECN packetdrill support
that is not in mainline packetdrill yet. Can you please share the
github URL for the version of packetdrill you used? I will work on
merging the appropriate experimental AccECN packetdrill support into
the Google packetdrill mainline branch.
An update on the 3 patches at:

https://github.com/google/packetdrill/pull/96

(1) I have merged the following patch into the google packetdrill repo to facilitate testing of the AccECN patch series:

"net-test: packetdrill: add Accurate ECN (AccECN) option support"
https://github.com/google/packetdrill/pull/96/changes/f6861f888bc7f1e08026de4825519a95504d1047

(2) The following patch I did not yet merge, because it proposes to add an odd number of u32 fields to tcp_info, so AFAICT leaves a 4-byte padding hole at the end of tcp_info:

  net-test: packetdrill: Support AccECN counters through tcpi
  https://github.com/google/packetdrill/pull/96/changes/f43649c87a2aa79a33a78111d3d7e5f027d13a7f

I think we'll need to tweak the AccECN kernel patch series so that it does not leave a 4-byte padding hole at the end of tcp_info, then update this packetdrill patch to match the kernel patch.

Let's come up with another useful u32 field we can add to the tcp_info struct, so that the kernel patch doesn't add a padding hole at the end of tcp_info.

One idea would be to add another field to represent newer options and connection features that are enabled. AFAICT all 8 bits of the tcpi_options field have been used, so we can't use more bits in that field. I'd suggest we add a u32 tcpi_more_options field before the tcpi_received_ce field, so we can encode other useful info, like:

+ 1 bit to indicate whether AccECN was negotiated (this can go in a
separate patch)

+ 1 bit to indicate whether TCP_NODELAY was set (since forgetting to
use TCP_NODELAY is a classic cause of performance problems; again this can go in a separate patch)

(And there will be future bits of info we want to add...)

Also, regarding the comment in this line:
  __u32   tcpi_received_ce;    /* # of CE marks received */

That comment is ambiguous, since it doesn't indicate whether it's counting (potentially LRO/GRO) skbs or TCP segments. I would suggest clarifying that this is counting segments:

__u32   tcpi_received_ce;    /* # of CE marked segments received */

(3) The following patch I did not merge, because I'd like to migrate to having all packetdrill tests for the Linux kernel reside in one place, in the Linux kernel source tree (not the Google packetdrill
repo):

  net-test: add TCP Accurate ECN cases
  https://github.com/google/packetdrill/pull/96/changes/fe4c7293ea640a4c81178b6c88744d7a5d209fd6

Thanks!
neal

Re: [PATCH net-next 1/1] selftests/net: Add packetdrill packetdrill cases

From: Neal Cardwell <ncardwell@google.com>
Date: 2026-01-19 00:05:56

On Sun, Jan 18, 2026 at 5:56 PM Chia-Yu Chang (Nokia)
[off-list ref] wrote:
quoted
-----Original Message-----
From: Neal Cardwell <ncardwell@google.com>
Sent: Sunday, January 18, 2026 5:11 PM
To: Chia-Yu Chang (Nokia) <redacted>
Cc: pabeni@redhat.com; edumazet@google.com; parav@nvidia.com; linux-doc@vger.kernel.org; corbet@lwn.net; horms@kernel.org; dsahern@kernel.org; kuniyu@google.com; bpf@vger.kernel.org; netdev@vger.kernel.org; dave.taht@gmail.com; jhs@mojatatu.com; kuba@kernel.org; stephen@networkplumber.org; xiyou.wangcong@gmail.com; jiri@resnulli.us; davem@davemloft.net; andrew+netdev@lunn.ch; donald.hunter@gmail.com; ast@fiberby.net; liuhangbin@gmail.com; shuah@kernel.org; linux-kselftest@vger.kernel.org; ij@kernel.org; Koen De Schepper (Nokia) <redacted>; g.white@cablelabs.com; ingemar.s.johansson@ericsson.com; mirja.kuehlewind@ericsson.com; cheshire <redacted>; rs.ietf@gmx.at; Jason_Livingood@comcast.com; Vidhi Goel <redacted>; Willem de Bruijn <willemb@google.com>
Subject: Re: [PATCH net-next 1/1] selftests/net: Add packetdrill packetdrill cases


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 Thu, Jan 8, 2026 at 5:46 PM Neal Cardwell [off-list ref] wrote:
quoted
On Thu, Jan 8, 2026 at 10:58 AM [off-list ref] wrote:
quoted
From: Chia-Yu Chang <redacted>

Linux Accurate ECN test sets using ACE counters and AccECN options
to cover several scenarios: Connection teardown, different ACK
conditions, counter wrapping, SACK space grabbing, fallback schemes,
negotiation retransmission/reorder/loss, AccECN option drop/loss,
different handshake reflectors, data with marking, and different sysctl values.

Co-developed-by: Ilpo Järvinen <ij@kernel.org>
Signed-off-by: Ilpo Järvinen <ij@kernel.org>
Co-developed-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: Neal Cardwell <ncardwell@google.com>
---
Chia-Yu, thank you for posting the packetdrill tests.

A couple thoughts:

(1) These tests are using the experimental AccECN packetdrill support
that is not in mainline packetdrill yet. Can you please share the
github URL for the version of packetdrill you used? I will work on
merging the appropriate experimental AccECN packetdrill support into
the Google packetdrill mainline branch.
An update on the 3 patches at:

https://github.com/google/packetdrill/pull/96

(1) I have merged the following patch into the google packetdrill repo to facilitate testing of the AccECN patch series:

"net-test: packetdrill: add Accurate ECN (AccECN) option support"
https://github.com/google/packetdrill/pull/96/changes/f6861f888bc7f1e08026de4825519a95504d1047

(2) The following patch I did not yet merge, because it proposes to add an odd number of u32 fields to tcp_info, so AFAICT leaves a 4-byte padding hole at the end of tcp_info:

  net-test: packetdrill: Support AccECN counters through tcpi
  https://github.com/google/packetdrill/pull/96/changes/f43649c87a2aa79a33a78111d3d7e5f027d13a7f

I think we'll need to tweak the AccECN kernel patch series so that it does not leave a 4-byte padding hole at the end of tcp_info, then update this packetdrill patch to match the kernel patch.

Let's come up with another useful u32 field we can add to the tcp_info struct, so that the kernel patch doesn't add a padding hole at the end of tcp_info.

One idea would be to add another field to represent newer options and connection features that are enabled. AFAICT all 8 bits of the tcpi_options field have been used, so we can't use more bits in that field. I'd suggest we add a u32 tcpi_more_options field before the tcpi_received_ce field, so we can encode other useful info, like:

+ 1 bit to indicate whether AccECN was negotiated (this can go in a
separate patch)

+ 1 bit to indicate whether TCP_NODELAY was set (since forgetting to
use TCP_NODELAY is a classic cause of performance problems; again this can go in a separate patch)

(And there will be future bits of info we want to add...)

Also, regarding the comment in this line:
  __u32   tcpi_received_ce;    /* # of CE marks received */

That comment is ambiguous, since it doesn't indicate whether it's counting (potentially LRO/GRO) skbs or TCP segments. I would suggest clarifying that this is counting segments:

__u32   tcpi_received_ce;    /* # of CE marked segments received */
Hi Neal,

Related to these 32-bit hole, two extra entries are added into b40671b5ee588c8a61b2d0eacbad32ffc57e9a8f of net-next, and one straightforward way is to apply these changes also in tcp.h of packetdrill (This is my miss).

+       __u16   tcpi_accecn_fail_mode;
+       __u16   tcpi_accecn_opt_seen;

But I would prefer to update this, because tcpi_accecn_fail_mode and tcpi_accecn_opt_seen overall just needs 8 bits (i.e., 4 bits for tcpi_accecn_fail_mode and 2 bits for tcpi_accecn_opt_seen).

So, maybe we could add u16 tcpi_more_options before tcpi_received_ce and change tcpi_accecn_fail_mode and tcpi_accecn_opt_seen both into u8.
Within tcpi_more_options, add one bit related to TCP_NODELAY as you said.
And within tcpi_accecn_opt_seen, add one bit related to whether AccECN was negotiated as you said, then we can leave more unused bits in tcpi_more_options.

Another thought is to use a single u32 before tcpi_received_ce, in which 4 bits for tcpi_accecn_fail_mode, 2 bits for tcpi_accecn_opt_seen, 26 bits for tcpi_more_options.

What do you think?
I would suggest something like your last suggestion, where there is a
u32 before tcpi_received_ce, with bit fields for tcpi_accecn_fail_mode
(4 bits) and tcpi_accecn_opt_seen (2 bits), and a tcpi_options2 for
the remaining unused bits in the u32.

I am leaning toward tcpi_options2 rather than tcpi_more_options,
because I guess in the future we might want yet another options bit
field, in which case it would be better to have {tcpi_options,
tcpi_options2, and tcpi_options3}, rather than having {tcpi_options,
tcpi_more_options, and tcpi_yet_more_options}. :-)

And rather than a single bit indicating whether AccECN was negotiated,
it occurs to me that it would probably be better to have a 2-bit enum
with 4 values, corresponding to the modes in tcp_ecn.h:
tcp_ecn_disabled(), tcp_ecn_mode_rfc3168(), tcp_ecn_mode_accecn(), and
tcp_ecn_mode_pending().

We also need to keep in mind that since the tcpi_accecn_fail_mode (4
bits) and tcpi_accecn_opt_seen (2 bits) enums are exported to
user-space, they will become part of the kernel API to userspace, so
should be moved out of tcp_ecn.h and instead be declared in
include/uapi/linux/tcp.h. We declare constant values exported to user
space in that file: (a) to make it easier for maintainers to remember
not to change the values for these, so kernel changes don't break
user-space apps; (b) to make it easier for application developers to
find the #define values they need to decode the values exported in
struct  tcp_info. :-)

So how about something like:
--- in include/uapi/linux/tcp.h:
/* Values for tcpi_ecn_mode */
#define TCPI_ECN_DISABLED 0x0
#define TCPI_ECN_RFC3168 0x1
#define  TCPI_ECN_ACCECN 0x2
#define TCPI_ECN_PENDING 0x3

/* Values for tcpi_accecn_opt_seen */
#define TCP_ACCECN_OPT_NOT_SEEN         0x0
#define TCP_ACCECN_OPT_EMPTY_SEEN       0x1
#define TCP_ACCECN_OPT_COUNTER_SEEN     0x2
#define TCP_ACCECN_OPT_FAIL_SEEN        0x3

/* Values for tcpi_accecn_fail_mode */
#define TCP_ACCECN_ACE_FAIL_SEND        BIT(0)
#define TCP_ACCECN_ACE_FAIL_RECV        BIT(1)
#define TCP_ACCECN_OPT_FAIL_SEND        BIT(2)
#define TCP_ACCECN_OPT_FAIL_RECV        BIT(3)

...
__u32 tcpi_ecn_mode:2,
    tcpi_accecn_opt_seen: 2,
    tcpi_accecn_fail_mode: 4,
    tcpi_options2:24;
__u32   tcpi_received_ce;    /* # of CE marked segments received */
...
--- in tcp_get_info() in net/ipv4/tcp.c:
if (tcp_ecn_disabled(tp))
  info-> tcpi_ecn_mode = TCPI_ECN_DISABLED;
else if (tcp_ecn_mode_rfc3168(tp))
  info-> tcpi_ecn_mode = TCPI_ECN_RFC3168;
else if (tcp_ecn_mode_accecn(tp))
  info-> tcpi_ecn_mode = TCPI_ECN_ACCECN;
else if (tcp_ecn_mode_pending(tp))
  info-> tcpi_ecn_mode = TCPI_ECN_PENDING;

WDYT?
And I will update the comment of tcpi_received_ce, thanks for the comments.
Great. Thanks!

neal
Chia-Yu
quoted
(3) The following patch I did not merge, because I'd like to migrate to having all packetdrill tests for the Linux kernel reside in one place, in the Linux kernel source tree (not the Google packetdrill
repo):

  net-test: add TCP Accurate ECN cases
  https://github.com/google/packetdrill/pull/96/changes/fe4c7293ea640a4c81178b6c88744d7a5d209fd6

Thanks!
neal
Chia-Yu

-----Original Message-----
From: Neal Cardwell <ncardwell@google.com>
Sent: Sunday, January 18, 2026 5:11 PM
To: Chia-Yu Chang (Nokia) <redacted>
Cc: pabeni@redhat.com; edumazet@google.com; parav@nvidia.com; linux-doc@vger.kernel.org; corbet@lwn.net; horms@kernel.org; dsahern@kernel.org; kuniyu@google.com; bpf@vger.kernel.org; netdev@vger.kernel.org; dave.taht@gmail.com; jhs@mojatatu.com; kuba@kernel.org; stephen@networkplumber.org; xiyou.wangcong@gmail.com; jiri@resnulli.us; davem@davemloft.net; andrew+netdev@lunn.ch; donald.hunter@gmail.com; ast@fiberby.net; liuhangbin@gmail.com; shuah@kernel.org; linux-kselftest@vger.kernel.org; ij@kernel.org; Koen De Schepper (Nokia) <redacted>; g.white@cablelabs.com; ingemar.s.johansson@ericsson.com; mirja.kuehlewind@ericsson.com; cheshire <redacted>; rs.ietf@gmx.at; Jason_Livingood@comcast.com; Vidhi Goel <redacted>; Willem de Bruijn <willemb@google.com>
Subject: Re: [PATCH net-next 1/1] selftests/net: Add packetdrill packetdrill cases


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 Thu, Jan 8, 2026 at 5:46 PM Neal Cardwell [off-list ref] wrote:
quoted
On Thu, Jan 8, 2026 at 10:58 AM [off-list ref] wrote:
quoted
From: Chia-Yu Chang <redacted>

Linux Accurate ECN test sets using ACE counters and AccECN options
to cover several scenarios: Connection teardown, different ACK
conditions, counter wrapping, SACK space grabbing, fallback schemes,
negotiation retransmission/reorder/loss, AccECN option drop/loss,
different handshake reflectors, data with marking, and different sysctl values.

Co-developed-by: Ilpo Järvinen <ij@kernel.org>
Signed-off-by: Ilpo Järvinen <ij@kernel.org>
Co-developed-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: Neal Cardwell <ncardwell@google.com>
---
Chia-Yu, thank you for posting the packetdrill tests.

A couple thoughts:

(1) These tests are using the experimental AccECN packetdrill support
that is not in mainline packetdrill yet. Can you please share the
github URL for the version of packetdrill you used? I will work on
merging the appropriate experimental AccECN packetdrill support into
the Google packetdrill mainline branch.
An update on the 3 patches at:

https://github.com/google/packetdrill/pull/96

(1) I have merged the following patch into the google packetdrill repo to facilitate testing of the AccECN patch series:

"net-test: packetdrill: add Accurate ECN (AccECN) option support"
https://github.com/google/packetdrill/pull/96/changes/f6861f888bc7f1e08026de4825519a95504d1047

(2) The following patch I did not yet merge, because it proposes to add an odd number of u32 fields to tcp_info, so AFAICT leaves a 4-byte padding hole at the end of tcp_info:

  net-test: packetdrill: Support AccECN counters through tcpi
  https://github.com/google/packetdrill/pull/96/changes/f43649c87a2aa79a33a78111d3d7e5f027d13a7f

I think we'll need to tweak the AccECN kernel patch series so that it does not leave a 4-byte padding hole at the end of tcp_info, then update this packetdrill patch to match the kernel patch.

Let's come up with another useful u32 field we can add to the tcp_info struct, so that the kernel patch doesn't add a padding hole at the end of tcp_info.

One idea would be to add another field to represent newer options and connection features that are enabled. AFAICT all 8 bits of the tcpi_options field have been used, so we can't use more bits in that field. I'd suggest we add a u32 tcpi_more_options field before the tcpi_received_ce field, so we can encode other useful info, like:

+ 1 bit to indicate whether AccECN was negotiated (this can go in a
separate patch)

+ 1 bit to indicate whether TCP_NODELAY was set (since forgetting to
use TCP_NODELAY is a classic cause of performance problems; again this can go in a separate patch)

(And there will be future bits of info we want to add...)

Also, regarding the comment in this line:
  __u32   tcpi_received_ce;    /* # of CE marks received */

That comment is ambiguous, since it doesn't indicate whether it's counting (potentially LRO/GRO) skbs or TCP segments. I would suggest clarifying that this is counting segments:

__u32   tcpi_received_ce;    /* # of CE marked segments received */

(3) The following patch I did not merge, because I'd like to migrate to having all packetdrill tests for the Linux kernel reside in one place, in the Linux kernel source tree (not the Google packetdrill
repo):

  net-test: add TCP Accurate ECN cases
  https://github.com/google/packetdrill/pull/96/changes/fe4c7293ea640a4c81178b6c88744d7a5d209fd6

Thanks!
neal

RE: [PATCH net-next 1/1] selftests/net: Add packetdrill packetdrill cases

From: Chia-Yu Chang (Nokia) <hidden>
Date: 2026-01-19 18:34:55

quoted hunk
-----Original Message-----
From: Neal Cardwell <ncardwell@google.com> 
Sent: Monday, January 19, 2026 1:06 AM
To: Chia-Yu Chang (Nokia) <redacted>
Cc: pabeni@redhat.com; edumazet@google.com; parav@nvidia.com; linux-doc@vger.kernel.org; corbet@lwn.net; horms@kernel.org; dsahern@kernel.org; kuniyu@google.com; bpf@vger.kernel.org; netdev@vger.kernel.org; dave.taht@gmail.com; jhs@mojatatu.com; kuba@kernel.org; stephen@networkplumber.org; xiyou.wangcong@gmail.com; jiri@resnulli.us; davem@davemloft.net; andrew+netdev@lunn.ch; donald.hunter@gmail.com; ast@fiberby.net; liuhangbin@gmail.com; shuah@kernel.org; linux-kselftest@vger.kernel.org; ij@kernel.org; Koen De Schepper (Nokia) <redacted>; g.white@cablelabs.com; ingemar.s.johansson@ericsson.com; mirja.kuehlewind@ericsson.com; cheshire <redacted>; rs.ietf@gmx.at; Jason_Livingood@comcast.com; Vidhi Goel <redacted>; Willem de Bruijn <willemb@google.com>
Subject: Re: [PATCH net-next 1/1] selftests/net: Add packetdrill packetdrill cases


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 Sun, Jan 18, 2026 at 5:56 PM Chia-Yu Chang (Nokia) [off-list ref] wrote:
quoted
quoted
-----Original Message-----
From: Neal Cardwell <ncardwell@google.com>
Sent: Sunday, January 18, 2026 5:11 PM
To: Chia-Yu Chang (Nokia) <redacted>
Cc: pabeni@redhat.com; edumazet@google.com; parav@nvidia.com; 
linux-doc@vger.kernel.org; corbet@lwn.net; horms@kernel.org; 
dsahern@kernel.org; kuniyu@google.com; bpf@vger.kernel.org; 
netdev@vger.kernel.org; dave.taht@gmail.com; jhs@mojatatu.com; 
kuba@kernel.org; stephen@networkplumber.org; 
xiyou.wangcong@gmail.com; jiri@resnulli.us; davem@davemloft.net; 
andrew+netdev@lunn.ch; donald.hunter@gmail.com; ast@fiberby.net; 
liuhangbin@gmail.com; shuah@kernel.org; 
linux-kselftest@vger.kernel.org; ij@kernel.org; Koen De Schepper 
(Nokia) [off-list ref]; 
g.white@cablelabs.com; ingemar.s.johansson@ericsson.com; 
mirja.kuehlewind@ericsson.com; cheshire [off-list ref]; 
rs.ietf@gmx.at; Jason_Livingood@comcast.com; Vidhi Goel 
[off-list ref]; Willem de Bruijn [off-list ref]
Subject: Re: [PATCH net-next 1/1] selftests/net: Add packetdrill 
packetdrill cases


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 Thu, Jan 8, 2026 at 5:46 PM Neal Cardwell [off-list ref] wrote:
quoted
On Thu, Jan 8, 2026 at 10:58 AM [off-list ref] wrote:
quoted
From: Chia-Yu Chang <redacted>

Linux Accurate ECN test sets using ACE counters and AccECN 
options to cover several scenarios: Connection teardown, 
different ACK conditions, counter wrapping, SACK space grabbing, 
fallback schemes, negotiation retransmission/reorder/loss, 
AccECN option drop/loss, different handshake reflectors, data with marking, and different sysctl values.

Co-developed-by: Ilpo Järvinen <ij@kernel.org>
Signed-off-by: Ilpo Järvinen <ij@kernel.org>
Co-developed-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: Neal Cardwell <ncardwell@google.com>
---
Chia-Yu, thank you for posting the packetdrill tests.

A couple thoughts:

(1) These tests are using the experimental AccECN packetdrill 
support that is not in mainline packetdrill yet. Can you please 
share the github URL for the version of packetdrill you used? I 
will work on merging the appropriate experimental AccECN 
packetdrill support into the Google packetdrill mainline branch.
An update on the 3 patches at:

https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgi
thub.com%2Fgoogle%2Fpacketdrill%2Fpull%2F96&data=05%7C02%7Cchia-yu.c
hang%40nokia-bell-labs.com%7C227b6e8cfe084ca9279708de56ee858b%7C5d47
17519675428d917b70f44f9630b0%7C0%7C0%7C639043779630263465%7CUnknown%
7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW
4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=l6PAGPTELL
T3KwEWsuLQnLaxQ0BUixhbrFp3n6dA950%3D&reserved=0

(1) I have merged the following patch into the google packetdrill repo to facilitate testing of the AccECN patch series:

"net-test: packetdrill: add Accurate ECN (AccECN) option support"
https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgi
thub.com%2Fgoogle%2Fpacketdrill%2Fpull%2F96%2Fchanges%2Ff6861f888bc7
f1e08026de4825519a95504d1047&data=05%7C02%7Cchia-yu.chang%40nokia-be
ll-labs.com%7C227b6e8cfe084ca9279708de56ee858b%7C5d4717519675428d917
b70f44f9630b0%7C0%7C0%7C639043779630288017%7CUnknown%7CTWFpbGZsb3d8e
yJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiT
WFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=wct5GueZNjBZHCaxpbokNBLXh
pGpDFjKKUiIbCMiKco%3D&reserved=0

(2) The following patch I did not yet merge, because it proposes to add an odd number of u32 fields to tcp_info, so AFAICT leaves a 4-byte padding hole at the end of tcp_info:

  net-test: packetdrill: Support AccECN counters through tcpi
  
https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgi
thub.com%2Fgoogle%2Fpacketdrill%2Fpull%2F96%2Fchanges%2Ff43649c87a2a
a79a33a78111d3d7e5f027d13a7f&data=05%7C02%7Cchia-yu.chang%40nokia-be
ll-labs.com%7C227b6e8cfe084ca9279708de56ee858b%7C5d4717519675428d917
b70f44f9630b0%7C0%7C0%7C639043779630306235%7CUnknown%7CTWFpbGZsb3d8e
yJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiT
WFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=HpI3cgq0qf1%2FrTCJACRAQZY
ZRs473MS3p%2BUB0VWATKE%3D&reserved=0

I think we'll need to tweak the AccECN kernel patch series so that it does not leave a 4-byte padding hole at the end of tcp_info, then update this packetdrill patch to match the kernel patch.

Let's come up with another useful u32 field we can add to the tcp_info struct, so that the kernel patch doesn't add a padding hole at the end of tcp_info.

One idea would be to add another field to represent newer options and connection features that are enabled. AFAICT all 8 bits of the tcpi_options field have been used, so we can't use more bits in that field. I'd suggest we add a u32 tcpi_more_options field before the tcpi_received_ce field, so we can encode other useful info, like:

+ 1 bit to indicate whether AccECN was negotiated (this can go in a
separate patch)

+ 1 bit to indicate whether TCP_NODELAY was set (since forgetting to
use TCP_NODELAY is a classic cause of performance problems; again 
this can go in a separate patch)

(And there will be future bits of info we want to add...)

Also, regarding the comment in this line:
  __u32   tcpi_received_ce;    /* # of CE marks received */

That comment is ambiguous, since it doesn't indicate whether it's counting (potentially LRO/GRO) skbs or TCP segments. I would suggest clarifying that this is counting segments:

__u32   tcpi_received_ce;    /* # of CE marked segments received */
Hi Neal,

Related to these 32-bit hole, two extra entries are added into b40671b5ee588c8a61b2d0eacbad32ffc57e9a8f of net-next, and one straightforward way is to apply these changes also in tcp.h of packetdrill (This is my miss).

+       __u16   tcpi_accecn_fail_mode;
+       __u16   tcpi_accecn_opt_seen;

But I would prefer to update this, because tcpi_accecn_fail_mode and tcpi_accecn_opt_seen overall just needs 8 bits (i.e., 4 bits for tcpi_accecn_fail_mode and 2 bits for tcpi_accecn_opt_seen).

So, maybe we could add u16 tcpi_more_options before tcpi_received_ce and change tcpi_accecn_fail_mode and tcpi_accecn_opt_seen both into u8.
Within tcpi_more_options, add one bit related to TCP_NODELAY as you said.
And within tcpi_accecn_opt_seen, add one bit related to whether AccECN was negotiated as you said, then we can leave more unused bits in tcpi_more_options.

Another thought is to use a single u32 before tcpi_received_ce, in which 4 bits for tcpi_accecn_fail_mode, 2 bits for tcpi_accecn_opt_seen, 26 bits for tcpi_more_options.

What do you think?
I would suggest something like your last suggestion, where there is a
u32 before tcpi_received_ce, with bit fields for tcpi_accecn_fail_mode
(4 bits) and tcpi_accecn_opt_seen (2 bits), and a tcpi_options2 for the remaining unused bits in the u32.

I am leaning toward tcpi_options2 rather than tcpi_more_options, because I guess in the future we might want yet another options bit field, in which case it would be better to have {tcpi_options, tcpi_options2, and tcpi_options3}, rather than having {tcpi_options, tcpi_more_options, and tcpi_yet_more_options}. :-)

And rather than a single bit indicating whether AccECN was negotiated, it occurs to me that it would probably be better to have a 2-bit enum with 4 values, corresponding to the modes in tcp_ecn.h:
tcp_ecn_disabled(), tcp_ecn_mode_rfc3168(), tcp_ecn_mode_accecn(), and tcp_ecn_mode_pending().

We also need to keep in mind that since the tcpi_accecn_fail_mode (4
bits) and tcpi_accecn_opt_seen (2 bits) enums are exported to user-space, they will become part of the kernel API to userspace, so should be moved out of tcp_ecn.h and instead be declared in include/uapi/linux/tcp.h. We declare constant values exported to user space in that file: (a) to make it easier for maintainers to remember not to change the values for these, so kernel changes don't break user-space apps; (b) to make it easier for application developers to find the #define values they need to decode the values exported in struct  tcp_info. :-)

So how about something like:
--- in include/uapi/linux/tcp.h:
/* Values for tcpi_ecn_mode */
#define TCPI_ECN_DISABLED 0x0
#define TCPI_ECN_RFC3168 0x1
#define  TCPI_ECN_ACCECN 0x2
#define TCPI_ECN_PENDING 0x3

/* Values for tcpi_accecn_opt_seen */
#define TCP_ACCECN_OPT_NOT_SEEN         0x0
#define TCP_ACCECN_OPT_EMPTY_SEEN       0x1
#define TCP_ACCECN_OPT_COUNTER_SEEN     0x2
#define TCP_ACCECN_OPT_FAIL_SEEN        0x3

/* Values for tcpi_accecn_fail_mode */
#define TCP_ACCECN_ACE_FAIL_SEND        BIT(0)
#define TCP_ACCECN_ACE_FAIL_RECV        BIT(1)
#define TCP_ACCECN_OPT_FAIL_SEND        BIT(2)
#define TCP_ACCECN_OPT_FAIL_RECV        BIT(3)

...
__u32 tcpi_ecn_mode:2,
    tcpi_accecn_opt_seen: 2,
    tcpi_accecn_fail_mode: 4,
    tcpi_options2:24;
__u32   tcpi_received_ce;    /* # of CE marked segments received */
...
--- in tcp_get_info() in net/ipv4/tcp.c:
if (tcp_ecn_disabled(tp))
  info-> tcpi_ecn_mode = TCPI_ECN_DISABLED; else if (tcp_ecn_mode_rfc3168(tp))
  info-> tcpi_ecn_mode = TCPI_ECN_RFC3168; else if (tcp_ecn_mode_accecn(tp))
  info-> tcpi_ecn_mode = TCPI_ECN_ACCECN; else if (tcp_ecn_mode_pending(tp))
  info-> tcpi_ecn_mode = TCPI_ECN_PENDING;

WDYT?
quoted
And I will update the comment of tcpi_received_ce, thanks for the comments.
Great. Thanks!

neal
quoted
Chia-Yu
quoted
(3) The following patch I did not merge, because I'd like to migrate 
to having all packetdrill tests for the Linux kernel reside in one 
place, in the Linux kernel source tree (not the Google packetdrill
repo):

  net-test: add TCP Accurate ECN cases
  
https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgi
thub.com%2Fgoogle%2Fpacketdrill%2Fpull%2F96%2Fchanges%2Ffe4c7293ea64
0a4c81178b6c88744d7a5d209fd6&data=05%7C02%7Cchia-yu.chang%40nokia-be
ll-labs.com%7C227b6e8cfe084ca9279708de56ee858b%7C5d4717519675428d917
b70f44f9630b0%7C0%7C0%7C639043779630323311%7CUnknown%7CTWFpbGZsb3d8e
yJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiT
WFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=kIDQalqUreGDjFAmUljiaodEq
kcxrypAa5YQBXsOvOE%3D&reserved=0

Thanks!
neal
Chia-Yu

-----Original Message-----
From: Neal Cardwell <ncardwell@google.com>
Sent: Sunday, January 18, 2026 5:11 PM
To: Chia-Yu Chang (Nokia) <redacted>
Cc: pabeni@redhat.com; edumazet@google.com; parav@nvidia.com; 
linux-doc@vger.kernel.org; corbet@lwn.net; horms@kernel.org; 
dsahern@kernel.org; kuniyu@google.com; bpf@vger.kernel.org; 
netdev@vger.kernel.org; dave.taht@gmail.com; jhs@mojatatu.com; 
kuba@kernel.org; stephen@networkplumber.org; xiyou.wangcong@gmail.com; 
jiri@resnulli.us; davem@davemloft.net; andrew+netdev@lunn.ch; 
donald.hunter@gmail.com; ast@fiberby.net; liuhangbin@gmail.com; 
shuah@kernel.org; linux-kselftest@vger.kernel.org; ij@kernel.org; Koen 
De Schepper (Nokia) [off-list ref]; 
g.white@cablelabs.com; ingemar.s.johansson@ericsson.com; 
mirja.kuehlewind@ericsson.com; cheshire [off-list ref]; 
rs.ietf@gmx.at; Jason_Livingood@comcast.com; Vidhi Goel 
[off-list ref]; Willem de Bruijn [off-list ref]
Subject: Re: [PATCH net-next 1/1] selftests/net: Add packetdrill 
packetdrill cases


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 Thu, Jan 8, 2026 at 5:46 PM Neal Cardwell [off-list ref] wrote:
quoted
On Thu, Jan 8, 2026 at 10:58 AM [off-list ref] wrote:
quoted
From: Chia-Yu Chang <redacted>

Linux Accurate ECN test sets using ACE counters and AccECN options 
to cover several scenarios: Connection teardown, different ACK 
conditions, counter wrapping, SACK space grabbing, fallback 
schemes, negotiation retransmission/reorder/loss, AccECN option 
drop/loss, different handshake reflectors, data with marking, and different sysctl values.

Co-developed-by: Ilpo Järvinen <ij@kernel.org>
Signed-off-by: Ilpo Järvinen <ij@kernel.org>
Co-developed-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: Neal Cardwell <ncardwell@google.com>
---
Chia-Yu, thank you for posting the packetdrill tests.

A couple thoughts:

(1) These tests are using the experimental AccECN packetdrill 
support that is not in mainline packetdrill yet. Can you please 
share the github URL for the version of packetdrill you used? I will 
work on merging the appropriate experimental AccECN packetdrill 
support into the Google packetdrill mainline branch.
An update on the 3 patches at:

https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgith
ub.com%2Fgoogle%2Fpacketdrill%2Fpull%2F96&data=05%7C02%7Cchia-yu.chang
%40nokia-bell-labs.com%7C227b6e8cfe084ca9279708de56ee858b%7C5d47175196
75428d917b70f44f9630b0%7C0%7C0%7C639043779630340275%7CUnknown%7CTWFpbG
Zsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFO
IjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=9cEIWqpEDSW4fyo2CclKk1
eNZ5c5C0lOADuSrE7lWFA%3D&reserved=0

(1) I have merged the following patch into the google packetdrill repo to facilitate testing of the AccECN patch series:

"net-test: packetdrill: add Accurate ECN (AccECN) option support"
https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgith
ub.com%2Fgoogle%2Fpacketdrill%2Fpull%2F96%2Fchanges%2Ff6861f888bc7f1e0
8026de4825519a95504d1047&data=05%7C02%7Cchia-yu.chang%40nokia-bell-lab
s.com%7C227b6e8cfe084ca9279708de56ee858b%7C5d4717519675428d917b70f44f9
630b0%7C0%7C0%7C639043779630357016%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1
hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUI
joyfQ%3D%3D%7C0%7C%7C%7C&sdata=V9Pt4nNHTV%2BcoQrb%2BMNQKOW%2FJARzk3DfY
LvhuVZ3ii4%3D&reserved=0

(2) The following patch I did not yet merge, because it proposes to add an odd number of u32 fields to tcp_info, so AFAICT leaves a 4-byte padding hole at the end of tcp_info:

  net-test: packetdrill: Support AccECN counters through tcpi
  
https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgith
ub.com%2Fgoogle%2Fpacketdrill%2Fpull%2F96%2Fchanges%2Ff43649c87a2aa79a
33a78111d3d7e5f027d13a7f&data=05%7C02%7Cchia-yu.chang%40nokia-bell-lab
s.com%7C227b6e8cfe084ca9279708de56ee858b%7C5d4717519675428d917b70f44f9
630b0%7C0%7C0%7C639043779630374376%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1
hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUI
joyfQ%3D%3D%7C0%7C%7C%7C&sdata=vy8TGIgoQum%2FFSN%2FnuaGT3rcZsTVjKHVx5G
dIDWTR7A%3D&reserved=0

I think we'll need to tweak the AccECN kernel patch series so that it does not leave a 4-byte padding hole at the end of tcp_info, then update this packetdrill patch to match the kernel patch.

Let's come up with another useful u32 field we can add to the tcp_info struct, so that the kernel patch doesn't add a padding hole at the end of tcp_info.

One idea would be to add another field to represent newer options and connection features that are enabled. AFAICT all 8 bits of the tcpi_options field have been used, so we can't use more bits in that field. I'd suggest we add a u32 tcpi_more_options field before the tcpi_received_ce field, so we can encode other useful info, like:

+ 1 bit to indicate whether AccECN was negotiated (this can go in a
separate patch)

+ 1 bit to indicate whether TCP_NODELAY was set (since forgetting to
use TCP_NODELAY is a classic cause of performance problems; again this 
can go in a separate patch)

(And there will be future bits of info we want to add...)

Also, regarding the comment in this line:
  __u32   tcpi_received_ce;    /* # of CE marks received */

That comment is ambiguous, since it doesn't indicate whether it's counting (potentially LRO/GRO) skbs or TCP segments. I would suggest clarifying that this is counting segments:

__u32   tcpi_received_ce;    /* # of CE marked segments received */
Hi Neal,

I've done doing the patch on both net-next and packetdrill, and all AccECN cases can still pass.

Would it be possible for me to send patches via email rather than creating PR (due to our internal rules)?

Thanks.
Chia-Yu
quoted
(3) The following patch I did not merge, because I'd like to migrate 
to having all packetdrill tests for the Linux kernel reside in one 
place, in the Linux kernel source tree (not the Google packetdrill
repo):

  net-test: add TCP Accurate ECN cases
  
https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgith
ub.com%2Fgoogle%2Fpacketdrill%2Fpull%2F96%2Fchanges%2Ffe4c7293ea640a4c
81178b6c88744d7a5d209fd6&data=05%7C02%7Cchia-yu.chang%40nokia-bell-lab
s.com%7C227b6e8cfe084ca9279708de56ee858b%7C5d4717519675428d917b70f44f9
630b0%7C0%7C0%7C639043779630393408%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1
hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUI
joyfQ%3D%3D%7C0%7C%7C%7C&sdata=uUeSfuXSHBuV3bFAc1Gc0CxeXDDICAE01dEyVod
pw30%3D&reserved=0

Thanks!
neal

Re: [PATCH net-next 1/1] selftests/net: Add packetdrill packetdrill cases

From: Neal Cardwell <ncardwell@google.com>
Date: 2026-01-19 18:39:33

On Mon, Jan 19, 2026 at 1:34 PM Chia-Yu Chang (Nokia)
[off-list ref] wrote:
quoted
-----Original Message-----
From: Neal Cardwell <ncardwell@google.com>
Sent: Monday, January 19, 2026 1:06 AM
To: Chia-Yu Chang (Nokia) <redacted>
Cc: pabeni@redhat.com; edumazet@google.com; parav@nvidia.com; linux-doc@vger.kernel.org; corbet@lwn.net; horms@kernel.org; dsahern@kernel.org; kuniyu@google.com; bpf@vger.kernel.org; netdev@vger.kernel.org; dave.taht@gmail.com; jhs@mojatatu.com; kuba@kernel.org; stephen@networkplumber.org; xiyou.wangcong@gmail.com; jiri@resnulli.us; davem@davemloft.net; andrew+netdev@lunn.ch; donald.hunter@gmail.com; ast@fiberby.net; liuhangbin@gmail.com; shuah@kernel.org; linux-kselftest@vger.kernel.org; ij@kernel.org; Koen De Schepper (Nokia) <redacted>; g.white@cablelabs.com; ingemar.s.johansson@ericsson.com; mirja.kuehlewind@ericsson.com; cheshire <redacted>; rs.ietf@gmx.at; Jason_Livingood@comcast.com; Vidhi Goel <redacted>; Willem de Bruijn <willemb@google.com>
Subject: Re: [PATCH net-next 1/1] selftests/net: Add packetdrill packetdrill cases


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 Sun, Jan 18, 2026 at 5:56 PM Chia-Yu Chang (Nokia) [off-list ref] wrote:
quoted
quoted
-----Original Message-----
From: Neal Cardwell <ncardwell@google.com>
Sent: Sunday, January 18, 2026 5:11 PM
To: Chia-Yu Chang (Nokia) <redacted>
Cc: pabeni@redhat.com; edumazet@google.com; parav@nvidia.com;
linux-doc@vger.kernel.org; corbet@lwn.net; horms@kernel.org;
dsahern@kernel.org; kuniyu@google.com; bpf@vger.kernel.org;
netdev@vger.kernel.org; dave.taht@gmail.com; jhs@mojatatu.com;
kuba@kernel.org; stephen@networkplumber.org;
xiyou.wangcong@gmail.com; jiri@resnulli.us; davem@davemloft.net;
andrew+netdev@lunn.ch; donald.hunter@gmail.com; ast@fiberby.net;
liuhangbin@gmail.com; shuah@kernel.org;
linux-kselftest@vger.kernel.org; ij@kernel.org; Koen De Schepper
(Nokia) [off-list ref];
g.white@cablelabs.com; ingemar.s.johansson@ericsson.com;
mirja.kuehlewind@ericsson.com; cheshire [off-list ref];
rs.ietf@gmx.at; Jason_Livingood@comcast.com; Vidhi Goel
[off-list ref]; Willem de Bruijn [off-list ref]
Subject: Re: [PATCH net-next 1/1] selftests/net: Add packetdrill
packetdrill cases


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 Thu, Jan 8, 2026 at 5:46 PM Neal Cardwell [off-list ref] wrote:
quoted
On Thu, Jan 8, 2026 at 10:58 AM [off-list ref] wrote:
quoted
From: Chia-Yu Chang <redacted>

Linux Accurate ECN test sets using ACE counters and AccECN
options to cover several scenarios: Connection teardown,
different ACK conditions, counter wrapping, SACK space grabbing,
fallback schemes, negotiation retransmission/reorder/loss,
AccECN option drop/loss, different handshake reflectors, data with marking, and different sysctl values.

Co-developed-by: Ilpo Järvinen <ij@kernel.org>
Signed-off-by: Ilpo Järvinen <ij@kernel.org>
Co-developed-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: Neal Cardwell <ncardwell@google.com>
---
Chia-Yu, thank you for posting the packetdrill tests.

A couple thoughts:

(1) These tests are using the experimental AccECN packetdrill
support that is not in mainline packetdrill yet. Can you please
share the github URL for the version of packetdrill you used? I
will work on merging the appropriate experimental AccECN
packetdrill support into the Google packetdrill mainline branch.
An update on the 3 patches at:

https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgi
thub.com%2Fgoogle%2Fpacketdrill%2Fpull%2F96&data=05%7C02%7Cchia-yu.c
hang%40nokia-bell-labs.com%7C227b6e8cfe084ca9279708de56ee858b%7C5d47
17519675428d917b70f44f9630b0%7C0%7C0%7C639043779630263465%7CUnknown%
7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW
4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=l6PAGPTELL
T3KwEWsuLQnLaxQ0BUixhbrFp3n6dA950%3D&reserved=0

(1) I have merged the following patch into the google packetdrill repo to facilitate testing of the AccECN patch series:

"net-test: packetdrill: add Accurate ECN (AccECN) option support"
https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgi
thub.com%2Fgoogle%2Fpacketdrill%2Fpull%2F96%2Fchanges%2Ff6861f888bc7
f1e08026de4825519a95504d1047&data=05%7C02%7Cchia-yu.chang%40nokia-be
ll-labs.com%7C227b6e8cfe084ca9279708de56ee858b%7C5d4717519675428d917
b70f44f9630b0%7C0%7C0%7C639043779630288017%7CUnknown%7CTWFpbGZsb3d8e
yJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiT
WFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=wct5GueZNjBZHCaxpbokNBLXh
pGpDFjKKUiIbCMiKco%3D&reserved=0

(2) The following patch I did not yet merge, because it proposes to add an odd number of u32 fields to tcp_info, so AFAICT leaves a 4-byte padding hole at the end of tcp_info:

  net-test: packetdrill: Support AccECN counters through tcpi

https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgi
thub.com%2Fgoogle%2Fpacketdrill%2Fpull%2F96%2Fchanges%2Ff43649c87a2a
a79a33a78111d3d7e5f027d13a7f&data=05%7C02%7Cchia-yu.chang%40nokia-be
ll-labs.com%7C227b6e8cfe084ca9279708de56ee858b%7C5d4717519675428d917
b70f44f9630b0%7C0%7C0%7C639043779630306235%7CUnknown%7CTWFpbGZsb3d8e
yJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiT
WFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=HpI3cgq0qf1%2FrTCJACRAQZY
ZRs473MS3p%2BUB0VWATKE%3D&reserved=0

I think we'll need to tweak the AccECN kernel patch series so that it does not leave a 4-byte padding hole at the end of tcp_info, then update this packetdrill patch to match the kernel patch.

Let's come up with another useful u32 field we can add to the tcp_info struct, so that the kernel patch doesn't add a padding hole at the end of tcp_info.

One idea would be to add another field to represent newer options and connection features that are enabled. AFAICT all 8 bits of the tcpi_options field have been used, so we can't use more bits in that field. I'd suggest we add a u32 tcpi_more_options field before the tcpi_received_ce field, so we can encode other useful info, like:

+ 1 bit to indicate whether AccECN was negotiated (this can go in a
separate patch)

+ 1 bit to indicate whether TCP_NODELAY was set (since forgetting to
use TCP_NODELAY is a classic cause of performance problems; again
this can go in a separate patch)

(And there will be future bits of info we want to add...)

Also, regarding the comment in this line:
  __u32   tcpi_received_ce;    /* # of CE marks received */

That comment is ambiguous, since it doesn't indicate whether it's counting (potentially LRO/GRO) skbs or TCP segments. I would suggest clarifying that this is counting segments:

__u32   tcpi_received_ce;    /* # of CE marked segments received */
Hi Neal,

Related to these 32-bit hole, two extra entries are added into b40671b5ee588c8a61b2d0eacbad32ffc57e9a8f of net-next, and one straightforward way is to apply these changes also in tcp.h of packetdrill (This is my miss).

+       __u16   tcpi_accecn_fail_mode;
+       __u16   tcpi_accecn_opt_seen;

But I would prefer to update this, because tcpi_accecn_fail_mode and tcpi_accecn_opt_seen overall just needs 8 bits (i.e., 4 bits for tcpi_accecn_fail_mode and 2 bits for tcpi_accecn_opt_seen).

So, maybe we could add u16 tcpi_more_options before tcpi_received_ce and change tcpi_accecn_fail_mode and tcpi_accecn_opt_seen both into u8.
Within tcpi_more_options, add one bit related to TCP_NODELAY as you said.
And within tcpi_accecn_opt_seen, add one bit related to whether AccECN was negotiated as you said, then we can leave more unused bits in tcpi_more_options.

Another thought is to use a single u32 before tcpi_received_ce, in which 4 bits for tcpi_accecn_fail_mode, 2 bits for tcpi_accecn_opt_seen, 26 bits for tcpi_more_options.

What do you think?
I would suggest something like your last suggestion, where there is a
u32 before tcpi_received_ce, with bit fields for tcpi_accecn_fail_mode
(4 bits) and tcpi_accecn_opt_seen (2 bits), and a tcpi_options2 for the remaining unused bits in the u32.

I am leaning toward tcpi_options2 rather than tcpi_more_options, because I guess in the future we might want yet another options bit field, in which case it would be better to have {tcpi_options, tcpi_options2, and tcpi_options3}, rather than having {tcpi_options, tcpi_more_options, and tcpi_yet_more_options}. :-)

And rather than a single bit indicating whether AccECN was negotiated, it occurs to me that it would probably be better to have a 2-bit enum with 4 values, corresponding to the modes in tcp_ecn.h:
tcp_ecn_disabled(), tcp_ecn_mode_rfc3168(), tcp_ecn_mode_accecn(), and tcp_ecn_mode_pending().

We also need to keep in mind that since the tcpi_accecn_fail_mode (4
bits) and tcpi_accecn_opt_seen (2 bits) enums are exported to user-space, they will become part of the kernel API to userspace, so should be moved out of tcp_ecn.h and instead be declared in include/uapi/linux/tcp.h. We declare constant values exported to user space in that file: (a) to make it easier for maintainers to remember not to change the values for these, so kernel changes don't break user-space apps; (b) to make it easier for application developers to find the #define values they need to decode the values exported in struct  tcp_info. :-)

So how about something like:
--- in include/uapi/linux/tcp.h:
/* Values for tcpi_ecn_mode */
#define TCPI_ECN_DISABLED 0x0
#define TCPI_ECN_RFC3168 0x1
#define  TCPI_ECN_ACCECN 0x2
#define TCPI_ECN_PENDING 0x3

/* Values for tcpi_accecn_opt_seen */
#define TCP_ACCECN_OPT_NOT_SEEN         0x0
#define TCP_ACCECN_OPT_EMPTY_SEEN       0x1
#define TCP_ACCECN_OPT_COUNTER_SEEN     0x2
#define TCP_ACCECN_OPT_FAIL_SEEN        0x3

/* Values for tcpi_accecn_fail_mode */
#define TCP_ACCECN_ACE_FAIL_SEND        BIT(0)
#define TCP_ACCECN_ACE_FAIL_RECV        BIT(1)
#define TCP_ACCECN_OPT_FAIL_SEND        BIT(2)
#define TCP_ACCECN_OPT_FAIL_RECV        BIT(3)

...
__u32 tcpi_ecn_mode:2,
    tcpi_accecn_opt_seen: 2,
    tcpi_accecn_fail_mode: 4,
    tcpi_options2:24;
__u32   tcpi_received_ce;    /* # of CE marked segments received */
...
--- in tcp_get_info() in net/ipv4/tcp.c:
if (tcp_ecn_disabled(tp))
  info-> tcpi_ecn_mode = TCPI_ECN_DISABLED; else if (tcp_ecn_mode_rfc3168(tp))
  info-> tcpi_ecn_mode = TCPI_ECN_RFC3168; else if (tcp_ecn_mode_accecn(tp))
  info-> tcpi_ecn_mode = TCPI_ECN_ACCECN; else if (tcp_ecn_mode_pending(tp))
  info-> tcpi_ecn_mode = TCPI_ECN_PENDING;

WDYT?
quoted
And I will update the comment of tcpi_received_ce, thanks for the comments.
Great. Thanks!

neal
quoted
Chia-Yu
quoted
(3) The following patch I did not merge, because I'd like to migrate
to having all packetdrill tests for the Linux kernel reside in one
place, in the Linux kernel source tree (not the Google packetdrill
repo):

  net-test: add TCP Accurate ECN cases

https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgi
thub.com%2Fgoogle%2Fpacketdrill%2Fpull%2F96%2Fchanges%2Ffe4c7293ea64
0a4c81178b6c88744d7a5d209fd6&data=05%7C02%7Cchia-yu.chang%40nokia-be
ll-labs.com%7C227b6e8cfe084ca9279708de56ee858b%7C5d4717519675428d917
b70f44f9630b0%7C0%7C0%7C639043779630323311%7CUnknown%7CTWFpbGZsb3d8e
yJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiT
WFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=kIDQalqUreGDjFAmUljiaodEq
kcxrypAa5YQBXsOvOE%3D&reserved=0

Thanks!
neal
Chia-Yu

-----Original Message-----
From: Neal Cardwell <ncardwell@google.com>
Sent: Sunday, January 18, 2026 5:11 PM
To: Chia-Yu Chang (Nokia) <redacted>
Cc: pabeni@redhat.com; edumazet@google.com; parav@nvidia.com;
linux-doc@vger.kernel.org; corbet@lwn.net; horms@kernel.org;
dsahern@kernel.org; kuniyu@google.com; bpf@vger.kernel.org;
netdev@vger.kernel.org; dave.taht@gmail.com; jhs@mojatatu.com;
kuba@kernel.org; stephen@networkplumber.org; xiyou.wangcong@gmail.com;
jiri@resnulli.us; davem@davemloft.net; andrew+netdev@lunn.ch;
donald.hunter@gmail.com; ast@fiberby.net; liuhangbin@gmail.com;
shuah@kernel.org; linux-kselftest@vger.kernel.org; ij@kernel.org; Koen
De Schepper (Nokia) [off-list ref];
g.white@cablelabs.com; ingemar.s.johansson@ericsson.com;
mirja.kuehlewind@ericsson.com; cheshire [off-list ref];
rs.ietf@gmx.at; Jason_Livingood@comcast.com; Vidhi Goel
[off-list ref]; Willem de Bruijn [off-list ref]
Subject: Re: [PATCH net-next 1/1] selftests/net: Add packetdrill
packetdrill cases


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 Thu, Jan 8, 2026 at 5:46 PM Neal Cardwell [off-list ref] wrote:
quoted
On Thu, Jan 8, 2026 at 10:58 AM [off-list ref] wrote:
quoted
From: Chia-Yu Chang <redacted>

Linux Accurate ECN test sets using ACE counters and AccECN options
to cover several scenarios: Connection teardown, different ACK
conditions, counter wrapping, SACK space grabbing, fallback
schemes, negotiation retransmission/reorder/loss, AccECN option
drop/loss, different handshake reflectors, data with marking, and different sysctl values.

Co-developed-by: Ilpo Järvinen <ij@kernel.org>
Signed-off-by: Ilpo Järvinen <ij@kernel.org>
Co-developed-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: Neal Cardwell <ncardwell@google.com>
---
Chia-Yu, thank you for posting the packetdrill tests.

A couple thoughts:

(1) These tests are using the experimental AccECN packetdrill
support that is not in mainline packetdrill yet. Can you please
share the github URL for the version of packetdrill you used? I will
work on merging the appropriate experimental AccECN packetdrill
support into the Google packetdrill mainline branch.
An update on the 3 patches at:

https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgith
ub.com%2Fgoogle%2Fpacketdrill%2Fpull%2F96&data=05%7C02%7Cchia-yu.chang
%40nokia-bell-labs.com%7C227b6e8cfe084ca9279708de56ee858b%7C5d47175196
75428d917b70f44f9630b0%7C0%7C0%7C639043779630340275%7CUnknown%7CTWFpbG
Zsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFO
IjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=9cEIWqpEDSW4fyo2CclKk1
eNZ5c5C0lOADuSrE7lWFA%3D&reserved=0

(1) I have merged the following patch into the google packetdrill repo to facilitate testing of the AccECN patch series:

"net-test: packetdrill: add Accurate ECN (AccECN) option support"
https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgith
ub.com%2Fgoogle%2Fpacketdrill%2Fpull%2F96%2Fchanges%2Ff6861f888bc7f1e0
8026de4825519a95504d1047&data=05%7C02%7Cchia-yu.chang%40nokia-bell-lab
s.com%7C227b6e8cfe084ca9279708de56ee858b%7C5d4717519675428d917b70f44f9
630b0%7C0%7C0%7C639043779630357016%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1
hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUI
joyfQ%3D%3D%7C0%7C%7C%7C&sdata=V9Pt4nNHTV%2BcoQrb%2BMNQKOW%2FJARzk3DfY
LvhuVZ3ii4%3D&reserved=0

(2) The following patch I did not yet merge, because it proposes to add an odd number of u32 fields to tcp_info, so AFAICT leaves a 4-byte padding hole at the end of tcp_info:

  net-test: packetdrill: Support AccECN counters through tcpi

https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgith
ub.com%2Fgoogle%2Fpacketdrill%2Fpull%2F96%2Fchanges%2Ff43649c87a2aa79a
33a78111d3d7e5f027d13a7f&data=05%7C02%7Cchia-yu.chang%40nokia-bell-lab
s.com%7C227b6e8cfe084ca9279708de56ee858b%7C5d4717519675428d917b70f44f9
630b0%7C0%7C0%7C639043779630374376%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1
hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUI
joyfQ%3D%3D%7C0%7C%7C%7C&sdata=vy8TGIgoQum%2FFSN%2FnuaGT3rcZsTVjKHVx5G
dIDWTR7A%3D&reserved=0

I think we'll need to tweak the AccECN kernel patch series so that it does not leave a 4-byte padding hole at the end of tcp_info, then update this packetdrill patch to match the kernel patch.

Let's come up with another useful u32 field we can add to the tcp_info struct, so that the kernel patch doesn't add a padding hole at the end of tcp_info.

One idea would be to add another field to represent newer options and connection features that are enabled. AFAICT all 8 bits of the tcpi_options field have been used, so we can't use more bits in that field. I'd suggest we add a u32 tcpi_more_options field before the tcpi_received_ce field, so we can encode other useful info, like:

+ 1 bit to indicate whether AccECN was negotiated (this can go in a
separate patch)

+ 1 bit to indicate whether TCP_NODELAY was set (since forgetting to
use TCP_NODELAY is a classic cause of performance problems; again this
can go in a separate patch)

(And there will be future bits of info we want to add...)

Also, regarding the comment in this line:
  __u32   tcpi_received_ce;    /* # of CE marks received */

That comment is ambiguous, since it doesn't indicate whether it's counting (potentially LRO/GRO) skbs or TCP segments. I would suggest clarifying that this is counting segments:

__u32   tcpi_received_ce;    /* # of CE marked segments received */
Hi Neal,

I've done doing the patch on both net-next and packetdrill, and all AccECN cases can still pass.

Would it be possible for me to send patches via email rather than creating PR (due to our internal rules)?
Yes, that's fine if you want to email the packetdrill patches to the
packetdrill@googlegroups.com mailing list.

thanks,
neal
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help