You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by an...@apache.org on 2021/11/09 00:09:30 UTC

[mynewt-nimble] branch master updated (17a7240 -> 4a89a4c)

This is an automated email from the ASF dual-hosted git repository.

andk pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git.


    from 17a7240  nimble/ll: Fix starting ctrl proc timer
     new 513ea27  Revert "nimble/ll: Fix encrypted data PDU payload length calculation"
     new 4a89a4c  nimble/ll: Fix encrypted payload length

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 nimble/controller/src/ble_ll_conn.c | 21 +++++++++------------
 1 file changed, 9 insertions(+), 12 deletions(-)

[mynewt-nimble] 01/02: Revert "nimble/ll: Fix encrypted data PDU payload length calculation"

Posted by an...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

andk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git

commit 513ea2738655bb10010dcf1d7e646b6e1ed3a355
Author: Andrzej Kaczmarek <an...@codecoup.pl>
AuthorDate: Mon Nov 8 11:23:14 2021 +0100

    Revert "nimble/ll: Fix encrypted data PDU payload length calculation"
    
    This reverts commit c185dd6719b1cc9e08abada79e16e866118d3501.
---
 nimble/controller/src/ble_ll_conn.c | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/nimble/controller/src/ble_ll_conn.c b/nimble/controller/src/ble_ll_conn.c
index ebeddd7..20b578a 100644
--- a/nimble/controller/src/ble_ll_conn.c
+++ b/nimble/controller/src/ble_ll_conn.c
@@ -855,7 +855,6 @@ static uint16_t
 ble_ll_conn_adjust_pyld_len(struct ble_ll_conn_sm *connsm, uint16_t pyld_len)
 {
     uint16_t phy_max_tx_octets;
-    uint16_t mic_len;
     uint16_t ret;
 
 #if (BLE_LL_BT5_PHY_SUPPORTED == 1)
@@ -878,19 +877,11 @@ ble_ll_conn_adjust_pyld_len(struct ble_ll_conn_sm *connsm, uint16_t pyld_len)
 
     ret = pyld_len;
 
-    mic_len = 0;
-#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LE_ENCRYPTION)
-    if (CONN_F_ENCRYPTED(connsm)) {
-        mic_len = BLE_LL_DATA_MIC_LEN;
-    }
-#endif
-
-
-    if (ret > connsm->eff_max_tx_octets - mic_len) {
+    if (ret > connsm->eff_max_tx_octets) {
         ret = connsm->eff_max_tx_octets;
     }
 
-    if (ret > phy_max_tx_octets - mic_len) {
+    if (ret > phy_max_tx_octets) {
         ret = phy_max_tx_octets;
     }
 

[mynewt-nimble] 02/02: nimble/ll: Fix encrypted payload length

Posted by an...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

andk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git

commit 4a89a4c5cb1a33e8eae3c01a2108fedfb7eb180e
Author: Andrzej Kaczmarek <an...@codecoup.pl>
AuthorDate: Mon Nov 8 11:23:31 2021 +0100

    nimble/ll: Fix encrypted payload length
    
    ble_ll_pdu_max_tx_octets_get() returns number of bytes that can be
    added between LL header and CRC so the complete PDU is no longer than
    maxTxTime allowed. However, if link is encrypted there will be also
    MIC added after the payload so effectively we need to stript that extra
    4 bytes from allowed payload length.
---
 nimble/controller/src/ble_ll_conn.c | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/nimble/controller/src/ble_ll_conn.c b/nimble/controller/src/ble_ll_conn.c
index 20b578a..30a381e 100644
--- a/nimble/controller/src/ble_ll_conn.c
+++ b/nimble/controller/src/ble_ll_conn.c
@@ -854,7 +854,7 @@ ble_ll_conn_chk_csm_flags(struct ble_ll_conn_sm *connsm)
 static uint16_t
 ble_ll_conn_adjust_pyld_len(struct ble_ll_conn_sm *connsm, uint16_t pyld_len)
 {
-    uint16_t phy_max_tx_octets;
+    uint16_t max_pyld_len;
     uint16_t ret;
 
 #if (BLE_LL_BT5_PHY_SUPPORTED == 1)
@@ -867,22 +867,28 @@ ble_ll_conn_adjust_pyld_len(struct ble_ll_conn_sm *connsm, uint16_t pyld_len)
         phy_mode = connsm->phy_data.tx_phy_mode;
     }
 
-    phy_max_tx_octets = ble_ll_pdu_max_tx_octets_get(connsm->eff_max_tx_time,
-                                                     phy_mode);
+    max_pyld_len = ble_ll_pdu_max_tx_octets_get(connsm->eff_max_tx_time,
+                                                phy_mode);
 
 #else
-    phy_max_tx_octets = ble_ll_pdu_max_tx_octets_get(connsm->eff_max_tx_time,
-                                                     BLE_PHY_MODE_1M);
+    max_pyld_len = ble_ll_pdu_max_tx_octets_get(connsm->eff_max_tx_time,
+                                                BLE_PHY_MODE_1M);
 #endif
 
     ret = pyld_len;
 
+#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LE_ENCRYPTION)
+    if (CONN_F_ENCRYPTED(connsm)) {
+        max_pyld_len -= BLE_LL_DATA_MIC_LEN;
+    }
+#endif
+
     if (ret > connsm->eff_max_tx_octets) {
         ret = connsm->eff_max_tx_octets;
     }
 
-    if (ret > phy_max_tx_octets) {
-        ret = phy_max_tx_octets;
+    if (ret > max_pyld_len) {
+        ret = max_pyld_len;
     }
 
     return ret;