zephyr/include/drivers
Joakim Andersson 4be66bd33d Bluetooth: Fix host RX thread deadlock
Fix host RX thread being deadlocked. The deadlock occurs because the
RX thread is stuck waiting in conn_tx_alloc with K_FOREVER but if the
connection is disconnected only the RX thread can unblock it in the
handling of the disconnect event.

This commit fixes this deadlock by splitting the processing of the
disconnected event into two parts.
The part needed to unblock the RX is to release resources held by
unack'ed TX packets and mark the connection state as not connected
anymore.
The RX thread waiting for free_tx fifo and the TX thread waiting for
the bt_dev.le.pkts semaphore will both check the connected state after
having acquired them and will abort if disconnected.
The rest of the processing will be handled at normal RX thread
priority like normal.

Move the bt_recv_prio handling to the Bluetooth host when the host
has defined its own RX thread (CONFIG_BT_RECV_IS_RX_THREAD=n).
If the HCI driver has the RX thread (CONFIG_BT_RECV_IS_RX_THREAD=y),
then the responsibility to call bt_recv and bt_recv_prio correctly
falls to the HCI driver.
The helper function bt_hci_evt_is_prio() is replaced with
bt_hci_evt_get_flags() so that the HCI driver can do this correctly.
This decision to replace was made so that existing HCI drivers
maintained out-of-tree will fail at compile time with the new system.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>

Bluetooth: host: Move bt_recv_prio to host when RX thread is defined

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-07-06 11:15:39 +02:00
..
adc zephyr: replace zephyr integer types with C99 types 2020-06-08 08:23:57 -05:00
bluetooth Bluetooth: Fix host RX thread deadlock 2020-07-06 11:15:39 +02:00
clock_control zephyr: replace zephyr integer types with C99 types 2020-06-08 08:23:57 -05:00
console zephyr: replace zephyr integer types with C99 types 2020-06-08 08:23:57 -05:00
gpio zephyr: replace zephyr integer types with C99 types 2020-06-08 08:23:57 -05:00
i2c/slave zephyr: replace zephyr integer types with C99 types 2020-06-08 08:23:57 -05:00
ieee802154 zephyr: replace zephyr integer types with C99 types 2020-06-08 08:23:57 -05:00
interrupt_controller drivers: interrupt_controller: Add gicv3 SGI api 2020-07-01 08:02:57 -04:00
led zephyr: replace zephyr integer types with C99 types 2020-06-08 08:23:57 -05:00
pcie pcie: endpoint: Add public API to register reset interrupt callback 2020-06-22 12:44:54 +02:00
rtc zephyr: replace zephyr integer types with C99 types 2020-06-08 08:23:57 -05:00
sensor zephyr: replace zephyr integer types with C99 types 2020-06-08 08:23:57 -05:00
timer zephyr: replace zephyr integer types with C99 types 2020-06-08 08:23:57 -05:00
usb zephyr: replace zephyr integer types with C99 types 2020-06-08 08:23:57 -05:00
adc.h zephyr: replace zephyr integer types with C99 types 2020-06-08 08:23:57 -05:00
can.h zephyr: replace zephyr integer types with C99 types 2020-06-08 08:23:57 -05:00
clock_control.h zephyr: replace zephyr integer types with C99 types 2020-06-08 08:23:57 -05:00
counter.h zephyr: replace zephyr integer types with C99 types 2020-06-08 08:23:57 -05:00
dac.h zephyr: replace zephyr integer types with C99 types 2020-06-08 08:23:57 -05:00
display.h zephyr: replace zephyr integer types with C99 types 2020-06-08 08:23:57 -05:00
dma.h dma: add support for MCUX EDMA 2020-06-12 13:03:28 -05:00
eeprom.h scripts: Replace hard-coded subsystem list with __subsystem annotations. 2020-03-11 17:13:39 +02:00
entropy.h zephyr: replace zephyr integer types with C99 types 2020-06-08 08:23:57 -05:00
espi.h drivers: espi: Add support for ACPI_EC1 interface 2020-06-25 17:05:43 -04:00
flash.h drivers/flash: Move write_block_size into flash_parameters 2020-06-22 14:35:03 +02:00
gna.h zephyr: replace zephyr integer types with C99 types 2020-06-08 08:23:57 -05:00
gpio.h gpio: remove deprecated API functions/macros 2020-06-16 19:13:05 +02:00
hwinfo.h zephyr: replace zephyr integer types with C99 types 2020-06-08 08:23:57 -05:00
i2c.h zephyr: replace zephyr integer types with C99 types 2020-06-08 08:23:57 -05:00
i2s.h zephyr: replace zephyr integer types with C99 types 2020-06-08 08:23:57 -05:00
ipm.h zephyr: replace zephyr integer types with C99 types 2020-06-08 08:23:57 -05:00
kscan.h zephyr: replace zephyr integer types with C99 types 2020-06-08 08:23:57 -05:00
led_strip.h zephyr: replace zephyr integer types with C99 types 2020-06-08 08:23:57 -05:00
led.h zephyr: replace zephyr integer types with C99 types 2020-06-08 08:23:57 -05:00
lora.h zephyr: replace zephyr integer types with C99 types 2020-06-08 08:23:57 -05:00
peci.h zephyr: replace zephyr integer types with C99 types 2020-06-08 08:23:57 -05:00
pinmux.h zephyr: replace zephyr integer types with C99 types 2020-06-08 08:23:57 -05:00
ps2.h zephyr: replace zephyr integer types with C99 types 2020-06-08 08:23:57 -05:00
pwm.h drivers: pwm: clarify behavior 2020-06-09 18:12:53 +02:00
sensor.h drivers: sensor: add api function for getting a sensor attribute 2020-06-17 17:13:14 +02:00
spi.h drivers: spi: CS configuration through devicetree 2020-07-01 16:40:03 -05:00
uart.h drivers: uart: RX_RDY after rx_disable 2020-06-16 19:11:57 +02:00
video-controls.h drivers: Add video API 2019-10-25 15:13:53 -05:00
video.h zephyr: replace zephyr integer types with C99 types 2020-06-08 08:23:57 -05:00
watchdog.h zephyr: replace zephyr integer types with C99 types 2020-06-08 08:23:57 -05:00