Skip to content

Commit bdaa7ba

Browse files
committed
Bluetooth: Controller: Allow multiple ctrl pkt enqueue
Scale the ctrl pkt enqueue implementation to allow multiple ctrl packets to be enqueued. This will aid in the graceful implementation of parallel control procedure collisions. Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
1 parent cff44ea commit bdaa7ba

File tree

1 file changed

+18
-11
lines changed
  • subsys/bluetooth/controller/ll_sw

1 file changed

+18
-11
lines changed

subsys/bluetooth/controller/ll_sw/ctrl.c

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6440,6 +6440,21 @@ static struct pdu_data *empty_tx_enqueue(struct connection *conn)
64406440
return pdu_data_tx;
64416441
}
64426442

6443+
static void ctrl_tx_enqueue_tail(struct connection *conn,
6444+
struct radio_pdu_node_tx *node_tx)
6445+
{
6446+
struct radio_pdu_node_tx *p;
6447+
6448+
/* TODO: optimise by having a ctrl_last member. */
6449+
p = conn->pkt_tx_ctrl;
6450+
while (p->next != conn->pkt_tx_data) {
6451+
p = p->next;
6452+
}
6453+
6454+
node_tx->next = p->next;
6455+
p->next = node_tx;
6456+
}
6457+
64436458
static void ctrl_tx_enqueue(struct connection *conn,
64446459
struct radio_pdu_node_tx *node_tx)
64456460
{
@@ -6468,16 +6483,12 @@ static void ctrl_tx_enqueue(struct connection *conn,
64686483
/* if no ctrl packet already queued, new ctrl added will be
64696484
* the ctrl pointer and is inserted after head.
64706485
*/
6471-
if (conn->pkt_tx_ctrl == 0) {
6486+
if (!conn->pkt_tx_ctrl) {
64726487
node_tx->next = conn->pkt_tx_head->next;
64736488
conn->pkt_tx_head->next = node_tx;
64746489
conn->pkt_tx_ctrl = node_tx;
64756490
} else {
6476-
/* TODO support for more than 2 pending ctrl packets. */
6477-
LL_ASSERT(conn->pkt_tx_ctrl->next == conn->pkt_tx_data);
6478-
6479-
node_tx->next = conn->pkt_tx_ctrl->next;
6480-
conn->pkt_tx_ctrl->next = node_tx;
6491+
ctrl_tx_enqueue_tail(conn, node_tx);
64816492
}
64826493
} else {
64836494
/* No packet needing ACK. */
@@ -6490,11 +6501,7 @@ static void ctrl_tx_enqueue(struct connection *conn,
64906501
conn->pkt_tx_head = node_tx;
64916502
conn->pkt_tx_ctrl = node_tx;
64926503
} else {
6493-
/* TODO support for more than 2 pending ctrl packets. */
6494-
LL_ASSERT(conn->pkt_tx_ctrl->next == conn->pkt_tx_data);
6495-
6496-
node_tx->next = conn->pkt_tx_ctrl->next;
6497-
conn->pkt_tx_ctrl->next = node_tx;
6504+
ctrl_tx_enqueue_tail(conn, node_tx);
64986505
}
64996506
}
65006507

0 commit comments

Comments
 (0)