Skip to content
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

Bluetooth: controller: Fix ISO broadcaster pre-transmission groups > 1 #77568

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

mtpr-ot
Copy link
Collaborator

@mtpr-ot mtpr-ot commented Aug 26, 2024

For pre-transmission groups > 1, the broadcaster link layer would fetch incorrect payloads from the TX node queue.

Update payload index calculation to reference correct TX payload. Fix PTO FIXMEs and range checks.

bsim bap_broadcast_audio_source/sink tested with PTO=2 PTO Group Count = 2:
bsim_bap_broadcast_source_sink_pto_2_ptogc_2.zip

@mtpr-ot mtpr-ot force-pushed the bugfix/iso_broadcast_pto branch from f2ab986 to cc18a3a Compare August 26, 2024 14:15
@mtpr-ot mtpr-ot force-pushed the bugfix/iso_broadcast_pto branch from cc18a3a to 736ca10 Compare September 9, 2024 12:52
@github-actions github-actions bot added the Stale label Nov 9, 2024
@github-actions github-actions bot closed this Nov 23, 2024
@zephyrproject-rtos zephyrproject-rtos deleted a comment from github-actions bot Jan 7, 2025
@cvinayak cvinayak removed the Stale label Jan 7, 2025
@cvinayak cvinayak self-assigned this Jan 7, 2025
@cvinayak cvinayak reopened this Jan 7, 2025
@cvinayak
Copy link
Contributor

cvinayak commented Jan 7, 2025

@mtpr-ot This PR was never put to ready for review, intentional? Seems this is valid change request, if there is no objection, I will put this for review and follow up (provided can do some testing if possible)

@Tronil
Copy link
Contributor

Tronil commented Jan 7, 2025

Hi @cvinayak - Morten recently left Oticon, so I'm not sure if he is still active with this account.

In any case, we are using this change downstream, so I think it is just an oversight that this PR never left draft.

@cvinayak
Copy link
Contributor

cvinayak commented Jan 7, 2025

Hi @cvinayak - Morten recently left Oticon, so I'm not sure if he is still active with this account.

In any case, we are using this change downstream, so I think it is just an oversight that this PR never left draft.

Ok, I will follow up on the failing bsim CI test, suspect an overlapping/drifting ACL role leading to missing ISO SDU reception...

@cvinayak
Copy link
Contributor

cvinayak commented Jan 8, 2025

The original author has provided the permissions: "Maintainers are allowed to edit this pull request. "
Will keep the original commit as-is, and add new commits as required to get this PR CI passing.

@cvinayak cvinayak force-pushed the bugfix/iso_broadcast_pto branch from 736ca10 to 5a58fd9 Compare January 8, 2025 03:54
@cvinayak cvinayak requested a review from Thalley January 8, 2025 07:57
subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv_iso.c Outdated Show resolved Hide resolved
(lll->ptc_curr * lll->pto);
payload_count = lll->payload_count + payload_index - lll->bn;
if (lll->ptc_curr) {
uint8_t ptx_idx = lll->ptc_curr - 1; /* max. nse 5 bits */
Copy link
Collaborator

Choose a reason for hiding this comment

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

Since ptc_curr is uint32_t ptc_curr:4;, then shouldn't this be

Suggested change
uint8_t ptx_idx = lll->ptc_curr - 1; /* max. nse 5 bits */
uint8_t ptx_idx = lll->ptc_curr - 1; /* max. nse 4 bits */

Which then also affect the bits of several of the values below?

Copy link
Contributor

Choose a reason for hiding this comment

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

Now I do not remember why ptc is 4 bits! ... it can be as much as (NSE - 1); 1 transmission followed by (NSE - 1) pre-transmissions.

@Tronil and @wopu-ot , are you testing the boundary conditions internally in your tests for this PR changes?

Copy link
Contributor

Choose a reason for hiding this comment

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

Now I do not remember why ptc is 4 bits! ... it can be as much as (NSE - 1); 1 transmission followed by (NSE - 1) pre-transmissions.

@Tronil and @wopu-ot , are you testing the boundary conditions internally in your tests for this PR changes?

We do not have extensive test coverage on the broadcaster side, no

Copy link
Contributor

Choose a reason for hiding this comment

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

@Tronil while testing this PR for PTO=2 and Group Count = 2, I discovered a bug in ull_sync_iso.c that subsequent BIS subevent reception failed; ptc was not assigned the correct value. This bug will not show up if only one BIS is synchronized to.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Shouldn't the comment be updated?

(lll->ptc_curr * lll->pto);
payload_count = lll->payload_count + payload_index - lll->bn;
if (lll->ptc_curr) {
uint8_t ptx_idx = lll->ptc_curr - 1; /* max. nse 5 bits */
Copy link
Contributor

Choose a reason for hiding this comment

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

Now I do not remember why ptc is 4 bits! ... it can be as much as (NSE - 1); 1 transmission followed by (NSE - 1) pre-transmissions.

@Tronil and @wopu-ot , are you testing the boundary conditions internally in your tests for this PR changes?

subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv_iso.c Outdated Show resolved Hide resolved
subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv_iso.c Outdated Show resolved Hide resolved
For pre-transmission groups > 1, the broadcaster link layer would fetch
incorrect payloads from the TX node queue.

Update payload index calculation to reference correct TX payload. Fix
PTO FIXMEs and range checks.

Signed-off-by: Morten Priess <mtpr@oticon.com>
@cvinayak cvinayak force-pushed the bugfix/iso_broadcast_pto branch from 9661220 to d3fefcb Compare January 9, 2025 15:15
subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv_iso.c Outdated Show resolved Hide resolved
(lll->ptc_curr * lll->pto);
payload_count = lll->payload_count + payload_index - lll->bn;
if (lll->ptc_curr) {
uint8_t ptx_idx = lll->ptc_curr - 1; /* max. nse 5 bits */
Copy link
Collaborator

Choose a reason for hiding this comment

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

Shouldn't the comment be updated?

subsys/bluetooth/controller/ll_sw/ull_adv_iso.c Outdated Show resolved Hide resolved
subsys/bluetooth/controller/ll_sw/ull_adv_iso.c Outdated Show resolved Hide resolved
subsys/bluetooth/controller/ll_sw/ull_adv_iso.c Outdated Show resolved Hide resolved
subsys/bluetooth/controller/ll_sw/ull_sync_iso.c Outdated Show resolved Hide resolved
Add back the implementation in the Controller that tries to
enable pre-transmissions to improve time diversity to aid a
remote ISO Sync Receiver role device.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
@cvinayak cvinayak force-pushed the bugfix/iso_broadcast_pto branch from d3fefcb to 7f70919 Compare January 9, 2025 20:27
Fixup payload_index to be uint16_t to avoid index overflow.

Do not remember why ptc is 4 bits, where as it must be 5 bit
value similar to nse; added an assertion check until it is
fixed.

Fix ISO Broadcaster and ISO Sync Receiver for PTO > 1 and
use of Pre-Transmission Group Counts.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
@cvinayak cvinayak force-pushed the bugfix/iso_broadcast_pto branch from 7f70919 to de3f005 Compare January 12, 2025 05:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants