Skip to content

Commit 4d4fb8e

Browse files
cvinayakcarlescufi
authored andcommitted
Bluetooth: controller: split: Fix ticks slot used on conn update
Fix incorrectly calculated ticks slots for a connection on connection update. The reservation incorrectly included the prepare offset. Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
1 parent ef7a814 commit 4d4fb8e

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

subsys/bluetooth/controller/ll_sw/ull_conn.c

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1934,10 +1934,9 @@ static inline int event_conn_upd_prep(struct ll_conn *conn, u16_t lazy,
19341934
ctrl_tx_enqueue(conn, tx);
19351935

19361936
} else if (instant_latency <= 0x7FFF) {
1937-
u32_t mayfly_was_enabled;
1937+
u32_t ticks_slot_overhead;
19381938
u16_t conn_interval_old;
19391939
u16_t conn_interval_new;
1940-
u32_t ticks_slot_offset;
19411940
u32_t ticks_win_offset;
19421941
u32_t conn_interval_us;
19431942
struct node_rx_pdu *rx;
@@ -2026,9 +2025,17 @@ static inline int event_conn_upd_prep(struct ll_conn *conn, u16_t lazy,
20262025
lll->latency_prepare += lazy;
20272026
lll->latency_prepare -= (instant_latency - latency);
20282027

2029-
/* calculate the offset, window widening and interval */
2030-
ticks_slot_offset = MAX(conn->evt.ticks_active_to_start,
2031-
conn->evt.ticks_xtal_to_start);
2028+
/* calculate the offset */
2029+
if (IS_ENABLED(CONFIG_BT_CTLR_LOW_LAT)) {
2030+
ticks_slot_overhead =
2031+
MAX(conn->evt.ticks_active_to_start,
2032+
conn->evt.ticks_xtal_to_start);
2033+
2034+
} else {
2035+
ticks_slot_overhead = 0U;
2036+
}
2037+
2038+
/* calculate the window widening and interval */
20322039
conn_interval_us = conn->llcp.conn_upd.interval * 1250U;
20332040
periodic_us = conn_interval_us;
20342041
if (lll->role) {
@@ -2101,8 +2108,9 @@ static inline int event_conn_upd_prep(struct ll_conn *conn, u16_t lazy,
21012108
/* disable ticker job, in order to chain stop and start
21022109
* to avoid RTC being stopped if no tickers active.
21032110
*/
2104-
mayfly_was_enabled = mayfly_is_enabled(TICKER_USER_ID_ULL_HIGH,
2105-
TICKER_USER_ID_ULL_LOW);
2111+
u32_t mayfly_was_enabled =
2112+
mayfly_is_enabled(TICKER_USER_ID_ULL_HIGH,
2113+
TICKER_USER_ID_ULL_LOW);
21062114
mayfly_enable(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_ULL_LOW,
21072115
0);
21082116
#endif
@@ -2128,7 +2136,8 @@ static inline int event_conn_upd_prep(struct ll_conn *conn, u16_t lazy,
21282136
#else
21292137
TICKER_NULL_LAZY,
21302138
#endif /* CONFIG_BT_CTLR_CONN_META */
2131-
(ticks_slot_offset + conn->evt.ticks_slot),
2139+
(ticks_slot_overhead +
2140+
conn->evt.ticks_slot),
21322141
#if defined(CONFIG_BT_PERIPHERAL) && defined(CONFIG_BT_CENTRAL)
21332142
lll->role ? ull_slave_ticker_cb :
21342143
ull_master_ticker_cb,

0 commit comments

Comments
 (0)