Skip to content

Commit a3347a3

Browse files
committed
Bluetooth: Controller: Fix conn timeout due to delayed conn upd ind
Unlike legacy Zephyr Controller's double headed Tx queue linked list, the new split Zephyr Controller's new LLCP does not place a control PDU at the head of the Tx queue causing control PDUs to be delayed on air. Pause the data enqueue until pending PDUs are transmitted across before enqueuing LE Connection Update Ind PDU, and thereafter resume other PDUs being enqueued again. There can still be connection timeout if enqueued PDUs are not being transmitted/acked during repeated retransmissions. Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
1 parent 8c72e60 commit a3347a3

File tree

4 files changed

+22
-1
lines changed

4 files changed

+22
-1
lines changed

subsys/bluetooth/controller/ll_sw/ull_conn.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1478,6 +1478,21 @@ void ull_conn_tx_lll_enqueue(struct ll_conn *conn, uint8_t count)
14781478
}
14791479
}
14801480

1481+
uint16_t ull_conn_tx_enqueue_count_get(struct ll_conn *conn)
1482+
{
1483+
uint16_t count = 0;
1484+
memq_link_t *curr;
1485+
1486+
curr = memq_peek(conn->lll.memq_tx.head, conn->lll.memq_tx.tail, NULL);
1487+
while (curr != NULL) {
1488+
count++;
1489+
1490+
curr = memq_peek(curr->next, conn->lll.memq_tx.tail, NULL);
1491+
}
1492+
1493+
return count;
1494+
}
1495+
14811496
void ull_conn_link_tx_release(void *link)
14821497
{
14831498
mem_release(link, &mem_link_tx.free);

subsys/bluetooth/controller/ll_sw/ull_conn_internal.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ int ull_conn_llcp(struct ll_conn *conn, uint32_t ticks_at_expire,
3131
void ull_conn_done(struct node_rx_event_done *done);
3232
void ull_conn_tx_demux(uint8_t count);
3333
void ull_conn_tx_lll_enqueue(struct ll_conn *conn, uint8_t count);
34+
uint16_t ull_conn_tx_enqueue_count_get(struct ll_conn *conn);
3435
void ull_conn_link_tx_release(void *link);
3536
uint8_t ull_conn_ack_last_idx_get(void);
3637
memq_link_t *ull_conn_ack_peek(uint8_t *ack_last, uint16_t *handle,

subsys/bluetooth/controller/ll_sw/ull_llcp_conn_upd.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,9 @@ static void lp_cu_send_conn_update_ind_finalize(struct ll_conn *conn, struct pro
438438
static void lp_cu_send_conn_update_ind(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt,
439439
void *param)
440440
{
441-
if (llcp_lr_ispaused(conn) || !llcp_tx_alloc_peek(conn, ctx)) {
441+
if (llcp_lr_ispaused(conn) || !llcp_tx_alloc_peek(conn, ctx) ||
442+
ull_conn_tx_enqueue_count_get(conn) != 0U) {
443+
llcp_tx_pause_data(conn, LLCP_TX_QUEUE_PAUSE_DATA_CONN_UPD);
442444
ctx->state = LP_CU_STATE_WAIT_TX_CONN_UPDATE_IND;
443445
} else {
444446
/* ensure alloc of TX node, before possibly waiting for NTF node */
@@ -448,6 +450,7 @@ static void lp_cu_send_conn_update_ind(struct ll_conn *conn, struct proc_ctx *ct
448450
ctx->state = LP_CU_STATE_WAIT_NTF_AVAIL;
449451
} else {
450452
lp_cu_send_conn_update_ind_finalize(conn, ctx, evt, param);
453+
llcp_tx_resume_data(conn, LLCP_TX_QUEUE_PAUSE_DATA_CONN_UPD);
451454
}
452455
}
453456
}
@@ -459,6 +462,7 @@ static void lp_cu_st_wait_ntf_avail(struct ll_conn *conn, struct proc_ctx *ctx,
459462
case LP_CU_EVT_RUN:
460463
if (llcp_ntf_alloc_is_available()) {
461464
lp_cu_send_conn_update_ind_finalize(conn, ctx, evt, param);
465+
llcp_tx_resume_data(conn, LLCP_TX_QUEUE_PAUSE_DATA_CONN_UPD);
462466
}
463467
break;
464468
default:

subsys/bluetooth/controller/ll_sw/ull_llcp_internal.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ enum llcp_tx_q_pause_data_mask {
4747
LLCP_TX_QUEUE_PAUSE_DATA_PHY_UPDATE = 0x02,
4848
LLCP_TX_QUEUE_PAUSE_DATA_DATA_LENGTH = 0x04,
4949
LLCP_TX_QUEUE_PAUSE_DATA_TERMINATE = 0x08,
50+
LLCP_TX_QUEUE_PAUSE_DATA_CONN_UPD = 0x10,
5051
};
5152

5253
#if ((CONFIG_BT_CTLR_LLCP_COMMON_TX_CTRL_BUF_NUM <\

0 commit comments

Comments
 (0)