Skip to content

Commit d72a107

Browse files
cvinayaknashif
authored andcommitted
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 <[email protected]>
1 parent 8da72d1 commit d72a107

File tree

4 files changed

+21
-5
lines changed

4 files changed

+21
-5
lines changed

subsys/bluetooth/controller/ll_sw/lll_scan.h

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,25 @@ struct lll_scan {
88
struct lll_hdr hdr;
99

1010
#if defined(CONFIG_BT_CENTRAL)
11-
/* NOTE: conn context has to be after lll_hdr */
11+
/* NOTE: conn context SHALL be after lll_hdr,
12+
* check ull_conn_setup how it access the connection LLL
13+
* context.
14+
*/
1215
struct lll_conn *conn;
16+
17+
uint8_t adv_addr[BDADDR_SIZE];
1318
uint32_t conn_win_offset_us;
1419
uint16_t conn_timeout;
1520
#endif /* CONFIG_BT_CENTRAL */
1621

1722
uint8_t state:1;
1823
uint8_t chan:2;
1924
uint8_t filter_policy:2;
20-
uint8_t adv_addr_type:1;
21-
uint8_t init_addr_type:1;
2225
uint8_t type:1;
26+
uint8_t init_addr_type:1;
27+
#if defined(CONFIG_BT_CENTRAL)
28+
uint8_t adv_addr_type:1;
29+
#endif /* CONFIG_BT_CENTRAL */
2330

2431
#if defined(CONFIG_BT_CTLR_ADV_EXT)
2532
uint16_t duration_reload;
@@ -35,7 +42,6 @@ struct lll_scan {
3542
#endif /* CONFIG_BT_CTLR_PRIVACY */
3643

3744
uint8_t init_addr[BDADDR_SIZE];
38-
uint8_t adv_addr[BDADDR_SIZE];
3945

4046
uint16_t interval;
4147
uint32_t ticks_window;

subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,10 @@ struct lll_adv {
8080
struct lll_hdr hdr;
8181

8282
#if defined(CONFIG_BT_PERIPHERAL)
83-
/* NOTE: conn context has to be after lll_hdr */
83+
/* NOTE: conn context SHALL be after lll_hdr,
84+
* check ull_conn_setup how it access the connection LLL
85+
* context.
86+
*/
8487
struct lll_conn *conn;
8588
uint8_t is_hdcd:1;
8689
#endif /* CONFIG_BT_PERIPHERAL */

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,12 @@ static inline int isr_rx_pdu(struct lll_scan *lll, struct pdu_adv *pdu_adv_rx,
6666
uint8_t devmatch_ok, uint8_t devmatch_id,
6767
uint8_t irkmatch_ok, uint8_t irkmatch_id,
6868
uint8_t rl_idx, uint8_t rssi_ready);
69+
#if defined(CONFIG_BT_CENTRAL)
6970
static inline bool isr_scan_init_check(struct lll_scan *lll,
7071
struct pdu_adv *pdu, uint8_t rl_idx);
7172
static inline bool isr_scan_init_adva_check(struct lll_scan *lll,
7273
struct pdu_adv *pdu, uint8_t rl_idx);
74+
#endif /* CONFIG_BT_CENTRAL */
7375
static inline bool isr_scan_tgta_check(struct lll_scan *lll, bool init,
7476
struct pdu_adv *pdu, uint8_t rl_idx,
7577
bool *dir_report);
@@ -1104,6 +1106,7 @@ static inline int isr_rx_pdu(struct lll_scan *lll, struct pdu_adv *pdu_adv_rx,
11041106
return -ECANCELED;
11051107
}
11061108

1109+
#if defined(CONFIG_BT_CENTRAL)
11071110
static inline bool isr_scan_init_check(struct lll_scan *lll,
11081111
struct pdu_adv *pdu, uint8_t rl_idx)
11091112
{
@@ -1133,6 +1136,7 @@ static inline bool isr_scan_init_adva_check(struct lll_scan *lll,
11331136
return ((lll->adv_addr_type == pdu->tx_addr) &&
11341137
!memcmp(lll->adv_addr, &pdu->adv_ind.addr[0], BDADDR_SIZE));
11351138
}
1139+
#endif /* CONFIG_BT_CENTRAL */
11361140

11371141
static inline bool isr_scan_tgta_check(struct lll_scan *lll, bool init,
11381142
struct pdu_adv *pdu, uint8_t rl_idx,

subsys/bluetooth/controller/ll_sw/ull_conn.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -779,6 +779,9 @@ void ull_conn_setup(memq_link_t *link, struct node_rx_hdr *rx)
779779

780780
ftr = &(rx->rx_ftr);
781781

782+
/* NOTE: LLL conn context SHALL be after lll_hdr in
783+
* struct lll_adv and struct lll_scan.
784+
*/
782785
lll = *((struct lll_conn **)((uint8_t *)ftr->param +
783786
sizeof(struct lll_hdr)));
784787
switch (lll->role) {

0 commit comments

Comments
 (0)