-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Bluetooth: Controller: Fix single switch timer use in ISO Sync #96653
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -1352,22 +1352,25 @@ static void isr_rx(void *param) | |||||||||
| hcto -= addr_us_get(lll->phy); | ||||||||||
| hcto -= radio_rx_ready_delay_get(lll->phy, PHY_FLAGS_S8); | ||||||||||
|
|
||||||||||
| overhead_us = radio_rx_chain_delay_get(lll->phy, PHY_FLAGS_S8); | ||||||||||
| overhead_us += addr_us_get(lll->phy); | ||||||||||
| overhead_us += radio_rx_ready_delay_get(lll->phy, PHY_FLAGS_S8); | ||||||||||
| /* Overhead within EVENT_IFS_US to exclude from max. jitter */ | ||||||||||
| /* Required radio ready duration, settling time */ | ||||||||||
| overhead_us = radio_rx_ready_delay_get(lll->phy, PHY_FLAGS_S8); | ||||||||||
| /* If single timer used, then consider required max. latency */ | ||||||||||
| overhead_us += HAL_RADIO_ISR_LATENCY_MAX_US; | ||||||||||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Previous use of Test that covers the change in this PR is in #75760, which checks for drifting |
||||||||||
| /* Add chain delay overhead */ | ||||||||||
| overhead_us += radio_rx_chain_delay_get(lll->phy, PHY_FLAGS_S8); | ||||||||||
|
||||||||||
| overhead_us += radio_rx_chain_delay_get(lll->phy, PHY_FLAGS_S8); | |
| overhead_us += radio_rx_chain_delay_get(lll->phy, PHY_FLAGS_S8); | |
| /* Add address timing overhead */ | |
| overhead_us += addr_us_get(lll->phy); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Intentionally excluded, use of duration until address is incorrect; only overhead duration between last bit on-air to first bit on-air be calculated.
Copilot
AI
Oct 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Using a bit shift to divide by 2 reduces readability with no performance benefit on modern compilers. Prefer an explicit division: jitter_max_us = (EVENT_IFS_US - overhead_us) / 2;
| jitter_max_us = (EVENT_IFS_US - overhead_us) >> 1; | |
| jitter_max_us = (EVENT_IFS_US - overhead_us) / 2; |
Copilot
AI
Oct 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Using both nse (local) and lll->nse (struct field) in the same expression is confusing. Consider renaming the local nse to something like subevent_idx or adding an inline comment clarifying that nse here is the current subevent index while lll->nse is the total number of subevents.
Copilot
AI
Oct 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Raising a variable named jitter_max_us with MAX(...) can exceed the true available jitter budget derived from EVENT_IFS_US - overhead_us, potentially allowing jitter_us to surpass the timing slack and causing missed radio timings. Instead, keep jitter_max_us as the budget ceiling and enforce the minimum on jitter_us (if needed) or remove the minimum entirely. For example: compute jitter_max_us on lines 1367–1369 as-is, then clamp jitter_us with both lower and upper bounds:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment states this addition applies 'If single timer used,' but the code unconditionally adds HAL_RADIO_ISR_LATENCY_MAX_US. Either guard this with the appropriate build-time/runtime condition for single-switch timer, or update the comment to reflect that this latency is always considered here.