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 2022/04/07 08:22:05 UTC

[mynewt-nimble] branch master updated (a6767eaf -> 2a0379d5)

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 a6767eaf nimble/ll: Optimize BLE_LL_ASSERT
     new 136bd224 nimble/transport/h4: Drop legacy advertising events on overflow
     new 2a0379d5 nimble/transport/h4: Assert on H4 failure

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/transport/common/hci_h4/src/hci_h4.c | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)


[mynewt-nimble] 01/02: nimble/transport/h4: Drop legacy advertising events on overflow

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 136bd2248ac360b5b03701c531fa6bb00222882f
Author: Andrzej Kaczmarek <an...@codecoup.pl>
AuthorDate: Wed Apr 6 15:16:22 2022 +0200

    nimble/transport/h4: Drop legacy advertising events on overflow
---
 nimble/transport/common/hci_h4/src/hci_h4.c | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/nimble/transport/common/hci_h4/src/hci_h4.c b/nimble/transport/common/hci_h4/src/hci_h4.c
index ac76ab03..2e86c1de 100644
--- a/nimble/transport/common/hci_h4/src/hci_h4.c
+++ b/nimble/transport/common/hci_h4/src/hci_h4.c
@@ -139,15 +139,23 @@ hci_h4_sm_w4_header(struct hci_h4_sm *h4sm, struct hci_h4_input_buffer *ib)
             }
         }
 
-        /* TODO lo/hi pool? */
-
         assert(h4sm->allocs && h4sm->allocs->evt);
-        h4sm->buf = h4sm->allocs->evt(0);
-        if (!h4sm->buf) {
-            return -1;
+
+        /* We can drop legacy advertising events if there's no free buffer in
+         * discardable pool.
+         */
+        if (h4sm->hdr[2] == BLE_HCI_LE_SUBEV_ADV_RPT) {
+            h4sm->buf = h4sm->allocs->evt(1);
+        } else {
+            h4sm->buf = h4sm->allocs->evt(0);
+            if (!h4sm->buf) {
+                return -1;
+            }
         }
 
-        memcpy(h4sm->buf, h4sm->hdr, h4sm->len);
+        if (h4sm->buf) {
+            memcpy(h4sm->buf, h4sm->hdr, h4sm->len);
+        }
 
         h4sm->exp_len = h4sm->hdr[1] + 2;
         break;


[mynewt-nimble] 02/02: nimble/transport/h4: Assert on H4 failure

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 2a0379d50774aa266d9cdd793b80a00bf7ad81f9
Author: Andrzej Kaczmarek <an...@codecoup.pl>
AuthorDate: Wed Apr 6 15:17:13 2022 +0200

    nimble/transport/h4: Assert on H4 failure
    
    We can't recover from H4 failure so let's just assert for now, it will
    be easier to spot the issue.
---
 nimble/transport/common/hci_h4/src/hci_h4.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/nimble/transport/common/hci_h4/src/hci_h4.c b/nimble/transport/common/hci_h4/src/hci_h4.c
index 2e86c1de..cb091342 100644
--- a/nimble/transport/common/hci_h4/src/hci_h4.c
+++ b/nimble/transport/common/hci_h4/src/hci_h4.c
@@ -264,6 +264,7 @@ hci_h4_sm_rx(struct hci_h4_sm *h4sm, const uint8_t *buf, uint16_t len)
         /* no break */
         case HCI_H4_SM_W4_HEADER:
             rc = hci_h4_sm_w4_header(h4sm, &ib);
+            assert(rc >= 0);
             if (rc) {
                 break;
             }
@@ -271,6 +272,7 @@ hci_h4_sm_rx(struct hci_h4_sm *h4sm, const uint8_t *buf, uint16_t len)
         /* no break */
         case HCI_H4_SM_W4_PAYLOAD:
             rc = hci_h4_sm_w4_payload(h4sm, &ib);
+            assert(rc >= 0);
             if (rc) {
                 break;
             }