Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: L2CAP: Fit an auto-tuned MTU's PDU in one EDR packet
@ 2026-11-22 15:50 Simon Mikuda
  2026-11-22 17:20 ` bluez.test.bot
  0 siblings, 1 reply; 2+ messages in thread
From: Simon Mikuda @ 2026-11-22 15:50 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Simon Mikuda, Marcel Holtmann, Luiz Augusto von Dentz

l2cap_mtu_auto() sets the input MTU to the payload size of the
largest EDR packet the link allows. The MTU only limits the SDU though,
and the 4-byte L2CAP header is added on top of it, so a full-sized SDU
does not fit into that packet and is sent as two ACL fragments.
Subtract the L2CAP header from each value, e.g. for 3-DH5 the MTU
becomes 1017 instead of 1021.

Fixes: 4b6e228e297b ("Bluetooth: Auto tune if input MTU is set to 0")
Signed-off-by: Simon Mikuda <simon.mikuda@streamunlimited.com>
---
 net/bluetooth/l2cap_core.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index da947b65d26a..fb6fe760b147 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -3433,37 +3433,37 @@ static void l2cap_mtu_auto(struct l2cap_chan *chan)
 	 * (including the 2-byte payload header)
 	 */
 	if (!(conn->pkt_type & HCI_2DH1))
-		chan->imtu = 54;
+		chan->imtu = 54 - L2CAP_HDR_SIZE;
 
 	/* The 3-DH1 packet has between 2 and 85 information bytes
 	 * (including the 2-byte payload header)
 	 */
 	if (!(conn->pkt_type & HCI_3DH1))
-		chan->imtu = 83;
+		chan->imtu = 83 - L2CAP_HDR_SIZE;
 
 	/* The 2-DH3 packet has between 2 and 369 information bytes
 	 * (including the 2-byte payload header)
 	 */
 	if (!(conn->pkt_type & HCI_2DH3))
-		chan->imtu = 367;
+		chan->imtu = 367 - L2CAP_HDR_SIZE;
 
 	/* The 3-DH3 packet has between 2 and 554 information bytes
 	 * (including the 2-byte payload header)
 	 */
 	if (!(conn->pkt_type & HCI_3DH3))
-		chan->imtu = 552;
+		chan->imtu = 552 - L2CAP_HDR_SIZE;
 
 	/* The 2-DH5 packet has between 2 and 681 information bytes
 	 * (including the 2-byte payload header)
 	 */
 	if (!(conn->pkt_type & HCI_2DH5))
-		chan->imtu = 679;
+		chan->imtu = 679 - L2CAP_HDR_SIZE;
 
 	/* The 3-DH5 packet has between 2 and 1023 information bytes
 	 * (including the 2-byte payload header)
 	 */
 	if (!(conn->pkt_type & HCI_3DH5))
-		chan->imtu = 1021;
+		chan->imtu = 1021 - L2CAP_HDR_SIZE;
 }
 
 static int l2cap_build_conf_req(struct l2cap_chan *chan, void *data, size_t data_size)

base-commit: 4fe38719e6738feaa90486e36b0790dd5d960a96
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* RE: Bluetooth: L2CAP: Fit an auto-tuned MTU's PDU in one EDR packet
  2026-11-22 15:50 [PATCH] Bluetooth: L2CAP: Fit an auto-tuned MTU's PDU in one EDR packet Simon Mikuda
@ 2026-11-22 17:20 ` bluez.test.bot
  0 siblings, 0 replies; 2+ messages in thread
From: bluez.test.bot @ 2026-11-22 17:20 UTC (permalink / raw)
  To: linux-bluetooth, simon.mikuda

[-- Attachment #1: Type: text/plain, Size: 1074 bytes --]

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/series/1218718/

---Test result---

Test Summary:
CheckPatch                    PASS      0.55 seconds
VerifyFixes                   PASS      0.09 seconds
VerifySignedoff               PASS      0.09 seconds
GitLint                       PASS      0.22 seconds
SubjectPrefix                 PASS      0.08 seconds
BuildKernel                   PASS      18.91 seconds
CheckAllWarning               PASS      21.67 seconds
CheckSparse                   PASS      22.96 seconds
BuildKernel32                 PASS      18.79 seconds
CheckKernelLLVM               PASS      19.27 seconds
TestRunnerSetup               PASS      429.37 seconds
TestRunner_l2cap-tester       PASS      14.63 seconds
IncrementalBuild              PASS      18.17 seconds



https://github.com/bluez/bluetooth-next/pull/1185

---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-22 17:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-22 15:50 [PATCH] Bluetooth: L2CAP: Fit an auto-tuned MTU's PDU in one EDR packet Simon Mikuda
2026-11-22 17:20 ` bluez.test.bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox