You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ry...@apache.org on 2018/12/21 17:55:34 UTC

[mynewt-nimble] branch master updated (86e128b -> bd346f6)

This is an automated email from the ASF dual-hosted git repository.

rymek pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git.


    from 86e128b  nimble/ll: Add support to advertise anonymously
     new 9f5637e  nimble/gap: Increase GAP update timeout
     new 7f3b525  nimble/gap: Reset GAP UPDATE timeout on fallback to L2CAP
     new 77a9782  nimble/gap: Remove gap update procedure entry on L2CAP response
     new bd346f6  nimble/unittest: Adjust unittest for handling conn update parameters

The 4 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/host/src/ble_gap.c           | 18 ++++++-----
 nimble/host/test/src/ble_gap_test.c | 60 +++++++++++++++++++++----------------
 2 files changed, 45 insertions(+), 33 deletions(-)


[mynewt-nimble] 04/04: nimble/unittest: Adjust unittest for handling conn update parameters

Posted by ry...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rymek pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git

commit bd346f6da279594d7b94ffb144ebb0e8ea6dd3d0
Author: Łukasz Rymanowski <lu...@codecoup.pl>
AuthorDate: Thu Dec 20 11:47:14 2018 +0100

    nimble/unittest: Adjust unittest for handling conn update parameters
    
    Nimble changed the way of handling connection update parameter which
    requires adjusting of unit tests. The main change is that from now on Nimble
    will not timeout when it receive response on
    L2CAP Connection Parameter Update Request at it is considered as the end of the
    procedure from the Host point of view.
---
 nimble/host/test/src/ble_gap_test.c | 60 +++++++++++++++++++++----------------
 1 file changed, 34 insertions(+), 26 deletions(-)

