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 <vich@nordicsemi.no>
This commit is contained in:
Vinayak Kariappa Chettimada 2021-03-16 11:21:25 +05:30 committed by Carles Cufí
commit b2e802b018
9 changed files with 28 additions and 23 deletions

View file

@ -46,7 +46,6 @@ struct lll_conn {
uint8_t data_chan_count:6; uint8_t data_chan_count:6;
uint8_t data_chan_sel:1; uint8_t data_chan_sel:1;
uint8_t role:1; uint8_t role:1;
uint8_t initiated:1;
union { union {
struct { struct {
@ -57,18 +56,24 @@ struct lll_conn {
uint16_t data_chan_id; uint16_t data_chan_id;
}; };
union {
struct {
uint8_t initiated:1;
} master;
#if defined(CONFIG_BT_PERIPHERAL) #if defined(CONFIG_BT_PERIPHERAL)
struct { struct {
uint8_t latency_enabled:1; uint8_t initiated:1;
uint8_t latency_enabled:1;
uint32_t window_widening_periodic_us; uint32_t window_widening_periodic_us;
uint32_t window_widening_max_us; uint32_t window_widening_max_us;
uint32_t window_widening_prepare_us; uint32_t window_widening_prepare_us;
uint32_t window_widening_event_us; uint32_t window_widening_event_us;
uint32_t window_size_prepare_us; uint32_t window_size_prepare_us;
uint32_t window_size_event_us; uint32_t window_size_event_us;
} slave; } slave;
#endif /* CONFIG_BT_PERIPHERAL */ #endif /* CONFIG_BT_PERIPHERAL */
};
#if defined(CONFIG_BT_CTLR_DATA_LENGTH) #if defined(CONFIG_BT_CTLR_DATA_LENGTH)
uint16_t max_tx_octets; uint16_t max_tx_octets;

View file

@ -744,7 +744,7 @@ static int prepare_cb(struct lll_prepare_param *p)
/* Check if stopped (on connection establishment race between LLL and /* Check if stopped (on connection establishment race between LLL and
* ULL. * ULL.
*/ */
if (unlikely(lll->conn && lll->conn->initiated)) { if (unlikely(lll->conn && lll->conn->slave.initiated)) {
int err; int err;
err = lll_hfclock_off(); err = lll_hfclock_off();
@ -1364,7 +1364,7 @@ static inline int isr_rx_pdu(struct lll_adv *lll,
#endif /* CONFIG_BT_CTLR_CONN_RSSI */ #endif /* CONFIG_BT_CTLR_CONN_RSSI */
/* Stop further LLL radio events */ /* Stop further LLL radio events */
lll->conn->initiated = 1; lll->conn->slave.initiated = 1;
rx = ull_pdu_rx_alloc(); rx = ull_pdu_rx_alloc();

View file

@ -685,7 +685,7 @@ static void isr_tx_connect_rsp(void *param)
if (is_done) { if (is_done) {
/* Stop further LLL radio events */ /* Stop further LLL radio events */
lll->conn->initiated = 1; lll->conn->slave.initiated = 1;
} }
/* Clear radio status and events */ /* Clear radio status and events */

View file

@ -138,7 +138,7 @@ static int prepare_cb(struct lll_prepare_param *p)
/* Check if stopped (on connection establishment race between LLL and /* Check if stopped (on connection establishment race between LLL and
* ULL. * ULL.
*/ */
if (unlikely(lll->conn && lll->conn->initiated)) { if (unlikely(lll->conn && lll->conn->master.initiated)) {
int err; int err;
err = lll_hfclock_off(); err = lll_hfclock_off();
@ -371,7 +371,7 @@ static void abort_cb(struct lll_prepare_param *prepare_param, void *param)
if (0) { if (0) {
#if defined(CONFIG_BT_CENTRAL) #if defined(CONFIG_BT_CENTRAL)
} else if (IS_ENABLED(CONFIG_BT_CTLR_LOW_LAT) && } else if (IS_ENABLED(CONFIG_BT_CTLR_LOW_LAT) &&
lll->conn && lll->conn->initiated) { lll->conn && lll->conn->master.initiated) {
while (!radio_has_disabled()) { while (!radio_has_disabled()) {
cpu_sleep(); cpu_sleep();
} }
@ -930,7 +930,7 @@ static inline int isr_rx_pdu(struct lll_scan *lll, struct pdu_adv *pdu_adv_rx,
*/ */
/* Stop further LLL radio events */ /* Stop further LLL radio events */
lll->conn->initiated = 1; lll->conn->master.initiated = 1;
rx = ull_pdu_rx_alloc(); rx = ull_pdu_rx_alloc();

View file

@ -330,7 +330,7 @@ static int prepare_cb(struct lll_prepare_param *prepare_param)
/* Check if stopped (on connection establishment race between LLL and /* Check if stopped (on connection establishment race between LLL and
* ULL. * ULL.
*/ */
if (lll->conn && lll->conn->initiated) { if (unlikely(lll->conn && lll->conn->master.initiated)) {
int err; int err;
err = lll_clk_off(); err = lll_clk_off();
@ -928,7 +928,7 @@ static inline int isr_rx_pdu(struct lll_adv *lll,
} }
#endif /* CONFIG_BT_CTLR_CONN_RSSI */ #endif /* CONFIG_BT_CTLR_CONN_RSSI */
/* Stop further LLL radio events */ /* Stop further LLL radio events */
lll->conn->initiated = 1; lll->conn->master.initiated = 1;
rx = ull_pdu_rx_alloc(); rx = ull_pdu_rx_alloc();

View file

@ -132,7 +132,7 @@ static int prepare_cb(struct lll_prepare_param *prepare_param)
/* Check if stopped (on connection establishment race between LLL and /* Check if stopped (on connection establishment race between LLL and
* ULL. * ULL.
*/ */
if (lll->conn && lll->conn->initiated) { if (unlikely(lll->conn && lll->conn->master.initiated)) {
int err; int err;
err = lll_clk_off(); err = lll_clk_off();
@ -827,7 +827,7 @@ static inline uint32_t isr_rx_pdu(struct lll_scan *lll, uint8_t devmatch_ok,
*/ */
/* Stop further LLL radio events */ /* Stop further LLL radio events */
lll->conn->initiated = 1; lll->conn->master.initiated = 1;
rx = ull_pdu_rx_alloc(); rx = ull_pdu_rx_alloc();

View file

@ -873,7 +873,7 @@ uint8_t ll_adv_enable(uint8_t enable)
/* FIXME: BEGIN: Move to ULL? */ /* FIXME: BEGIN: Move to ULL? */
conn_lll->role = 1; conn_lll->role = 1;
conn_lll->initiated = 0; conn_lll->slave.initiated = 0;
conn_lll->data_chan_sel = 0; conn_lll->data_chan_sel = 0;
conn_lll->data_chan_use = 0; conn_lll->data_chan_use = 0;
conn_lll->event_counter = 0; conn_lll->event_counter = 0;

View file

@ -221,7 +221,7 @@ uint8_t ll_create_connection(uint16_t scan_interval, uint16_t scan_window,
conn_lll->data_chan_sel = 0; conn_lll->data_chan_sel = 0;
conn_lll->data_chan_use = 0; conn_lll->data_chan_use = 0;
conn_lll->role = 0; conn_lll->role = 0;
conn_lll->initiated = 0; conn_lll->master.initiated = 0;
/* FIXME: END: Move to ULL? */ /* FIXME: END: Move to ULL? */
#if defined(CONFIG_BT_CTLR_CONN_META) #if defined(CONFIG_BT_CTLR_CONN_META)
memset(&conn_lll->conn_meta, 0, sizeof(conn_lll->conn_meta)); memset(&conn_lll->conn_meta, 0, sizeof(conn_lll->conn_meta));

View file

@ -130,7 +130,7 @@ void ull_slave_setup(memq_link_t *link, struct node_rx_hdr *rx,
lll->interval = sys_le16_to_cpu(pdu_adv->connect_ind.interval); lll->interval = sys_le16_to_cpu(pdu_adv->connect_ind.interval);
if ((lll->data_chan_count < 2) || (lll->data_chan_hop < 5) || if ((lll->data_chan_count < 2) || (lll->data_chan_hop < 5) ||
(lll->data_chan_hop > 16) || !lll->interval) { (lll->data_chan_hop > 16) || !lll->interval) {
lll->initiated = 0U; lll->slave.initiated = 0U;
/* Mark for buffer for release */ /* Mark for buffer for release */
rx->type = NODE_RX_TYPE_RELEASE; rx->type = NODE_RX_TYPE_RELEASE;