From cf51b86dceda80349cb0c2de87a05df9bc42c1d0 Mon Sep 17 00:00:00 2001 From: Andrzej Kaczmarek Date: Mon, 22 Aug 2022 15:31:01 +0200 Subject: [PATCH] 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 5d7749033..56f1c528e 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 bbf227538..0aa96251a 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))