Bluetooth: controller: Improve mem mngt of proc ctx

Move the mem_pool structure to the internal header for wider access.
Introduce a mem_pool owner in the proc_ctx, sch that multiple mem_pool
could be used for memory management of proc_ctx, also static 'foreign'
allocated proc_ctx would be supported by this.

Signed-off-by: Thomas Ebert Hansen <thoh@oticon.com>
This commit is contained in:
Thomas Ebert Hansen 2022-02-09 13:06:15 +01:00 committed by Carles Cufí
commit cecb12e9d9
2 changed files with 34 additions and 21 deletions

View file

@ -4,6 +4,12 @@
* SPDX-License-Identifier: Apache-2.0
*/
/* LLCP Memory Pool Descriptor */
struct llcp_mem_pool {
void *free;
uint8_t *pool;
};
/* LLCP Procedure */
enum llcp_proc {
PROC_UNKNOWN,
@ -114,6 +120,9 @@ struct proc_ctx {
/* Must be the first for sys_slist to work */
sys_snode_t node;
/* llcp_mem_pool owner of this context */
struct llcp_mem_pool *owner;
/* PROC_ */
enum llcp_proc proc;
@ -335,6 +344,7 @@ struct proc_ctx *llcp_create_remote_procedure(enum llcp_proc proc);
bool llcp_tx_alloc_peek(struct ll_conn *conn, struct proc_ctx *ctx);
void llcp_tx_alloc_unpeek(struct proc_ctx *ctx);
struct node_tx *llcp_tx_alloc(struct ll_conn *conn, struct proc_ctx *ctx);
void llcp_proc_ctx_release(struct proc_ctx *ctx);
/*
* ULL -> LLL Interface
@ -571,7 +581,6 @@ void llcp_pdu_encode_conn_param_rsp(struct proc_ctx *ctx, struct pdu_data *pdu);
void llcp_pdu_decode_conn_param_rsp(struct proc_ctx *ctx, struct pdu_data *pdu);
void llcp_pdu_encode_conn_update_ind(struct proc_ctx *ctx, struct pdu_data *pdu);
void llcp_pdu_decode_conn_update_ind(struct proc_ctx *ctx, struct pdu_data *pdu);
void llcp_proc_ctx_release(struct proc_ctx *ctx);
/*
* Remote Channel Map Update Procedure Helper