zephyr/subsys
Piotr Pryga e84cabf0d4 Bluetooth: Controller: fix mayfly unwanted re-init every bt_enable call
Mayfly by design uses a memq for storage of its jobs. The memq
requires head and tail to track the content. It is considered
empty is head equals tail.

When memq instance is initialized then there is a new link
instance stored in head and tail, nevertheless the memq is
still empty.

When new job is enqueued to a memq, the inilial link is used
to store the job. New link, provided by enqueue call, is stored
in the tail for future enqueue.

When enqueued job was served and is dequeued, the link it was
assigned to is returned and stored in the job object.
That link will be used in future for call to enqueue.

Now lets consider a situation when we are just after initalization.
Some default initial link is in empty memq. We enqueue and dequeue
a job. After dequeue, the job object stores the initial link object.
The one that was put into the memq during initialization.
Next Bluetooth stack is disabled and enabled again.

The job is enqueued again, but it still stores the initial link
address. After enqueue the memq head points to initial link object,
that stores new job. Tail points to link deliveded by enqueue call,
that is also the initial link object. The memq is considered to be
empty, nevertheless there was a successful enqueue operation.

The issue is casued by lack of re-initialization of a job object
on init. In most cases these objects are static members of some
functions, hence there is no re-initialization after bt_disable
and bt_enable calls.

The problem is fixed by re-initialization of mayfly only once
on bt_enable() call. Then it doesn't matter what links are stored
in dequeued objects and there is no need to re-initialized mayfly
job objects.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2022-07-13 16:13:57 +02:00
..
bluetooth Bluetooth: Controller: fix mayfly unwanted re-init every bt_enable call 2022-07-13 16:13:57 +02:00
canbus subsystems: migrate includes to <zephyr/...> 2022-05-09 12:07:35 +02:00
console subsystems: migrate includes to <zephyr/...> 2022-05-09 12:07:35 +02:00
cpp cpp: Include additional contents in <cstddef> 2022-06-23 09:12:33 +02:00
debug debug: coredump: flash backend: add query/command to get raw data 2022-07-11 18:04:05 +00:00
demand_paging subsystems: migrate includes to <zephyr/...> 2022-05-09 12:07:35 +02:00
dfu subsystems: migrate includes to <zephyr/...> 2022-05-09 12:07:35 +02:00
disk subsystems: migrate includes to <zephyr/...> 2022-05-09 12:07:35 +02:00
emul emul: emul_bmi160: Remove unused struct element 2022-07-12 10:14:23 +02:00
fb scripts: move gen_cfb_font_header.py to scripts/build 2022-07-12 10:03:45 +02:00
fs fs/testsuite: add mising braces to single line if statements 2022-07-06 11:00:45 -04:00
ipc ipc_service: static_vrings: Fix TX virtqueue alignment 2022-07-06 11:03:04 +02:00
jwt subsystems: migrate includes to <zephyr/...> 2022-05-09 12:07:35 +02:00
logging logging: Prevent redundant thread wake up 2022-07-11 18:05:35 +00:00
lorawan lorawan: move REQUIRES_FULL_LIBC dependency 2022-07-02 14:16:18 +02:00
mgmt mgmt: hawkbit: fix call to bin2hex 2022-07-11 10:30:05 +02:00
modbus modbus: use DT_INST_PARENT instead of DT_INST_BUS 2022-07-13 11:36:59 +02:00
net drivers: net: canbus: move CAN bus network driver to drivers/net 2022-07-13 10:34:51 +02:00
pm pm: device_runtime: detect power up failures 2022-07-12 10:07:18 +02:00
portability subsystems: migrate includes to <zephyr/...> 2022-05-09 12:07:35 +02:00
random subsystems: migrate includes to <zephyr/...> 2022-05-09 12:07:35 +02:00
rtio rtio: Low (Memory) Cost Concurrent scheduler 2022-06-28 13:53:13 -04:00
sd sd: add proper handling for DISK_IOCTL_CTRL_SYNC 2022-07-04 14:25:33 +00:00
settings treewide: update flash_area name retrieval 2022-07-02 16:04:16 +02:00
shell Shell: kernel: Add runtime log filtering command 2022-07-12 12:24:43 +02:00
stats subsystems: migrate includes to <zephyr/...> 2022-05-09 12:07:35 +02:00
storage storage: flash_map: handle disabled flash nodes 2022-07-04 10:28:41 +02:00
task_wdt include: add more missing zephyr/ prefixes 2022-05-27 15:20:27 -07:00
testsuite ztest: generate symbols for tests 2022-07-11 11:56:39 +02:00
timing subsystems: migrate includes to <zephyr/...> 2022-05-09 12:07:35 +02:00
tracing samples: subsys: tracing: No tracing during switch in/out using EFI console 2022-07-05 16:52:32 -04:00
usb usb: device: add dummy configure API 2022-07-13 11:36:59 +02:00
CMakeLists.txt rtio: Real-Time Input/Output Stream 2022-06-28 13:53:13 -04:00
Kconfig rtio: Real-Time Input/Output Stream 2022-06-28 13:53:13 -04:00