Bluetooth: controller: Copy the connect_ind into node_rx

The node_rx buffer does not contain the data from the connect ind, so
copy it over.
Also back up the adv pdu chan_sel bit so that it can be used to properly
select the correct channel selection algorithm

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
This commit is contained in:
Joakim Andersson 2019-05-16 14:47:12 +02:00 committed by Anas Nashif
commit cecd7f8d70
2 changed files with 18 additions and 7 deletions

View file

@ -769,7 +769,17 @@ static inline u32_t isr_rx_pdu(struct lll_scan *lll, u8_t devmatch_ok,
rx->hdr.type = NODE_RX_TYPE_CONNECTION;
rx->hdr.handle = 0xffff;
u8_t pdu_adv_rx_chan_sel = pdu_adv_rx->chan_sel;
memcpy(rx->pdu, pdu_tx, (offsetof(struct pdu_adv, connect_ind) +
sizeof(struct pdu_adv_connect_ind)));
/* Overwrite the sent chan sel with received chan sel, when
* giving this PDU to the higher layer. */
pdu_adv_rx = (void *)rx->pdu;
pdu_adv_rx->chan_sel = pdu_adv_rx_chan_sel;
ftr = &(rx->hdr.rx_ftr);
ftr->param = lll;
ftr->ticks_anchor = radio_tmr_start_get();
ftr->us_radio_end = conn_space_us -

View file

@ -421,7 +421,7 @@ void ull_master_setup(memq_link_t *link, struct node_rx_hdr *rx,
struct ll_scan_set *scan;
struct node_rx_cc *cc;
struct ll_conn *conn;
struct pdu_adv *pdu;
struct pdu_adv *pdu_tx;
u32_t ticker_status;
u8_t chan_sel;
@ -430,21 +430,22 @@ void ull_master_setup(memq_link_t *link, struct node_rx_hdr *rx,
scan = ((struct lll_scan *)ftr->param)->hdr.parent;
conn = lll->hdr.parent;
pdu = (void *)((struct node_rx_pdu *)rx)->pdu;
pdu_tx = (void *)((struct node_rx_pdu *)rx)->pdu;
#if defined(CONFIG_BT_CTLR_PRIVACY)
u8_t own_addr_type = pdu->tx_addr;
u8_t own_addr_type = pdu_tx->tx_addr;
u8_t own_addr[BDADDR_SIZE];
u8_t peer_addr[BDADDR_SIZE];
u8_t rl_idx;
memcpy(own_addr, &pdu->connect_ind.init_addr[0], BDADDR_SIZE);
memcpy(peer_addr, &pdu->connect_ind.adv_addr[0], BDADDR_SIZE);
memcpy(own_addr, &pdu_tx->connect_ind.init_addr[0], BDADDR_SIZE);
memcpy(peer_addr, &pdu_tx->connect_ind.adv_addr[0], BDADDR_SIZE);
#endif
chan_sel = pdu->chan_sel;
/* This is the chan sel bit from the received adv pdu */
chan_sel = pdu_tx->chan_sel;
cc = (void *)pdu;
cc = (void *)pdu_tx;
cc->status = 0U;
cc->role = 0U;