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

[nrf fromtree] bluetooth: host: downstream bluetooth/buf.h API change #2353

Merged
merged 10 commits into from
Dec 20, 2024

Conversation

PavelVPV
Copy link
Contributor

PavelVPV added a commit to PavelVPV/sdk-nrf that referenced this pull request Dec 11, 2024
Update sdk-zephyr revision to pull in nrfconnect/sdk-zephyr#2353

Signed-off-by: Pavel Vasilyev <[email protected]>
alwa-nordic and others added 10 commits December 13, 2024 11:56
…GRESS`

Fix discrepancy in reference management between calls to
`bt_l2cap_chan_ops.recv` when the application returns `-EINPROGRESS`.

There are two call sites, `l2cap_chan_le_recv_sdu` and
`l2cap_chan_le_recv`, that were inconsistent.

`l2cap_chan_le_recv_sdu` moves the reference, and this patch updates
`l2cap_chan_le_recv` to do the same.

This behavior is also now documented.

This bug has existed since the introduction of this feature in
3151d26.

Signed-off-by: Aleksander Wasaznik <[email protected]>
(cherry picked from commit 200de7c)
…rror

For ease of development, we should log the event as an error.

Signed-off-by: Aleksander Wasaznik <[email protected]>
(cherry picked from commit 70ad45d)
…ol destroy

This is needed for a test to catch a double-free.

Signed-off-by: Aleksander Wasaznik <[email protected]>
(cherry picked from commit 5f89a6b)
…00_00_00_00_`

This is shorthand for random static addresses. It's similar to
`bt_addr_le_from_str`, but is a macro that results in an object literal,
making it more versatile and less verbose.

This macro only gives access to the first 255 random static addresses,
but this ought to be enough addresses for testing.

Signed-off-by: Aleksander Wasaznik <[email protected]>
(cherry picked from commit abeca24)
The test implementation is based on a copy of the HFC multilink test.
The test verifies that the stack respects the reference counting of SDU
buffers when the L2CAP -EINPROGRESS feature is used.

Signed-off-by: Aleksander Wasaznik <[email protected]>
(cherry picked from commit 47325f8)
…uide docs for 4.1

This introduces the release notes and migration guide for 4.1.0 earlier
than we typically do, so that people have a placeholder to start adding
content as they line up pull requests for 4.1.
The two documents are currently orphan and not visible from the main
documentation as this would confuse users of 4.0.

Signed-off-by: Benjamin Cabé <[email protected]>
(cherry picked from commit d342f9e)
Because the number of ACL RX buffers must be at least the number of
maximum connections plus one, increasing `CONFIG_BT_MAX_CONN` could
inadvertently lead to a build failure if the number of ACL RX buffers is
not also increased. This dependency may not be obvious to users.

To address this issue, this commit deprecates the
`CONFIG_BT_BUF_RX_COUNT` Kconfig symbol and computes the value in
`buf.h` using the new `BT_BUF_RX_COUNT` define. Note that the default
value and the minimum range value have been changed to 0 to "disable"
the option.

Additionally, to allow users to increase the number of ACL RX buffers,
this commit introduces the new `CONFIG_BT_BUF_RX_COUNT_EXTRA` Kconfig
symbol. The value of this symbol will be added to the computed value of
`BT_BUF_RX_COUNT`.

The configurations of tests and samples have been updated to reflect
these changes.

Signed-off-by: Théo Battrel <[email protected]>
(cherry picked from commit 66ff97e)
This allows to combine several types in a single value.

Signed-off-by: Pavel Vasilyev <[email protected]>
(cherry picked from commit bd9a1ce)
…pool

The Bluetooth data buffer API currently lacks a mechanism to notify when
a buffer is freed in the RX pool. This limitation forces HCI drivers to
adopt inefficient workarounds to manage buffer allocation.

HCI drivers face two suboptimal options:

- Blocking calls: Use bt_buf_get_rx with K_FOREVER, which blocks the
  execution context until a buffer becomes available.
- Polling: Repeatedly call bt_buf_get_rx with K_NO_WAIT, which increases
  CPU load and reduces efficiency.

This commit introduces a callback mechanism that is triggered each time
a buffer is freed in the RX pool. With this feature, HCI drivers can:

- Call bt_buf_get_rx with K_NO_WAIT.
- Wait for the callback notification if a NULL buffer is returned,
  avoiding unnecessary polling.

The new callback improves efficiency by enabling event-driven behavior
for buffer management, reducing CPU overhead while maintaining
responsiveness.

Signed-off-by: Pavel Vasilyev <[email protected]>
(cherry picked from commit c2488fd)
This commit adds a unit test that checks the freed buffer callback of
the bluetooth data buffer API.

Signed-off-by: Pavel Vasilyev <[email protected]>
(cherry picked from commit 0d06691)
@PavelVPV PavelVPV force-pushed the hci_driver_async_buf_get_downstream branch from bb327d7 to 13aed60 Compare December 13, 2024 10:56
PavelVPV added a commit to PavelVPV/sdk-nrf that referenced this pull request Dec 13, 2024
Update sdk-zephyr revision to pull in nrfconnect/sdk-zephyr#2353

Signed-off-by: Pavel Vasilyev <[email protected]>
@jukkar jukkar merged commit 7f8d857 into nrfconnect:main Dec 20, 2024
16 checks passed
@PavelVPV PavelVPV deleted the hci_driver_async_buf_get_downstream branch December 20, 2024 09:45
@PavelVPV PavelVPV restored the hci_driver_async_buf_get_downstream branch December 20, 2024 09:45
@PavelVPV PavelVPV deleted the hci_driver_async_buf_get_downstream branch December 20, 2024 09:46
PavelVPV added a commit to PavelVPV/sdk-nrf that referenced this pull request Dec 20, 2024
Update sdk-zephyr revision to pull in nrfconnect/sdk-zephyr#2353

Signed-off-by: Pavel Vasilyev <[email protected]>
PavelVPV added a commit to PavelVPV/sdk-nrf that referenced this pull request Dec 20, 2024
Update sdk-zephyr revision to pull in nrfconnect/sdk-zephyr#2353

Signed-off-by: Pavel Vasilyev <[email protected]>
rlubos pushed a commit to PavelVPV/sdk-nrf that referenced this pull request Jan 2, 2025
Update sdk-zephyr revision to pull in nrfconnect/sdk-zephyr#2353

Signed-off-by: Pavel Vasilyev <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants