Backport upstream fix that adds an imtu field to default_settings for
OBEX profiles (OPP, FTP, PBAP, MAS, MNS) and applies it to the L2CAP
listening socket via bt_io_set(). Without this, the listening socket
advertises the L2CAP minimum of 672 bytes in L2CAP_CONFIGURATION_RSP,
limiting the peer's outgoing PDU size and degrading Rx throughput.

Upstream-Status: Backport [bluez/bluez@646014a]
Signed-off-by: Wei Deng <[email protected]>
---
 meta/recipes-connectivity/bluez5/bluez5.inc   |   1 +
 ...2CAP-IMTU-for-OBEX-profile-listeners.patch | 118 ++++++++++++++++++
 2 files changed, 119 insertions(+)
 create mode 100644 
meta/recipes-connectivity/bluez5/bluez5/0001-profile-Set-L2CAP-IMTU-for-OBEX-profile-listeners.patch

diff --git a/meta/recipes-connectivity/bluez5/bluez5.inc 
b/meta/recipes-connectivity/bluez5/bluez5.inc
index e827d0a6d7..71bceddb21 100644
--- a/meta/recipes-connectivity/bluez5/bluez5.inc
+++ b/meta/recipes-connectivity/bluez5/bluez5.inc
@@ -72,6 +72,7 @@ SRC_URI = 
"${KERNELORG_MIRROR}/linux/bluetooth/bluez-${PV}.tar.xz \
            
file://0001-tools-Work-around-broken-stdin-handling-in-home-made.patch \
            
file://0001-gatt-client-Fix-use-after-free-caused-by-reentrant-c.patch \
            
file://0001-transport-Fix-set-volume-failure-with-invalid-device.patch \
+           file://0001-profile-Set-L2CAP-IMTU-for-OBEX-profile-listeners.patch 
\
            "
 S = "${UNPACKDIR}/bluez-${PV}"
 
diff --git 
a/meta/recipes-connectivity/bluez5/bluez5/0001-profile-Set-L2CAP-IMTU-for-OBEX-profile-listeners.patch
 
b/meta/recipes-connectivity/bluez5/bluez5/0001-profile-Set-L2CAP-IMTU-for-OBEX-profile-listeners.patch
new file mode 100644
index 0000000000..332b11464e
--- /dev/null
+++ 
b/meta/recipes-connectivity/bluez5/bluez5/0001-profile-Set-L2CAP-IMTU-for-OBEX-profile-listeners.patch
@@ -0,0 +1,118 @@
+From 646014a6a246fe99df27da12d2de7bcd2e04d0df Mon Sep 17 00:00:00 2001
+From: Wei Deng <[email protected]>
+Date: Thu, 4 Jun 2026 15:00:24 +0530
+Subject: [PATCH] profile: Set L2CAP IMTU for OBEX profile listeners
+
+The default_settings entries for OBEX profiles (OPP, FTP, PBAP, MAS,
+MNS) have no imtu field, so ext_start_servers() creates the L2CAP
+listening socket without an explicit IMTU. This causes the socket to
+advertise the L2CAP minimum of 672 bytes in L2CAP_CONFIGURATION_RSP,
+limiting the peer's outgoing PDU size and degrading Rx throughput.
+
+Add an imtu field to default_settings and set it to 32767 for all
+OBEX profiles that use L2CAP. Copy the value in ext_set_defaults()
+and apply it to the listening socket via bt_io_set() after
+bt_io_listen() succeeds.
+
+Signed-off-by: Wei Deng <[email protected]>
+Upstream-Status: Backport 
[https://github.com/bluez/bluez/commit/646014a6a246fe99df27da12d2de7bcd2e04d0df]
+---
+ src/profile.c | 19 +++++++++++++++++--
+ 1 file changed, 17 insertions(+), 2 deletions(-)
+
+diff --git a/src/profile.c b/src/profile.c
+index dfc5f7161..65df0f7a0 100644
+--- a/src/profile.c
++++ b/src/profile.c
+@@ -55,6 +55,8 @@
+ #define MAS_DEFAULT_CHANNEL   16
+ #define MNS_DEFAULT_CHANNEL   17
+ 
++#define BT_RX_MTU             32767
++
+ #define BTD_PROFILE_PSM_AUTO  -1
+ #define BTD_PROFILE_CHAN_AUTO -1
+ 
+@@ -678,6 +680,7 @@ struct ext_profile {
+ 
+       uint16_t version;
+       uint16_t features;
++      uint16_t imtu;
+ 
+       GSList *records;
+       GSList *servers;
+@@ -1423,6 +1426,9 @@ static uint32_t ext_start_servers(struct ext_profile 
*ext,
+                       if (psm == 0)
+                               bt_io_get(io, NULL, BT_IO_OPT_PSM, &psm,
+                                                       BT_IO_OPT_INVALID);
++                      if (ext->imtu)
++                              bt_io_set(io, NULL, BT_IO_OPT_IMTU, ext->imtu,
++                                                      BT_IO_OPT_INVALID);
+                       l2cap->io = io;
+                       l2cap->proto = BTPROTO_L2CAP;
+                       l2cap->psm = psm;
+@@ -2075,6 +2081,7 @@ static struct default_settings {
+                                       struct ext_io *rfcomm);
+       uint16_t        version;
+       uint16_t        features;
++      uint16_t        imtu;
+ } defaults[] = {
+       {
+               .uuid           = SPP_UUID,
+@@ -2142,6 +2149,7 @@ static struct default_settings {
+               .authorize      = false,
+               .get_record     = get_opp_record,
+               .version        = 0x0102,
++              .imtu           = BT_RX_MTU,
+       }, {
+               .uuid           = OBEX_FTP_UUID,
+               .name           = "File Transfer",
+@@ -2151,6 +2159,7 @@ static struct default_settings {
+               .authorize      = true,
+               .get_record     = get_ftp_record,
+               .version        = 0x0103,
++              .imtu           = BT_RX_MTU,
+       }, {
+               .uuid           = OBEX_SYNC_UUID,
+               .name           = "Synchronization",
+@@ -2167,6 +2176,7 @@ static struct default_settings {
+               .authorize      = true,
+               .get_record     = get_pse_record,
+               .version        = 0x0101,
++              .imtu           = BT_RX_MTU,
+       }, {
+               .uuid           = OBEX_PCE_UUID,
+               .name           = "Phone Book Access Client",
+@@ -2182,7 +2192,8 @@ static struct default_settings {
+               .mode           = BT_IO_MODE_ERTM,
+               .authorize      = true,
+               .get_record     = get_mas_record,
+-              .version        = 0x0100
++              .version        = 0x0100,
++              .imtu           = BT_RX_MTU,
+       }, {
+               .uuid           = OBEX_MNS_UUID,
+               .name           = "Message Notification",
+@@ -2191,7 +2202,8 @@ static struct default_settings {
+               .mode           = BT_IO_MODE_ERTM,
+               .authorize      = true,
+               .get_record     = get_mns_record,
+-              .version        = 0x0104
++              .version        = 0x0104,
++              .imtu           = BT_RX_MTU,
+       },
+ };
+ 
+@@ -2249,6 +2261,9 @@ static void ext_set_defaults(struct ext_profile *ext)
+               if (settings->features)
+                       ext->features = settings->features;
+ 
++              if (settings->imtu)
++                      ext->imtu = settings->imtu;
++
+               if (settings->name)
+                       ext->name = g_strdup(settings->name);
+       }
+-- 
+2.34.1
+
-- 
2.34.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#238137): 
https://lists.openembedded.org/g/openembedded-core/message/238137
Mute This Topic: https://lists.openembedded.org/mt/119657111/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to