zephyrproject-rtos / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
10.16k stars 6.23k forks source link

RFC: Bluetooth: Require the use of `struct bt_l2cap_chan` for all EATT-related operations #68107

Open carlescufi opened 5 months ago

carlescufi commented 5 months ago

The goal of this proposal is to give the application full control over traffic and operations on multiple dynamic L2CAP channels that are acting as ATT bearers (i.e. connecting to the 0x0027 SPSM). This requires the use of struct bt_l2cap_chan as an identifier on all of these operations and callbacks/app notifications (i.e. both ways).

Additionally, consider restructuring the different L2CAP channel structure so that it reflects the spec and the nature of L2CAP, and not necessarily BR/EDR and LE. For example, consider having an struct l2cap_fixed_chan and struct l2cap_dyn_chan.

carlescufi commented 5 months ago

https://gist.github.com/carlescufi/11e5a429a705864e42f247d585a14c4b

Thalley commented 3 months ago

One thing not discussed here is that the ATT implementation has a synchronous callback structure, meaning that any request will send a response before handling the next request.

One of the purposes of EATT was to support multiple requests simultaneously, which we won't be able to do with the current callback-based implementation. To properly support EATT we need multiple threads (one for each bearer) or a asynchronous approach to sending responses.

jori-nordic commented 3 months ago

I would obviously vote for an async approach, with the application allocating the working memory, and any other resources for the req/rsp.

Thalley commented 3 months ago

I would obviously vote for an async approach, with the application allocating the working memory, and any other resources for the req/rsp.

Yes please :)