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/22 01:40:50 UTC

[GitHub] [mynewt-nimble] ncasaril opened a new pull request #944: WIP [DNM] nimble/ll_conn: Fix for frag tx of mbufs >255 bytes

ncasaril opened a new pull request #944:
URL: https://github.com/apache/mynewt-nimble/pull/944


   Further details in #940. 
   
   When using nimble over hci with a perph that is using an MTU larger than 255 bytes the variables changed in this PR overflowed causing the transfer to halt. 
   
   With these changes an MTU of up to 512 can be used, but not 513 and above. The MTU should be able to go to 525?! 
   
   I'm also aware that I'm not very versed in the nimble code base and am open to other solutions to this altogether?


-- 
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] ncasaril commented on a change in pull request #944: nimble/ll_conn: Fix for frag tx of mbufs >255 bytes

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



##########
File path: nimble/controller/src/ble_ll_conn.c
##########
@@ -1129,11 +1129,10 @@ ble_ll_conn_tx_pdu(struct ble_ll_conn_sm *connsm)
         if ((cur_offset + cur_txlen) < pktlen) {
             next_txlen = pktlen - (cur_offset + cur_txlen);
         } else {
-            if (nextpkthdr->omp_len > connsm->eff_max_tx_octets) {
-                next_txlen = connsm->eff_max_tx_octets;
-            } else {
-                next_txlen = nextpkthdr->omp_len;
-            }
+            next_txlen = connsm->eff_max_tx_octets;

Review comment:
       This should instead probably be
    
   ```
        next_txlen = nextpkthdr->omp_len;
   ```
   




-- 
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] kasjer commented on pull request #944: WIP [DNM] nimble/ll_conn: Fix for frag tx of mbufs >255 bytes

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


   > @wes3 @kasjer, any ideas why this only works up to a MTU of 512 and not higher?
   > I'm running out of ideas as to how to push this further.
   
   I'm checking this from the USB side perspective...


-- 
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] apache-mynewt-bot removed a comment on pull request #944: WIP [DNM] nimble/ll_conn: Fix for frag tx of mbufs >255 bytes

Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot removed a comment on pull request #944:
URL: https://github.com/apache/mynewt-nimble/pull/944#issuecomment-803707957


   
   <!-- style-bot -->
   
   ## Style check summary
   
   ### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
   
   
   #### nimble/include/nimble/ble.h
   <details>
   
   ```diff
   @@ -106,16 +104,14 @@
    #define BLE_MBUF_HDR_F_RXSTATE_MASK     (0x0007)
    
    /* Transmit info. NOTE: no flags defined */
   -struct ble_mbuf_hdr_txinfo
   -{
   +struct ble_mbuf_hdr_txinfo {
        uint8_t flags;
        uint16_t offset;
        uint16_t pyld_len;
        uint8_t hdr_byte;
    };
    
   -struct ble_mbuf_hdr
   -{
   +struct ble_mbuf_hdr {
        union {
            struct ble_mbuf_hdr_rxinfo rxinfo;
            struct ble_mbuf_hdr_txinfo txinfo;
   ```
   
   </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] andrzej-kaczmarek merged pull request #944: nimble/ll_conn: Fix for frag tx of mbufs >255 bytes

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


   


-- 
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] ncasaril commented on pull request #944: WIP [DNM] nimble/ll_conn: Fix for frag tx of mbufs >255 bytes

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


   @wes3 @kasjer, any ideas why this only works up to a MTU of 512 and not higher? 
   I'm running out of ideas as to how to push this further. 


-- 
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] ncasaril commented on a change in pull request #944: WIP [DNM] nimble/ll_conn: Fix for frag tx of mbufs >255 bytes

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



##########
File path: nimble/controller/src/ble_ll_conn.c
##########
@@ -1128,6 +1128,7 @@ ble_ll_conn_tx_pdu(struct ble_ll_conn_sm *connsm)
          */
         if ((cur_offset + cur_txlen) < pktlen) {
             next_txlen = pktlen - (cur_offset + cur_txlen);
+            next_txlen = (next_txlen < connsm->eff_max_tx_octets) ? next_txlen : connsm->eff_max_tx_octets;

Review comment:
       Agree, much cleaner. 




-- 
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] ncasaril commented on pull request #944: nimble/ll_conn: Fix for frag tx of mbufs >255 bytes

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


   Sounds good. We can explore separately why the MTU isn't happy exceeding 512 separately.


-- 
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] ncasaril commented on a change in pull request #944: WIP [DNM] nimble/ll_conn: Fix for frag tx of mbufs >255 bytes

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



##########
File path: nimble/include/nimble/ble.h
##########
@@ -109,8 +109,8 @@ struct ble_mbuf_hdr_rxinfo
 struct ble_mbuf_hdr_txinfo
 {
     uint8_t flags;
-    uint8_t offset;
-    uint8_t pyld_len;
+    uint16_t offset;
+    uint16_t pyld_len;
     uint8_t hdr_byte;

Review comment:
       Done




-- 
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] ncasaril commented on a change in pull request #944: nimble/ll_conn: Fix for frag tx of mbufs >255 bytes

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



