-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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: ISO Broadcast/Receive interleaved packing support #67231
base: main
Are you sure you want to change the base?
Bluetooth: Controller: ISO Broadcast/Receive interleaved packing support #67231
Conversation
b0bb1b4
to
8858f32
Compare
a62e1f8
to
c82573d
Compare
152fe27
to
d81d759
Compare
d81d759
to
12bd3e0
Compare
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.
Need more time to address all the comments, will try to see if some refactoring can be done.
@@ -18,6 +18,17 @@ struct lll_adv_iso_stream { | |||
uint16_t pkt_seq_num; | |||
}; | |||
|
|||
struct lll_adv_iso_data_chan { | |||
uint16_t prn_s; |
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.
This is the variable documented in the BT Spec, as one of the pseudo random number used in the channel calculations.
iss_us = (lll->bis_spacing >= (lll->sub_interval * lll->nse)) ? | ||
lll->sub_interval : lll->bis_spacing; | ||
iss_us -= PDU_BIS_US(pdu->len, ((pdu->len) ? lll->enc : 0U), | ||
lll->phy, lll->phy_flags); |
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.
sub_interval
or bis_spacing
are calculated based on the max PDU lengths, hence the calculation does not lead to underflow.
} else if (lll->bis_spacing >= (lll->sub_interval * lll->nse)) { | ||
next_chan_calc_seq(lll, event_counter, data_chan_id); | ||
#endif /* CONFIG_BT_CTLR_ADV_ISO_SEQUENTIAL */ | ||
|
||
#if defined(CONFIG_BT_CTLR_ADV_ISO_INTERLEAVED) | ||
} else if (lll->bis_spacing < (lll->sub_interval * lll->nse)) { |
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.
I will leave this be as-is and let the compiler do the optimization as necessary based in the combination of selected conditional compilations.
iss_us = (lll->bis_spacing >= (lll->sub_interval * lll->nse)) ? | ||
lll->sub_interval : lll->bis_spacing; | ||
iss_us -= PDU_BIS_US(pdu->len, ((pdu->len) ? lll->enc : 0U), | ||
lll->phy, lll->phy_flags); |
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.
There is no underflow based on the calculation of sub_interval
or bis_spacing
#if defined(CONFIG_BT_CTLR_ADV_ISO_SEQUENTIAL) | ||
} else if (lll->bis_spacing >= (lll->sub_interval * lll->nse)) { | ||
next_chan_calc_seq(lll, event_counter, data_chan_id); | ||
#endif /* CONFIG_BT_CTLR_ADV_ISO_SEQUENTIAL */ | ||
|
||
#if defined(CONFIG_BT_CTLR_ADV_ISO_INTERLEAVED) | ||
} else if (lll->bis_spacing < (lll->sub_interval * lll->nse)) { | ||
next_chan_calc_int(lll, event_counter); | ||
#endif /* CONFIG_BT_CTLR_ADV_ISO_INTERLEAVED */ |
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.
I will leave this be as-is and let the compiler do the optimization as necessary based in the combination of selected conditional compilations.
config BT_CTLR_ADV_ISO_SEQUENTIAL | ||
bool "LE Broadcast Isochronous Channel advertising sequential packing" | ||
depends on BT_CTLR_ADV_ISO | ||
|
||
config BT_CTLR_ADV_ISO_INTERLEAVED | ||
bool "LE Broadcast Isochronous Channel advertising interleaved packing" | ||
depends on BT_CTLR_ADV_ISO |
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.
Most broadcast application do not change the packing once set between create and terminate. These Kconfig provide the option to reduce code size. Both these would mostly be enabled under controller-only builds, like, hci_ipc/hci_uart.
config BT_CTLR_SYNC_ISO_SEQUENTIAL | ||
bool "LE Broadcast Isochronous Channel advertising sync sequential packing" | ||
depends on BT_CTLR_SYNC_ISO | ||
default y | ||
|
||
config BT_CTLR_SYNC_ISO_INTERLEAVED | ||
bool "LE Broadcast Isochronous Channel advertising sync interleaved packing" | ||
depends on BT_CTLR_SYNC_ISO | ||
default y |
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.
In the case of receiver, by default both are enabled. Again when having applications with broadcaster and receiver solutions that get bundled together, then these options alway for either one of the packing be enabled to save code space.
bis = 0U; | ||
|
||
LL_ASSERT(false); |
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.
This is to avoid compiler warning, as the compiler think that we exit from the assertion call and then later use an uninitialized bis
value.
#endif /* CONFIG_BT_CTLR_SYNC_ISO_SEQUENTIAL */ | ||
|
||
goto isr_rx_ctrl; | ||
|
||
#if defined(CONFIG_BT_CTLR_SYNC_ISO_INTERLEAVED) | ||
isr_rx_interleaved: |
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.
Yes, looks weird now that I have them functioning (developed iteratively, sequential first and interleaved next) and to try keep prior implementation not changed a lot.
This jigsaw of goto is used so that in case of looping to skip already received PDUs, I wanted to avoid checking for packing type (which is sufficient once checked).
I do not have allocated time to rethink the implementation, but surely will consider for refactoring as a separate task (not sure if it will ever get picked).
8137e8f
to
0bb387e
Compare
9a75fc5
to
5075a9a
Compare
5075a9a
to
c8169be
Compare
c8169be
to
968f730
Compare
Fix incorrect use of BIS indices to dereference the payload array, instead correctly use synchronised stream indices. Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Restrict possible maximum stream synchronization to implementation defined 2 stream, as structure declarations in the implementation is limited to 2. Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix buf alloc timeout to 20 millisecond as the sent callback can have a latency that is upto twice the ISO interval. Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix BIS sub_interval calculation for interleaved packing. Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Add ISO Broadcast interleaved packing support in Lower Link Layer implementation. Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
968f730
to
d1011b7
Compare
Add ISO Receive interleaved packing support in Lower Link Layer implementation. Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Updates to project configuration extras to build with Zephyr Controller. Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Add Kconfig options in Broadcast ISO related samples to support enabling interleaved packing use in subevents. Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Test for single BIS with interleaved packing or sequential packing requested. Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Test broadcast audio source sample in interleaved and sequential packing. Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
d1011b7
to
cc13047
Compare
Fixes #42892