Skip to content

Commit 7be9bce

Browse files
Bluetooth: Controller: Store parent lll struct in aux context
We use 1st node enqueued in aux context to retrieve lll scan/sync struct, but that only works if we buffer PDUs in aux context. It's better to store parent lll struct as explicit member in aux context as this also works if we skip buffering. Signed-off-by: Andrzej Kaczmarek <[email protected]>
1 parent 730c173 commit 7be9bce

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
#include <ull_scan_types.h>
5151
#include <ull_scan_internal.h>
5252
#include <ull_sync_types.h>
53+
#include <ull_sync_internal.h>
5354
#include "hal/debug.h"
5455

5556
static int init_reset(void);
@@ -264,7 +265,7 @@ static int prepare_cb(struct lll_prepare_param *p)
264265

265266
lll = p->param;
266267
aux_set = HDR_LLL2ULL(lll);
267-
scan_set = HDR_LLL2ULL(aux_set->rx_head->rx_ftr.param);
268+
scan_set = HDR_LLL2ULL(aux_set->parent);
268269
scan_set = ull_scan_is_valid_get(scan_set);
269270

270271
if (scan_set) {
@@ -289,7 +290,7 @@ static int prepare_cb(struct lll_prepare_param *p)
289290
} else {
290291
/* We are in sync context */
291292
scan_lll = NULL;
292-
sync_set = HDR_LLL2ULL(aux_set->rx_head->rx_ftr.param);
293+
sync_set = HDR_LLL2ULL(aux_set->parent);
293294
sync_lll = &sync_set->lll;
294295
LL_ASSERT(sync_lll);
295296
}
@@ -633,7 +634,7 @@ static void isr_rx_ull_schedule(void *param)
633634

634635
lll_aux = param;
635636
aux = HDR_LLL2ULL(lll_aux);
636-
param_lll = aux->rx_head->rx_ftr.param;
637+
param_lll = aux->parent;
637638

638639
if (ull_scan_is_valid_get(HDR_LLL2ULL(param_lll))) {
639640
lll = param_lll;

subsys/bluetooth/controller/ll_sw/ull_scan_aux.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_hdr *rx)
138138
lll_aux = ftr->param;
139139
aux = HDR_LLL2ULL(lll_aux);
140140
/* FIXME: pick the aux somehow */
141-
lll = aux->rx_head->rx_ftr.param;
141+
lll = aux->parent;
142142
} else if (ull_scan_is_valid_get(HDR_LLL2ULL(ftr->param))) {
143143
/* Node that does not have valid aux context but has
144144
* valid scan set was scheduled from LLL. We can
@@ -151,7 +151,7 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_hdr *rx)
151151
LL_ASSERT(lll_aux);
152152

153153
aux = HDR_LLL2ULL(lll_aux);
154-
LL_ASSERT(lll == aux->rx_head->rx_ftr.param);
154+
LL_ASSERT(lll == aux->parent);
155155
} else {
156156
/* If none of the above, node is part of sync scanning
157157
*/
@@ -366,6 +366,8 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_hdr *rx)
366366

367367
ull_hdr_init(&aux->ull);
368368
lll_hdr_init(lll_aux, aux);
369+
370+
aux->parent = lll ? (void *)lll : (void *)lll_sync;
369371
}
370372

371373
/* Enqueue the rx in aux context */

subsys/bluetooth/controller/ll_sw/ull_scan_types.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ struct ll_scan_aux_set {
4141
struct ull_hdr ull;
4242
struct lll_scan_aux lll;
4343

44+
/* lll_scan or lll_sync */
45+
void *parent;
46+
4447
struct node_rx_hdr *rx_head;
4548
struct node_rx_hdr *rx_last;
4649
};

0 commit comments

Comments
 (0)