GATT: Fix data length parameter
Should also account for L2CAP header size (4)
Bug: 199009840
Tag: #feature
Test: NRF connect
Change-Id: I6b51a8ef046d81836a4ca4850d052b68e0f4dd46
diff --git a/stack/gatt/gatt_sr.cc b/stack/gatt/gatt_sr.cc
index c0aedfa..9fe642c 100644
--- a/stack/gatt/gatt_sr.cc
+++ b/stack/gatt/gatt_sr.cc
@@ -32,6 +32,7 @@
#include "stack/eatt/eatt.h"
#include "stack/l2cap/l2c_int.h"
#define GATT_MTU_REQ_MIN_LEN 2
+#define L2CAP_PKT_OVERHEAD 4
using base::StringPrintf;
using bluetooth::Uuid;
@@ -814,7 +815,7 @@
LOG(INFO) << "MTU request PDU with MTU size " << +tcb.payload_size;
- BTM_SetBleDataLength(tcb.peer_bda, tcb.payload_size);
+ BTM_SetBleDataLength(tcb.peer_bda, tcb.payload_size + L2CAP_PKT_OVERHEAD);
tGATT_SR_MSG gatt_sr_msg;
gatt_sr_msg.mtu = tcb.payload_size;