Bluetooth: Controller: Update support for Periodic Sync Receive enable

Update support for Periodic Advertising Synchronization
Receive Enable command, so that PDUs are received so that
contents of Extended Common Payload Format is parsed and
process for information like Channel Map Update and BIGInfo.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
This commit is contained in:
Vinayak Kariappa Chettimada 2021-12-02 07:08:34 +05:30 committed by Carles Cufí
commit a1810425ca
6 changed files with 40 additions and 30 deletions

View file

@ -6164,10 +6164,10 @@ static void le_per_adv_sync_report(struct pdu_data *pdu_data,
uint8_t data_len_max;
uint8_t *acad = NULL;
uint8_t hdr_buf_len;
bool dup = false;
uint8_t hdr_len;
uint8_t *ptr;
int8_t rssi;
bool drop;
if (!(event_mask & BT_EVT_MASK_LE_META_EVENT) ||
(!(le_event_mask & BT_EVT_MASK_LE_PER_ADVERTISING_REPORT) &&
@ -6292,23 +6292,29 @@ no_ext_hdr:
BT_DBG(" AD Data (%u): <todo>", data_len);
}
if (0) {
#if (CONFIG_BT_CTLR_DUP_FILTER_LEN > 0) && \
defined(CONFIG_BT_CTLR_SYNC_PERIODIC_ADI_SUPPORT)
if (IS_ENABLED(CONFIG_BT_CTLR_SYNC_PERIODIC_ADI_SUPPORT) && adi) {
} else if (IS_ENABLED(CONFIG_BT_CTLR_SYNC_PERIODIC_ADI_SUPPORT) &&
adi) {
const struct ll_sync_set *sync = HDR_LLL2ULL(ftr->param);
/* FIXME: Use correct data status else chain PDU report will
* be filtered out.
*/
dup = sync->nodups && dup_found(PDU_ADV_TYPE_EXT_IND,
drop = !ftr->sync_rx_enabled ||
(sync->nodups && dup_found(PDU_ADV_TYPE_EXT_IND,
sync->peer_id_addr_type,
sync->peer_id_addr,
DUP_EXT_ADV_MODE_PERIODIC,
adi, 0U);
}
adi, 0U));
#endif /* CONFIG_BT_CTLR_DUP_FILTER_LEN > 0 &&
* CONFIG_BT_CTLR_SYNC_PERIODIC_ADI_SUPPORT
*/
} else {
drop = !ftr->sync_rx_enabled;
}
data_len_max = ADV_REPORT_EVT_MAX_LEN -
sizeof(struct bt_hci_evt_le_meta_event) -
@ -6316,7 +6322,7 @@ no_ext_hdr:
evt_buf = buf;
if (!dup && (le_event_mask & BT_EVT_MASK_LE_PER_ADVERTISING_REPORT)) {
if ((le_event_mask & BT_EVT_MASK_LE_PER_ADVERTISING_REPORT) && !drop) {
do {
struct bt_hci_evt_le_per_advertising_report *sep;
uint8_t data_len_frag;

View file

@ -335,6 +335,7 @@ struct node_rx_ftr {
uint8_t aux_failed:1;
#if defined(CONFIG_BT_CTLR_SYNC_PERIODIC)
uint8_t sync_status:2;
uint8_t sync_rx_enabled:1;
#endif /* CONFIG_BT_CTLR_SYNC_PERIODIC */
uint8_t phy_flags:1;

View file

@ -18,13 +18,13 @@ struct lll_sync {
uint8_t crc_init[3];
uint8_t phy:3;
uint8_t is_rx_enabled:1;
/* Bitmask providing not allowed types of CTE. */
uint8_t cte_type:5;
/* The member is required for filtering by CTE type. If filtering policy is disabled then
* synchronization is terminated for periodic advertisements with wrong CTE type.
*/
uint8_t filter_policy:1;
uint8_t is_rx_enabled:1;
uint8_t is_aux_sched:1;
#if defined(CONFIG_BT_CTLR_SYNC_ISO)

View file

@ -627,8 +627,7 @@ static int isr_rx(struct lll_sync *lll, uint8_t node_type, uint8_t crc_ok, uint8
struct node_rx_pdu *node_rx;
node_rx = ull_pdu_rx_alloc_peek(3);
if (node_rx &&
(lll->is_rx_enabled || (node_type == NODE_RX_TYPE_SYNC))) {
if (node_rx) {
struct node_rx_ftr *ftr;
struct pdu_adv *pdu;
@ -646,6 +645,7 @@ static int isr_rx(struct lll_sync *lll, uint8_t node_type, uint8_t crc_ok, uint8
radio_rx_chain_delay_get(lll->phy,
1);
ftr->sync_status = status;
ftr->sync_rx_enabled = lll->is_rx_enabled;
pdu = (void *)node_rx->pdu;

View file

@ -179,6 +179,10 @@ uint8_t ll_sync_create(uint8_t options, uint8_t sid, uint8_t adv_addr_type,
sync->node_rx_sync_estab = node_rx;
sync->node_rx_lost.hdr.link = link_sync_lost;
/* Reporting initially enabled/disabled */
sync->rx_enable =
!(options & BT_HCI_LE_PER_ADV_CREATE_SYNC_FP_REPORTS_DISABLED);
#if defined(CONFIG_BT_CTLR_SYNC_PERIODIC_ADI_SUPPORT)
sync->nodups = (options &
BT_HCI_LE_PER_ADV_CREATE_SYNC_FP_FILTER_DUPLICATE) ?
@ -218,6 +222,7 @@ uint8_t ll_sync_create(uint8_t options, uint8_t sid, uint8_t adv_addr_type,
/* Initialize sync LLL context */
lll_sync = &sync->lll;
lll_sync->is_rx_enabled = sync->rx_enable;
lll_sync->skip_prepare = 0U;
lll_sync->skip_event = 0U;
lll_sync->window_widening_prepare_us = 0U;
@ -227,10 +232,6 @@ uint8_t ll_sync_create(uint8_t options, uint8_t sid, uint8_t adv_addr_type,
lll_sync->filter_policy = scan->per_scan.filter_policy;
#endif /* CONFIG_BT_CTLR_SYNC_PERIODIC_CTE_TYPE_FILTERING */
/* Reporting initially enabled/disabled */
lll_sync->is_rx_enabled =
!(options & BT_HCI_LE_PER_ADV_CREATE_SYNC_FP_REPORTS_DISABLED);
#if defined(CONFIG_BT_CTLR_DF_SCAN_CTE_RX)
ull_df_sync_cfg_init(&lll_sync->df_cfg);
#endif /* CONFIG_BT_CTLR_DF_SCAN_CTE_RX */
@ -362,7 +363,6 @@ uint8_t ll_sync_terminate(uint16_t handle)
uint8_t ll_sync_recv_enable(uint16_t handle, uint8_t enable)
{
struct ll_sync_set *sync;
struct lll_sync *lll;
sync = ull_sync_is_enabled_get(handle);
if (!sync) {
@ -370,9 +370,7 @@ uint8_t ll_sync_recv_enable(uint16_t handle, uint8_t enable)
}
/* Reporting enabled/disabled */
lll = &sync->lll;
lll->is_rx_enabled = (enable &
BT_HCI_LE_SET_PER_ADV_RECV_ENABLE_ENABLE) ?
sync->rx_enable = (enable & BT_HCI_LE_SET_PER_ADV_RECV_ENABLE_ENABLE) ?
1U : 0U;
#if defined(CONFIG_BT_CTLR_SYNC_PERIODIC_ADI_SUPPORT)
@ -735,7 +733,6 @@ void ull_sync_established_report(memq_link_t *link, struct node_rx_hdr *rx)
struct lll_sync *lll;
ftr = &rx->rx_ftr;
lll = ftr->param;
#if defined(CONFIG_BT_CTLR_SYNC_PERIODIC_CTE_TYPE_FILTERING)
enum sync_status sync_status;
@ -745,6 +742,8 @@ void ull_sync_established_report(memq_link_t *link, struct node_rx_hdr *rx)
#else
struct pdu_cte_info *rx_cte_info;
lll = ftr->param;
rx_cte_info = pdu_cte_info_get((struct pdu_adv *)((struct node_rx_pdu *)rx)->pdu);
if (rx_cte_info != NULL) {
sync_status = lll_sync_cte_is_allowed(lll->cte_type, lll->filter_policy,
@ -767,6 +766,7 @@ void ull_sync_established_report(memq_link_t *link, struct node_rx_hdr *rx)
/* Set the sync handle corresponding to the LLL context passed in the node rx
* footer field.
*/
lll = ftr->param;
ull_sync = HDR_LLL2ULL(lll);
/* Prepare and dispatch sync notification */
@ -808,7 +808,6 @@ void ull_sync_established_report(memq_link_t *link, struct node_rx_hdr *rx)
/* Switch sync event prepare function to one reposnsible for regular PDUs receive */
mfy_lll_prepare.fp = lll_sync_prepare;
if (lll->is_rx_enabled) {
/* Change node type to appropriately handle periodic
* advertising PDU report.
*/
@ -816,7 +815,6 @@ void ull_sync_established_report(memq_link_t *link, struct node_rx_hdr *rx)
ull_scan_aux_setup(link, rx);
}
}
}
void ull_sync_done(struct node_rx_event_done *done)
{
@ -1102,6 +1100,9 @@ static void ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift,
lll = &sync->lll;
/* Commit receive enable changed value */
lll->is_rx_enabled = sync->rx_enable;
/* Increment prepare reference count */
ref = ull_ref_inc(&sync->ull);
LL_ASSERT(ref);

View file

@ -29,6 +29,8 @@ struct ll_sync_set {
* CONFIG_BT_CTLR_SYNC_PERIODIC_ADI_SUPPORT
*/
uint8_t rx_enable:1;
#if defined(CONFIG_BT_CTLR_SYNC_PERIODIC_ADI_SUPPORT)
uint8_t nodups:1;
#endif