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 2019/12/09 18:16:03 UTC

[mynewt-nimble] branch master updated (0e9dd72 -> 8391e2a)

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 0e9dd72  Merge pull request #691 from andrzej-kaczmarek/ll-scan-cleanup
     new afbbeac  nimble/ll: Fix recalculating rfclk start
     new 8391e2a  nimble/ll: Fix rfclk after extended scan stop

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/src/ble_ll_scan.c  | 10 +++++++++-
 nimble/controller/src/ble_ll_sched.c |  9 +++++++++
 2 files changed, 18 insertions(+), 1 deletion(-)


[mynewt-nimble] 01/02: nimble/ll: Fix recalculating rfclk start

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 afbbeace7053d866aa8b52fadb13d9dc92de1897
Author: Andrzej Kaczmarek <an...@codecoup.pl>
AuthorDate: Thu Dec 5 17:04:31 2019 +0100

    nimble/ll: Fix recalculating rfclk start
    
    ble_ll_xcvr_rfclk_timer_start() assumes that it should not reschedule
    rfclk if it's already scheduled before requested tick. This is correct
    since it may be called it different contexts, however when called from
    ble_ll_sched_rfclk_chk_restart() we expect that rfclk will be scheduled
    for a first item in scheduler and this may not work as expected.
    
    Consider following scenario (one of many):
    - connection is active
    - sync with periodic advertising is active
    - scaner is active
    - sync scan item is in scheduler
    - next connection event item is scheduled *after* above sync scan item
    
    At this point we have rfclk timer set to fire at sync scan item. And now
    interesting things will happen:
    - terminate sync which removes sync scan item from scheduler
    - disable scan
    
    If both of the above happen before scheduled connection event item, we
    have a problem. This is because when sync scan item was removed, we did
    not move rfclk timer to connection event item because rfclk code checked
    that it already has rfclk scheduled before requested time. This means
    rfclk will be enabled at the time of removed sync scan item, but it will
    not be rescheduled to connection event item since there is no scheduler
    item do do this. So far so good - we still have rfclk enabled. But then
    we have scan disable which disables rfclk since connection event item is
    apparently far enough in the future so this is allowed. As a result we
    do not have rfclk enabled for a connection event.
    
    To fix this we make sure that every time we reevaluate scheduler for
    rfclk change, we need to stop existing timer so it can be always started
    for a proper item.
---
 nimble/controller/src/ble_ll_sched.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/nimble/controller/src/ble_ll_sched.c b/nimble/controller/src/ble_ll_sched.c
index 3ce22e9..626f939 100644
--- a/nimble/controller/src/ble_ll_sched.c
+++ b/nimble/controller/src/ble_ll_sched.c
@@ -1608,6 +1608,15 @@ ble_ll_sched_rfclk_chk_restart(void)
          */
         time_till_next = (int32_t)(next_time - os_cputime_get32());
         if (time_till_next > g_ble_ll_data.ll_xtal_ticks) {
+            /*
+             * XXX stop timer if already scheduled since it could be set for a
+             *     scheduler item which was removed prior to calling this func.
+             *     in such case we need to make sure we are set to proper item.
+             */
+            if (g_ble_ll_data.ll_rfclk_is_sched) {
+                g_ble_ll_data.ll_rfclk_is_sched = 0;
+                os_cputime_timer_stop(&g_ble_ll_data.ll_rfclk_timer);
+            }
             /* Restart the rfclk timer based on the next scheduled time */
             ble_ll_xcvr_rfclk_timer_start(next_time);
 


[mynewt-nimble] 02/02: nimble/ll: Fix rfclk after extended 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 8391e2a40df66b29c98bdd071ba55bba045ca7c3
Author: Andrzej Kaczmarek <an...@codecoup.pl>
AuthorDate: Thu Dec 5 17:07:39 2019 +0100

    nimble/ll: Fix rfclk after extended scan stop
    
    It's quite possible that when stopping extended scan we also remove some
    AUX scan items form scheduler so we should trigger rfclk to restart on
    proper item.
---
 nimble/controller/src/ble_ll_scan.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/nimble/controller/src/ble_ll_scan.c b/nimble/controller/src/ble_ll_scan.c
index f331314..75d674a 100644
--- a/nimble/controller/src/ble_ll_scan.c
+++ b/nimble/controller/src/ble_ll_scan.c
@@ -1270,7 +1270,6 @@ ble_ll_scan_sm_stop(int chk_disable)
     if (scansm->ext_scanning) {
         ble_ll_scan_clean_cur_aux_data();
         ble_ll_sched_rmv_elem_type(BLE_LL_SCHED_TYPE_AUX_SCAN, ble_ll_scan_sched_remove);
-        scansm->ext_scanning = 0;
     }
 #endif
 
@@ -1304,6 +1303,15 @@ ble_ll_scan_sm_stop(int chk_disable)
         }
         OS_EXIT_CRITICAL(sr);
     }
+
+#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
+    if (scansm->ext_scanning) {
+#ifdef BLE_XCVR_RFCLK
+        ble_ll_sched_rfclk_chk_restart();
+#endif
+        scansm->ext_scanning = 0;
+    }
+#endif
 }
 
 static int