Bluetooth: controller: Dropp IQ sampl report if CTE disabled after evt end

Disable of CTE sampling for periodic advertising sync PDUs may be
interrupted by radio event. In such situation, TX thread will be
handled before RX thread delivers IQ samples report to host. In
this case RX thread would deliver IQ samples report after CTE
sampling was disabled.

To avoid such situation RX thread has to check if:
- CTE sampling is not disabled,
- CTE sampling was not requested to be disabled after start of radio
  event.

CTE sampling configuration is double buffered. Updated configuration is
swapped at the beginning of radio event.

If CTE sampling is diabled or requested to disable (next radio event
didn't start), the IQ samples report should be dropped by RX thread
and should not be delivered to host.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
This commit is contained in:
Piotr Pryga 2021-04-09 16:23:18 +02:00 committed by Carles Cufí
commit f74a0b294c
4 changed files with 45 additions and 8 deletions

View file

@ -49,6 +49,7 @@
#include "ll_sw/ull_conn_types.h"
#include "ll_sw/ull_conn_internal.h"
#include "ll_sw/ull_conn_iso_types.h"
#include "ll_sw/ull_df.h"
#include "ll.h"
#include "ll_feat.h"
@ -2552,6 +2553,18 @@ static void le_df_connectionless_iq_report(struct pdu_data *pdu_rx,
return;
}
lll = iq_report->hdr.rx_ftr.param;
/* TX LL thread has higher priority than RX thread. It may happen that
* host succefully disables CTE sampling in the meantime.
* It should be verified here, to avoid reporint IQ samples after
* the functionality was disabled.
*/
if (ull_df_sync_cfg_is_disabled_or_requested_to_disable(&lll->df_cfg)) {
/* Dropp further processing of the event. */
return;
}
/* If there are no IQ samples due to insufficient resources
* HCI event should inform about it by store single octet with
* special I_sample and Q_sample data.
@ -2569,8 +2582,6 @@ static void le_df_connectionless_iq_report(struct pdu_data *pdu_rx,
sep->rssi_ant_id = iq_report->rssi_ant_id;
sep->cte_type = iq_report->cte_info.type;
lll = iq_report->hdr.rx_ftr.param;
sep->chan_idx = lll->data_chan_id;
sep->per_evt_counter = sys_cpu_to_le16(lll->event_counter);