You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2021/03/10 10:15:38 UTC

[GitHub] [mynewt-nimble] andrzej-kaczmarek opened a new pull request #931: nimble/ll: Scanner improvements

andrzej-kaczmarek opened a new pull request #931:
URL: https://github.com/apache/mynewt-nimble/pull/931


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [mynewt-nimble] andrzej-kaczmarek merged pull request #931: nimble/ll: Decouple aux scanner from main scansm

Posted by GitBox <gi...@apache.org>.
andrzej-kaczmarek merged pull request #931:
URL: https://github.com/apache/mynewt-nimble/pull/931


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [mynewt-nimble] andrzej-kaczmarek commented on a change in pull request #931: nimble/ll: Decouple aux scanner from main scansm

Posted by GitBox <gi...@apache.org>.
andrzej-kaczmarek commented on a change in pull request #931:
URL: https://github.com/apache/mynewt-nimble/pull/931#discussion_r718667525



##########
File path: nimble/controller/src/ble_ll_scan.c
##########
@@ -2388,48 +2109,31 @@ ble_ll_scan_rx_isr_end(struct os_mbuf *rxpdu, uint8_t crcok)
         return 0;
     }
 
-    rxbuf = rxpdu->om_data;
-    pdu_type = rxbuf[0] & BLE_ADV_PDU_HDR_TYPE_MASK;
-
-#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
-    /*
-     * In case aux was expected, copy aux_data for LL to use. Make sure this was
-     * indeed an aux as otherwise there's no need to process it and just pass to
-     * LL immediately.
-     */
-    if (scansm->cur_aux_data) {
-        rxinfo->user_data = scansm->cur_aux_data;
-        scansm->cur_aux_data = NULL;
-        if (pdu_type != BLE_ADV_PDU_TYPE_ADV_EXT_IND) {
-            ble_ll_state_set(BLE_LL_STATE_STANDBY);
-            return -1;
-        }
-    }
-#endif
-
     if (!crcok) {
         goto scan_rx_isr_ignore;
     }
 
-    /*
-     * Addresses will be always set in handlers, no need to initialize them. We
-     * only need to initialize rl which may not be always set, depending on how
-     * filtering goes.
-     */
-    addrd.rl = NULL;
+    rxbuf = rxpdu->om_data;
+    pdu_type = rxbuf[0] & BLE_ADV_PDU_HDR_TYPE_MASK;
 
     switch (pdu_type) {
     case BLE_ADV_PDU_TYPE_ADV_IND:
     case BLE_ADV_PDU_TYPE_ADV_DIRECT_IND:
     case BLE_ADV_PDU_TYPE_ADV_NONCONN_IND:
-    case BLE_ADV_PDU_TYPE_SCAN_RSP:
     case BLE_ADV_PDU_TYPE_ADV_SCAN_IND:
-        rc = ble_ll_scan_rx_isr_on_legacy(pdu_type, rxbuf, hdr, &addrd);
+        rc = ble_ll_scan_rx_isr_on_adv(pdu_type, rxbuf, hdr, &addrd);
+        break;
+    case BLE_ADV_PDU_TYPE_SCAN_RSP:
+        rc = ble_ll_scan_rx_isr_on_scan_rsp(pdu_type, rxbuf, hdr, &addrd);
         break;
 #if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
     case BLE_ADV_PDU_TYPE_ADV_EXT_IND:
-        rc = ble_ll_scan_rx_isr_on_aux(pdu_type, rxbuf, hdr, &addrd);
-        break;
+        rc = ble_ll_scan_aux_rx_isr_end_on_ext(&g_ble_ll_scan_sm, rxpdu);
+        if (rc < 0) {
+            rxinfo->flags |= BLE_MBUF_HDR_F_IGNORED;
+        }
+        ble_ll_state_set(BLE_LL_STATE_STANDBY);
+        return -1;

Review comment:
       yes, returning -1 will disable phy since we do not need to send anything back on ext.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [mynewt-nimble] sjanc commented on a change in pull request #931: nimble/ll: Decouple aux scanner from main scansm

Posted by GitBox <gi...@apache.org>.
sjanc commented on a change in pull request #931:
URL: https://github.com/apache/mynewt-nimble/pull/931#discussion_r719220250



##########
File path: nimble/controller/src/ble_ll_scan.c
##########
@@ -2388,48 +2109,31 @@ ble_ll_scan_rx_isr_end(struct os_mbuf *rxpdu, uint8_t crcok)
         return 0;
     }
 
