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:43:58 UTC
[mynewt-nimble] branch master updated (ec86d1f -> 28cbf7a)
This is an automated email from the ASF dual-hosted git repository.
andk pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git.
from ec86d1f nimble/ll: Simplify/refactor PDU RX flow in scanner
new 015b130 nimble/ll: Match device in ext adv event only once
new 28cbf7a nimble/ll: Do not check periodic sync on AUX_CHAIN_IND
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
nimble/controller/include/controller/ble_ll_scan.h | 5 ++-
nimble/controller/src/ble_ll_scan.c | 39 ++++++++++++++++++++--
2 files changed, 40 insertions(+), 4 deletions(-)
[mynewt-nimble] 01/02: nimble/ll: Match device in ext adv event
only once
Posted by an...@apache.org.
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 015b130362384b844f9c176543e11e24a670b9eb
Author: Andrzej Kaczmarek <an...@codecoup.pl>
AuthorDate: Sat Jan 4 17:39:23 2020 +0100
nimble/ll: Match device in ext adv event only once
Once extended advertising PDU is allowed through filters, we can
simply allow all subsequent PDUs in chain without running them through
filtering again since the result will be the same.
---
nimble/controller/include/controller/ble_ll_scan.h | 2 ++
nimble/controller/src/ble_ll_scan.c | 28 ++++++++++++++++++++++
2 files changed, 30 insertions(+)
diff --git a/nimble/controller/include/controller/ble_ll_scan.h b/nimble/controller/include/controller/ble_ll_scan.h
index 6b254d4..4ffc081 100644
--- a/nimble/controller/include/controller/ble_ll_scan.h
+++ b/nimble/controller/include/controller/ble_ll_scan.h
@@ -94,6 +94,8 @@ struct ble_ll_scan_params
#define BLE_LL_AUX_HAS_ADVA 0x01
#define BLE_LL_AUX_HAS_TARGETA 0x02
#define BLE_LL_AUX_HAS_ADI 0x04
+#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
diff --git a/nimble/controller/src/ble_ll_scan.c b/nimble/controller/src/ble_ll_scan.c
index 15973ac..5d051af 100644
--- a/nimble/controller/src/ble_ll_scan.c
+++ b/nimble/controller/src/ble_ll_scan.c
@@ -2229,6 +2229,22 @@ ble_ll_scan_rx_isr_on_aux(uint8_t pdu_type, uint8_t *rxbuf,
/* Now we can update aux_data from header since it may have just been created */
aux_data = rxinfo->user_data;
+ /*
+ * Restore proper header flags if filtering was already done successfully on
+ * some previous PDU in an event.
+ */
+ if (aux_data->flags & BLE_LL_AUX_IS_MATCHED) {
+ rxinfo->flags |= BLE_MBUF_HDR_F_DEVMATCH;
+ rxinfo->rpa_index = aux_data->rpa_index;
+ if (rxinfo->rpa_index >= 0) {
+ rxinfo->flags |= BLE_MBUF_HDR_F_RESOLVED;
+ }
+ if (aux_data->flags & BLE_LL_AUX_IS_TARGETA_RESOLVED) {
+ rxinfo->flags |= BLE_MBUF_HDR_F_TARGETA_RESOLVED;
+ }
+ goto done;
+ }
+
if (aux_data->flags & BLE_LL_AUX_HAS_ADVA) {
addrd->adva = aux_data->adva;
addrd->adva_type = aux_data->adva_type;
@@ -2251,11 +2267,23 @@ ble_ll_scan_rx_isr_on_aux(uint8_t pdu_type, uint8_t *rxbuf,
rxinfo->flags |= BLE_MBUF_HDR_F_DEVMATCH;
+ /*
+ * Once we matched device, there's no need to go through filtering on every
+ * other PDU in an event so just store info required to restore state for
+ * subsequent PDUs in aux_data.
+ */
+ aux_data->flags |= BLE_LL_AUX_IS_MATCHED;
+ if (rxinfo->flags & BLE_MBUF_HDR_F_TARGETA_RESOLVED) {
+ aux_data->flags |= BLE_LL_AUX_IS_TARGETA_RESOLVED;
+ /* AdvA state is already stored in rpa_index */
+ }
+
if (rc == 2) {
/* Scan request forbidden by filter policy */
return 0;
}
+done:
return (scanp->scan_type == BLE_SCAN_TYPE_ACTIVE) &&
((rxbuf[2] >> 6) == BLE_LL_EXT_ADV_MODE_SCAN);
}
[mynewt-nimble] 02/02: nimble/ll: Do not check periodic sync on
AUX_CHAIN_IND
Posted by an...@apache.org.
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;
}