Bluetooth: controller: split: SCAN_RSP for ADV_IND or SCAN_IND

Added implementation to differentiate SCAN_RSP received for
ADV_IND or SCAN_IND PDU.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
This commit is contained in:
Vinayak Kariappa Chettimada 2020-04-09 14:43:24 +05:30 committed by Carles Cufí
commit d9523c5005
3 changed files with 24 additions and 4 deletions

View file

@ -75,7 +75,6 @@ static inline bool isr_scan_rsp_adva_matches(struct pdu_adv *srsp);
static uint32_t isr_rx_scan_report(struct lll_scan *lll, uint8_t rssi_ready, static uint32_t isr_rx_scan_report(struct lll_scan *lll, uint8_t rssi_ready,
uint8_t rl_idx, bool dir_report); uint8_t rl_idx, bool dir_report);
int lll_scan_init(void) int lll_scan_init(void)
{ {
int err; int err;
@ -147,6 +146,7 @@ static int prepare_cb(struct lll_prepare_param *p)
lll->state = 0U; lll->state = 0U;
radio_reset(); radio_reset();
#if defined(CONFIG_BT_CTLR_TX_PWR_DYNAMIC_CONTROL) #if defined(CONFIG_BT_CTLR_TX_PWR_DYNAMIC_CONTROL)
radio_tx_power_set(lll->tx_pwr_lvl); radio_tx_power_set(lll->tx_pwr_lvl);
#else #else
@ -157,6 +157,8 @@ static int prepare_cb(struct lll_prepare_param *p)
/* TODO: if coded we use S8? */ /* TODO: if coded we use S8? */
radio_phy_set(lll->phy, 1); radio_phy_set(lll->phy, 1);
radio_pkt_configure(8, PDU_AC_PAYLOAD_SIZE_MAX, (lll->phy << 1)); radio_pkt_configure(8, PDU_AC_PAYLOAD_SIZE_MAX, (lll->phy << 1));
lll->is_adv_ind = 0U;
#else /* !CONFIG_BT_CTLR_ADV_EXT */ #else /* !CONFIG_BT_CTLR_ADV_EXT */
radio_phy_set(0, 0); radio_phy_set(0, 0);
radio_pkt_configure(8, PDU_AC_PAYLOAD_SIZE_MAX, 0); radio_pkt_configure(8, PDU_AC_PAYLOAD_SIZE_MAX, 0);
@ -525,6 +527,10 @@ static void isr_done(void *param)
lll->state = 0U; lll->state = 0U;
#if defined(CONFIG_BT_CTLR_ADV_EXT)
lll->is_adv_ind = 0U;
#endif /* CONFIG_BT_CTLR_ADV_EXT */
#if defined(CONFIG_BT_CTLR_GPIO_LNA_PIN) #if defined(CONFIG_BT_CTLR_GPIO_LNA_PIN)
start_us = radio_tmr_start_now(0); start_us = radio_tmr_start_now(0);
@ -930,6 +936,13 @@ static inline uint32_t isr_rx_pdu(struct lll_scan *lll, uint8_t devmatch_ok,
/* switch scanner state to active */ /* switch scanner state to active */
lll->state = 1U; lll->state = 1U;
#if defined(CONFIG_BT_CTLR_ADV_EXT)
if (pdu_adv_rx->type == PDU_ADV_TYPE_ADV_IND) {
lll->is_adv_ind = 1U;
}
#endif /* CONFIG_BT_CTLR_ADV_EXT */
radio_isr_set(isr_tx, lll); radio_isr_set(isr_tx, lll);
return 0; return 0;
@ -1061,7 +1074,6 @@ static uint32_t isr_rx_scan_report(struct lll_scan *lll, uint8_t rssi_ready,
uint8_t rl_idx, bool dir_report) uint8_t rl_idx, bool dir_report)
{ {
struct node_rx_pdu *node_rx; struct node_rx_pdu *node_rx;
struct pdu_adv *pdu_adv_rx;
node_rx = ull_pdu_rx_alloc_peek(3); node_rx = ull_pdu_rx_alloc_peek(3);
if (!node_rx) { if (!node_rx) {
@ -1081,6 +1093,8 @@ static uint32_t isr_rx_scan_report(struct lll_scan *lll, uint8_t rssi_ready,
#if defined(CONFIG_BT_CTLR_ADV_EXT) #if defined(CONFIG_BT_CTLR_ADV_EXT)
} else if (lll->phy) { } else if (lll->phy) {
struct pdu_adv *pdu_adv_rx;
switch (lll->phy) { switch (lll->phy) {
case BIT(0): case BIT(0):
node_rx->hdr.type = NODE_RX_TYPE_EXT_1M_REPORT; node_rx->hdr.type = NODE_RX_TYPE_EXT_1M_REPORT;
@ -1094,13 +1108,17 @@ static uint32_t isr_rx_scan_report(struct lll_scan *lll, uint8_t rssi_ready,
LL_ASSERT(0); LL_ASSERT(0);
break; break;
} }
pdu_adv_rx = (void *)node_rx->pdu;
if ((pdu_adv_rx->type == PDU_ADV_TYPE_SCAN_RSP) &&
lll->is_adv_ind) {
pdu_adv_rx->type = PDU_ADV_TYPE_ADV_IND_SCAN_RSP;
}
#endif /* CONFIG_BT_CTLR_ADV_EXT */ #endif /* CONFIG_BT_CTLR_ADV_EXT */
} else { } else {
node_rx->hdr.type = NODE_RX_TYPE_REPORT; node_rx->hdr.type = NODE_RX_TYPE_REPORT;
} }
pdu_adv_rx = (void *)node_rx->pdu;
node_rx->hdr.rx_ftr.rssi = (rssi_ready) ? node_rx->hdr.rx_ftr.rssi = (rssi_ready) ?
(radio_rssi_get() & 0x7f) (radio_rssi_get() & 0x7f)
: 0x7f; : 0x7f;

View file

@ -24,6 +24,7 @@ struct lll_scan {
#if defined(CONFIG_BT_CTLR_ADV_EXT) #if defined(CONFIG_BT_CTLR_ADV_EXT)
uint8_t phy:3; uint8_t phy:3;
uint8_t is_adv_ind:1;
#endif /* CONFIG_BT_CTLR_ADV_EXT */ #endif /* CONFIG_BT_CTLR_ADV_EXT */
#if defined(CONFIG_BT_CTLR_PRIVACY) #if defined(CONFIG_BT_CTLR_PRIVACY)

View file

@ -239,6 +239,7 @@ enum pdu_adv_type {
PDU_ADV_TYPE_SCAN_REQ = 0x03, PDU_ADV_TYPE_SCAN_REQ = 0x03,
PDU_ADV_TYPE_AUX_SCAN_REQ = PDU_ADV_TYPE_SCAN_REQ, PDU_ADV_TYPE_AUX_SCAN_REQ = PDU_ADV_TYPE_SCAN_REQ,
PDU_ADV_TYPE_SCAN_RSP = 0x04, PDU_ADV_TYPE_SCAN_RSP = 0x04,
PDU_ADV_TYPE_ADV_IND_SCAN_RSP = 0x05,
PDU_ADV_TYPE_CONNECT_IND = 0x05, PDU_ADV_TYPE_CONNECT_IND = 0x05,
PDU_ADV_TYPE_AUX_CONNECT_REQ = PDU_ADV_TYPE_CONNECT_IND, PDU_ADV_TYPE_AUX_CONNECT_REQ = PDU_ADV_TYPE_CONNECT_IND,
PDU_ADV_TYPE_SCAN_IND = 0x06, PDU_ADV_TYPE_SCAN_IND = 0x06,