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/03/22 15:08:56 UTC

[mynewt-nimble] branch master updated: nimble/transport/nrf53: Fix slow reads from IPC

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


The following commit(s) were added to refs/heads/master by this push:
     new adc6b03  nimble/transport/nrf53: Fix slow reads from IPC
adc6b03 is described below

commit adc6b036466584b707cb73cf288d148f907d53f8
Author: Andrzej Kaczmarek <an...@codecoup.pl>
AuthorDate: Mon Mar 21 18:18:15 2022 +0100

    nimble/transport/nrf53: Fix slow reads from IPC
    
    Reading byte-by-byte from IPC to H4 is terribly slow, we should use new
    API that can return pointer to an IPC buffer and read directly from
    there.
---
 nimble/transport/nrf5340/src/nrf5340_ble_hci.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/nimble/transport/nrf5340/src/nrf5340_ble_hci.c b/nimble/transport/nrf5340/src/nrf5340_ble_hci.c
index 111c048..fc9fec7 100644
--- a/nimble/transport/nrf5340/src/nrf5340_ble_hci.c
+++ b/nimble/transport/nrf5340/src/nrf5340_ble_hci.c
@@ -93,15 +93,14 @@ nrf5340_ble_hci_frame_cb(uint8_t pkt_type, void *data)
 static void
 nrf5340_ble_hci_trans_rx(int channel, void *user_data)
 {
-    uint8_t byte;
-    int rlen;
-
-    while (ipc_nrf5340_available(channel) > 0) {
-        rlen = ipc_nrf5340_read(channel, &byte, 1);
-        assert(rlen == 1);
-
-        rlen = hci_h4_sm_rx(&hci_nrf5340_h4sm, &byte, 1);
-        assert(rlen == 1);
+    uint8_t *buf;
+    int len;
+
+    len = ipc_nrf5340_available_buf(channel, (void **)&buf);
+    while (len > 0) {
+        len = hci_h4_sm_rx(&hci_nrf5340_h4sm, buf, len);
+        ipc_nrf5340_consume(channel, len);
+        len = ipc_nrf5340_available_buf(channel, (void **)&buf);
     }
 }