Files
openthread/tests/toranj
Abtin Keshavarzian 5c8c318627 [sub-mac] introduce unified ReceiveAt logic for timed RX (#13491)
This commit introduces a unified `ReceiveAt` abstraction in `SubMac` to
handle timed reception windows (CSL receiver, WED / Thread-Direct wakeup
listener)

Motivation & Benefits:

Previously, CSL sample window calculation and scheduling differed between
platform-offloaded timing (`OT_RADIO_CAPS_RECEIVE_TIMING`) and stack-driven
timing (`SubMac` software timers):
- `GetCslWindowEdges()` added `kCslReceiveTimeAhead` lead time to the window
  margin, only for offloaded callers to manually subtract it back out before
  calling `Radio::ReceiveAt()`.
- Stack-driven mode relied on separate timers for sample/sleep transitions
  (`HandleCslReceiveOrSleep`, `HandleWedReceiveOrSleep`), leading to code
  duplication and inconsistent timing margins across platform vs stack-driven
  executions.

This commit harmonizes timed reception handling:
- `GetCslWindowEdges()` cleanly computes target window bounds without caller-side
  adjustments.
- `SubMac::ReceiveAt()` provides a single, consistent API for both offloaded
  and stack-driven timing.
- Provides a clean foundation for Thread-Direct wakeup listening (WED) and
  future timed reception features.

Key changes:

- State Machine Refactoring: Simplifies the state management adding
  `kStateTimedReceive`. The radio state is `kStateTimedReceive` when
  actively receiving in a target rx window, and `kStateSleep` otherwise.
- `TimedRx` Helper Class: Encapsulates window parameters (`mStartTime`,
  `mDuration`, `mChannel`) and state checks (`HasStarted`, `HasEnded`).
- Pending & Active Window Preemption: `UpdateTimedRxState()` manages
  the timed RX schedules and sets the timer accordingly. It ensures
  pending windows starting before an active window ends are promoted
  seamlessly.
- Unit Test: Adds a detailed `test_sub_mac_recv_at.cpp` covering various
  behaviors (including edge-cases) of `ReceiveAt()` logic.
2026-08-31 14:27:24 -07:00
..

toranj test framework

toranj is a test framework for OpenThread.

It provides two modes:

  • toranj-cli which enables testing of OpenThread using its CLI interface.
  • toranj-ncp which enables testing of the combined behavior of OpenThread (in NCP mode), spinel interface, and wpantund driver on linux.

toranj features:

  • It is developed in Python.
  • It can be used to simulate multiple nodes forming complex network topologies.
  • It allows testing of network interactions between many nodes (IPv6 traffic exchanges).
  • toranj in NCP mode runs wpantund natively with OpenThread in NCP mode on simulation platform (real-time).
  • toranj in CLI mode runs ot-cli-ftd on simulation platform (real-time).
  • toranj tests run as part of GitHub Actions pull request validation in OpenThread and wpantund GitHub projects.

toranj modes


What does "toranj" mean? it's the name of a common symmetric weaving pattern used in Persian carpets.