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/06/30 20:40:21 UTC
[mynewt-nimble] branch master updated (cd6da7f -> ac1b8f6)
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 cd6da7f porting: cleanup porting_init()
new 768e18b nimble/ll: Fix legacy scanning with ext adv support enabled
new fcc306f nimble/ll: Fix race in scan stop
new ac1b8f6 nimble/ll: Ignore PDUs received after scan disabled
The 3 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/src/ble_ll_scan.c | 42 ++++++++++++++++++-------------------
1 file changed, 20 insertions(+), 22 deletions(-)
[mynewt-nimble] 02/03: nimble/ll: Fix race in scan stop
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 fcc306f47b37b63c73c6728eaa84add8ae5f6e54
Author: Andrzej Kaczmarek <an...@codecoup.pl>
AuthorDate: Tue Jun 30 01:26:40 2020 +0200
nimble/ll: Fix race in scan stop
We should better disable PHY before cleaning up scansm. This way we
avoid e.g. scenario when extended scanner was active, but PDU was
received after ext_scanning flag was cleared so such PDU would be
marked incorrectly.
---
nimble/controller/src/ble_ll_scan.c | 32 ++++++++++++++++----------------
1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/nimble/controller/src/ble_ll_scan.c b/nimble/controller/src/ble_ll_scan.c
index c17a9c8..930d88a 100644
--- a/nimble/controller/src/ble_ll_scan.c
+++ b/nimble/controller/src/ble_ll_scan.c
@@ -1125,6 +1125,22 @@ ble_ll_scan_sm_stop(int chk_disable)
scansm = &g_ble_ll_scan_sm;
os_cputime_timer_stop(&scansm->scan_timer);
+ /* Only set state if we are currently in a scan window */
+ if (chk_disable) {
+ OS_ENTER_CRITICAL(sr);
+ lls = ble_ll_state_get();
+
+ if ((lls == BLE_LL_STATE_SCANNING) ||
+ (lls == BLE_LL_STATE_INITIATING && chk_disable == 1)) {
+ /* Disable phy */
+ ble_phy_disable();
+
+ /* Set LL state to standby */
+ ble_ll_state_set(BLE_LL_STATE_STANDBY);
+ }
+ OS_EXIT_CRITICAL(sr);
+ }
+
OS_ENTER_CRITICAL(sr);
/* Disable scanning state machine */
@@ -1149,22 +1165,6 @@ ble_ll_scan_sm_stop(int chk_disable)
/* Count # of times stopped */
STATS_INC(ble_ll_stats, scan_stops);
- /* Only set state if we are currently in a scan window */
- if (chk_disable) {
- OS_ENTER_CRITICAL(sr);
- lls = ble_ll_state_get();
-
- if ((lls == BLE_LL_STATE_SCANNING) ||
- (lls == BLE_LL_STATE_INITIATING && chk_disable == 1)) {
- /* Disable phy */
- ble_phy_disable();
-
- /* Set LL state to standby */
- ble_ll_state_set(BLE_LL_STATE_STANDBY);
- }
- OS_EXIT_CRITICAL(sr);
- }
-
/* No need for RF anymore */
OS_ENTER_CRITICAL(sr);
ble_ll_rfmgmt_scan_changed(false, 0);
[mynewt-nimble] 03/03: nimble/ll: Ignore PDUs received after scan
disabled
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 ac1b8f65b9bf38f0d203f844a8cdae961d68cb7f
Author: Andrzej Kaczmarek <an...@codecoup.pl>
AuthorDate: Tue Jun 30 01:30:05 2020 +0200
nimble/ll: Ignore PDUs received after scan disabled
We should better ignore any PDU that was received in LL after scanner
was disabled since they may not be handled as they should be.
---
nimble/controller/src/ble_ll_scan.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/nimble/controller/src/ble_ll_scan.c b/nimble/controller/src/ble_ll_scan.c
index 930d88a..11ccbed 100644
--- a/nimble/controller/src/ble_ll_scan.c
+++ b/nimble/controller/src/ble_ll_scan.c
@@ -3021,7 +3021,8 @@ ble_ll_scan_rx_pkt_in_on_legacy(uint8_t pdu_type, struct os_mbuf *om,
if (!BLE_MBUF_HDR_DEVMATCH(hdr) ||
!BLE_MBUF_HDR_CRC_OK(hdr) ||
- BLE_MBUF_HDR_IGNORED(hdr)) {
+ BLE_MBUF_HDR_IGNORED(hdr) ||
+ !scansm->scan_enabled) {
return;
}
@@ -3075,7 +3076,8 @@ ble_ll_scan_rx_pkt_in_on_aux(uint8_t pdu_type, struct os_mbuf *om,
BLE_MBUF_HDR_IGNORED(hdr) ||
BLE_MBUF_HDR_AUX_INVALID(hdr) ||
(aux_data->flags_ll & BLE_LL_AUX_FLAG_SCAN_ERROR) ||
- (pdu_type != BLE_ADV_PDU_TYPE_ADV_EXT_IND)) {
+ (pdu_type != BLE_ADV_PDU_TYPE_ADV_EXT_IND) ||
+ !scansm->scan_enabled) {
if (aux_data) {
ble_ll_scan_end_adv_evt(aux_data);
ble_ll_scan_aux_data_unref(aux_data);
[mynewt-nimble] 01/03: nimble/ll: Fix legacy scanning with ext adv
support enabled
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 768e18bdfcacf72707f5a72bc76bdead391163b0
Author: Andrzej Kaczmarek <an...@codecoup.pl>
AuthorDate: Tue Jun 30 01:18:47 2020 +0200
nimble/ll: Fix legacy scanning with ext adv support enabled
LL will try to unref aux_data for an ADV_EXT_IND PDU which was received
while legacy scanning was active. This is not correct since such PDU
does not have aux_data allocated and we'll hit an assert.
We can just skip that check in LL context since ISR will mark such PDU
as ignored and it can be handled properly by LL.
---
nimble/controller/src/ble_ll_scan.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/nimble/controller/src/ble_ll_scan.c b/nimble/controller/src/ble_ll_scan.c
index 2e93ba2..c17a9c8 100644
--- a/nimble/controller/src/ble_ll_scan.c
+++ b/nimble/controller/src/ble_ll_scan.c
@@ -3060,10 +3060,6 @@ ble_ll_scan_rx_pkt_in_on_aux(uint8_t pdu_type, struct os_mbuf *om,
bool send_hci_report;
int rc;
- if (!scansm->ext_scanning) {
- goto scan_continue;
- }
-
if (aux_data) {
aux_data->flags_ll |= aux_data->flags_isr;
}