]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
[Bluetooth] Reduce L2CAP MTU for RFCOMM connections
authorMarcel Holtmann <marcel@holtmann.org>
Mon, 13 Feb 2006 10:39:57 +0000 (11:39 +0100)
committerMarcel Holtmann <marcel@holtmann.org>
Mon, 13 Feb 2006 10:39:57 +0000 (11:39 +0100)
This patch reduces the default L2CAP MTU for all RFCOMM connections
from 1024 to 1013 to improve the interoperability with some broken
RFCOMM implementations. To make this more flexible the L2CAP MTU
becomes also a module parameter and so it can changed at runtime.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
include/net/bluetooth/rfcomm.h
net/bluetooth/rfcomm/core.c

index bbfac86734ec44f50b34efaf5067498c8080a3dc..89d743cfdfdfdd107d315331d37d5650305e52ad 100644 (file)
@@ -33,7 +33,7 @@
 #define RFCOMM_DEFAULT_MTU     127
 #define RFCOMM_DEFAULT_CREDITS 7
 
-#define RFCOMM_MAX_L2CAP_MTU   1024
+#define RFCOMM_MAX_L2CAP_MTU   1013
 #define RFCOMM_MAX_CREDITS     40
 
 #define RFCOMM_SKB_HEAD_RESERVE        8
index 0d89d64341364fcf9e6eb4214568c24795ea6a51..5b4253c61f628d2c7256f5ac5f196bd20b40f5ce 100644 (file)
 #include <net/bluetooth/l2cap.h>
 #include <net/bluetooth/rfcomm.h>
 
-#define VERSION "1.6"
-
 #ifndef CONFIG_BT_RFCOMM_DEBUG
 #undef  BT_DBG
 #define BT_DBG(D...)
 #endif
 
+#define VERSION "1.7"
+
+static unsigned int l2cap_mtu = RFCOMM_MAX_L2CAP_MTU;
+
 static struct task_struct *rfcomm_thread;
 
 static DECLARE_MUTEX(rfcomm_sem);
@@ -623,7 +625,7 @@ static struct rfcomm_session *rfcomm_session_create(bdaddr_t *src, bdaddr_t *dst
        /* Set L2CAP options */
        sk = sock->sk;
        lock_sock(sk);
-       l2cap_pi(sk)->imtu = RFCOMM_MAX_L2CAP_MTU;
+       l2cap_pi(sk)->imtu = l2cap_mtu;
        release_sock(sk);
 
        s = rfcomm_session_add(sock, BT_BOUND);
@@ -1868,7 +1870,7 @@ static int rfcomm_add_listener(bdaddr_t *ba)
        /* Set L2CAP options */
        sk = sock->sk;
        lock_sock(sk);
-       l2cap_pi(sk)->imtu = RFCOMM_MAX_L2CAP_MTU;
+       l2cap_pi(sk)->imtu = l2cap_mtu;
        release_sock(sk);
 
        /* Start listening on the socket */
@@ -2070,6 +2072,9 @@ static void __exit rfcomm_exit(void)
 module_init(rfcomm_init);
 module_exit(rfcomm_exit);
 
+module_param(l2cap_mtu, uint, 0644);
+MODULE_PARM_DESC(l2cap_mtu, "Default MTU for the L2CAP connection");
+
 MODULE_AUTHOR("Maxim Krasnyansky <maxk@qualcomm.com>, Marcel Holtmann <marcel@holtmann.org>");
 MODULE_DESCRIPTION("Bluetooth RFCOMM ver " VERSION);
 MODULE_VERSION(VERSION);