Bluetooth: controller: Fix ull_conn LSTO for must_expire

When CONFIG_BT_CTLR_CONN_META is enabled and the ticker "must_expire"
feature is used, collisions may cause incorrect decrement of the
supervision_expire counter, resulting in a too early link supervision
timeout.

Signed-off-by: Morten Priess <mtpr@oticon.com>
This commit is contained in:
Morten Priess 2020-11-19 09:57:25 +01:00 committed by Carles Cufí
commit 392e044548
4 changed files with 16 additions and 0 deletions

View file

@ -1084,7 +1084,14 @@ void ull_conn_done(struct node_rx_event_done *done)
}
/* Events elapsed used in timeout checks below */
#if defined(CONFIG_BT_CTLR_CONN_META)
/* If event has shallow expiry do not add latency, but rely on
* accumulated lazy count.
*/
latency_event = conn->common.is_must_expire ? 0 : lll->latency_event;
#else
latency_event = lll->latency_event;
#endif
elapsed_event = latency_event + 1;
/* Slave drift compensation calc and new latency or

View file

@ -59,6 +59,9 @@ struct ll_conn {
union {
struct {
uint8_t fex_valid:1;
#if defined(CONFIG_BT_CTLR_CONN_META)
uint8_t is_must_expire:1;
#endif /* CONFIG_BT_CTLR_CONN_META */
} common;
#if defined(CONFIG_BT_PERIPHERAL)

View file

@ -750,6 +750,9 @@ void ull_master_ticker_cb(uint32_t ticks_at_expire, uint32_t remainder, uint16_t
return;
}
#if defined(CONFIG_BT_CTLR_CONN_META)
conn->common.is_must_expire = (lazy == TICKER_LAZY_MUST_EXPIRE);
#endif
/* If this is a must-expire callback, LLCP state machine does not need
* to know. Will be called with lazy > 0 when scheduled in air.
*/

View file

@ -375,6 +375,9 @@ void ull_slave_ticker_cb(uint32_t ticks_at_expire, uint32_t remainder,
return;
}
#if defined(CONFIG_BT_CTLR_CONN_META)
conn->common.is_must_expire = (lazy == TICKER_LAZY_MUST_EXPIRE);
#endif
/* If this is a must-expire callback, LLCP state machine does not need
* to know. Will be called with lazy > 0 when scheduled in air.
*/