Skip to content

Commit

Permalink
[Bluetooth] Reduce L2CAP MTU for RFCOMM connections
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Marcel Holtmann committed Feb 13, 2006
1 parent e9bb4c9 commit 56f3a40
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion include/net/bluetooth/rfcomm.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 9 additions & 4 deletions net/bluetooth/rfcomm/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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 */
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 56f3a40

Please sign in to comment.