Bluetooth: Controller: Allow resolving list update during passive scan

Allow resolving list update  when passive scanning,
otherwise deny if advertising, active scanning, initiating
or periodic sync create is active.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
This commit is contained in:
Vinayak Kariappa Chettimada 2021-09-09 15:45:49 +05:30 committed by Carles Cufí
parent bbe8fe721b
commit e0ac70ad91
2 changed files with 21 additions and 6 deletions

View file

@ -1014,8 +1014,12 @@ static int rl_access_check(bool check_ar)
}
}
/* NOTE: Allowed when passive scanning, otherwise deny if advertising,
* active scanning, initiating or periodic sync create is active.
*/
return ((IS_ENABLED(CONFIG_BT_BROADCASTER) && ull_adv_is_enabled(0)) ||
(IS_ENABLED(CONFIG_BT_OBSERVER) && ull_scan_is_enabled(0)))
(IS_ENABLED(CONFIG_BT_OBSERVER) &&
(ull_scan_is_enabled(0) & ~BIT(0))))
? 0 : 1;
}

View file

@ -618,18 +618,29 @@ uint32_t ull_scan_is_enabled(uint8_t handle)
{
struct ll_scan_set *scan;
scan = ull_scan_is_enabled_get(handle);
if (!scan) {
return 0;
}
/* NOTE: BIT(0) - passive scanning enabled
* BIT(1) - active scanning enabled
* BIT(2) - initiator enabled
* BIT(3) - periodic sync create active
*/
scan = ull_scan_is_enabled_get(handle);
if (!scan) {
#if defined(CONFIG_BT_CTLR_SYNC_PERIODIC)
scan = ull_scan_set_get(handle);
return scan->per_scan.sync ? BIT(3) : 0;
#else
return 0;
#endif
}
return (((uint32_t)scan->is_enabled << scan->lll.type) |
#if defined(CONFIG_BT_CENTRAL)
(scan->lll.conn ? BIT(2) : 0) |
#endif
#if defined(CONFIG_BT_CTLR_SYNC_PERIODIC)
(scan->per_scan.sync ? BIT(3) : 0) |
#endif
0);
}