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 <vich@nordicsemi.no>
This commit is contained in:
Vinayak Kariappa Chettimada 2019-10-15 08:50:44 +05:30 committed by Carles Cufí
commit 4d4fb8e301

View file

@ -1934,10 +1934,9 @@ static inline int event_conn_upd_prep(struct ll_conn *conn, u16_t lazy,
ctrl_tx_enqueue(conn, tx); ctrl_tx_enqueue(conn, tx);
} else if (instant_latency <= 0x7FFF) { } else if (instant_latency <= 0x7FFF) {
u32_t mayfly_was_enabled; u32_t ticks_slot_overhead;
u16_t conn_interval_old; u16_t conn_interval_old;
u16_t conn_interval_new; u16_t conn_interval_new;
u32_t ticks_slot_offset;
u32_t ticks_win_offset; u32_t ticks_win_offset;
u32_t conn_interval_us; u32_t conn_interval_us;
struct node_rx_pdu *rx; struct node_rx_pdu *rx;
@ -2026,9 +2025,17 @@ static inline int event_conn_upd_prep(struct ll_conn *conn, u16_t lazy,
lll->latency_prepare += lazy; lll->latency_prepare += lazy;
lll->latency_prepare -= (instant_latency - latency); lll->latency_prepare -= (instant_latency - latency);
/* calculate the offset, window widening and interval */ /* calculate the offset */
ticks_slot_offset = MAX(conn->evt.ticks_active_to_start, if (IS_ENABLED(CONFIG_BT_CTLR_LOW_LAT)) {
conn->evt.ticks_xtal_to_start); ticks_slot_overhead =
MAX(conn->evt.ticks_active_to_start,
conn->evt.ticks_xtal_to_start);
} else {
ticks_slot_overhead = 0U;
}
/* calculate the window widening and interval */
conn_interval_us = conn->llcp.conn_upd.interval * 1250U; conn_interval_us = conn->llcp.conn_upd.interval * 1250U;
periodic_us = conn_interval_us; periodic_us = conn_interval_us;
if (lll->role) { if (lll->role) {
@ -2101,8 +2108,9 @@ static inline int event_conn_upd_prep(struct ll_conn *conn, u16_t lazy,
/* disable ticker job, in order to chain stop and start /* disable ticker job, in order to chain stop and start
* to avoid RTC being stopped if no tickers active. * to avoid RTC being stopped if no tickers active.
*/ */
mayfly_was_enabled = mayfly_is_enabled(TICKER_USER_ID_ULL_HIGH, u32_t mayfly_was_enabled =
TICKER_USER_ID_ULL_LOW); mayfly_is_enabled(TICKER_USER_ID_ULL_HIGH,
TICKER_USER_ID_ULL_LOW);
mayfly_enable(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_ULL_LOW, mayfly_enable(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_ULL_LOW,
0); 0);
#endif #endif
@ -2128,7 +2136,8 @@ static inline int event_conn_upd_prep(struct ll_conn *conn, u16_t lazy,
#else #else
TICKER_NULL_LAZY, TICKER_NULL_LAZY,
#endif /* CONFIG_BT_CTLR_CONN_META */ #endif /* CONFIG_BT_CTLR_CONN_META */
(ticks_slot_offset + conn->evt.ticks_slot), (ticks_slot_overhead +
conn->evt.ticks_slot),
#if defined(CONFIG_BT_PERIPHERAL) && defined(CONFIG_BT_CENTRAL) #if defined(CONFIG_BT_PERIPHERAL) && defined(CONFIG_BT_CENTRAL)
lll->role ? ull_slave_ticker_cb : lll->role ? ull_slave_ticker_cb :
ull_master_ticker_cb, ull_master_ticker_cb,