Skip to content

Commit 8ebc4f3

Browse files
cvinayakkartben
authored andcommitted
Bluetooth: Controller: Fix sync_delay and latency in LE BIG Complete
Fix missing sync_delay and transport_latency information in HCI LE BIG Complete event. Relates to commit 1a640e4 ("Bluetooth: controller: Included transport latency in LE_Big_Established"). Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
1 parent 296f91a commit 8ebc4f3

File tree

1 file changed

+33
-3
lines changed
  • subsys/bluetooth/controller/hci

1 file changed

+33
-3
lines changed

subsys/bluetooth/controller/hci/hci.c

+33-3
Original file line numberDiff line numberDiff line change
@@ -8152,8 +8152,11 @@ static void le_big_complete(struct pdu_data *pdu_data,
81528152
struct net_buf *buf)
81538153
{
81548154
struct bt_hci_evt_le_big_complete *sep;
8155+
uint32_t transport_latency_big;
81558156
struct ll_adv_iso_set *adv_iso;
8157+
uint32_t iso_interval_us;
81568158
struct lll_adv_iso *lll;
8159+
uint32_t big_sync_delay;
81578160
size_t evt_size;
81588161

81598162
adv_iso = node_rx->rx_ftr.param;
@@ -8170,9 +8173,36 @@ static void le_big_complete(struct pdu_data *pdu_data,
81708173
return;
81718174
}
81728175

8173-
/* FIXME: Fill sync delay and latency */
8174-
sys_put_le24(0, sep->sync_delay);
8175-
sys_put_le24(0, sep->latency);
8176+
/* BT Core v5.4 - Vol 6, Part B, Section 4.4.6.4:
8177+
* BIG_Sync_Delay = (Num_BIS – 1) × BIS_Spacing + (NSE – 1) × Sub_Interval + MPT.
8178+
*
8179+
* BT Core v5.4 - Vol 6, Part G, Section 3.2.1: (Framed)
8180+
* Transport_Latenct_BIG = BIG_Sync_Delay + PTO × (NSE / BN – IRC) * ISO_Interval +
8181+
* ISO_Interval + SDU_Interval
8182+
*
8183+
* BT Core v5.4 - Vol 6, Part G, Section 3.2.2: (Unframed)
8184+
* Transport_Latenct_BIG = BIG_Sync_Delay + (PTO × (NSE / BN – IRC) + 1) * ISO_Interval -
8185+
* SDU_Interval
8186+
*/
8187+
iso_interval_us = lll->iso_interval * ISO_INT_UNIT_US;
8188+
big_sync_delay = ull_iso_big_sync_delay(lll->num_bis, lll->bis_spacing, lll->nse,
8189+
lll->sub_interval, lll->phy, lll->max_pdu,
8190+
lll->enc);
8191+
sys_put_le24(big_sync_delay, sep->sync_delay);
8192+
8193+
if (lll->framing) {
8194+
/* Framed */
8195+
transport_latency_big = big_sync_delay +
8196+
lll->pto * (lll->nse / lll->bn - lll->irc) *
8197+
iso_interval_us + iso_interval_us + lll->sdu_interval;
8198+
} else {
8199+
/* Unframed */
8200+
transport_latency_big = big_sync_delay +
8201+
(lll->pto * (lll->nse / lll->bn - lll->irc) + 1) *
8202+
iso_interval_us - lll->sdu_interval;
8203+
}
8204+
8205+
sys_put_le24(transport_latency_big, sep->latency);
81768206

81778207
sep->phy = find_lsb_set(lll->phy);
81788208
sep->nse = lll->nse;

0 commit comments

Comments
 (0)