Skip to content

Commit 8da72d1

Browse files
cvinayaknashif
authored andcommitted
Bluetooth: controller: Move initiated flag into role specific union
Move the initiated bit flag into role specific union, so that other role specific bit flags can share bit space in the LLL context structure. Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
1 parent 1e320a3 commit 8da72d1

File tree

9 files changed

+29
-24
lines changed

9 files changed

+29
-24
lines changed

subsys/bluetooth/controller/ll_sw/lll_conn.h

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ struct lll_conn {
4646
uint8_t data_chan_count:6;
4747
uint8_t data_chan_sel:1;
4848
uint8_t role:1;
49-
uint8_t initiated:1;
5049

5150
union {
5251
struct {
@@ -57,18 +56,24 @@ struct lll_conn {
5756
uint16_t data_chan_id;
5857
};
5958

59+
union {
60+
struct {
61+
uint8_t initiated:1;
62+
} master;
6063
#if defined(CONFIG_BT_PERIPHERAL)
61-
struct {
62-
uint8_t latency_enabled:1;
63-
64-
uint32_t window_widening_periodic_us;
65-
uint32_t window_widening_max_us;
66-
uint32_t window_widening_prepare_us;
67-
uint32_t window_widening_event_us;
68-
uint32_t window_size_prepare_us;
69-
uint32_t window_size_event_us;
70-
} slave;
64+
struct {
65+
uint8_t initiated:1;
66+
uint8_t latency_enabled:1;
67+
68+
uint32_t window_widening_periodic_us;
69+
uint32_t window_widening_max_us;
70+
uint32_t window_widening_prepare_us;
71+
uint32_t window_widening_event_us;
72+
uint32_t window_size_prepare_us;
73+
uint32_t window_size_event_us;
74+
} slave;
7175
#endif /* CONFIG_BT_PERIPHERAL */
76+
};
7277

7378
#if defined(CONFIG_BT_CTLR_DATA_LENGTH)
7479
uint16_t max_tx_octets;

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ static int prepare_cb(struct lll_prepare_param *p)
444444
/* Check if stopped (on connection establishment race between LLL and
445445
* ULL.
446446
*/
447-
if (unlikely(lll->conn && lll->conn->initiated)) {
447+
if (unlikely(lll->conn && lll->conn->slave.initiated)) {
448448
int err;
449449

450450
err = lll_hfclock_off();
@@ -1062,7 +1062,7 @@ static inline int isr_rx_pdu(struct lll_adv *lll,
10621062
#endif /* CONFIG_BT_CTLR_CONN_RSSI */
10631063

10641064
/* Stop further LLL radio events */
1065-
lll->conn->initiated = 1;
1065+
lll->conn->slave.initiated = 1;
10661066

10671067
rx = ull_pdu_rx_alloc();
10681068

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,7 @@ static void isr_tx_connect_rsp(void *param)
680680

681681
if (is_done) {
682682
/* Stop further LLL radio events */
683-
lll->conn->initiated = 1;
683+
lll->conn->slave.initiated = 1;
684684
}
685685

686686
/* Clear radio status and events */

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ static int prepare_cb(struct lll_prepare_param *p)
138138
/* Check if stopped (on connection establishment race between LLL and
139139
* ULL.
140140
*/
141-
if (unlikely(lll->conn && lll->conn->initiated)) {
141+
if (unlikely(lll->conn && lll->conn->master.initiated)) {
142142
int err;
143143

144144
err = lll_hfclock_off();
@@ -371,7 +371,7 @@ static void abort_cb(struct lll_prepare_param *prepare_param, void *param)
371371
if (0) {
372372
#if defined(CONFIG_BT_CENTRAL)
373373
} else if (IS_ENABLED(CONFIG_BT_CTLR_LOW_LAT) &&
374-
lll->conn && lll->conn->initiated) {
374+
lll->conn && lll->conn->master.initiated) {
375375
while (!radio_has_disabled()) {
376376
cpu_sleep();
377377
}
@@ -930,7 +930,7 @@ static inline int isr_rx_pdu(struct lll_scan *lll, struct pdu_adv *pdu_adv_rx,
930930
*/
931931

932932
/* Stop further LLL radio events */
933-
lll->conn->initiated = 1;
933+
lll->conn->master.initiated = 1;
934934

935935
rx = ull_pdu_rx_alloc();
936936

subsys/bluetooth/controller/ll_sw/openisa/lll/lll_adv.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ static int prepare_cb(struct lll_prepare_param *prepare_param)
330330
/* Check if stopped (on connection establishment race between LLL and
331331
* ULL.
332332
*/
333-
if (lll->conn && lll->conn->initiated) {
333+
if (unlikely(lll->conn && lll->conn->master.initiated)) {
334334
int err;
335335

336336
err = lll_clk_off();
@@ -926,7 +926,7 @@ static inline int isr_rx_pdu(struct lll_adv *lll,
926926
}
927927
#endif /* CONFIG_BT_CTLR_CONN_RSSI */
928928
/* Stop further LLL radio events */
929-
lll->conn->initiated = 1;
929+
lll->conn->master.initiated = 1;
930930

931931
rx = ull_pdu_rx_alloc();
932932

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ static int prepare_cb(struct lll_prepare_param *prepare_param)
131131
/* Check if stopped (on connection establishment race between LLL and
132132
* ULL.
133133
*/
134-
if (lll->conn && lll->conn->initiated) {
134+
if (unlikely(lll->conn && lll->conn->master.initiated)) {
135135
int err;
136136

137137
err = lll_clk_off();
@@ -826,7 +826,7 @@ static inline uint32_t isr_rx_pdu(struct lll_scan *lll, uint8_t devmatch_ok,
826826
*/
827827

828828
/* Stop further LLL radio events */
829-
lll->conn->initiated = 1;
829+
lll->conn->master.initiated = 1;
830830

831831
rx = ull_pdu_rx_alloc();
832832

subsys/bluetooth/controller/ll_sw/ull_adv.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -856,7 +856,7 @@ uint8_t ll_adv_enable(uint8_t enable)
856856

857857
/* FIXME: BEGIN: Move to ULL? */
858858
conn_lll->role = 1;
859-
conn_lll->initiated = 0;
859+
conn_lll->slave.initiated = 0;
860860
conn_lll->data_chan_sel = 0;
861861
conn_lll->data_chan_use = 0;
862862
conn_lll->event_counter = 0;

subsys/bluetooth/controller/ll_sw/ull_master.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ uint8_t ll_create_connection(uint16_t scan_interval, uint16_t scan_window,
210210
conn_lll->data_chan_sel = 0;
211211
conn_lll->data_chan_use = 0;
212212
conn_lll->role = 0;
213-
conn_lll->initiated = 0;
213+
conn_lll->master.initiated = 0;
214214
/* FIXME: END: Move to ULL? */
215215
#if defined(CONFIG_BT_CTLR_CONN_META)
216216
memset(&conn_lll->conn_meta, 0, sizeof(conn_lll->conn_meta));

subsys/bluetooth/controller/ll_sw/ull_slave.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ void ull_slave_setup(memq_link_t *link, struct node_rx_hdr *rx,
8686
lll->interval = sys_le16_to_cpu(pdu_adv->connect_ind.interval);
8787
if ((lll->data_chan_count < 2) || (lll->data_chan_hop < 5) ||
8888
(lll->data_chan_hop > 16) || !lll->interval) {
89-
lll->initiated = 0U;
89+
lll->slave.initiated = 0U;
9090

9191
/* Mark for buffer for release */
9292
rx->type = NODE_RX_TYPE_RELEASE;

0 commit comments

Comments
 (0)