Skip to content

Commit

Permalink
Bluetooth: Controller: Allow multiple ctrl pkt enqueue
Browse files Browse the repository at this point in the history
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 <vich@nordicsemi.no>
  • Loading branch information
cvinayak committed May 5, 2017
1 parent cff44ea commit bdaa7ba
Showing 1 changed file with 18 additions and 11 deletions.
29 changes: 18 additions & 11 deletions subsys/bluetooth/controller/ll_sw/ctrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -6440,6 +6440,21 @@ static struct pdu_data *empty_tx_enqueue(struct connection *conn)
return pdu_data_tx;
}

static void ctrl_tx_enqueue_tail(struct connection *conn,
struct radio_pdu_node_tx *node_tx)
{
struct radio_pdu_node_tx *p;

/* TODO: optimise by having a ctrl_last member. */
p = conn->pkt_tx_ctrl;
while (p->next != conn->pkt_tx_data) {
p = p->next;
}

node_tx->next = p->next;
p->next = node_tx;
}

static void ctrl_tx_enqueue(struct connection *conn,
struct radio_pdu_node_tx *node_tx)
{
Expand Down Expand Up @@ -6468,16 +6483,12 @@ static void ctrl_tx_enqueue(struct connection *conn,
/* if no ctrl packet already queued, new ctrl added will be
* the ctrl pointer and is inserted after head.
*/
if (conn->pkt_tx_ctrl == 0) {
if (!conn->pkt_tx_ctrl) {
node_tx->next = conn->pkt_tx_head->next;
conn->pkt_tx_head->next = node_tx;
conn->pkt_tx_ctrl = node_tx;
} else {
/* TODO support for more than 2 pending ctrl packets. */
LL_ASSERT(conn->pkt_tx_ctrl->next == conn->pkt_tx_data);

node_tx->next = conn->pkt_tx_ctrl->next;
conn->pkt_tx_ctrl->next = node_tx;
ctrl_tx_enqueue_tail(conn, node_tx);
}
} else {
/* No packet needing ACK. */
Expand All @@ -6490,11 +6501,7 @@ static void ctrl_tx_enqueue(struct connection *conn,
conn->pkt_tx_head = node_tx;
conn->pkt_tx_ctrl = node_tx;
} else {
/* TODO support for more than 2 pending ctrl packets. */
LL_ASSERT(conn->pkt_tx_ctrl->next == conn->pkt_tx_data);

node_tx->next = conn->pkt_tx_ctrl->next;
conn->pkt_tx_ctrl->next = node_tx;
ctrl_tx_enqueue_tail(conn, node_tx);
}
}

Expand Down

0 comments on commit bdaa7ba

Please sign in to comment.