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

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

commit 5b00265f0263c98c17e32b733dc95953092de83c
Author: Krzysztof Kopyściński <[email protected]>
AuthorDate: Mon Aug 21 10:16:34 2023 +0200

    host/ble_att.c: fix ATT MTU for EATT channels
    
    For EATT bearer, ATT MTU is same for bot RX and TX and is minimum of the
    two. L2CAP Credit Based Reconfigure Request can be used to change its
    value.
---
 nimble/host/src/ble_att.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/nimble/host/src/ble_att.c b/nimble/host/src/ble_att.c
index 3c5eaf75..5e221824 100644
--- a/nimble/host/src/ble_att.c
+++ b/nimble/host/src/ble_att.c
@@ -463,9 +463,12 @@ ble_att_chan_mtu(const struct ble_l2cap_chan *chan)
     uint16_t mtu;
 
 #if MYNEWT_VAL(BLE_EATT_CHAN_NUM) > 0
-    if (chan->scid != BLE_L2CAP_CID_ATT) {
-        /* EATT case */
-        return chan->coc_tx.mtu;
+    if (chan->psm == BLE_EATT_PSM) {
+        /* The ATT_MTU for the Enhanced ATT bearer shall be set to the minimum 
of the
+         * MTU field values of the two devices. Reference:
+         * Core v5.0, Vol 6, Part B, section 1.3.2.1
+         */
+        return min(chan->coc_tx.mtu, chan->coc_rx.mtu);
     }
 #endif
 

Reply via email to