diff --git a/nimble/host/test/src/ble_gap_test.c b/nimble/host/test/src/ble_gap_test.c
index baed307..463c278 100644
--- a/nimble/host/test/src/ble_gap_test.c
+++ b/nimble/host/test/src/ble_gap_test.c
@@ -1961,15 +1961,13 @@ ble_gap_test_util_update_l2cap(struct ble_gap_upd_params *params,
 
     /* Receive l2cap connection parameter update response. */
     ble_hs_test_util_rx_l2cap_update_rsp(2, id, l2cap_result);
-    if (l2cap_result == BLE_L2CAP_SIG_UPDATE_RSP_RESULT_ACCEPT) {
-        TEST_ASSERT(ble_gap_dbg_update_active(2));
+    TEST_ASSERT(!ble_gap_dbg_update_active(2));
 
+    if (l2cap_result == BLE_L2CAP_SIG_UPDATE_RSP_RESULT_ACCEPT) {
         /* Receive connection update complete event. */
         ble_gap_test_util_rx_update_complete(0, params);
     }
 
-    TEST_ASSERT(!ble_gap_dbg_update_active(2));
-
     TEST_ASSERT(ble_gap_test_event.type == BLE_GAP_EVENT_CONN_UPDATE);
     if (l2cap_result != BLE_L2CAP_SIG_UPDATE_RSP_RESULT_ACCEPT) {
         TEST_ASSERT(ble_gap_test_conn_status == BLE_HS_EREJECT);
@@ -2025,12 +2023,12 @@ ble_gap_test_util_update_no_l2cap_tmo(struct ble_gap_upd_params *params,
     /* Ensure no update event reported. */
     TEST_ASSERT(ble_gap_test_event.type == 0xff);
 
-    /* Advance 29 seconds; ensure no timeout reported. */
-    os_time_advance(29 * OS_TICKS_PER_SEC);
+    /* Advance 39 seconds; ensure no timeout reported. */
+    os_time_advance(39 * OS_TICKS_PER_SEC);
     ble_gap_timer();
     TEST_ASSERT(ble_gap_test_event.type == 0xff);
 
-    /* Advance 30th second; ensure timeout reported. */
+    /* Advance 40th second; ensure timeout reported. */
     os_time_advance(1 * OS_TICKS_PER_SEC);
 
     /* Timeout will result in a terminate HCI command being sent; schedule ack
@@ -2094,14 +2092,18 @@ ble_gap_test_util_update_l2cap_tmo(struct ble_gap_upd_params *params,
         /* Receive l2cap connection parameter update response. */
         ble_hs_test_util_rx_l2cap_update_rsp(
             2, id, BLE_L2CAP_SIG_UPDATE_RSP_RESULT_ACCEPT);
-    }
 
-    TEST_ASSERT(ble_gap_dbg_update_active(2));
+        TEST_ASSERT(!ble_gap_dbg_update_active(2));
+    } else {
+        TEST_ASSERT(ble_gap_dbg_update_active(2));
+    }
 
     /* Ensure no update event reported. */
     TEST_ASSERT(ble_gap_test_event.type == 0xff);
 
-    /* Advance 29 seconds; ensure no timeout reported. */
+    /* Advance 29 seconds; ensure no timeout reported.
+     * Note: L2CAP signaling timeout is 30 sec, GAP update timeout is 40 sec
+     */
     os_time_advance(29 * OS_TICKS_PER_SEC);
     ble_gap_timer();
     ble_l2cap_sig_timer();
@@ -2110,22 +2112,31 @@ ble_gap_test_util_update_l2cap_tmo(struct ble_gap_upd_params *params,
     /* Advance 30th second; ensure timeout reported. */
     os_time_advance(1 * OS_TICKS_PER_SEC);
 
-    /* Timeout will result in a terminate HCI command being sent; schedule ack
-     * from controller.
-     */
-    ble_hs_test_util_hci_ack_set_disconnect(0);
+    /* If L2CAP response has been received, GAP Timer is removed */
+     if (!rx_l2cap) {
 
-    ble_gap_timer();
-    ble_l2cap_sig_timer();
+         /* Timeout will result in a terminate HCI command being sent; schedule ack
+          * from controller.
+          */
+         ble_hs_test_util_hci_ack_set_disconnect(0);
 
-    /* Verify terminate was sent. */
-    ble_gap_test_util_verify_tx_disconnect();
+         ble_gap_timer();
+         ble_l2cap_sig_timer();
 
-    TEST_ASSERT(ble_gap_test_event.type == BLE_GAP_EVENT_CONN_UPDATE);
-    TEST_ASSERT(ble_gap_test_conn_status == BLE_HS_ETIMEOUT);
-    TEST_ASSERT(ble_gap_test_conn_desc.conn_handle == 2);
-    TEST_ASSERT(memcmp(ble_gap_test_conn_desc.peer_id_addr.val,
-                       peer_addr, 6) == 0);
+         /* Verify terminate was sent. */
+         ble_gap_test_util_verify_tx_disconnect();
+
+        TEST_ASSERT(ble_gap_test_event.type == BLE_GAP_EVENT_CONN_UPDATE);
+        TEST_ASSERT(ble_gap_test_conn_status == BLE_HS_ETIMEOUT);
+        TEST_ASSERT(ble_gap_test_conn_desc.conn_handle == 2);
+        TEST_ASSERT(memcmp(ble_gap_test_conn_desc.peer_id_addr.val,
+                           peer_addr, 6) == 0);
+    } else {
+        ble_gap_timer();
+        ble_l2cap_sig_timer();
+
+        TEST_ASSERT(ble_gap_test_event.type == 0xff);
+    }
 }
 
 static void
@@ -2893,9 +2904,6 @@ TEST_CASE(ble_gap_test_case_update_timeout)
     /* L2CAP - Local unsupported; L2CAP timeout. */
     ble_gap_test_util_update_l2cap_tmo(&params, BLE_ERR_UNKNOWN_HCI_CMD, 0, 0);
 
-    /* L2CAP - Local unsupported; LL timeout. */
-    ble_gap_test_util_update_l2cap_tmo(&params, BLE_ERR_UNKNOWN_HCI_CMD, 0, 1);
-
     /* L2CAP - Remote unsupported; L2CAP timeout. */
     ble_gap_test_util_update_l2cap_tmo(&params, 0, BLE_ERR_UNSUPP_REM_FEATURE,
                                        0);


[mynewt-nimble] 02/04: nimble/gap: Reset GAP UPDATE timeout on fallback to L2CAP

Posted by ry...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rymek pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git

commit 7f3b525e175000309b621329c620267f239e7f48
Author: Łukasz Rymanowski <lu...@codecoup.pl>
AuthorDate: Fri Dec 14 18:45:23 2018 +0100

    nimble/gap: Reset GAP UPDATE timeout on fallback to L2CAP
    
    In case LL Update failed but took already some time, make sure we give
    more time for the connection update procedure over L2CAP
---
 nimble/host/src/ble_gap.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/nimble/host/src/ble_gap.c b/nimble/host/src/ble_gap.c
index 9547bca..77d1cf3 100644
--- a/nimble/host/src/ble_gap.c
+++ b/nimble/host/src/ble_gap.c
@@ -1128,6 +1128,8 @@ ble_gap_rx_update_complete(struct hci_le_conn_upd_complete *evt)
             entry = ble_gap_update_entry_find(evt->connection_handle, NULL);
             if (entry != NULL && !(conn->bhc_flags & BLE_HS_CONN_F_MASTER)) {
                 ble_gap_update_to_l2cap(&entry->params, &l2cap_params);
+                entry->exp_os_ticks = ble_npl_time_get() +
+                                      ble_npl_time_ms_to_ticks32(BLE_GAP_UPDATE_TIMEOUT_MS);
             }
             break;
 


[mynewt-nimble] 03/04: nimble/gap: Remove gap update procedure entry on L2CAP response

Posted by ry...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rymek pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git

commit 77a9782c25b90fafeff2c9b7c8bf597c8f742b64
Author: Łukasz Rymanowski <lu...@codecoup.pl>
AuthorDate: Fri Dec 14 18:46:53 2018 +0100

    nimble/gap: Remove gap update procedure entry on L2CAP response
    
    Whenever L2CAP connection parameter update response is received
    it is OK to remove procedure entry at all which also stops the timer for
    the procedure.
    
    In case parameters were not accepted by peer it is clear as Nimble
    just sends no success notification to the application and there is
    nothing to do.
    
    In case parameters has been accepted by peer, Nimble can remove procedure
    entry which stops the timer, because now it is controller job to notify
    host about updated parameters. Host cannot do nothing more about it.
---
 nimble/host/src/ble_gap.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/nimble/host/src/ble_gap.c b/nimble/host/src/ble_gap.c
index 77d1cf3..b4cddb1 100644
--- a/nimble/host/src/ble_gap.c
+++ b/nimble/host/src/ble_gap.c
@@ -4022,15 +4022,17 @@ ble_gap_update_l2cap_cb(uint16_t conn_handle, int status, void *arg)
     /* Report failures and rejections.  Success gets reported when the
      * controller sends the connection update complete event.
      */
-    if (status != 0) {
-        ble_hs_lock();
-        entry = ble_gap_update_entry_remove(conn_handle);
-        ble_hs_unlock();
 
-        if (entry != NULL) {
-            ble_gap_update_entry_free(entry);
+    ble_hs_lock();
+    entry = ble_gap_update_entry_remove(conn_handle);
+    ble_hs_unlock();
+
+    if (entry != NULL) {
+        ble_gap_update_entry_free(entry);
+        if (status != 0) {
             ble_gap_update_notify(conn_handle, status);
         }
+        /* On success let's wait for the controller to notify about update */
     }
 }
 


[mynewt-nimble] 01/04: nimble/gap: Increase GAP update timeout

Posted by ry...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rymek pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git

commit 9f5637e15c2eefa2450c9cfa1013d041fdad3923
Author: Łukasz Rymanowski <lu...@codecoup.pl>
AuthorDate: Fri Dec 14 18:38:28 2018 +0100

    nimble/gap: Increase GAP update timeout
    
    We want to make it longer just to make sure that peer device has time to
    reply (LL_RESPONSE_TIMEOUT is 40 sec)
---
 nimble/host/src/ble_gap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/nimble/host/src/ble_gap.c b/nimble/host/src/ble_gap.c
index ebd4354..9547bca 100644
--- a/nimble/host/src/ble_gap.c
+++ b/nimble/host/src/ble_gap.c
@@ -85,7 +85,7 @@
  */
 #define BLE_GAP_CANCEL_RETRY_TIMEOUT_MS         100 /* ms */
 
-#define BLE_GAP_UPDATE_TIMEOUT_MS               30000 /* ms */
+#define BLE_GAP_UPDATE_TIMEOUT_MS               40000 /* ms */
 
 static const struct ble_gap_conn_params ble_gap_conn_params_dflt = {
     .scan_itvl = 0x0010,