mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-10 23:20:05 +00:00
[Bluetooth] Reduce L2CAP MTU for RFCOMM connections
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>
This commit is contained in:
parent
e9bb4c9929
commit
56f3a40a5e
@ -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
|
||||
|
@ -46,13 +46,15 @@
|
||||
#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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user