Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drivers: bluetooth: hci: ipc: HCI IPC driver drops incoming ACL data #86091

Open
PavelVPV opened this issue Feb 20, 2025 · 2 comments · May be fixed by #86087
Open

drivers: bluetooth: hci: ipc: HCI IPC driver drops incoming ACL data #86091

PavelVPV opened this issue Feb 20, 2025 · 2 comments · May be fixed by #86087
Assignees
Labels
area: Bluetooth HCI Bluetooth HCI Driver area: Bluetooth Host Bluetooth Host (excluding BR/EDR) area: Bluetooth bug The issue is a bug, or the PR is fixing a bug

Comments

@PavelVPV
Copy link
Collaborator

Describe the bug
When building a bluetooth application for nRF5340 when Host and Controller are located application and network cores accordingly the HCI IPC driver is used to exchange HCI packets between network and application cores.

The HCI IPC driver is currently implemented in a way that it always expects a free buffer for the incoming (from Controller to Host) ACL data:

buf = bt_buf_get_rx(BT_BUF_ACL_IN, K_NO_WAIT);
if (buf) {
memcpy((void *)&hdr, data, sizeof(hdr));
data += sizeof(hdr);
remaining -= sizeof(hdr);
net_buf_add_mem(buf, &hdr, sizeof(hdr));
} else {
LOG_ERR("No available ACL buffers!");

I've implemented a test that sends notifications to a peer device over multiple EATT channels and makes the HCI IPC driver eventually drop the incoming ACL data. I put a PR with the test here: #85991

The test fails with and without CONFIG_BT_HCI_ACL_FLOW_CONTROL (see logs below).

The case with enabled CONFIG_BT_HCI_ACL_FLOW_CONTROL should be fixed by #83774 (if it gets merged).
The test fails with disabled CONFIG_BT_HCI_ACL_FLOW_CONTROL regardless of 83774 PR.

To Reproduce
To reproduce the dropped ACL data when CONFIG_BT_HCI_ACL_FLOW_CONTROL is enabled (if #83774 is not merged):

  1. Cherry-pick 2dd0b63 (the test commit from tests: bsim: bluetooth: host: add hci driver stress test #85991)
  2. Build tests/bsim/bluetooth/host/gatt/notify_stress for nrf5340bsim/nrf5340/cpuapp target.
  3. Observe No available ACL buffers! messages

To reproduce the dropped ACL data with CONFIG_BT_HCI_ACL_FLOW_CONTROL is disabled:

  1. Cherry-pick 2dd0b63 (the test commit from tests: bsim: bluetooth: host: add hci driver stress test #85991)
  2. Cherry-pick 0af5beb
  3. Build tests/bsim/bluetooth/host/gatt/notify_stress for nrf5340bsim/nrf5340/cpuapp target.
  4. Observe No available ACL buffers! messages

Expected behavior
The ACL data must never be dropped by an HCI driver.

Impact
A Bluetooth LE nRF5340 device using ACL data.

Logs and console output
The output from the test when CONFIG_BT_HCI_ACL_FLOW_CONTROL is enabled (run here: https://github.com/zephyrproject-rtos/zephyr/actions/runs/13421908610/job/37496285461?pr=85991):

...
d_00: @00:00:01.314845  (CPU:0): [00:00:01.314,819] <err> bt_hci_driver: No available ACL buffers!
d_00: @00:00:02.312836  (CPU:0): [00:00:02.312,835] <err> bt_conn: Unexpected first L2CAP frame
...

The output from the test when CONFIG_BT_HCI_ACL_FLOW_CONTROL is disabled:

...
d_01: @00:00:01.309167  (CPU:0): Notifications enabled
d_01: @00:00:01.309388  (CPU:0): Sent notification #0 with length 60
d_01: @00:00:01.309388  (CPU:0): Sent notification #1 with length 60
d_01: @00:00:01.309388  (CPU:0): Sent notification #2 with length 60
d_01: @00:00:01.309388  (CPU:0): Sent notification #3 with length 60
d_01: @00:00:01.309388  (CPU:0): Sent notification #4 with length 60
d_01: @00:00:01.309388  (CPU:0): Sent notification #5 with length 60
d_01: @00:00:01.309388  (CPU:0): Sent notification #6 with length 60
d_01: @00:00:01.309388  (CPU:0): Sent notification #7 with length 60
d_01: @00:00:01.309388  (CPU:0): Sent notification #8 with length 60
d_01: @00:00:01.309388  (CPU:0): Sent notification #9 with length 60
d_01: @00:00:01.309388  (CPU:0): Sent notification #10 with length 60
d_01: @00:00:01.309388  (CPU:0): Sent notification #11 with length 60
d_01: @00:00:01.309388  (CPU:0): Sent notification #12 with length 60
d_01: @00:00:01.309388  (CPU:0): Sent notification #13 with length 60
d_00: @00:00:01.310073  (CPU:0): Subscribed to long characteristic
d_01: @00:00:01.310303  (CPU:0): Sent notification #14 with length 60
d_01: @00:00:01.311019  (CPU:0): Sent notification #15 with length 60
d_00: @00:00:01.311036  (CPU:0): Subscribed
d_00: @00:00:01.312817  (CPU:0): Received notification #0 with length 60
d_00: @00:00:01.324373  (CPU:0): [00:00:01.324,371] <err> bt_hci_driver: No available ACL buffers!
d_00: @00:00:01.324985  (CPU:0): [00:00:01.324,981] <err> bt_hci_driver: No available ACL buffers!
d_00: @00:00:01.325693  (CPU:0): [00:00:01.325,683] <err> bt_hci_driver: No available ACL buffers!
d_00: @00:00:01.326401  (CPU:0): [00:00:01.326,385] <err> bt_hci_driver: No available ACL buffers!
d_00: @00:00:01.327013  (CPU:0): [00:00:01.326,995] <err> bt_hci_driver: No available ACL buffers!
...

Environment (please complete the following information):

  • OS: Linux
  • Toolchain: Zephyr SDK 0.16.8
  • Commit SHA or Version used: 059e86f
@PavelVPV PavelVPV added bug The issue is a bug, or the PR is fixing a bug area: Bluetooth area: Bluetooth Host Bluetooth Host (excluding BR/EDR) labels Feb 20, 2025
@PavelVPV PavelVPV added the area: Bluetooth HCI Bluetooth HCI Driver label Feb 20, 2025
@PavelVPV
Copy link
Collaborator Author

A proposed workaround to prevent HCI IPC driver drop packets: #86087

@PavelVPV
Copy link
Collaborator Author

If #83774 gets merged, I propose to prevent building HCI IPC driver and hci_ipc sample without CONFIG_BT_HCI_ACL_FLOW_CONTROL: #86005

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Bluetooth HCI Bluetooth HCI Driver area: Bluetooth Host Bluetooth Host (excluding BR/EDR) area: Bluetooth bug The issue is a bug, or the PR is fixing a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants