Skip to content

Commit 7417e6e

Browse files
cvinayakaescolar
authored andcommitted
Bluetooth: controller: split: conn handle invalidation on release
Move invalidation of connection handle to connection context release done on release of terminate rx node. Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
1 parent d3e3f8d commit 7417e6e

File tree

2 files changed

+17
-10
lines changed

2 files changed

+17
-10
lines changed

subsys/bluetooth/controller/ll_sw/ull.c

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -818,16 +818,29 @@ void ll_rx_mem_release(void **node_rx)
818818
case NODE_RX_TYPE_TERMINATE:
819819
{
820820
struct ll_conn *conn;
821+
struct lll_conn *lll;
821822
memq_link_t *link;
822823

824+
/* Get the connection context */
823825
conn = ll_conn_get(rx_free->handle);
826+
lll = &conn->lll;
824827

825-
LL_ASSERT(!conn->lll.link_tx_free);
826-
link = memq_deinit(&conn->lll.memq_tx.head,
827-
&conn->lll.memq_tx.tail);
828+
/* Invalidate the connection context */
829+
lll->handle = 0xFFFF;
830+
831+
/* Demux and flush Tx PDUs that remain enqueued in
832+
* thread context
833+
*/
834+
ull_conn_tx_demux(UINT8_MAX);
835+
836+
/* De-initialize tx memq and release the used link */
837+
LL_ASSERT(!lll->link_tx_free);
838+
link = memq_deinit(&lll->memq_tx.head,
839+
&lll->memq_tx.tail);
828840
LL_ASSERT(link);
829-
conn->lll.link_tx_free = link;
841+
lll->link_tx_free = link;
830842

843+
/* Release the connection context to free pool */
831844
ll_conn_release(conn);
832845
}
833846
break;

subsys/bluetooth/controller/ll_sw/ull_conn.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1713,9 +1713,6 @@ static void conn_cleanup(struct ll_conn *conn, u8_t reason)
17131713
ticker_op_stop_cb, (void *)lll);
17141714
LL_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) ||
17151715
(ticker_status == TICKER_STATUS_BUSY));
1716-
1717-
/* Demux and flush Tx PDUs that remain enqueued in thread context */
1718-
ull_conn_tx_demux(UINT8_MAX);
17191716
}
17201717

17211718
static void tx_ull_flush(struct ll_conn *conn)
@@ -1743,9 +1740,6 @@ static void tx_lll_flush(void *param)
17431740

17441741
lll_conn_flush(lll);
17451742

1746-
/* Invalidate the connection context */
1747-
lll->handle = 0xFFFF;
1748-
17491743
link = memq_dequeue(lll->memq_tx.tail, &lll->memq_tx.head,
17501744
(void **)&tx);
17511745
while (link) {

0 commit comments

Comments
 (0)