-    rxbuf = rxpdu->om_data;
-    pdu_type = rxbuf[0] & BLE_ADV_PDU_HDR_TYPE_MASK;
-
-#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
-    /*
-     * In case aux was expected, copy aux_data for LL to use. Make sure this was
-     * indeed an aux as otherwise there's no need to process it and just pass to
-     * LL immediately.
-     */
-    if (scansm->cur_aux_data) {
-        rxinfo->user_data = scansm->cur_aux_data;
-        scansm->cur_aux_data = NULL;
-        if (pdu_type != BLE_ADV_PDU_TYPE_ADV_EXT_IND) {
-            ble_ll_state_set(BLE_LL_STATE_STANDBY);
-            return -1;
-        }
-    }
-#endif
-
     if (!crcok) {
         goto scan_rx_isr_ignore;
     }
 
-    /*
-     * Addresses will be always set in handlers, no need to initialize them. We
-     * only need to initialize rl which may not be always set, depending on how
-     * filtering goes.
-     */
-    addrd.rl = NULL;
+    rxbuf = rxpdu->om_data;
+    pdu_type = rxbuf[0] & BLE_ADV_PDU_HDR_TYPE_MASK;
 
     switch (pdu_type) {
     case BLE_ADV_PDU_TYPE_ADV_IND:
     case BLE_ADV_PDU_TYPE_ADV_DIRECT_IND:
     case BLE_ADV_PDU_TYPE_ADV_NONCONN_IND:
-    case BLE_ADV_PDU_TYPE_SCAN_RSP:
     case BLE_ADV_PDU_TYPE_ADV_SCAN_IND:
-        rc = ble_ll_scan_rx_isr_on_legacy(pdu_type, rxbuf, hdr, &addrd);
+        rc = ble_ll_scan_rx_isr_on_adv(pdu_type, rxbuf, hdr, &addrd);
+        break;
+    case BLE_ADV_PDU_TYPE_SCAN_RSP:
+        rc = ble_ll_scan_rx_isr_on_scan_rsp(pdu_type, rxbuf, hdr, &addrd);
         break;
 #if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
     case BLE_ADV_PDU_TYPE_ADV_EXT_IND:
-        rc = ble_ll_scan_rx_isr_on_aux(pdu_type, rxbuf, hdr, &addrd);
-        break;
+        rc = ble_ll_scan_aux_rx_isr_end_on_ext(&g_ble_ll_scan_sm, rxpdu);
+        if (rc < 0) {
+            rxinfo->flags |= BLE_MBUF_HDR_F_IGNORED;
+        }
+        ble_ll_state_set(BLE_LL_STATE_STANDBY);
+        return -1;

Review comment:
       alright (maybe add code comment though for future reference)




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [mynewt-nimble] apache-mynewt-bot commented on pull request #931: nimble/ll: Scanner improvements

Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot commented on pull request #931:
URL: https://github.com/apache/mynewt-nimble/pull/931#issuecomment-795200415


   
   <!-- style-bot -->
   
   ## Style check summary
   
   ### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
   
   
   #### nimble/controller/include/controller/ble_ll_scan.h
   <details>
   
   ```diff
   @@ -79,8 +79,7 @@
        uint32_t start_time;
    };
    
   -struct ble_ll_scan_phy
   -{
   +struct ble_ll_scan_phy {
        uint8_t configured;
        uint8_t phy;
        uint8_t scan_type;
   @@ -148,8 +147,7 @@
        uint8_t adva[BLE_DEV_ADDR_LEN];
    };
    
   -struct ble_ll_scan_sm
   -{
   +struct ble_ll_scan_sm {
        uint8_t scan_enabled;
    
        uint8_t own_addr_type;
   ```
   
   </details>
   
   #### nimble/controller/src/ble_ll_scan.c
   <details>
   
   ```diff
   @@ -1224,7 +1224,7 @@
        TAILQ_INIT(&g_scan_dup_list);
    
        if ((BLE_LL_SCAN_NUM_PHYS > 1) && scansm->scan_phys[0].configured &&
   -                                      scansm->scan_phys[1].configured) {
   +        scansm->scan_phys[1].configured) {
            scanp_0 = &scansm->scan_phys[0];
            scanp_1 = &scansm->scan_phys[1];
    
   @@ -3377,8 +3377,8 @@
         */
        if (!(cmd->phys & SCAN_VALID_PHY_MASK) ||
            (cmd->phys & ~SCAN_VALID_PHY_MASK)) {
   -         return BLE_ERR_INV_HCI_CMD_PARMS;
   -     }
   +        return BLE_ERR_INV_HCI_CMD_PARMS;
   +    }
    
        scanp = &scan_phys_new[0];
    
   @@ -3852,9 +3854,9 @@
        scanp->phy = BLE_PHY_1M;
        scanp->scan_type = BLE_SCAN_TYPE_PASSIVE;
        scanp->timing.interval =
   -                ble_ll_scan_time_hci_to_ticks(BLE_HCI_SCAN_ITVL_DEF);
   +        ble_ll_scan_time_hci_to_ticks(BLE_HCI_SCAN_ITVL_DEF);
        scanp->timing.window =
   -                ble_ll_scan_time_hci_to_ticks(BLE_HCI_SCAN_WINDOW_DEF);
   +        ble_ll_scan_time_hci_to_ticks(BLE_HCI_SCAN_WINDOW_DEF);
    
    #if BLE_LL_SCAN_NUM_PHYS > 1
        scanp = &g_ble_ll_scan_params.scan_phys[1];
   ```
   
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [mynewt-nimble] sjanc commented on a change in pull request #931: nimble/ll: Decouple aux scanner from main scansm

Posted by GitBox <gi...@apache.org>.
sjanc commented on a change in pull request #931:
URL: https://github.com/apache/mynewt-nimble/pull/931#discussion_r719133893



##########
File path: nimble/controller/src/ble_ll_scan.c
##########
@@ -2388,48 +2109,31 @@ ble_ll_scan_rx_isr_end(struct os_mbuf *rxpdu, uint8_t crcok)
         return 0;
     }
 
