@@ -444,19 +444,30 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_pdu *rx)
444444
445445 ptr = h -> data ;
446446
447+ #if defined(CONFIG_BT_CTLR_SYNC_PERIODIC )
448+ bool is_aux_addr_match = false;
449+ #endif /* CONFIG_BT_CTLR_SYNC_PERIODIC */
450+
447451 if (h -> adv_addr ) {
448452#if defined(CONFIG_BT_CTLR_SYNC_PERIODIC )
449453 /* Check if Periodic Advertising Synchronization to be created
450454 */
451455 if (sync && (scan -> periodic .state != LL_SYNC_STATE_CREATED )) {
452- /* Check address and update internal state */
453456#if defined(CONFIG_BT_CTLR_PRIVACY )
454- ull_sync_setup_addr_check (sync , scan , pdu -> tx_addr , ptr ,
455- ftr -> rl_idx );
457+ uint8_t rl_idx = ftr -> rl_idx ;
456458#else /* !CONFIG_BT_CTLR_PRIVACY */
457- ull_sync_setup_addr_check ( sync , scan , pdu -> tx_addr , ptr , 0U ) ;
459+ uint8_t rl_idx = 0U ;
458460#endif /* !CONFIG_BT_CTLR_PRIVACY */
459461
462+ /* Check address and update internal state */
463+ is_aux_addr_match =
464+ ull_sync_setup_addr_check (sync , scan -> periodic .filter_policy ,
465+ pdu -> tx_addr , ptr , rl_idx );
466+ if (is_aux_addr_match ) {
467+ scan -> periodic .state = LL_SYNC_STATE_ADDR_MATCH ;
468+ } else {
469+ scan -> periodic .state = LL_SYNC_STATE_IDLE ;
470+ }
460471 }
461472#endif /* CONFIG_BT_CTLR_SYNC_PERIODIC */
462473
@@ -489,14 +500,21 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_pdu *rx)
489500 si = (void * )ptr ;
490501 ptr += sizeof (* si );
491502
503+ #if defined(CONFIG_BT_CTLR_SYNC_PERIODIC )
492504 /* Check if Periodic Advertising Synchronization to be created.
493505 * Setup synchronization if address and SID match in the
494506 * Periodic Advertiser List or with the explicitly supplied.
507+ *
508+ * is_aux_addr_match, device address in auxiliary channel PDU;
509+ * scan->periodic.param has not been assigned yet.
510+ * Otherwise, address was in primary channel PDU and we are now
511+ * checking SID (in SyncInfo) in auxiliary channel PDU.
495512 */
496- if (IS_ENABLED ( CONFIG_BT_CTLR_SYNC_PERIODIC ) && aux && sync && adi &&
513+ if (sync && aux && ( is_aux_addr_match || ( scan -> periodic . param == aux )) && adi &&
497514 ull_sync_setup_sid_match (sync , scan , PDU_ADV_ADI_SID_GET (adi ))) {
498515 ull_sync_setup (scan , aux -> lll .phy , rx , si );
499516 }
517+ #endif /* CONFIG_BT_CTLR_SYNC_PERIODIC */
500518 }
501519
502520 if (h -> tx_pwr ) {
@@ -692,6 +710,15 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_pdu *rx)
692710#endif /* CONFIG_BT_CTLR_JIT_SCHEDULING */
693711
694712#if defined(CONFIG_BT_CTLR_SYNC_PERIODIC )
713+ /* Store the aux context that has Periodic Advertising
714+ * Synchronization address match.
715+ */
716+ if (sync && (scan -> periodic .state == LL_SYNC_STATE_ADDR_MATCH )) {
717+ scan -> periodic .param = aux ;
718+ }
719+
720+ /* Store the node rx allocated for incomplete report, if needed.
721+ */
695722 aux -> rx_incomplete = rx_incomplete ;
696723 rx_incomplete = NULL ;
697724#endif /* CONFIG_BT_CTLR_SYNC_PERIODIC */
@@ -916,6 +943,7 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_pdu *rx)
916943#if defined(CONFIG_BT_CTLR_SYNC_PERIODIC )
917944 if (sync && (scan -> periodic .state != LL_SYNC_STATE_CREATED )) {
918945 scan -> periodic .state = LL_SYNC_STATE_IDLE ;
946+ scan -> periodic .param = NULL ;
919947 }
920948#endif /* CONFIG_BT_CTLR_SYNC_PERIODIC */
921949
@@ -1518,7 +1546,16 @@ static void ticker_op_cb(uint32_t status, void *param)
15181546}
15191547
15201548#else /* CONFIG_BT_CTLR_SCAN_AUX_USE_CHAINS */
1521-
1549+ /* NOTE: BT_CTLR_SCAN_AUX_USE_CHAINS is alternative new design with less RAM
1550+ * usage for supporting Extended Scanning of simultaneous interleaved
1551+ * Extended Advertising chains.
1552+ *
1553+ * TODO: As the previous design has Bluetooth Qualified Design Listing by
1554+ * Nordic Semiconductor ASA, both implementation are present in this file,
1555+ * and default builds use CONFIG_BT_CTLR_SCAN_AUX_USE_CHAINS=n. Remove old
1556+ * implementation when we have a new Bluetooth Qualified Design Listing
1557+ * with the new Extended Scanning and Periodic Sync implementation.
1558+ */
15221559void ull_scan_aux_setup (memq_link_t * link , struct node_rx_pdu * rx )
15231560{
15241561 struct node_rx_pdu * rx_incomplete ;
@@ -1778,19 +1815,30 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_pdu *rx)
17781815
17791816 ptr = h -> data ;
17801817
1818+ #if defined(CONFIG_BT_CTLR_SYNC_PERIODIC )
1819+ bool is_aux_addr_match = false;
1820+ #endif /* CONFIG_BT_CTLR_SYNC_PERIODIC */
1821+
17811822 if (h -> adv_addr ) {
17821823#if defined(CONFIG_BT_CTLR_SYNC_PERIODIC )
17831824 /* Check if Periodic Advertising Synchronization to be created
17841825 */
17851826 if (sync && (scan -> periodic .state != LL_SYNC_STATE_CREATED )) {
1786- /* Check address and update internal state */
17871827#if defined(CONFIG_BT_CTLR_PRIVACY )
1788- ull_sync_setup_addr_check (sync , scan , pdu -> tx_addr , ptr ,
1789- ftr -> rl_idx );
1828+ uint8_t rl_idx = ftr -> rl_idx ;
17901829#else /* !CONFIG_BT_CTLR_PRIVACY */
1791- ull_sync_setup_addr_check ( sync , scan , pdu -> tx_addr , ptr , 0U ) ;
1830+ uint8_t rl_idx = 0U ;
17921831#endif /* !CONFIG_BT_CTLR_PRIVACY */
17931832
1833+ /* Check address and update internal state */
1834+ is_aux_addr_match =
1835+ ull_sync_setup_addr_check (sync , scan -> periodic .filter_policy ,
1836+ pdu -> tx_addr , ptr , rl_idx );
1837+ if (is_aux_addr_match ) {
1838+ scan -> periodic .state = LL_SYNC_STATE_ADDR_MATCH ;
1839+ } else {
1840+ scan -> periodic .state = LL_SYNC_STATE_IDLE ;
1841+ }
17941842 }
17951843#endif /* CONFIG_BT_CTLR_SYNC_PERIODIC */
17961844
@@ -1823,14 +1871,21 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_pdu *rx)
18231871 si = (void * )ptr ;
18241872 ptr += sizeof (* si );
18251873
1874+ #if defined(CONFIG_BT_CTLR_SYNC_PERIODIC )
18261875 /* Check if Periodic Advertising Synchronization to be created.
18271876 * Setup synchronization if address and SID match in the
18281877 * Periodic Advertiser List or with the explicitly supplied.
1878+ *
1879+ * is_aux_addr_match, device address in auxiliary channel PDU;
1880+ * scan->periodic.param has not been assigned yet.
1881+ * Otherwise, address was in primary channel PDU and we are now
1882+ * checking SID (in SyncInfo) in auxiliary channel PDU.
18291883 */
1830- if (IS_ENABLED ( CONFIG_BT_CTLR_SYNC_PERIODIC ) && chain && sync && adi &&
1831- ull_sync_setup_sid_match (sync , scan , PDU_ADV_ADI_SID_GET (adi ))) {
1884+ if (sync && chain && ( is_aux_addr_match || ( scan -> periodic . param == chain )) &&
1885+ adi && ull_sync_setup_sid_match (sync , scan , PDU_ADV_ADI_SID_GET (adi ))) {
18321886 ull_sync_setup (scan , chain -> lll .phy , rx , si );
18331887 }
1888+ #endif /* CONFIG_BT_CTLR_SYNC_PERIODIC */
18341889 }
18351890
18361891 if (h -> tx_pwr ) {
@@ -2012,6 +2067,13 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_pdu *rx)
20122067#endif /* CONFIG_BT_CTLR_JIT_SCHEDULING */
20132068
20142069#if defined(CONFIG_BT_CTLR_SYNC_PERIODIC )
2070+ /* Store the chain context that has Periodic Advertising
2071+ * Synchronization address match.
2072+ */
2073+ if (sync && (scan -> periodic .state == LL_SYNC_STATE_ADDR_MATCH )) {
2074+ scan -> periodic .param = chain ;
2075+ }
2076+
20152077 if (sync_lll ) {
20162078 struct ll_sync_set * sync_set = HDR_LLL2ULL (sync_lll );
20172079
@@ -2153,6 +2215,7 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_pdu *rx)
21532215#if defined(CONFIG_BT_CTLR_SYNC_PERIODIC )
21542216 if (sync && (scan -> periodic .state != LL_SYNC_STATE_CREATED )) {
21552217 scan -> periodic .state = LL_SYNC_STATE_IDLE ;
2218+ scan -> periodic .param = NULL ;
21562219 }
21572220#endif /* CONFIG_BT_CTLR_SYNC_PERIODIC */
21582221
0 commit comments