L2CAP functions simplification [WIP] #1849
Open
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.
This PR is related to #1846. These were the thoughts during gatt offset research.
One of the concerns is unnecessary (as it seems to me) arguments passed down the line to functions. It confuses a little about real dependencies.
The idea behind joining
ble_l2cap_parse_hdr
andos_mbuf_adj
is to make it similar toble_hs_hci_util_data_hdr_strip
, asble_l2cap_parse_hdr
is not used anywhere outside the function.The main concern is that
ble_l2cap_rx
andble_l2cap_rx_payload
besides business logic are messing with mbuf processing and other "infrastructure" stuff. Mixing logic from different layers of abstraction. This functions would be simpler if they just did l2cap processing and returning error codes immediately and the caller made cleaning and processing. Soble_hs_hci_evt_acl_process
could clean the buffer as it already does, also schedule a timer on l2cap fragments as it already knows about fragments in the switch block.