From 9fc4fefc4756d32d70082b7593246afc4a4306d7 Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Tue, 4 Jul 2017 21:06:49 +0200 Subject: [PATCH] Bluetooth: controller: Fix slave latency enable at conn setup Fix implementation to maintain a connection in the slave role not taking slave latency into use before receiving an acknowledgement from the master. This fixes TP/CON/ADV/BV-03-C [Master Missing Slave Packets] in LL.TS.5.0.0. Signed-off-by: Vinayak Kariappa Chettimada Tested-by: Ulrich Myhre --- subsys/bluetooth/controller/ll_sw/ctrl.c | 13 +++++++++++-- subsys/bluetooth/controller/ll_sw/ctrl_internal.h | 3 ++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/subsys/bluetooth/controller/ll_sw/ctrl.c b/subsys/bluetooth/controller/ll_sw/ctrl.c index 8e17b993867..9a299ea5370 100644 --- a/subsys/bluetooth/controller/ll_sw/ctrl.c +++ b/subsys/bluetooth/controller/ll_sw/ctrl.c @@ -2450,6 +2450,13 @@ isr_rx_conn_pkt(struct radio_pdu_node_rx *radio_pdu_node_rx, /* Increment serial number */ _radio.conn_curr->sn++; + /* First ack (and redundantly any other ack) enable use of + * slave latency. + */ + if (_radio.role == ROLE_SLAVE) { + _radio.conn_curr->slave.latency_enabled = 1; + } + if (_radio.conn_curr->empty == 0) { struct radio_pdu_node_tx *node_tx; u8_t pdu_data_tx_len, pdu_data_tx_ll_id; @@ -3067,13 +3074,11 @@ static inline void isr_close_conn(void) preamble_to_addr_us); } - /* Reset window widening, as anchor point sync-ed */ _radio.conn_curr->slave.window_widening_event_us = 0; _radio.conn_curr->slave.window_size_event_us = 0; /* apply latency if no more data */ - _radio.conn_curr->latency_event = _radio.conn_curr->latency; if (_radio.conn_curr->pkt_tx_head) { struct pdu_data *pdu_data_tx; @@ -3083,6 +3088,9 @@ static inline void isr_close_conn(void) _radio.conn_curr->packet_tx_head_offset) { _radio.conn_curr->latency_event = 0; } + } else if (_radio.conn_curr->slave.latency_enabled) { + _radio.conn_curr->latency_event = + _radio.conn_curr->latency; } } @@ -8314,6 +8322,7 @@ u32_t radio_adv_enable(u16_t interval, u8_t chan_map, u8_t filter_policy, conn->role = 1; conn->connect_expire = 6; + conn->slave.latency_enabled = 0; conn->slave.latency_cancel = 0; conn->slave.window_widening_prepare_us = 0; conn->slave.window_widening_event_us = 0; diff --git a/subsys/bluetooth/controller/ll_sw/ctrl_internal.h b/subsys/bluetooth/controller/ll_sw/ctrl_internal.h index cec133bc69f..243a652a8b0 100644 --- a/subsys/bluetooth/controller/ll_sw/ctrl_internal.h +++ b/subsys/bluetooth/controller/ll_sw/ctrl_internal.h @@ -91,8 +91,9 @@ struct connection { #endif /* CONFIG_BLUETOOTH_CONTROLLER_LE_PING */ struct { - u8_t sca:3; + u8_t latency_enabled:1; u8_t latency_cancel:1; + u8_t sca:3; u32_t window_widening_periodic_us; u32_t window_widening_max_us; u32_t window_widening_prepare_us;