@@ -179,6 +179,10 @@ uint8_t ll_sync_create(uint8_t options, uint8_t sid, uint8_t adv_addr_type,
179179 sync -> node_rx_sync_estab = node_rx ;
180180 sync -> node_rx_lost .hdr .link = link_sync_lost ;
181181
182+ /* Reporting initially enabled/disabled */
183+ sync -> rx_enable =
184+ !(options & BT_HCI_LE_PER_ADV_CREATE_SYNC_FP_REPORTS_DISABLED );
185+
182186#if defined(CONFIG_BT_CTLR_SYNC_PERIODIC_ADI_SUPPORT )
183187 sync -> nodups = (options &
184188 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,
218222
219223 /* Initialize sync LLL context */
220224 lll_sync = & sync -> lll ;
225+ lll_sync -> is_rx_enabled = sync -> rx_enable ;
221226 lll_sync -> skip_prepare = 0U ;
222227 lll_sync -> skip_event = 0U ;
223228 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,
227232 lll_sync -> filter_policy = scan -> per_scan .filter_policy ;
228233#endif /* CONFIG_BT_CTLR_SYNC_PERIODIC_CTE_TYPE_FILTERING */
229234
230- /* Reporting initially enabled/disabled */
231- lll_sync -> is_rx_enabled =
232- !(options & BT_HCI_LE_PER_ADV_CREATE_SYNC_FP_REPORTS_DISABLED );
233-
234235#if defined(CONFIG_BT_CTLR_DF_SCAN_CTE_RX )
235236 ull_df_sync_cfg_init (& lll_sync -> df_cfg );
236237#endif /* CONFIG_BT_CTLR_DF_SCAN_CTE_RX */
@@ -362,18 +363,15 @@ uint8_t ll_sync_terminate(uint16_t handle)
362363uint8_t ll_sync_recv_enable (uint16_t handle , uint8_t enable )
363364{
364365 struct ll_sync_set * sync ;
365- struct lll_sync * lll ;
366366
367367 sync = ull_sync_is_enabled_get (handle );
368368 if (!sync ) {
369369 return BT_HCI_ERR_UNKNOWN_ADV_IDENTIFIER ;
370370 }
371371
372372 /* Reporting enabled/disabled */
373- lll = & sync -> lll ;
374- lll -> is_rx_enabled = (enable &
375- BT_HCI_LE_SET_PER_ADV_RECV_ENABLE_ENABLE ) ?
376- 1U : 0U ;
373+ sync -> rx_enable = (enable & BT_HCI_LE_SET_PER_ADV_RECV_ENABLE_ENABLE ) ?
374+ 1U : 0U ;
377375
378376#if defined(CONFIG_BT_CTLR_SYNC_PERIODIC_ADI_SUPPORT )
379377 sync -> nodups = (enable &
@@ -735,7 +733,6 @@ void ull_sync_established_report(memq_link_t *link, struct node_rx_hdr *rx)
735733 struct lll_sync * lll ;
736734
737735 ftr = & rx -> rx_ftr ;
738- lll = ftr -> param ;
739736
740737#if defined(CONFIG_BT_CTLR_SYNC_PERIODIC_CTE_TYPE_FILTERING )
741738 enum sync_status sync_status ;
@@ -745,6 +742,8 @@ void ull_sync_established_report(memq_link_t *link, struct node_rx_hdr *rx)
745742#else
746743 struct pdu_cte_info * rx_cte_info ;
747744
745+ lll = ftr -> param ;
746+
748747 rx_cte_info = pdu_cte_info_get ((struct pdu_adv * )((struct node_rx_pdu * )rx )-> pdu );
749748 if (rx_cte_info != NULL ) {
750749 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)
767766 /* Set the sync handle corresponding to the LLL context passed in the node rx
768767 * footer field.
769768 */
769+ lll = ftr -> param ;
770770 ull_sync = HDR_LLL2ULL (lll );
771771
772772 /* Prepare and dispatch sync notification */
@@ -808,13 +808,11 @@ void ull_sync_established_report(memq_link_t *link, struct node_rx_hdr *rx)
808808 /* Switch sync event prepare function to one reposnsible for regular PDUs receive */
809809 mfy_lll_prepare .fp = lll_sync_prepare ;
810810
811- if (lll -> is_rx_enabled ) {
812- /* Change node type to appropriately handle periodic
813- * advertising PDU report.
814- */
815- rx -> type = NODE_RX_TYPE_SYNC_REPORT ;
816- ull_scan_aux_setup (link , rx );
817- }
811+ /* Change node type to appropriately handle periodic
812+ * advertising PDU report.
813+ */
814+ rx -> type = NODE_RX_TYPE_SYNC_REPORT ;
815+ ull_scan_aux_setup (link , rx );
818816 }
819817}
820818
@@ -1102,6 +1100,9 @@ static void ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift,
11021100
11031101 lll = & sync -> lll ;
11041102
1103+ /* Commit receive enable changed value */
1104+ lll -> is_rx_enabled = sync -> rx_enable ;
1105+
11051106 /* Increment prepare reference count */
11061107 ref = ull_ref_inc (& sync -> ull );
11071108 LL_ASSERT (ref );
0 commit comments