Skip to content

[radio] allow otPlatRadioReceiveAt() to replace or update a window - #1360

Merged
jwhui merged 1 commit into
openthread:mainfrom
bukepo:radio-receive-at-update
Oct 23, 2026
Merged

jwhui merged 1 commit into
openthread:mainfrom
bukepo:radio-receive-at-update

Conversation

@bukepo

@bukepo bukepo commented Oct 20, 2026

Copy link
Copy Markdown
Member

otPlatRadioReceiveAt() failed when a previously scheduled receive
window was pending or ongoing, since the driver accepted a delayed
reception only when no delayed reception was in progress.

The delayed reception now tracks the requested window (not started yet)
separately from the ongoing window, so that it behaves as defined by
otPlatRadioReceiveAt():

  • A requested window which has not started yet is replaced.
  • An ongoing window is not interrupted. If the new window starts before
    the ongoing one ends, reception continues until the new window
    starts; otherwise the ongoing window ends as scheduled. The new
    window then dictates the channel and the end of the reception.
  • A window whose start is too close or has passed starts immediately,
    and a window which has already ended ends the ongoing reception
    (after the frame being received, if any).
  • The receiver is not restarted when the channel does not change, and
    it is retuned when switching channel within an ongoing window (the
    channel update was previously vetoed by the delayed RX abort hook).

In addition, otPlatRadioReceiveAt() returns OT_ERROR_INVALID_STATE
when the radio is disabled, and otPlatRadioDisable() cancels any
scheduled or ongoing receive window.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the Nordic Semiconductor 802154 radio driver to support seamless updates and replacements of delayed RX windows without interrupting ongoing reception. The review feedback highlights several critical issues, including potential linked list corruption in the timer scheduler when adding a timer without first removing it, race conditions caused by non-atomic direct state modifications of RSCH_DLY_RX, and a potential double failure notification to the upper layer when an ongoing window is stopped.

@bukepo
bukepo requested a review from LuDuda October 20, 2026 10:00
@bukepo bukepo added the bug Something isn't working label Oct 21, 2026
@bukepo
bukepo requested review from LuDuda and removed request for LuDuda October 21, 2026 11:07
@LuDuda

LuDuda commented Oct 21, 2026

Copy link
Copy Markdown
Member

Thank you for the PR!

@pkwiek is going to review it asap.

@pkwiek pkwiek left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The functionality is sound albeit a bit opinionated. With the state of bare-metal OT support from us I am fine with this. I commented on some possible readability improvements.

@bukepo
bukepo force-pushed the radio-receive-at-update branch 2 times, most recently from 4ffb8c1 to 29a665a Compare October 23, 2026 07:07

@pkwiek pkwiek left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@bukepo
bukepo requested a review from jwhui October 23, 2026 09:32
Comment thread src/src/radio.c Outdated
`otPlatRadioReceiveAt()` failed when a previously scheduled receive
window was pending or ongoing, since the driver accepted a delayed
reception only when no delayed reception was in progress.

The delayed reception now tracks the requested window (not started yet)
separately from the ongoing window, so that it behaves as defined by
`otPlatRadioReceiveAt()`:

- A requested window which has not started yet is replaced.
- An ongoing window is not interrupted. If the new window starts before
  the ongoing one ends, reception continues until the new window
  starts; otherwise the ongoing window ends as scheduled. The new
  window then dictates the channel and the end of the reception.
- A window whose start is too close or has passed starts immediately,
  and a window which has already ended ends the ongoing reception
  (after the frame being received, if any).
- The receiver is not restarted when the channel does not change, and
  it is retuned when switching channel within an ongoing window (the
  channel update was previously vetoed by the delayed RX abort hook).

In addition, `otPlatRadioReceiveAt()` returns `OT_ERROR_INVALID_STATE`
when the radio is disabled, and `otPlatRadioDisable()` cancels any
scheduled or ongoing receive window.
@bukepo
bukepo force-pushed the radio-receive-at-update branch from 29a665a to f6f3084 Compare October 23, 2026 21:34
@jwhui
jwhui merged commit ebb444a into openthread:main Oct 23, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants