Skip to content

Commit 2ab1671

Browse files
cvinayakfabiobaltieri
authored andcommitted
Bluetooth: Controller: Introduce deferred ACL Tx packet transmission
Introduce deferred ACL Tx packet transmission setup by radio, so that an enqueued ACL Data packet can be transmitted with the shortest latency. Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
1 parent ba1def1 commit 2ab1671

File tree

4 files changed

+59
-1
lines changed

4 files changed

+59
-1
lines changed

subsys/bluetooth/controller/Kconfig.ll_sw_split

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,6 +1022,14 @@ config BT_CTLR_TX_RETRY_DISABLE
10221022
would happen in the next connection event instead of repeated retries
10231023
in the current connection event.
10241024

1025+
config BT_CTLR_TX_DEFER
1026+
bool "Deferred ACL Tx packet transmission setup"
1027+
select BT_CTLR_RADIO_TIMER_ISR
1028+
help
1029+
Enable deferred ACL Tx packet transmission setup by radio, so that an
1030+
enqueued ACL Data packet by the upper layer can be transmitted with
1031+
the shortest latency.
1032+
10251033
config BT_CTLR_THROUGHPUT
10261034
bool "Measure incoming Tx throughput"
10271035
help

subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,3 +109,6 @@
109109
#else /* For simulated targets there is no delay for the PPI task -> TIMER start */
110110
#define HAL_RADIO_TMR_START_DELAY_US 0U
111111
#endif
112+
113+
/* This is the minimum prepare duration required to setup radio for deferred transmission */
114+
#define HAL_RADIO_TMR_DEFERRED_TX_DELAY_US 50U

subsys/bluetooth/controller/ll_sw/nordic/lll/lll_conn.c

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,18 @@ static void isr_done(void *param);
4848
static inline int isr_rx_pdu(struct lll_conn *lll, struct pdu_data *pdu_data_rx,
4949
uint8_t *is_rx_enqueue,
5050
struct node_tx **tx_release, uint8_t *is_done);
51+
52+
#if defined(CONFIG_BT_CTLR_TX_DEFER)
53+
static void isr_tx_deferred_set(void *param);
54+
#endif /* CONFIG_BT_CTLR_TX_DEFER */
55+
5156
static void empty_tx_init(void);
57+
5258
#if defined(CONFIG_BT_CTLR_DF_CONN_CTE_RX)
5359
static inline bool create_iq_report(struct lll_conn *lll, uint8_t rssi_ready,
5460
uint8_t packet_status);
5561
#endif /* CONFIG_BT_CTLR_DF_CONN_CTE_RX */
62+
5663
#if defined(CONFIG_BT_CTLR_DF_CONN_CTE_TX)
5764
static struct pdu_data *get_last_tx_pdu(struct lll_conn *lll);
5865
#endif /* CONFIG_BT_CTLR_DF_CONN_CTE_TX */
@@ -365,7 +372,8 @@ void lll_conn_isr_rx(void *param)
365372
}
366373

367374
/* Decide on event continuation and hence Radio Shorts to use */
368-
is_done = is_done || ((crc_ok) && (pdu_data_rx->md == 0) &&
375+
is_done = is_done || ((crc_ok) &&
376+
(pdu_data_rx->md == 0) &&
369377
(pdu_data_tx->md == 0) &&
370378
(pdu_data_tx->len == 0));
371379

@@ -445,6 +453,22 @@ void lll_conn_isr_rx(void *param)
445453
LL_ASSERT(!radio_is_address());
446454
}
447455

456+
#if defined(CONFIG_BT_CTLR_TX_DEFER)
457+
if (!is_empty_pdu_tx_retry && (pdu_data_tx->len == 0U)) {
458+
uint32_t tx_defer_us;
459+
uint32_t defer_us;
460+
461+
/* Restore state if transmission setup for empty PDU */
462+
lll->empty = 0U;
463+
464+
/* Setup deferred tx packet set */
465+
tx_defer_us = radio_tmr_tifs_base_get() + EVENT_IFS_US -
466+
HAL_RADIO_TMR_DEFERRED_TX_DELAY_US;
467+
defer_us = radio_tmr_isr_set(tx_defer_us, isr_tx_deferred_set,
468+
param);
469+
}
470+
#endif /* CONFIG_BT_CTLR_TX_DEFER */
471+
448472
lll_conn_isr_rx_exit:
449473
/* Save the AA captured for the first Rx in connection event */
450474
if (!radio_tmr_aa_restore()) {
@@ -666,9 +690,11 @@ void lll_conn_isr_tx(void *param)
666690
}
667691

668692
#if defined(CONFIG_BT_CTLR_PROFILE_ISR) || \
693+
defined(CONFIG_BT_CTLR_TX_DEFER) || \
669694
defined(HAL_RADIO_GPIO_HAVE_PA_PIN)
670695
radio_tmr_end_capture();
671696
#endif /* CONFIG_BT_CTLR_PROFILE_ISR ||
697+
* CONFIG_BT_CTLR_TX_DEFER ||
672698
* HAL_RADIO_GPIO_HAVE_PA_PIN
673699
*/
674700

@@ -1125,6 +1151,25 @@ static inline int isr_rx_pdu(struct lll_conn *lll, struct pdu_data *pdu_data_rx,
11251151
return 0;
11261152
}
11271153

1154+
#if defined(CONFIG_BT_CTLR_TX_DEFER)
1155+
static void isr_tx_deferred_set(void *param)
1156+
{
1157+
struct pdu_data *pdu_data_tx;
1158+
struct lll_conn *lll;
1159+
1160+
/* Prepare Tx PDU, maybe we have non-empty PDU when we check here */
1161+
lll = param;
1162+
lll_conn_pdu_tx_prep(lll, &pdu_data_tx);
1163+
1164+
/* Fill sn and nesn */
1165+
pdu_data_tx->sn = lll->sn;
1166+
pdu_data_tx->nesn = lll->nesn;
1167+
1168+
/* setup the radio tx packet buffer */
1169+
lll_conn_tx_pkt_set(lll, pdu_data_tx);
1170+
}
1171+
#endif /* CONFIG_BT_CTLR_TX_DEFER */
1172+
11281173
static void empty_tx_init(void)
11291174
{
11301175
struct pdu_data *p;

subsys/bluetooth/controller/ll_sw/nordic/lll/lll_peripheral.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,9 +315,11 @@ static int prepare_cb(struct lll_prepare_param *p)
315315
#endif /* HAL_RADIO_GPIO_HAVE_LNA_PIN */
316316

317317
#if defined(CONFIG_BT_CTLR_PROFILE_ISR) || \
318+
defined(CONFIG_BT_CTLR_TX_DEFER) || \
318319
defined(HAL_RADIO_GPIO_HAVE_PA_PIN)
319320
radio_tmr_end_capture();
320321
#endif /* CONFIG_BT_CTLR_PROFILE_ISR ||
322+
* CONFIG_BT_CTLR_TX_DEFER ||
321323
* HAL_RADIO_GPIO_HAVE_PA_PIN
322324
*/
323325

0 commit comments

Comments
 (0)