all/mpbthciport.c: Don't restart BLE polling if already running. #17264
+40
−5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
When nimble stack schedules a reset (ble_hs_reset) it's handled in
mp_bluetooth_nimble_os_eventq_run_all()
which itself is run inmp_bluetooth_hci_poll()
.The stack reset process starts with running
mp_bluetooth_hci_uart_deinit
thenmp_bluetooth_hci_uart_init
. The init function ends withmp_bluetooth_hci_start_polling();
which brings us to this PR, a C scheduled hci poll can result in a re-schedule of itself in the event of a stack reset (failure / non-resonse detected from radio).This was first discovered in #17246
Testing
This has been tested on a stm32wb55 with the radio firware wiped so the nimble stack continually attempts to re-init the hci connection.
Trade-offs and Alternatives
This issue can also be avoided with the C scheduler loop break first proposed in af4a8e9