-    rxbuf = rxpdu->om_data;
-    pdu_type = rxbuf[0] & BLE_ADV_PDU_HDR_TYPE_MASK;
-
-#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
-    /*
-     * In case aux was expected, copy aux_data for LL to use. Make sure this was
-     * indeed an aux as otherwise there's no need to process it and just pass to
-     * LL immediately.
-     */
-    if (scansm->cur_aux_data) {
-        rxinfo->user_data = scansm->cur_aux_data;
-        scansm->cur_aux_data = NULL;
-        if (pdu_type != BLE_ADV_PDU_TYPE_ADV_EXT_IND) {
-            ble_ll_state_set(BLE_LL_STATE_STANDBY);
-            return -1;
-        }
-    }
-#endif
-
     if (!crcok) {
         goto scan_rx_isr_ignore;
     }
 
-    /*
-     * Addresses will be always set in handlers, no need to initialize them. We
-     * only need to initialize rl which may not be always set, depending on how
-     * filtering goes.
-     */
-    addrd.rl = NULL;
+    rxbuf = rxpdu->om_data;
+    pdu_type = rxbuf[0] & BLE_ADV_PDU_HDR_TYPE_MASK;
 
     switch (pdu_type) {
     case BLE_ADV_PDU_TYPE_ADV_IND:
     case BLE_ADV_PDU_TYPE_ADV_DIRECT_IND:
     case BLE_ADV_PDU_TYPE_ADV_NONCONN_IND:
-    case BLE_ADV_PDU_TYPE_SCAN_RSP:
     case BLE_ADV_PDU_TYPE_ADV_SCAN_IND:
-        rc = ble_ll_scan_rx_isr_on_legacy(pdu_type, rxbuf, hdr, &addrd);
+        rc = ble_ll_scan_rx_isr_on_adv(pdu_type, rxbuf, hdr, &addrd);
+        break;
+    case BLE_ADV_PDU_TYPE_SCAN_RSP:
+        rc = ble_ll_scan_rx_isr_on_scan_rsp(pdu_type, rxbuf, hdr, &addrd);
         break;
 #if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
     case BLE_ADV_PDU_TYPE_ADV_EXT_IND:
-        rc = ble_ll_scan_rx_isr_on_aux(pdu_type, rxbuf, hdr, &addrd);
-        break;
+        rc = ble_ll_scan_aux_rx_isr_end_on_ext(&g_ble_ll_scan_sm, rxpdu);
+        if (rc < 0) {
+            rxinfo->flags |= BLE_MBUF_HDR_F_IGNORED;
+        }
+        ble_ll_state_set(BLE_LL_STATE_STANDBY);
+        return -1;

Review comment:
       OK, wouldn't common exit path do the same? (just like for other cases)
   
   rc = ble_ll_scan_aux_rx_isr_end_on_ext(&g_ble_ll_scan_sm, rxpdu);
   break;




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [mynewt-nimble] andrzej-kaczmarek commented on a change in pull request #931: nimble/ll: Decouple aux scanner from main scansm

Posted by GitBox <gi...@apache.org>.
andrzej-kaczmarek commented on a change in pull request #931:
URL: https://github.com/apache/mynewt-nimble/pull/931#discussion_r718667525



##########
File path: nimble/controller/src/ble_ll_scan.c
##########
@@ -2388,48 +2109,31 @@ ble_ll_scan_rx_isr_end(struct os_mbuf *rxpdu, uint8_t crcok)
         return 0;
     }
 