##########
File path: nimble/include/nimble/ble.h
##########
@@ -109,9 +109,9 @@ struct ble_mbuf_hdr_rxinfo
 struct ble_mbuf_hdr_txinfo
 {
     uint8_t flags;
-    uint8_t offset;
-    uint8_t pyld_len;
     uint8_t hdr_byte;
+    uint16_t offset;
+    uint16_t pyld_len;

Review comment:
       Changing the types to uint16_t here breaks larger replies from a peripheral. For instance listing the images using newtmgr with two images present on the peripheral. Changing the types back to uint8_t makes it work. Adding a dummy byte before the offset / pyld_len breaks download again. I.e.:
   
   ```
   /* This works */
   struct ble_mbuf_hdr_txinfo
    {
        uint8_t flags;
        uint8_t offset;
        uint8_t pyld_len;
        uint8_t hdr_byte;
   }; 
   ```
   ```
   /* This doesn't work */
   struct ble_mbuf_hdr_txinfo
   {
       uint8_t flags;
       uint8_t offset;
       uint8_t dummy;
       uint8_t pyld_len;
       uint8_t hdr_byte;
   }; 
   ```
   
   Is anyone else seeing this? @andrzej-kaczmarek 




-- 
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 #944: WIP [DNM] nimble/ll_conn: Fix for frag tx of mbufs >255 bytes

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


   
   <!-- style-bot -->
   
   ## Style check summary
   
   ### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
   
   
   #### nimble/include/nimble/ble.h
   <details>
   
   ```diff
   @@ -106,16 +104,14 @@
    #define BLE_MBUF_HDR_F_RXSTATE_MASK     (0x0007)
    
    /* Transmit info. NOTE: no flags defined */
   -struct ble_mbuf_hdr_txinfo
   -{
   +struct ble_mbuf_hdr_txinfo {
        uint8_t flags;
        uint16_t offset;
        uint16_t pyld_len;
        uint8_t hdr_byte;
    };
    
   -struct ble_mbuf_hdr
   -{
   +struct ble_mbuf_hdr {
        union {
            struct ble_mbuf_hdr_rxinfo rxinfo;
            struct ble_mbuf_hdr_txinfo txinfo;
   ```
   
   </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] andrzej-kaczmarek commented on a change in pull request #944: WIP [DNM] nimble/ll_conn: Fix for frag tx of mbufs >255 bytes

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



##########
File path: nimble/include/nimble/ble.h
##########
@@ -109,8 +109,8 @@ struct ble_mbuf_hdr_rxinfo
 struct ble_mbuf_hdr_txinfo
 {
     uint8_t flags;
-    uint8_t offset;
-    uint8_t pyld_len;
+    uint16_t offset;
+    uint16_t pyld_len;
     uint8_t hdr_byte;

Review comment:
       move `hdr_byte` after `flags` to optimize alignment in struct

##########
File path: nimble/controller/src/ble_ll_conn.c
##########
@@ -1128,6 +1128,7 @@ ble_ll_conn_tx_pdu(struct ble_ll_conn_sm *connsm)
          */
         if ((cur_offset + cur_txlen) < pktlen) {
             next_txlen = pktlen - (cur_offset + cur_txlen);
+            next_txlen = (next_txlen < connsm->eff_max_tx_octets) ? next_txlen : connsm->eff_max_tx_octets;

Review comment:
       I'd rewrite whole block:
   ```
   if ((cur_offset + cur_txlen) < pktlen) {
       next_txlen = pktlen - (cur_offset + cur_txlen);
   } else {
       next_txlen = connsm->eff_max_tx_octets;
   }
   if (next_txlen > connsm->eff_max_tx_octets) {
       next_txlen = connsm->eff_max_tx_octets;
   }
   ```




-- 
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] apache-mynewt-bot commented on pull request #944: WIP [DNM] nimble/ll_conn: Fix for frag tx of mbufs >255 bytes

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


   
   <!-- style-bot -->
   
   ## Style check summary
   
   ### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
   
   
   #### nimble/include/nimble/ble.h
   <details>
   
   ```diff
   @@ -106,16 +104,14 @@
    #define BLE_MBUF_HDR_F_RXSTATE_MASK     (0x0007)
    
    /* Transmit info. NOTE: no flags defined */
   -struct ble_mbuf_hdr_txinfo
   -{
   +struct ble_mbuf_hdr_txinfo {
        uint8_t flags;
        uint8_t hdr_byte;
        uint16_t offset;
        uint16_t pyld_len;
    };
    
   -struct ble_mbuf_hdr
   -{
   +struct ble_mbuf_hdr {
        union {
            struct ble_mbuf_hdr_rxinfo rxinfo;
            struct ble_mbuf_hdr_txinfo txinfo;
   ```
   
   </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