Skip to content
Permalink
Browse files

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>
  • Loading branch information...
joerchan authored and nashif committed May 16, 2019
1 parent 6db4776 commit cecd7f8d709391502b970cb0b8f2b4e792b56f16
@@ -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 -
@@ -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;

0 comments on commit cecd7f8

Please sign in to comment.
You can’t perform that action at this time.