-    rxbuf = rxpdu->om_data;
-    pdu_type = rxbuf[0] & BLE_ADV_PDU_HDR_TYPE_MASK;
-
-#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
-    /*
-     * In case aux was expected, copy aux_data for LL to use. Make sure this was
-     * indeed an aux as otherwise there's no need to process it and just pass to
-     * LL immediately.
-     */
-    if (scansm->cur_aux_data) {
-        rxinfo->user_data = scansm->cur_aux_data;
-        scansm->cur_aux_data = NULL;
-        if (pdu_type != BLE_ADV_PDU_TYPE_ADV_EXT_IND) {
-            ble_ll_state_set(BLE_LL_STATE_STANDBY);
-            return -1;
-        }
-    }
-#endif
-
     if (!crcok) {
         goto scan_rx_isr_ignore;
     }
 
-    /*
-     * Addresses will be always set in handlers, no need to initialize them. We
-     * only need to initialize rl which may not be always set, depending on how
-     * filtering goes.
-     */
-    addrd.rl = NULL;
+    rxbuf = rxpdu->om_data;
+    pdu_type = rxbuf[0] & BLE_ADV_PDU_HDR_TYPE_MASK;
 
     switch (pdu_type) {
     case BLE_ADV_PDU_TYPE_ADV_IND:
     case BLE_ADV_PDU_TYPE_ADV_DIRECT_IND:
     case BLE_ADV_PDU_TYPE_ADV_NONCONN_IND:
-    case BLE_ADV_PDU_TYPE_SCAN_RSP:
     case BLE_ADV_PDU_TYPE_ADV_SCAN_IND:
-        rc = ble_ll_scan_rx_isr_on_legacy(pdu_type, rxbuf, hdr, &addrd);
+        rc = ble_ll_scan_rx_isr_on_adv(pdu_type, rxbuf, hdr, &addrd);
+        break;
+    case BLE_ADV_PDU_TYPE_SCAN_RSP:
+        rc = ble_ll_scan_rx_isr_on_scan_rsp(pdu_type, rxbuf, hdr, &addrd);
         break;
 #if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
     case BLE_ADV_PDU_TYPE_ADV_EXT_IND:
-        rc = ble_ll_scan_rx_isr_on_aux(pdu_type, rxbuf, hdr, &addrd);
-        break;
+        rc = ble_ll_scan_aux_rx_isr_end_on_ext(&g_ble_ll_scan_sm, rxpdu);
+        if (rc < 0) {
+            rxinfo->flags |= BLE_MBUF_HDR_F_IGNORED;
+        }
+        ble_ll_state_set(BLE_LL_STATE_STANDBY);
+        return -1;

Review comment:
       yes, returning -1 will disable phy since we do not need to send anything back on ext.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [mynewt-nimble] andrzej-kaczmarek commented on a change in pull request #931: nimble/ll: Decouple aux scanner from main scansm

Posted by GitBox <gi...@apache.org>.
andrzej-kaczmarek commented on a change in pull request #931:
URL: https://github.com/apache/mynewt-nimble/pull/931#discussion_r719245571



##########
File path: nimble/controller/src/ble_ll_scan.c
##########
@@ -2388,48 +2109,31 @@ ble_ll_scan_rx_isr_end(struct os_mbuf *rxpdu, uint8_t crcok)
         return 0;
     }
 
