Skip to content

Commit

Permalink
Bluetooth: controller: Refactor ull_conn_tx_ack function
Browse files Browse the repository at this point in the history
Refactor ull_conn_tx_ack function as it no longer needs to
return the connection context back to caller.

Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
  • Loading branch information
cvinayak authored and ioannisg committed Sep 28, 2020
1 parent 35c0b77 commit 0096fca
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 25 deletions.
12 changes: 1 addition & 11 deletions subsys/bluetooth/controller/ll_sw/ull.c
Original file line number Diff line number Diff line change
Expand Up @@ -1526,25 +1526,15 @@ static inline void rx_demux_conn_tx_ack(uint8_t ack_last, uint16_t handle,
#if !defined(CONFIG_BT_CTLR_LOW_LAT_ULL)
do {
#endif /* CONFIG_BT_CTLR_LOW_LAT_ULL */
struct ll_conn *conn;

/* Dequeue node */
ull_conn_ack_dequeue();

/* Process Tx ack */
conn = ull_conn_tx_ack(handle, link, node_tx);
ull_conn_tx_ack(handle, link, node_tx);

/* Release link mem */
ull_conn_link_tx_release(link);

/* De-mux 1 tx node from FIFO */
ull_conn_tx_demux(1);

/* Enqueue towards LLL */
if (conn) {
ull_conn_tx_lll_enqueue(conn, 1);
}

/* check for more rx ack */
link = ull_conn_ack_by_last_peek(ack_last, &handle, &node_tx);

Expand Down
22 changes: 10 additions & 12 deletions subsys/bluetooth/controller/ll_sw/ull_conn.c
Original file line number Diff line number Diff line change
Expand Up @@ -1386,43 +1386,41 @@ void ull_conn_lll_ack_enqueue(uint16_t handle, struct node_tx *tx)
MFIFO_ENQUEUE(conn_ack, idx);
}

struct ll_conn *ull_conn_tx_ack(uint16_t handle, memq_link_t *link,
struct node_tx *tx)
void ull_conn_tx_ack(uint16_t handle, memq_link_t *link, struct node_tx *tx)
{
struct ll_conn *conn = NULL;
struct pdu_data *pdu_tx;

pdu_tx = (void *)tx->pdu;
LL_ASSERT(pdu_tx->len);

if (pdu_tx->ll_id == PDU_DATA_LLID_CTRL) {
if (handle != 0xFFFF) {
conn = ll_conn_get(handle);
struct ll_conn *conn = ll_conn_get(handle);

ctrl_tx_ack(conn, &tx, pdu_tx);
}

/* release mem if points to itself */
/* release ctrl mem if points to itself */
if (link->next == (void *)tx) {

LL_ASSERT(link->next);

mem_release(tx, &mem_conn_tx_ctrl.free);
return conn;
return;
} else if (!tx) {
return conn;
/* Tx Node re-used to enqueue new ctrl PDU */
return;
} else {
LL_ASSERT(!link->next);
}
} else if (handle != 0xFFFF) {
conn = ll_conn_get(handle);
} else {
} else if (handle == 0xFFFF) {
pdu_tx->ll_id = PDU_DATA_LLID_RESV;
} else {
LL_ASSERT(handle != 0xFFFF);
}

ll_tx_ack_put(handle, tx);

return conn;
return;
}

uint8_t ull_conn_llcp_req(void *conn)
Expand Down
3 changes: 1 addition & 2 deletions subsys/bluetooth/controller/ll_sw/ull_conn_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ memq_link_t *ull_conn_ack_peek(uint8_t *ack_last, uint16_t *handle,
memq_link_t *ull_conn_ack_by_last_peek(uint8_t last, uint16_t *handle,
struct node_tx **tx);
void *ull_conn_ack_dequeue(void);
struct ll_conn *ull_conn_tx_ack(uint16_t handle, memq_link_t *link,
struct node_tx *tx);
void ull_conn_tx_ack(uint16_t handle, memq_link_t *link, struct node_tx *tx);
uint8_t ull_conn_llcp_req(void *conn);
void ull_conn_upd_curr_reset(void);

0 comments on commit 0096fca

Please sign in to comment.