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 2023/02/06 11:49:07 UTC
[mynewt-nimble] branch master updated: nimble/transport: Remove ACL pool if not used
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 4ff37848 nimble/transport: Remove ACL pool if not used
4ff37848 is described below
commit 4ff3784817bf2e162614dc49718ceca926e26bdb
Author: Andrzej Kaczmarek <an...@codecoup.pl>
AuthorDate: Fri Feb 3 22:12:49 2023 +0100
nimble/transport: Remove ACL pool if not used
This removes extra memory used by ACL pool structures if pool is not
used, i.e. count=0. This happens e.g. on combined build since both hs
and ll sides use msys instead of transport pool. This can also be set by
user if neither central nor peripheral role is enabled and ACL pool is
not needed.
---
nimble/transport/src/transport.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/nimble/transport/src/transport.c b/nimble/transport/src/transport.c
index a1ee3409..7e5601d1 100644
--- a/nimble/transport/src/transport.c
+++ b/nimble/transport/src/transport.c
@@ -71,9 +71,11 @@ static struct os_mempool pool_evt;
static uint8_t pool_evt_lo_buf[ OS_MEMPOOL_BYTES(POOL_EVT_LO_COUNT, POOL_EVT_SIZE) ];
static struct os_mempool pool_evt_lo;
+#if POOL_ACL_COUNT > 0
static uint8_t pool_acl_buf[ OS_MEMPOOL_BYTES(POOL_ACL_COUNT, POOL_ACL_SIZE) ];
static struct os_mempool_ext pool_acl;
static struct os_mbuf_pool mpool_acl;
+#endif
static os_mempool_put_fn *transport_put_acl_from_ll_cb;
@@ -134,6 +136,7 @@ ble_transport_alloc_evt(int discardable)
struct os_mbuf *
ble_transport_alloc_acl_from_hs(void)
{
+#if POOL_ACL_COUNT > 0
struct os_mbuf *om;
struct os_mbuf_pkthdr *pkthdr;
uint16_t usrhdr_len;
@@ -151,11 +154,15 @@ ble_transport_alloc_acl_from_hs(void)
}
return om;
+#else
+ return NULL;
+#endif
}
struct os_mbuf *
ble_transport_alloc_acl_from_ll(void)
{
+#if POOL_ACL_COUNT > 0
struct os_mbuf *om;
struct os_mbuf_pkthdr *pkthdr;
@@ -166,6 +173,9 @@ ble_transport_alloc_acl_from_ll(void)
}
return om;
+#else
+ return NULL;
+#endif
}
void
@@ -202,6 +212,7 @@ ble_transport_ipc_free(void *buf)
}
}
+#if POOL_ACL_COUNT > 0
static os_error_t
ble_transport_acl_put(struct os_mempool_ext *mpe, void *data, void *arg)
{
@@ -235,6 +246,7 @@ ble_transport_acl_put(struct os_mempool_ext *mpe, void *data, void *arg)
return err;
}
+#endif
void
ble_transport_init(void)
@@ -255,6 +267,7 @@ ble_transport_init(void)
pool_evt_lo_buf, "transport_pool_evt_lo");
SYSINIT_PANIC_ASSERT(rc == 0);
+#if POOL_ACL_COUNT > 0
rc = os_mempool_ext_init(&pool_acl, POOL_ACL_COUNT, POOL_ACL_SIZE,
pool_acl_buf, "transport_pool_acl");
SYSINIT_PANIC_ASSERT(rc == 0);
@@ -264,6 +277,7 @@ ble_transport_init(void)
SYSINIT_PANIC_ASSERT(rc == 0);
pool_acl.mpe_put_cb = ble_transport_acl_put;
+#endif
}
int