Bluetooth: controller: Conditional compile adv addr used by initiator

Conditional compile adv_addr which is only used by
controller when supporting initiator/central role.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
This commit is contained in:
Vinayak Kariappa Chettimada 2021-03-16 11:46:30 +05:30 committed by Carles Cufí
commit 34451a9970
4 changed files with 21 additions and 5 deletions

View file

@ -61,7 +61,10 @@ struct lll_adv {
struct lll_hdr hdr; struct lll_hdr hdr;
#if defined(CONFIG_BT_PERIPHERAL) #if defined(CONFIG_BT_PERIPHERAL)
/* NOTE: conn context has to be after lll_hdr */ /* NOTE: conn context SHALL be after lll_hdr,
* check ull_conn_setup how it access the connection LLL
* context.
*/
struct lll_conn *conn; struct lll_conn *conn;
uint8_t is_hdcd:1; uint8_t is_hdcd:1;
#endif /* CONFIG_BT_PERIPHERAL */ #endif /* CONFIG_BT_PERIPHERAL */

View file

@ -8,8 +8,13 @@ struct lll_scan {
struct lll_hdr hdr; struct lll_hdr hdr;
#if defined(CONFIG_BT_CENTRAL) #if defined(CONFIG_BT_CENTRAL)
/* NOTE: conn context has to be after lll_hdr */ /* NOTE: conn context SHALL be after lll_hdr,
* check ull_conn_setup how it access the connection LLL
* context.
*/
struct lll_conn *conn; struct lll_conn *conn;
uint8_t adv_addr[BDADDR_SIZE];
uint32_t conn_win_offset_us; uint32_t conn_win_offset_us;
uint16_t conn_timeout; uint16_t conn_timeout;
#endif /* CONFIG_BT_CENTRAL */ #endif /* CONFIG_BT_CENTRAL */
@ -17,9 +22,11 @@ struct lll_scan {
uint8_t state:1; uint8_t state:1;
uint8_t chan:2; uint8_t chan:2;
uint8_t filter_policy:2; uint8_t filter_policy:2;
uint8_t adv_addr_type:1;
uint8_t init_addr_type:1;
uint8_t type:1; uint8_t type:1;
uint8_t init_addr_type:1;
#if defined(CONFIG_BT_CENTRAL)
uint8_t adv_addr_type:1;
#endif /* CONFIG_BT_CENTRAL */
#if defined(CONFIG_BT_CTLR_ADV_EXT) #if defined(CONFIG_BT_CTLR_ADV_EXT)
uint16_t duration_reload; uint16_t duration_reload;
@ -35,7 +42,6 @@ struct lll_scan {
#endif /* CONFIG_BT_CTLR_PRIVACY */ #endif /* CONFIG_BT_CTLR_PRIVACY */
uint8_t init_addr[BDADDR_SIZE]; uint8_t init_addr[BDADDR_SIZE];
uint8_t adv_addr[BDADDR_SIZE];
uint16_t interval; uint16_t interval;
uint32_t ticks_window; uint32_t ticks_window;

View file

@ -66,10 +66,12 @@ static inline int isr_rx_pdu(struct lll_scan *lll, struct pdu_adv *pdu_adv_rx,
uint8_t devmatch_ok, uint8_t devmatch_id, uint8_t devmatch_ok, uint8_t devmatch_id,
uint8_t irkmatch_ok, uint8_t irkmatch_id, uint8_t irkmatch_ok, uint8_t irkmatch_id,
uint8_t rl_idx, uint8_t rssi_ready); uint8_t rl_idx, uint8_t rssi_ready);
#if defined(CONFIG_BT_CENTRAL)
static inline bool isr_scan_init_check(struct lll_scan *lll, static inline bool isr_scan_init_check(struct lll_scan *lll,
struct pdu_adv *pdu, uint8_t rl_idx); struct pdu_adv *pdu, uint8_t rl_idx);
static inline bool isr_scan_init_adva_check(struct lll_scan *lll, static inline bool isr_scan_init_adva_check(struct lll_scan *lll,
struct pdu_adv *pdu, uint8_t rl_idx); struct pdu_adv *pdu, uint8_t rl_idx);
#endif /* CONFIG_BT_CENTRAL */
static inline bool isr_scan_tgta_check(struct lll_scan *lll, bool init, static inline bool isr_scan_tgta_check(struct lll_scan *lll, bool init,
struct pdu_adv *pdu, uint8_t rl_idx, struct pdu_adv *pdu, uint8_t rl_idx,
bool *dir_report); bool *dir_report);
@ -1104,6 +1106,7 @@ static inline int isr_rx_pdu(struct lll_scan *lll, struct pdu_adv *pdu_adv_rx,
return -ECANCELED; return -ECANCELED;
} }
#if defined(CONFIG_BT_CENTRAL)
static inline bool isr_scan_init_check(struct lll_scan *lll, static inline bool isr_scan_init_check(struct lll_scan *lll,
struct pdu_adv *pdu, uint8_t rl_idx) struct pdu_adv *pdu, uint8_t rl_idx)
{ {
@ -1133,6 +1136,7 @@ static inline bool isr_scan_init_adva_check(struct lll_scan *lll,
return ((lll->adv_addr_type == pdu->tx_addr) && return ((lll->adv_addr_type == pdu->tx_addr) &&
!memcmp(lll->adv_addr, &pdu->adv_ind.addr[0], BDADDR_SIZE)); !memcmp(lll->adv_addr, &pdu->adv_ind.addr[0], BDADDR_SIZE));
} }
#endif /* CONFIG_BT_CENTRAL */
static inline bool isr_scan_tgta_check(struct lll_scan *lll, bool init, static inline bool isr_scan_tgta_check(struct lll_scan *lll, bool init,
struct pdu_adv *pdu, uint8_t rl_idx, struct pdu_adv *pdu, uint8_t rl_idx,

View file

@ -811,6 +811,9 @@ void ull_conn_setup(memq_link_t *link, struct node_rx_hdr *rx)
ftr = &(rx->rx_ftr); ftr = &(rx->rx_ftr);
/* NOTE: LLL conn context SHALL be after lll_hdr in
* struct lll_adv and struct lll_scan.
*/
lll = *((struct lll_conn **)((uint8_t *)ftr->param + lll = *((struct lll_conn **)((uint8_t *)ftr->param +
sizeof(struct lll_hdr))); sizeof(struct lll_hdr)));
switch (lll->role) { switch (lll->role) {