[GitHub] [mynewt-nimble] rymanluk commented on a diff in pull request #1271: L2CAP COC: added buffers for incoming SDU

2022-07-22 Thread GitBox


rymanluk commented on code in PR #1271:
URL: https://github.com/apache/mynewt-nimble/pull/1271#discussion_r927661215


##
nimble/host/src/ble_l2cap_coc.c:
##
@@ -186,10 +189,12 @@ ble_l2cap_coc_rx_fn(struct ble_l2cap_chan *chan)
 rx = >coc_rx;
 BLE_HS_DBG_ASSERT(rx != NULL);
 
+rx_sdu = rx->sdus[current_sdu];

Review Comment:
   are we sure tha rx_sdu will be non null?



##
nimble/host/src/ble_l2cap_coc.c:
##
@@ -582,7 +597,12 @@ ble_l2cap_coc_recv_ready(struct ble_l2cap_chan *chan, 
struct os_mbuf *sdu_rx)
 return BLE_HS_EINVAL;
 }
 
-chan->coc_rx.sdu = sdu_rx;

Review Comment:
   What if user call this function more time than BLE_L2CAP_SDU_BUFF_CNT ?
   
   Before we just overwrite chan->coc_rx.sdu which was not great as well.



##
nimble/host/src/ble_l2cap_coc.c:
##
@@ -186,10 +189,12 @@ ble_l2cap_coc_rx_fn(struct ble_l2cap_chan *chan)
 rx = >coc_rx;
 BLE_HS_DBG_ASSERT(rx != NULL);
 
+rx_sdu = rx->sdus[current_sdu];

Review Comment:
   btw - please add current_sdu to debug logs somewhere below



##
nimble/host/src/ble_l2cap_coc.c:
##
@@ -257,17 +265,19 @@ ble_l2cap_coc_rx_fn(struct ble_l2cap_chan *chan)
 
 rx->credits--;
 
-if (OS_MBUF_PKTLEN(rx->sdu) == rx->data_offset) {
-struct os_mbuf *sdu_rx = rx->sdu;
+if (OS_MBUF_PKTLEN(rx_sdu) == rx->data_offset) {
+struct os_mbuf *sdu_rx = rx_sdu;
 
 BLE_HS_LOG(DEBUG, "Received sdu_len=%d, credits left=%d\n",
-   OS_MBUF_PKTLEN(rx->sdu), rx->credits);
+   OS_MBUF_PKTLEN(rx_sdu), rx->credits);
 
 /* Lets get back control to os_mbuf to application.
  * Since it this callback application might want to set new sdu
  * we need to prepare space for this. Therefore we need sdu_rx
  */
-rx->sdu = NULL;
+rx_sdu = NULL;
+current_sdu =
+current_sdu < BLE_L2CAP_SDU_BUFF_CNT - 1 ? current_sdu + 1 : 0;

Review Comment:
   what if user provided 2 buffers only and we just used the second?



-- 
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-unsubscr...@mynewt.apache.org

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



[GitHub] [mynewt-nimble] apache-mynewt-bot commented on pull request #1303: apps/blehr: Fix blehr notify stopped incorrectly

2022-07-22 Thread GitBox


apache-mynewt-bot commented on PR #1303:
URL: https://github.com/apache/mynewt-nimble/pull/1303#issuecomment-1192533907

   
   
   
   ## Style check summary
   
    No suggestions at this time!
   


-- 
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-unsubscr...@mynewt.apache.org

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



[GitHub] [mynewt-nimble] apache-mynewt-bot commented on pull request #1271: L2CAP COC: added buffers for incoming SDU

2022-07-22 Thread GitBox


apache-mynewt-bot commented on PR #1271:
URL: https://github.com/apache/mynewt-nimble/pull/1271#issuecomment-1192501851

   
   
   
   ## Style check summary
   
    No suggestions at this time!
   


-- 
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-unsubscr...@mynewt.apache.org

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



[GitHub] [mynewt-nimble] apache-mynewt-bot commented on pull request #1271: L2CAP COC: added buffers for incoming SDU

2022-07-22 Thread GitBox


apache-mynewt-bot commented on PR #1271:
URL: https://github.com/apache/mynewt-nimble/pull/1271#issuecomment-1192468699

   
   
   
   ## Style check summary
   
   ### Our coding style is 
[here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
   
   
    nimble/host/src/ble_l2cap_coc.c
   
   
   ```diff
   @@ -191,7 +191,7 @@

rx_sdu = rx->sdus[current_sdu];

   -//DFLT_LOG_CRITICAL("current_sdu: %d\n", current_sdu);
   +/*DFLT_LOG_CRITICAL("current_sdu: %d\n", current_sdu); */

om_total = OS_MBUF_PKTLEN(*om);

   ```
   
   


-- 
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-unsubscr...@mynewt.apache.org

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