-    rxbuf = rxpdu->om_data;
-    pdu_type = rxbuf[0] & BLE_ADV_PDU_HDR_TYPE_MASK;
-
-#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
-    /*
-     * In case aux was expected, copy aux_data for LL to use. Make sure this was
-     * indeed an aux as otherwise there's no need to process it and just pass to
-     * LL immediately.
-     */
-    if (scansm->cur_aux_data) {
-        rxinfo->user_data = scansm->cur_aux_data;
-        scansm->cur_aux_data = NULL;
-        if (pdu_type != BLE_ADV_PDU_TYPE_ADV_EXT_IND) {
-            ble_ll_state_set(BLE_LL_STATE_STANDBY);
-            return -1;
-        }
-    }
-#endif
-
     if (!crcok) {
         goto scan_rx_isr_ignore;
     }
 
-    /*
-     * Addresses will be always set in handlers, no need to initialize them. We
-     * only need to initialize rl which may not be always set, depending on how
-     * filtering goes.
-     */
-    addrd.rl = NULL;
+    rxbuf = rxpdu->om_data;
+    pdu_type = rxbuf[0] & BLE_ADV_PDU_HDR_TYPE_MASK;
 
     switch (pdu_type) {
     case BLE_ADV_PDU_TYPE_ADV_IND:
     case BLE_ADV_PDU_TYPE_ADV_DIRECT_IND:
     case BLE_ADV_PDU_TYPE_ADV_NONCONN_IND:
-    case BLE_ADV_PDU_TYPE_SCAN_RSP:
     case BLE_ADV_PDU_TYPE_ADV_SCAN_IND:
-        rc = ble_ll_scan_rx_isr_on_legacy(pdu_type, rxbuf, hdr, &addrd);
+        rc = ble_ll_scan_rx_isr_on_adv(pdu_type, rxbuf, hdr, &addrd);
+        break;
+    case BLE_ADV_PDU_TYPE_SCAN_RSP:
+        rc = ble_ll_scan_rx_isr_on_scan_rsp(pdu_type, rxbuf, hdr, &addrd);
         break;
 #if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
     case BLE_ADV_PDU_TYPE_ADV_EXT_IND:
-        rc = ble_ll_scan_rx_isr_on_aux(pdu_type, rxbuf, hdr, &addrd);
-        break;
+        rc = ble_ll_scan_aux_rx_isr_end_on_ext(&g_ble_ll_scan_sm, rxpdu);
+        if (rc < 0) {
+            rxinfo->flags |= BLE_MBUF_HDR_F_IGNORED;
+        }
+        ble_ll_state_set(BLE_LL_STATE_STANDBY);
+        return -1;

Review comment:
       will add in subsequent PR, I have few more cleanups to send anyway :)




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [mynewt-nimble] andrzej-kaczmarek commented on a change in pull request #931: nimble/ll: Decouple aux scanner from main scansm

Posted by GitBox <gi...@apache.org>.
andrzej-kaczmarek commented on a change in pull request #931:
URL: https://github.com/apache/mynewt-nimble/pull/931#discussion_r719198715



##########
File path: nimble/controller/src/ble_ll_scan.c
##########
@@ -2388,48 +2109,31 @@ ble_ll_scan_rx_isr_end(struct os_mbuf *rxpdu, uint8_t crcok)
         return 0;
     }
 
-    rxbuf = rxpdu->om_data;
-    pdu_type = rxbuf[0] & BLE_ADV_PDU_HDR_TYPE_MASK;
-
-#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
-    /*
-     * In case aux was expected, copy aux_data for LL to use. Make sure this was
-     * indeed an aux as otherwise there's no need to process it and just pass to
-     * LL immediately.
-     */
-    if (scansm->cur_aux_data) {
-        rxinfo->user_data = scansm->cur_aux_data;
-        scansm->cur_aux_data = NULL;
-        if (pdu_type != BLE_ADV_PDU_TYPE_ADV_EXT_IND) {
-            ble_ll_state_set(BLE_LL_STATE_STANDBY);
-            return -1;
-        }
-    }
-#endif
-
     if (!crcok) {
         goto scan_rx_isr_ignore;
     }
 
