Bluetooth: Controller: Fix read ISO Tx Sync for Broadcast ISO

Fix missing read ISO Tx Sync for Broadcast ISO feature.

Co-authored-by: Nirosharn Amarasinghe <niag@demant.com>
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
This commit is contained in:
Vinayak Kariappa Chettimada 2023-06-02 09:12:04 +05:30 committed by Anas Nashif
commit 4195ba5870
5 changed files with 94 additions and 29 deletions

View file

@ -5792,6 +5792,8 @@ int hci_iso_handle(struct net_buf *buf, struct net_buf **evt)
struct ll_adv_iso_set *adv_iso;
struct lll_adv_iso *lll_iso;
uint16_t stream_handle;
uint8_t target_event;
uint8_t event_offset;
uint16_t slen;
/* FIXME: Code only expects header present */
@ -5817,33 +5819,34 @@ int hci_iso_handle(struct net_buf *buf, struct net_buf **evt)
return -EINVAL;
}
/* FIXME: convey group start */
sdu_frag_tx.grp_ref_point = 0;
/* FIXME: temporary interface to enable ISOAL data Tx
* Create provide proper interface between client
* (using ISOAL target_event) and ISOAL, preferably
* without dependence on peeking at LL data.
* Problem is that client must specify a value greater
* than LL bisPayloadCounter or no data is sent.
/* Determine the target event and the first event offset after
* datapath setup.
* event_offset mitigates the possibility of first SDU being
* late on the datapath and avoid all subsequent SDUs being
* dropped for a said SDU interval. i.e. upper layer is not
* drifting, say first SDU dropped, hence subsequent SDUs all
* dropped, is mitigated by offsetting the grp_ref_point.
*
* It is ok to do the below for every received ISO data, ISOAL
* will not consider subsequent skewed target_event after the
* first use of target_event value.
*
* In BIG implementation in LLL, payload_count corresponds to
* the next BIG event, hence calculate grp_ref_point for next
* BIG event by incrementing the previous elapsed big_ref_point
* by one additional ISO interval.
*/
lll_iso = &adv_iso->lll;
target_event = lll_iso->payload_count / lll_iso->bn;
event_offset = ull_ref_get(&adv_iso->ull) ? 0U : 1U;
event_offset += lll_iso->latency_prepare;
/* FIXME: Remove the below temporary hack to buffer up ISO data
* if the SDU interval and ISO interval misalign.
*/
uint64_t pkt_seq_num = lll_iso->payload_count / lll_iso->bn;
if (((pkt_seq_num - stream->pkt_seq_num) & BIT64_MASK(39)) <=
BIT64_MASK(38)) {
stream->pkt_seq_num = pkt_seq_num;
} else {
pkt_seq_num = stream->pkt_seq_num;
}
sdu_frag_tx.target_event = pkt_seq_num;
stream->pkt_seq_num++;
sdu_frag_tx.target_event = target_event + event_offset;
sdu_frag_tx.grp_ref_point =
isoal_get_wrapped_time_us(adv_iso->big_ref_point,
((event_offset + 1U) *
lll_iso->iso_interval *
ISO_INT_UNIT_US));
/* Start Fragmentation */
/* FIXME: need to ensure ISO-AL returns proper isoal_status.