Bluetooth: Controller: Release LLL scheduling aux on incomplete data

Add implementation to release Auxiliary Context on failure
to receive auxiliary chain being in LLL scheduling.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
This commit is contained in:
Vinayak Kariappa Chettimada 2021-08-03 05:59:29 +05:30 committed by Carles Cufí
parent 48ee84ffda
commit 2feffaf719
6 changed files with 68 additions and 8 deletions

View File

@ -222,6 +222,7 @@ enum node_rx_type {
NODE_RX_TYPE_EXT_2M_REPORT,
NODE_RX_TYPE_EXT_CODED_REPORT,
NODE_RX_TYPE_EXT_AUX_REPORT,
NODE_RX_TYPE_EXT_AUX_RELEASE,
NODE_RX_TYPE_EXT_SCAN_TERMINATE,
NODE_RX_TYPE_SYNC,
NODE_RX_TYPE_SYNC_REPORT,

View File

@ -912,6 +912,22 @@ static void isr_done_cleanup(void *param)
#if defined(CONFIG_BT_CTLR_ADV_EXT)
struct event_done_extra *extra;
struct lll_scan *lll;
lll = param;
if (lll->is_aux_sched) {
struct node_rx_pdu *node_rx;
node_rx = ull_pdu_rx_alloc();
LL_ASSERT(node_rx);
node_rx->hdr.type = NODE_RX_TYPE_EXT_AUX_RELEASE;
node_rx->hdr.rx_ftr.param = lll;
ull_rx_put(node_rx->hdr.link, node_rx);
ull_rx_sched();
}
extra = ull_event_done_extra_get();
LL_ASSERT(extra);

View File

@ -653,10 +653,21 @@ isr_rx_do_close:
if (lll_aux) {
radio_isr_set(isr_done, lll_aux);
} else {
/* TODO: Send message to flush Auxiliary PDU list */
/* Send message to flush Auxiliary PDU list */
if (err != -ECANCELED) {
LL_ASSERT(0);
struct node_rx_pdu *node_rx;
node_rx = ull_pdu_rx_alloc();
LL_ASSERT(node_rx);
node_rx->hdr.type = NODE_RX_TYPE_EXT_AUX_RELEASE;
node_rx->hdr.rx_ftr.param = lll;
ull_rx_put(node_rx->hdr.link, node_rx);
ull_rx_sched();
}
radio_isr_set(lll_scan_isr_resume, lll);
}
radio_disable();

View File

@ -2346,6 +2346,13 @@ static inline int rx_demux_rx(memq_link_t *link, struct node_rx_hdr *rx)
ull_scan_aux_setup(link, rx);
}
break;
case NODE_RX_TYPE_EXT_AUX_RELEASE:
{
memq_dequeue(memq_ull_rx.tail, &memq_ull_rx.head, NULL);
ull_scan_aux_release(link, rx);
}
break;
#endif /* CONFIG_BT_CTLR_ADV_EXT */
#endif /* CONFIG_BT_OBSERVER */

View File

@ -162,6 +162,8 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_hdr *rx)
if (scan) {
/* Here we are scanner context */
sync = sync_create_get(scan);
/* Generate report based on PHY scanned */
switch (phy) {
case PHY_1M:
rx->type = NODE_RX_TYPE_EXT_1M_REPORT;
@ -492,6 +494,26 @@ struct ll_scan_aux_set *ull_scan_aux_is_valid_get(struct ll_scan_aux_set *aux)
return aux;
}
void ull_scan_aux_release(memq_link_t *link, struct node_rx_hdr *rx)
{
struct lll_scan_aux *lll_aux;
struct ll_scan_aux_set *aux;
struct lll_scan *lll;
lll = rx->rx_ftr.param;
lll_aux = lll->lll_aux;
if (lll_aux) {
aux = HDR_LLL2ULL(lll_aux);
flush(aux, NULL);
}
/* Mark for buffer for release */
rx->type = NODE_RX_TYPE_RELEASE;
ll_rx_put(link, rx);
ll_rx_sched();
}
static int init_reset(void)
{
/* Initialize adv aux pool. */

View File

@ -40,6 +40,9 @@ uint8_t ull_scan_enable(struct ll_scan_set *scan);
/* Disable scanning/initiating role */
uint8_t ull_scan_disable(uint8_t handle, struct ll_scan_set *scan);
/* Helper function to handle scan done events */
void ull_scan_done(struct node_rx_event_done *done);
/* Helper function to dequeue scan timeout event */
void ull_scan_term_dequeue(uint8_t handle);
@ -52,9 +55,6 @@ uint8_t ull_scan_handle_get(struct ll_scan_set *scan);
/* Helper function to check and return if a valid scan context */
struct ll_scan_set *ull_scan_is_valid_get(struct ll_scan_set *scan);
/* Helper function to check and return if a valid aux scan context */
struct ll_scan_aux_set *ull_scan_aux_is_valid_get(struct ll_scan_aux_set *aux);
/* Return ll_scan_set context if enabled */
struct ll_scan_set *ull_scan_is_enabled_get(uint8_t handle);
@ -73,8 +73,11 @@ int ull_scan_aux_reset(void);
/* Helper to setup scanning on auxiliary channel */
void ull_scan_aux_setup(memq_link_t *link, struct node_rx_hdr *rx);
/* Helper function to handle scan done events */
void ull_scan_done(struct node_rx_event_done *done);
/* Helper to clean up auxiliary channel scanning */
void ull_scan_aux_done(struct node_rx_event_done *done);
/* Helper function to check and return if a valid aux scan context */
struct ll_scan_aux_set *ull_scan_aux_is_valid_get(struct ll_scan_aux_set *aux);
/* Helper function to flush and release incomplete auxiliary PDU chaining */
void ull_scan_aux_release(memq_link_t *link, struct node_rx_hdr *rx);