You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by an...@apache.org on 2020/01/07 21:44:00 UTC

[mynewt-nimble] 02/02: nimble/ll: Do not check periodic sync on AUX_CHAIN_IND

This is an automated email from the ASF dual-hosted git repository.

andk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git

commit 28cbf7a318e570265e04d4cbfe49e46acc628524
Author: Andrzej Kaczmarek <an...@codecoup.pl>
AuthorDate: Sat Jan 4 17:39:58 2020 +0100

    nimble/ll: Do not check periodic sync on AUX_CHAIN_IND
    
    SyncInfo is only allowed in AUX_ADV_IND so no need to parse it for each
    AUX_CHAIN_IND.
---
 nimble/controller/include/controller/ble_ll_scan.h |  3 ++-
 nimble/controller/src/ble_ll_scan.c                | 11 ++++++++---
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/nimble/controller/include/controller/ble_ll_scan.h b/nimble/controller/include/controller/ble_ll_scan.h
index 4ffc081..139ad5e 100644
--- a/nimble/controller/include/controller/ble_ll_scan.h
+++ b/nimble/controller/include/controller/ble_ll_scan.h
@@ -97,12 +97,13 @@ struct ble_ll_scan_params
 #define BLE_LL_AUX_IS_MATCHED                   0x08
 #define BLE_LL_AUX_IS_TARGETA_RESOLVED          0x10
 
-#define BLE_LL_AUX_FLAG_AUX_RECEIVED            0x01
 #define BLE_LL_AUX_FLAG_HCI_SENT_ANY            0x02
 #define BLE_LL_AUX_FLAG_HCI_SENT_COMPLETED      0x04
 #define BLE_LL_AUX_FLAG_HCI_SENT_TRUNCATED      0x08
 #define BLE_LL_AUX_FLAG_SCAN_COMPLETE           0x10
 #define BLE_LL_AUX_FLAG_SCAN_ERROR              0x20
+#define BLE_LL_AUX_FLAG_AUX_ADV_RECEIVED        0x40
+#define BLE_LL_AUX_FLAG_AUX_CHAIN_RECEIVED      0x80
 
 struct ble_ll_aux_data {
     uint8_t flags;
diff --git a/nimble/controller/src/ble_ll_scan.c b/nimble/controller/src/ble_ll_scan.c
index 5d051af..26e7c07 100644
--- a/nimble/controller/src/ble_ll_scan.c
+++ b/nimble/controller/src/ble_ll_scan.c
@@ -1631,7 +1631,11 @@ ble_ll_scan_update_aux_data(struct ble_mbuf_hdr *ble_hdr, uint8_t *rxbuf,
 
         aux_data->aux_primary_phy = ble_hdr->rxinfo.phy;
     } else {
-        aux_data->flags_isr |= BLE_LL_AUX_FLAG_AUX_RECEIVED;
+        if (aux_data->flags_isr & BLE_LL_AUX_FLAG_AUX_ADV_RECEIVED) {
+            aux_data->flags_isr |= BLE_LL_AUX_FLAG_AUX_CHAIN_RECEIVED;
+        } else {
+            aux_data->flags_isr |= BLE_LL_AUX_FLAG_AUX_ADV_RECEIVED;
+        }
     }
 
     /* Now parse extended header... */
@@ -3110,7 +3114,8 @@ ble_ll_scan_rx_pkt_in_on_aux(uint8_t pdu_type, struct os_mbuf *om,
      * regardless of scanner filtering. Just make sure we already have AdvA.
      */
     if (ble_ll_sync_enabled() &&
-        ((rxbuf[2] >> 6) == BLE_LL_EXT_ADV_MODE_NON_CONN) && addrd->adva) {
+        ((rxbuf[2] >> 6) == BLE_LL_EXT_ADV_MODE_NON_CONN) && addrd->adva &&
+        !(aux_data->flags_ll & BLE_LL_AUX_FLAG_AUX_CHAIN_RECEIVED)) {
         ble_ll_scan_check_periodic_sync(om, hdr, addrd->adva, addrd->adva_type,
                                         rxinfo->rpa_index);
     }
@@ -3139,7 +3144,7 @@ ble_ll_scan_rx_pkt_in_on_aux(uint8_t pdu_type, struct os_mbuf *om,
         }
 
         /* Ignore if this was just ADV_EXT_IND with AuxPtr, will process aux */
-        if (!(aux_data->flags_ll & BLE_LL_AUX_FLAG_AUX_RECEIVED)) {
+        if (!(aux_data->flags_ll & BLE_LL_AUX_FLAG_AUX_ADV_RECEIVED)) {
             goto scan_continue;
         }