From 2b410afac179635ac5df0812188630bbcec5289a Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Fri, 16 Dec 2016 21:29:52 +0200 Subject: [PATCH] Bluetooth: Fix priority event buffer availability when ECC is used The ECC emulation synthesizes its own HCI events so we may need up to two available priority buffers at any point in time. Change-Id: I88b37c7e9e9f64483d80cde9243470a7f0477321 Signed-off-by: Johan Hedberg --- subsys/bluetooth/host/hci_core.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/subsys/bluetooth/host/hci_core.c b/subsys/bluetooth/host/hci_core.c index 9add8cd44ce..afb44fe31d4 100644 --- a/subsys/bluetooth/host/hci_core.c +++ b/subsys/bluetooth/host/hci_core.c @@ -130,10 +130,17 @@ NET_BUF_POOL_DEFINE(hci_evt_pool, CONFIG_BLUETOOTH_HCI_EVT_COUNT, * This priority pool is to handle HCI events that must not be dropped * (currently this is Command Status, Command Complete and Number of * Complete Packets) if running low on buffers. Buffers from this pool are not - * allowed to be passed to RX thread and must be returned from bt_recv(). + * allowed to be passed to RX thread and must be returned from bt_recv(). Since + * the HCI ECC emulation is able to also allocate command status events + * we need to reserve one extra buffer for it. */ +#if defined(CONFIG_BLUETOOTH_TINYCRYPT_ECC) +NET_BUF_POOL_DEFINE(hci_evt_prio_pool, 2, BT_BUF_EVT_SIZE, + BT_BUF_USER_DATA_MIN, NULL); +#else NET_BUF_POOL_DEFINE(hci_evt_prio_pool, 1, BT_BUF_EVT_SIZE, BT_BUF_USER_DATA_MIN, NULL); +#endif #endif /* CONFIG_BLUETOOTH_HOST_BUFFERS */