-    /*
-     * Addresses will be always set in handlers, no need to initialize them. We
-     * only need to initialize rl which may not be always set, depending on how
-     * filtering goes.
-     */
-    addrd.rl = NULL;
+    rxbuf = rxpdu->om_data;
+    pdu_type = rxbuf[0] & BLE_ADV_PDU_HDR_TYPE_MASK;
 
     switch (pdu_type) {
     case BLE_ADV_PDU_TYPE_ADV_IND:
     case BLE_ADV_PDU_TYPE_ADV_DIRECT_IND:
     case BLE_ADV_PDU_TYPE_ADV_NONCONN_IND:
-    case BLE_ADV_PDU_TYPE_SCAN_RSP:
     case BLE_ADV_PDU_TYPE_ADV_SCAN_IND:
-        rc = ble_ll_scan_rx_isr_on_legacy(pdu_type, rxbuf, hdr, &addrd);
+        rc = ble_ll_scan_rx_isr_on_adv(pdu_type, rxbuf, hdr, &addrd);
+        break;
+    case BLE_ADV_PDU_TYPE_SCAN_RSP:
+        rc = ble_ll_scan_rx_isr_on_scan_rsp(pdu_type, rxbuf, hdr, &addrd);
         break;
 #if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
     case BLE_ADV_PDU_TYPE_ADV_EXT_IND:
-        rc = ble_ll_scan_rx_isr_on_aux(pdu_type, rxbuf, hdr, &addrd);
-        break;
+        rc = ble_ll_scan_aux_rx_isr_end_on_ext(&g_ble_ll_scan_sm, rxpdu);
+        if (rc < 0) {
+            rxinfo->flags |= BLE_MBUF_HDR_F_IGNORED;
+        }
+        ble_ll_state_set(BLE_LL_STATE_STANDBY);
+        return -1;

Review comment:
       yes, although my reasoning for explicit return value here was to indicate that path for ext handling is separate from any other PDU, just in case some changes are done below.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [mynewt-nimble] sjanc commented on a change in pull request #931: nimble/ll: Decouple aux scanner from main scansm

Posted by GitBox <gi...@apache.org>.
sjanc commented on a change in pull request #931:
URL: https://github.com/apache/mynewt-nimble/pull/931#discussion_r718459235



##########
File path: nimble/controller/src/ble_ll_scan.c
##########
@@ -2388,48 +2109,31 @@ ble_ll_scan_rx_isr_end(struct os_mbuf *rxpdu, uint8_t crcok)
         return 0;
     }
 
-    rxbuf = rxpdu->om_data;
-    pdu_type = rxbuf[0] & BLE_ADV_PDU_HDR_TYPE_MASK;
-
-#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
-    /*
-     * In case aux was expected, copy aux_data for LL to use. Make sure this was
-     * indeed an aux as otherwise there's no need to process it and just pass to
-     * LL immediately.
-     */
-    if (scansm->cur_aux_data) {
-        rxinfo->user_data = scansm->cur_aux_data;
-        scansm->cur_aux_data = NULL;
-        if (pdu_type != BLE_ADV_PDU_TYPE_ADV_EXT_IND) {
-            ble_ll_state_set(BLE_LL_STATE_STANDBY);
-            return -1;
-        }
-    }
-#endif
-
     if (!crcok) {
         goto scan_rx_isr_ignore;
     }
 
-    /*
-     * Addresses will be always set in handlers, no need to initialize them. We
-     * only need to initialize rl which may not be always set, depending on how
-     * filtering goes.
-     */
-    addrd.rl = NULL;
+    rxbuf = rxpdu->om_data;
+    pdu_type = rxbuf[0] & BLE_ADV_PDU_HDR_TYPE_MASK;
 
     switch (pdu_type) {
     case BLE_ADV_PDU_TYPE_ADV_IND:
     case BLE_ADV_PDU_TYPE_ADV_DIRECT_IND:
     case BLE_ADV_PDU_TYPE_ADV_NONCONN_IND:
-    case BLE_ADV_PDU_TYPE_SCAN_RSP:
     case BLE_ADV_PDU_TYPE_ADV_SCAN_IND:
-        rc = ble_ll_scan_rx_isr_on_legacy(pdu_type, rxbuf, hdr, &addrd);
+        rc = ble_ll_scan_rx_isr_on_adv(pdu_type, rxbuf, hdr, &addrd);
+        break;
+    case BLE_ADV_PDU_TYPE_SCAN_RSP:
+        rc = ble_ll_scan_rx_isr_on_scan_rsp(pdu_type, rxbuf, hdr, &addrd);
         break;
 #if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
     case BLE_ADV_PDU_TYPE_ADV_EXT_IND:
-        rc = ble_ll_scan_rx_isr_on_aux(pdu_type, rxbuf, hdr, &addrd);
-        break;
+        rc = ble_ll_scan_aux_rx_isr_end_on_ext(&g_ble_ll_scan_sm, rxpdu);
+        if (rc < 0) {
+            rxinfo->flags |= BLE_MBUF_HDR_F_IGNORED;
+        }
+        ble_ll_state_set(BLE_LL_STATE_STANDBY);
+        return -1;

Review comment:
       not sure if I get this correctly,  this is due to no scan_req being sent for ext_adv?

##########
File path: nimble/controller/src/ble_ll_scan.c
##########
@@ -867,8 +841,8 @@ ble_ll_scan_send_adv_report(uint8_t pdu_type,
                                                    hdr->rxinfo.rssi,
                                                    adv_data_len, om,
                                                    inita, inita_type);
-        goto done;
-    }
+goto done;

