Bluetooth: Offload bt_recv to fiber if run from task

Task can be preempted and bt_recv is expected to be atomic. Since
on microkernel with TinyCrypt ECC enabled this can be called from
task context we need to make it run in critical section.

Change-Id: I24414e8d98b0dfe8affc18058eb164ba0cba7b17
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
This commit is contained in:
Szymon Janc 2016-05-24 18:01:10 +02:00
parent 684ffd1e23
commit 7a82d7f661

View file

@ -3027,6 +3027,12 @@ int bt_recv(struct net_buf *buf)
{
struct bt_hci_evt_hdr *hdr;
#if defined(CONFIG_MICROKERNEL)
if (sys_execution_context_type_get() == NANO_CTX_TASK) {
return task_offload_to_fiber(bt_recv, buf);
}
#endif /* CONFIG_MICROKERNEL */
bt_monitor_send(bt_monitor_opcode(buf), buf->data, buf->len);
BT_DBG("buf %p len %u", buf, buf->len);