aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2013-12-02 04:20:20 -0500
committerMarcel Holtmann <marcel@holtmann.org>2013-12-05 10:05:32 -0500
commit9149761ad74f618371b58fd37141d4c3706d88fc (patch)
tree9304f31b1fa1e95c274cbbede99ef05bf56446e2
parent6d3c15da1ddbffff2d0f50132a239209b2fa138e (diff)
Bluetooth: Add module parameter to enable LE CoC support
Along with the L2CAP Connection Oriented Channels features it is now allowed to use both custom fixed CIDs as well as PSM based (connection oriented connections). Since the support for this (with the subsequent patches) is still on an experimental stage, add a module parameter to enable it. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
-rw-r--r--include/net/bluetooth/l2cap.h1
-rw-r--r--net/bluetooth/l2cap_sock.c18
2 files changed, 13 insertions, 6 deletions
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index c853b16de4ef..94645d56fea7 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -809,6 +809,7 @@ static inline long l2cap_chan_no_get_sndtimeo(struct l2cap_chan *chan)
809} 809}
810 810
811extern bool disable_ertm; 811extern bool disable_ertm;
812extern bool enable_lecoc;
812 813
813int l2cap_init_sockets(void); 814int l2cap_init_sockets(void);
814void l2cap_cleanup_sockets(void); 815void l2cap_cleanup_sockets(void);
diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c
index 7cc24d263caa..5a1d0cb0b8d5 100644
--- a/net/bluetooth/l2cap_sock.c
+++ b/net/bluetooth/l2cap_sock.c
@@ -27,6 +27,7 @@
27 27
28/* Bluetooth L2CAP sockets. */ 28/* Bluetooth L2CAP sockets. */
29 29
30#include <linux/module.h>
30#include <linux/export.h> 31#include <linux/export.h>
31 32
32#include <net/bluetooth/bluetooth.h> 33#include <net/bluetooth/bluetooth.h>
@@ -35,6 +36,8 @@
35 36
36#include "smp.h" 37#include "smp.h"
37 38
39bool enable_lecoc;
40
38static struct bt_sock_list l2cap_sk_list = { 41static struct bt_sock_list l2cap_sk_list = {
39 .lock = __RW_LOCK_UNLOCKED(l2cap_sk_list.lock) 42 .lock = __RW_LOCK_UNLOCKED(l2cap_sk_list.lock)
40}; 43};
@@ -73,11 +76,11 @@ static int l2cap_sock_bind(struct socket *sock, struct sockaddr *addr, int alen)
73 return -EINVAL; 76 return -EINVAL;
74 77
75 if (bdaddr_type_is_le(la.l2_bdaddr_type)) { 78 if (bdaddr_type_is_le(la.l2_bdaddr_type)) {
76 /* Connection oriented channels are not supported on LE */ 79 if (!enable_lecoc && la.l2_psm)
77 if (la.l2_psm)
78 return -EINVAL; 80 return -EINVAL;
79 /* We only allow ATT user space socket */ 81 /* We only allow ATT user space socket */
80 if (la.l2_cid != __constant_cpu_to_le16(L2CAP_CID_ATT)) 82 if (la.l2_cid &&
83 la.l2_cid != __constant_cpu_to_le16(L2CAP_CID_ATT))
81 return -EINVAL; 84 return -EINVAL;
82 } 85 }
83 86
@@ -189,11 +192,11 @@ static int l2cap_sock_connect(struct socket *sock, struct sockaddr *addr,
189 return -EINVAL; 192 return -EINVAL;
190 193
191 if (bdaddr_type_is_le(la.l2_bdaddr_type)) { 194 if (bdaddr_type_is_le(la.l2_bdaddr_type)) {
192 /* Connection oriented channels are not supported on LE */ 195 if (!enable_lecoc && la.l2_psm)
193 if (la.l2_psm)
194 return -EINVAL; 196 return -EINVAL;
195 /* We only allow ATT user space socket */ 197 /* We only allow ATT user space socket */
196 if (la.l2_cid != __constant_cpu_to_le16(L2CAP_CID_ATT)) 198 if (la.l2_cid &&
199 la.l2_cid != __constant_cpu_to_le16(L2CAP_CID_ATT))
197 return -EINVAL; 200 return -EINVAL;
198 } 201 }
199 202
@@ -1469,3 +1472,6 @@ void l2cap_cleanup_sockets(void)
1469 bt_sock_unregister(BTPROTO_L2CAP); 1472 bt_sock_unregister(BTPROTO_L2CAP);
1470 proto_unregister(&l2cap_proto); 1473 proto_unregister(&l2cap_proto);
1471} 1474}
1475
1476module_param(enable_lecoc, bool, 0644);
1477MODULE_PARM_DESC(enable_lecoc, "Enable support for LE CoC");