Review comment:
       nitpick




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [mynewt-nimble] sjanc commented on a change in pull request #931: nimble/ll: Decouple aux scanner from main scansm

Posted by GitBox <gi...@apache.org>.
sjanc commented on a change in pull request #931:
URL: https://github.com/apache/mynewt-nimble/pull/931#discussion_r718459235



##########
File path: nimble/controller/src/ble_ll_scan.c
##########
@@ -2388,48 +2109,31 @@ ble_ll_scan_rx_isr_end(struct os_mbuf *rxpdu, uint8_t crcok)
         return 0;
     }
 
-    rxbuf = rxpdu->om_data;
-    pdu_type = rxbuf[0] & BLE_ADV_PDU_HDR_TYPE_MASK;
-
-#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
-    /*
-     * In case aux was expected, copy aux_data for LL to use. Make sure this was
-     * indeed an aux as otherwise there's no need to process it and just pass to
-     * LL immediately.
-     */
-    if (scansm->cur_aux_data) {
-        rxinfo->user_data = scansm->cur_aux_data;
-        scansm->cur_aux_data = NULL;
-        if (pdu_type != BLE_ADV_PDU_TYPE_ADV_EXT_IND) {
-            ble_ll_state_set(BLE_LL_STATE_STANDBY);
-            return -1;
-        }
-    }
-#endif
-
     if (!crcok) {
         goto scan_rx_isr_ignore;
     }
 
-    /*
-     * Addresses will be always set in handlers, no need to initialize them. We
-     * only need to initialize rl which may not be always set, depending on how
-     * filtering goes.
-     */
-    addrd.rl = NULL;
+    rxbuf = rxpdu->om_data;
+    pdu_type = rxbuf[0] & BLE_ADV_PDU_HDR_TYPE_MASK;
 
     switch (pdu_type) {
     case BLE_ADV_PDU_TYPE_ADV_IND:
     case BLE_ADV_PDU_TYPE_ADV_DIRECT_IND:
     case BLE_ADV_PDU_TYPE_ADV_NONCONN_IND:
-    case BLE_ADV_PDU_TYPE_SCAN_RSP:
     case BLE_ADV_PDU_TYPE_ADV_SCAN_IND:
-        rc = ble_ll_scan_rx_isr_on_legacy(pdu_type, rxbuf, hdr, &addrd);
+        rc = ble_ll_scan_rx_isr_on_adv(pdu_type, rxbuf, hdr, &addrd);
+        break;
+    case BLE_ADV_PDU_TYPE_SCAN_RSP:
+        rc = ble_ll_scan_rx_isr_on_scan_rsp(pdu_type, rxbuf, hdr, &addrd);
         break;
 #if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
     case BLE_ADV_PDU_TYPE_ADV_EXT_IND:
-        rc = ble_ll_scan_rx_isr_on_aux(pdu_type, rxbuf, hdr, &addrd);
-        break;
+        rc = ble_ll_scan_aux_rx_isr_end_on_ext(&g_ble_ll_scan_sm, rxpdu);
+        if (rc < 0) {
+            rxinfo->flags |= BLE_MBUF_HDR_F_IGNORED;
+        }
+        ble_ll_state_set(BLE_LL_STATE_STANDBY);
+        return -1;

Review comment:
       not sure if I get this correctly,  this is due to no scan_req being sent for ext_adv?

##########
File path: nimble/controller/src/ble_ll_scan.c
##########
@@ -867,8 +841,8 @@ ble_ll_scan_send_adv_report(uint8_t pdu_type,
                                                    hdr->rxinfo.rssi,
                                                    adv_data_len, om,
                                                    inita, inita_type);
-        goto done;
-    }
+goto done;

Review comment:
       nitpick




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org