From: Johan Hedberg <johan.hedberg@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH 02/31] Bluetooth: Add module parameter to enable LE CoC support
Date: Wed, 4 Dec 2013 16:10:58 +0200 [thread overview]
Message-ID: <1386166287-13693-3-git-send-email-johan.hedberg@gmail.com> (raw)
In-Reply-To: <1386166287-13693-1-git-send-email-johan.hedberg@gmail.com>
From: Johan Hedberg <johan.hedberg@intel.com>
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>
---
include/net/bluetooth/l2cap.h | 1 +
net/bluetooth/l2cap_sock.c | 18 ++++++++++++------
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)
}
extern bool disable_ertm;
+extern bool enable_lecoc;
int l2cap_init_sockets(void);
void 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 @@
/* Bluetooth L2CAP sockets. */
+#include <linux/module.h>
#include <linux/export.h>
#include <net/bluetooth/bluetooth.h>
@@ -35,6 +36,8 @@
#include "smp.h"
+bool enable_lecoc;
+
static struct bt_sock_list l2cap_sk_list = {
.lock = __RW_LOCK_UNLOCKED(l2cap_sk_list.lock)
};
@@ -73,11 +76,11 @@ static int l2cap_sock_bind(struct socket *sock, struct sockaddr *addr, int alen)
return -EINVAL;
if (bdaddr_type_is_le(la.l2_bdaddr_type)) {
- /* Connection oriented channels are not supported on LE */
- if (la.l2_psm)
+ if (!enable_lecoc && la.l2_psm)
return -EINVAL;
/* We only allow ATT user space socket */
- if (la.l2_cid != __constant_cpu_to_le16(L2CAP_CID_ATT))
+ if (la.l2_cid &&
+ la.l2_cid != __constant_cpu_to_le16(L2CAP_CID_ATT))
return -EINVAL;
}
@@ -189,11 +192,11 @@ static int l2cap_sock_connect(struct socket *sock, struct sockaddr *addr,
return -EINVAL;
if (bdaddr_type_is_le(la.l2_bdaddr_type)) {
- /* Connection oriented channels are not supported on LE */
- if (la.l2_psm)
+ if (!enable_lecoc && la.l2_psm)
return -EINVAL;
/* We only allow ATT user space socket */
- if (la.l2_cid != __constant_cpu_to_le16(L2CAP_CID_ATT))
+ if (la.l2_cid &&
+ la.l2_cid != __constant_cpu_to_le16(L2CAP_CID_ATT))
return -EINVAL;
}
@@ -1469,3 +1472,6 @@ void l2cap_cleanup_sockets(void)
bt_sock_unregister(BTPROTO_L2CAP);
proto_unregister(&l2cap_proto);
}
+
+module_param(enable_lecoc, bool, 0644);
+MODULE_PARM_DESC(enable_lecoc, "Enable support for LE CoC");
--
1.8.4.2
next prev parent reply other threads:[~2013-12-04 14:10 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-04 14:10 [PATCH 00/31] Bluetooth: LE CoC support Johan Hedberg
2013-12-04 14:10 ` [PATCH 01/31] Bluetooth: Remove unnecessary braces from one-line if-statement Johan Hedberg
2013-12-04 14:10 ` Johan Hedberg [this message]
2013-12-04 14:10 ` [PATCH 03/31] Bluetooth: Update l2cap_global_chan_by_psm() to take a link type Johan Hedberg
2013-12-04 14:11 ` [PATCH 04/31] Bluetooth: Allow l2cap_chan_check_security() to be used for LE links Johan Hedberg
2013-12-04 14:11 ` [PATCH 05/31] Bluetooth: Pass command length to LE signaling channel handlers Johan Hedberg
2013-12-04 14:11 ` [PATCH 06/31] Bluetooth: Move LE L2CAP initiator procedure to its own function Johan Hedberg
2013-12-04 14:11 ` [PATCH 07/31] Bluetooth: Add definitions for LE connection oriented channels Johan Hedberg
2013-12-04 14:11 ` [PATCH 08/31] Bluetooth: Add initial code for LE L2CAP Connect Request Johan Hedberg
2013-12-04 14:11 ` [PATCH 09/31] Bluetooth: Add smp_sufficient_security helper function Johan Hedberg
2013-12-04 14:11 ` [PATCH 10/31] Bluetooth: Refactor L2CAP connect rejection to its own function Johan Hedberg
2013-12-04 16:14 ` Vinicius Costa Gomes
2013-12-04 14:11 ` [PATCH 11/31] Bluetooth: Add basic LE L2CAP connect request receiving support Johan Hedberg
2013-12-04 14:11 ` [PATCH 12/31] Bluetooth: Fix L2CAP channel closing for LE connections Johan Hedberg
2013-12-04 14:11 ` [PATCH 13/31] Bluetooth: Add L2CAP Disconnect suppport for LE Johan Hedberg
2013-12-04 14:11 ` [PATCH 14/31] Bluetooth: Make l2cap_le_sig_cmd logic consistent Johan Hedberg
2013-12-04 14:11 ` [PATCH 15/31] Bluetooth: Add LE L2CAP flow control mode Johan Hedberg
2013-12-04 14:11 ` [PATCH 16/31] Bluetooth: Track LE L2CAP credits in l2cap_chan Johan Hedberg
2013-12-04 14:11 ` [PATCH 17/31] Bluetooth: Limit L2CAP_OPTIONS socket option usage with LE Johan Hedberg
2013-12-04 14:11 ` [PATCH 18/31] Bluetooth: Add new BT_SNDMTU and BT_RCVMTU socket options Johan Hedberg
2013-12-04 14:11 ` [PATCH 19/31] Bluetooth: Implement returning of LE L2CAP credits Johan Hedberg
2013-12-04 16:15 ` Vinicius Costa Gomes
2013-12-04 14:11 ` [PATCH 20/31] Bluetooth: Add LE flow control discipline Johan Hedberg
2013-12-04 14:11 ` [PATCH 21/31] Bluetooth: Reject LE CoC commands when the feature is not enabled Johan Hedberg
2013-12-04 14:11 ` [PATCH 22/31] Bluetooth: Introduce L2CAP channel callback for suspending Johan Hedberg
2013-12-04 14:11 ` [PATCH 23/31] Bluetooth: Add LE L2CAP segmentation support for outgoing data Johan Hedberg
2013-12-04 14:11 ` [PATCH 24/31] Bluetooth: Implement LE L2CAP reassembly Johan Hedberg
2013-12-04 14:11 ` [PATCH 25/31] Bluetooth: Fix LE L2CAP Connect Request handling together with SMP Johan Hedberg
2013-12-04 14:11 ` [PATCH 26/31] Bluetooth: Fix suspending the L2CAP socket if we start with 0 credits Johan Hedberg
2013-12-04 14:11 ` [PATCH 27/31] Bluetooth: Limit LE MPS to the MTU value Johan Hedberg
2013-12-04 14:11 ` [PATCH 28/31] Bluetooth: Fix clearing of chan->omtu for LE CoC channels Johan Hedberg
2013-12-04 14:11 ` [PATCH 29/31] Bluetooth: Fix CID ranges for LE CoC CID allocations Johan Hedberg
2013-12-04 14:11 ` [PATCH 30/31] Bluetooth: Fix validating LE PSM values Johan Hedberg
2013-12-04 14:11 ` [PATCH 31/31] Bluetooth: Add debugfs controls for LE CoC MPS and Credits Johan Hedberg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1386166287-13693-3-git-send-email-johan.hedberg@gmail.com \
--to=johan.hedberg@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).