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 2022/08/22 18:51:06 UTC

[mynewt-nimble] branch master updated: nimble/ll: Fix ext adv report status when failed to schedule chain scan

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


The following commit(s) were added to refs/heads/master by this push:
     new cf51b86d nimble/ll: Fix ext adv report status when failed to schedule chain scan
cf51b86d is described below

commit cf51b86dceda80349cb0c2de87a05df9bc42c1d0
Author: Andrzej Kaczmarek <an...@codecoup.pl>
AuthorDate: Mon Aug 22 15:31:01 2022 +0200

    nimble/ll: Fix ext adv report status when failed to schedule chain scan
    
    If aux chain scan failed to schedule, we simply remove aux ptr flag
    which results in "complete" event being sent instead of "truncated". We
    should mark PDU accordingly and send "truncated" if this is last aux
    chain scanned, but there were more to come.
    
    This fixes LL/DDI/SCN/BV-62-C.
---
 nimble/controller/src/ble_ll_scan_aux.c | 3 +++
 nimble/include/nimble/ble.h             | 5 +----
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/nimble/controller/src/ble_ll_scan_aux.c b/nimble/controller/src/ble_ll_scan_aux.c
index 5d774903..56f1c528 100644
--- a/nimble/controller/src/ble_ll_scan_aux.c
+++ b/nimble/controller/src/ble_ll_scan_aux.c
@@ -564,6 +564,8 @@ ble_ll_hci_ev_send_ext_adv_report(struct os_mbuf *rxpdu,
             } else {
                 report->evt_type |= BLE_HCI_ADV_DATA_STATUS_TRUNCATED;
             }
+        } else if (rxinfo->flags & BLE_MBUF_HDR_F_AUX_PTR_FAILED) {
+            report->evt_type |= BLE_HCI_ADV_DATA_STATUS_TRUNCATED;
         }
 
         switch (report->evt_type & BLE_HCI_ADV_DATA_STATUS_MASK) {
@@ -1667,6 +1669,7 @@ ble_ll_scan_aux_rx_pkt_in(struct os_mbuf *rxpdu, struct ble_mbuf_hdr *rxhdr)
                                    aux->aux_ptr);
         if (rc < 0) {
             rxinfo->flags &= ~BLE_MBUF_HDR_F_AUX_PTR_WAIT;
+            rxinfo->flags |= BLE_MBUF_HDR_F_AUX_PTR_FAILED;
         }
     }
 
diff --git a/nimble/include/nimble/ble.h b/nimble/include/nimble/ble.h
index bbf22753..0aa96251 100644
--- a/nimble/include/nimble/ble.h
+++ b/nimble/include/nimble/ble.h
@@ -101,7 +101,7 @@ struct ble_mbuf_hdr_rxinfo
 #define BLE_MBUF_HDR_F_EXT_ADV          (0x0800)
 #define BLE_MBUF_HDR_F_RESOLVED         (0x0400)
 #define BLE_MBUF_HDR_F_AUX_PTR_WAIT     (0x0200)
-#define BLE_MBUF_HDR_F_AUX_INVALID      (0x0100)
+#define BLE_MBUF_HDR_F_AUX_PTR_FAILED   (0x0100)
 #define BLE_MBUF_HDR_F_CRC_OK           (0x0080)
 #define BLE_MBUF_HDR_F_DEVMATCH         (0x0040)
 #define BLE_MBUF_HDR_F_MIC_FAILURE      (0x0020)
@@ -146,9 +146,6 @@ struct ble_mbuf_hdr
 #define BLE_MBUF_HDR_SCAN_RSP_RXD(hdr) \
     (!!((hdr)->rxinfo.flags & BLE_MBUF_HDR_F_SCAN_RSP_RXD))
 
-#define BLE_MBUF_HDR_AUX_INVALID(hdr) \
-    (!!((hdr)->rxinfo.flags & BLE_MBUF_HDR_F_AUX_INVALID))
-
 #define BLE_MBUF_HDR_WAIT_AUX(hdr)      \
     (!!((hdr)->rxinfo.flags & BLE_MBUF_HDR_F_AUX_PTR_WAIT))