linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFCv0 0/4] L2CAP and HCI preparation code for A2MP
@ 2011-10-12  7:53 Emeltchenko Andrei
  2011-10-12  7:53 ` [RFCv0 1/4] Bluetooth: L2CAP Create Chan Req/Rsp support Emeltchenko Andrei
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Emeltchenko Andrei @ 2011-10-12  7:53 UTC (permalink / raw)
  To: linux-bluetooth

From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

Preparation code for AMP

Andrei Emeltchenko (4):
  Bluetooth: L2CAP Create Chan Req/Rsp support
  Bluetooth: AMP: read local amp info HCI command
  Bluetooth: physical link HCI interface to AMP
  Bluetooth: add A2MP fixed channel when hs_enabled

 include/net/bluetooth/hci.h      |   42 +++++++++++++++++++
 include/net/bluetooth/hci_core.h |   11 +++++
 include/net/bluetooth/l2cap.h    |   27 +++++++++++-
 net/bluetooth/hci_core.c         |   45 ++++++++++++++++++++
 net/bluetooth/hci_event.c        |   28 +++++++++++++
 net/bluetooth/l2cap_core.c       |   84 ++++++++++++++++++++++++++++++++++++-
 6 files changed, 232 insertions(+), 5 deletions(-)

-- 
1.7.4.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [RFCv0 1/4] Bluetooth: L2CAP Create Chan Req/Rsp support
  2011-10-12  7:53 [RFCv0 0/4] L2CAP and HCI preparation code for A2MP Emeltchenko Andrei
@ 2011-10-12  7:53 ` Emeltchenko Andrei
  2011-10-13 20:33   ` Gustavo Padovan
  2011-10-12  7:53 ` [RFCv0 2/4] Bluetooth: AMP: read local amp info HCI command Emeltchenko Andrei
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: Emeltchenko Andrei @ 2011-10-12  7:53 UTC (permalink / raw)
  To: linux-bluetooth

From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

Backport l2cap create channel req/rsp from codeaurora tree
git://codeaurora.org/kernel/msm.git
Currently functionality is the same like in l2cap connect req/rsp

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
---
 include/net/bluetooth/hci.h   |    3 ++
 include/net/bluetooth/l2cap.h |   22 +++++++++++-
 net/bluetooth/l2cap_core.c    |   72 ++++++++++++++++++++++++++++++++++++++++-
 3 files changed, 94 insertions(+), 3 deletions(-)

diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index aaf79af..f8adc8e 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -56,6 +56,9 @@
 #define HCI_BREDR	0x00
 #define HCI_AMP		0x01
 
+#define HCI_AMP_ID(id)     ((id) + 0x10)  /* convert HCI dev index to AMP ID */
+#define AMP_HCI_ID(id)     ((id) - 0x10)  /* convert AMP ID to HCI dev index */
+
 /* HCI device quirks */
 enum {
 	HCI_QUIRK_NO_RESET,
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index ebd6392..45d1814 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -91,6 +91,8 @@ struct l2cap_conninfo {
 #define L2CAP_ECHO_RSP		0x09
 #define L2CAP_INFO_REQ		0x0a
 #define L2CAP_INFO_RSP		0x0b
+#define L2CAP_CREATE_CHAN_REQ	0x0c
+#define L2CAP_CREATE_CHAN_RSP	0x0d
 #define L2CAP_CONN_PARAM_UPDATE_REQ	0x12
 #define L2CAP_CONN_PARAM_UPDATE_RSP	0x13
 
@@ -214,14 +216,15 @@ struct l2cap_conn_rsp {
 #define L2CAP_CID_DYN_START	0x0040
 #define L2CAP_CID_DYN_END	0xffff
 
-/* connect result */
+/* connect/create channel results */
 #define L2CAP_CR_SUCCESS	0x0000
 #define L2CAP_CR_PEND		0x0001
 #define L2CAP_CR_BAD_PSM	0x0002
 #define L2CAP_CR_SEC_BLOCK	0x0003
 #define L2CAP_CR_NO_MEM		0x0004
+#define L2CAP_CR_BAD_AMP	0x0005
 
-/* connect status */
+/* connect/create channel status */
 #define L2CAP_CS_NO_INFO	0x0000
 #define L2CAP_CS_AUTHEN_PEND	0x0001
 #define L2CAP_CS_AUTHOR_PEND	0x0002
@@ -298,6 +301,19 @@ struct l2cap_info_rsp {
 	__u8        data[0];
 } __packed;
 
+struct l2cap_create_chan_req {
+	__le16      psm;
+	__le16      scid;
+	__u8        amp_id;
+} __packed;
+
+struct l2cap_create_chan_rsp {
+	__le16      dcid;
+	__le16      scid;
+	__le16      result;
+	__le16      status;
+} __packed;
+
 /* info type */
 #define L2CAP_IT_CL_MTU		0x0001
 #define L2CAP_IT_FEAT_MASK	0x0002
@@ -353,6 +369,8 @@ struct l2cap_chan {
 
 	__u8		ident;
 
+	__u8		amp_id;
+
 	__u8		conf_req[64];
 	__u8		conf_len;
 	__u8		num_conf_req;
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index d418ddb..9144d70 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -2392,7 +2392,8 @@ static inline int l2cap_command_rej(struct l2cap_conn *conn, struct l2cap_cmd_hd
 	return 0;
 }
 
-static inline int l2cap_connect_req(struct l2cap_conn *conn, struct l2cap_cmd_hdr *cmd, u8 *data)
+static inline struct sock *__l2cap_connect(struct l2cap_conn *conn,
+		struct l2cap_cmd_hdr *cmd, u8 *data, u8 rsp_code, u8 amp_id)
 {
 	struct l2cap_conn_req *req = (struct l2cap_conn_req *) data;
 	struct l2cap_conn_rsp rsp;
@@ -2464,6 +2465,7 @@ static inline int l2cap_connect_req(struct l2cap_conn *conn, struct l2cap_cmd_hd
 	__set_chan_timer(chan, sk->sk_sndtimeo);
 
 	chan->ident = cmd->ident;
+	chan->amp_id = amp_id;
 
 	if (conn->info_state & L2CAP_INFO_FEAT_MASK_REQ_DONE) {
 		if (l2cap_check_security(chan)) {
@@ -2526,6 +2528,14 @@ sendresp:
 	return 0;
 }
 
+static inline int l2cap_connect_req(struct l2cap_conn *conn,
+					struct l2cap_cmd_hdr *cmd, u8 *data)
+{
+	__l2cap_connect(conn, cmd, data, L2CAP_CONN_RSP, 0);
+
+	return 0;
+}
+
 static inline int l2cap_connect_rsp(struct l2cap_conn *conn, struct l2cap_cmd_hdr *cmd, u8 *data)
 {
 	struct l2cap_conn_rsp *rsp = (struct l2cap_conn_rsp *) data;
@@ -2950,6 +2960,58 @@ static inline int l2cap_information_rsp(struct l2cap_conn *conn, struct l2cap_cm
 	return 0;
 }
 
+static inline int l2cap_create_channel_req(struct l2cap_conn *conn,
+					struct l2cap_cmd_hdr *cmd, u8 *data)
+{
+	struct l2cap_create_chan_req *req =
+		(struct l2cap_create_chan_req *) data;
+	struct sock *sk;
+	u16 psm, scid;
+
+	psm = le16_to_cpu(req->psm);
+	scid = le16_to_cpu(req->scid);
+
+	BT_DBG("psm %d, scid %d, amp_id %d", psm, scid, req->amp_id);
+
+	if (req->amp_id) {
+		struct hci_dev *hdev;
+
+		/* Validate AMP controller id */
+		hdev = hci_dev_get(AMP_HCI_ID(req->amp_id));
+		if (!hdev || !test_bit(HCI_UP, &hdev->flags)) {
+			struct l2cap_create_chan_rsp rsp;
+
+			rsp.dcid = 0;
+			rsp.scid = cpu_to_le16(scid);
+			rsp.result = L2CAP_CR_BAD_AMP;
+			rsp.status = L2CAP_CS_NO_INFO;
+
+			l2cap_send_cmd(conn, cmd->ident, L2CAP_CREATE_CHAN_RSP,
+							sizeof(rsp), &rsp);
+
+			if (hdev)
+				hci_dev_put(hdev);
+
+			return 0;
+		}
+
+		hci_dev_put(hdev);
+	}
+
+	sk = __l2cap_connect(conn, cmd, data, L2CAP_CREATE_CHAN_RSP,
+								req->amp_id);
+
+	return 0;
+}
+
+static inline int l2cap_create_channel_rsp(struct l2cap_conn *conn,
+					struct l2cap_cmd_hdr *cmd, u8 *data)
+{
+	BT_DBG("conn %p", conn);
+
+	return l2cap_connect_rsp(conn, cmd, data);
+}
+
 static inline int l2cap_check_conn_param(u16 min, u16 max, u16 latency,
 							u16 to_multiplier)
 {
@@ -3062,6 +3124,14 @@ static inline int l2cap_bredr_sig_cmd(struct l2cap_conn *conn,
 		err = l2cap_information_rsp(conn, cmd, data);
 		break;
 
+	case L2CAP_CREATE_CHAN_REQ:
+		err = l2cap_create_channel_req(conn, cmd, data);
+		break;
+
+	case L2CAP_CREATE_CHAN_RSP:
+		err = l2cap_create_channel_rsp(conn, cmd, data);
+		break;
+
 	default:
 		BT_ERR("Unknown BR/EDR signaling command 0x%2.2x", cmd->code);
 		err = -EINVAL;
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [RFCv0 2/4] Bluetooth: AMP: read local amp info HCI command
  2011-10-12  7:53 [RFCv0 0/4] L2CAP and HCI preparation code for A2MP Emeltchenko Andrei
  2011-10-12  7:53 ` [RFCv0 1/4] Bluetooth: L2CAP Create Chan Req/Rsp support Emeltchenko Andrei
@ 2011-10-12  7:53 ` Emeltchenko Andrei
  2011-10-13 20:35   ` Gustavo Padovan
  2011-10-12  7:53 ` [RFCv0 3/4] Bluetooth: physical link HCI interface to AMP Emeltchenko Andrei
  2011-10-12  7:53 ` [RFCv0 4/4] Bluetooth: add A2MP fixed channel when hs_enabled Emeltchenko Andrei
  3 siblings, 1 reply; 8+ messages in thread
From: Emeltchenko Andrei @ 2011-10-12  7:53 UTC (permalink / raw)
  To: linux-bluetooth

From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

Implementation of Read Local AMP Info Command

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
---
 include/net/bluetooth/hci.h      |   15 +++++++++++++++
 include/net/bluetooth/hci_core.h |   11 +++++++++++
 net/bluetooth/hci_event.c        |   28 ++++++++++++++++++++++++++++
 3 files changed, 54 insertions(+), 0 deletions(-)

diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index f8adc8e..5a6fa24 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -729,6 +729,21 @@ struct hci_cp_write_page_scan_activity {
 	#define PAGE_SCAN_TYPE_STANDARD		0x00
 	#define PAGE_SCAN_TYPE_INTERLACED	0x01
 
+#define HCI_OP_READ_LOCAL_AMP_INFO	0x1409
+struct hci_rp_read_local_amp_info {
+	__u8     status;
+	__u8     amp_status;
+	__le32   total_bw;
+	__le32   max_bw;
+	__le32   min_latency;
+	__le32   max_pdu;
+	__u8     amp_type;
+	__le16   pal_cap;
+	__le16   max_assoc_size;
+	__le32   max_flush_to;
+	__le32   be_flush_to;
+} __packed;
+
 #define HCI_OP_LE_SET_EVENT_MASK	0x2001
 struct hci_cp_le_set_event_mask {
 	__u8     mask[8];
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 5b92442..32cddb0 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -150,6 +150,17 @@ struct hci_dev {
 	__u16		sniff_min_interval;
 	__u16		sniff_max_interval;
 
+	__u8		amp_status;
+	__u32		amp_total_bw;
+	__u32		amp_max_bw;
+	__u32		amp_min_latency;
+	__u32		amp_max_pdu;
+	__u8		amp_type;
+	__u16		amp_pal_cap;
+	__u16		amp_assoc_size;
+	__u32		amp_max_flush_to;
+	__u32		amp_be_flush_to;
+
 	unsigned int	auto_accept_delay;
 
 	unsigned long	quirks;
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index d7d96b6..4149de6 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -748,6 +748,30 @@ static void hci_cc_write_ca_timeout(struct hci_dev *hdev, struct sk_buff *skb)
 	hci_req_complete(hdev, HCI_OP_WRITE_CA_TIMEOUT, status);
 }
 
+static void hci_cc_read_local_amp_info(struct hci_dev *hdev,
+		struct sk_buff *skb)
+{
+	struct hci_rp_read_local_amp_info *rp = (void *) skb->data;
+
+	BT_DBG("%s status 0x%x", hdev->name, rp->status);
+
+	if (rp->status)
+		return;
+
+	hdev->amp_status = rp->amp_status;
+	hdev->amp_total_bw = __le32_to_cpu(rp->total_bw);
+	hdev->amp_max_bw = __le32_to_cpu(rp->max_bw);
+	hdev->amp_min_latency = __le32_to_cpu(rp->min_latency);
+	hdev->amp_max_pdu = __le32_to_cpu(rp->max_pdu);
+	hdev->amp_type = rp->amp_type;
+	hdev->amp_pal_cap = __le16_to_cpu(rp->pal_cap);
+	hdev->amp_assoc_size = __le16_to_cpu(rp->max_assoc_size);
+	hdev->amp_be_flush_to = __le32_to_cpu(rp->be_flush_to);
+	hdev->amp_max_flush_to = __le32_to_cpu(rp->max_flush_to);
+
+	hci_req_complete(hdev, HCI_OP_READ_LOCAL_AMP_INFO, rp->status);
+}
+
 static void hci_cc_delete_stored_link_key(struct hci_dev *hdev,
 							struct sk_buff *skb)
 {
@@ -1898,6 +1922,10 @@ static inline void hci_cmd_complete_evt(struct hci_dev *hdev, struct sk_buff *sk
 		hci_cc_write_ca_timeout(hdev, skb);
 		break;
 
+	case HCI_OP_READ_LOCAL_AMP_INFO:
+		hci_cc_read_local_amp_info(hdev, skb);
+		break;
+
 	case HCI_OP_DELETE_STORED_LINK_KEY:
 		hci_cc_delete_stored_link_key(hdev, skb);
 		break;
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [RFCv0 3/4] Bluetooth: physical link HCI interface to AMP
  2011-10-12  7:53 [RFCv0 0/4] L2CAP and HCI preparation code for A2MP Emeltchenko Andrei
  2011-10-12  7:53 ` [RFCv0 1/4] Bluetooth: L2CAP Create Chan Req/Rsp support Emeltchenko Andrei
  2011-10-12  7:53 ` [RFCv0 2/4] Bluetooth: AMP: read local amp info HCI command Emeltchenko Andrei
@ 2011-10-12  7:53 ` Emeltchenko Andrei
  2011-10-13 20:36   ` Gustavo Padovan
  2011-10-12  7:53 ` [RFCv0 4/4] Bluetooth: add A2MP fixed channel when hs_enabled Emeltchenko Andrei
  3 siblings, 1 reply; 8+ messages in thread
From: Emeltchenko Andrei @ 2011-10-12  7:53 UTC (permalink / raw)
  To: linux-bluetooth

From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

Adds support for physical link create/acceppt/disconnect AMP HCI
commands. To be used by the upper layer.
Backport from CodeAurora & Atheros

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
---
 include/net/bluetooth/hci.h |   24 ++++++++++++++++++++++
 net/bluetooth/hci_core.c    |   45 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 69 insertions(+), 0 deletions(-)

diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index 5a6fa24..8748121 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -30,6 +30,8 @@
 #define HCI_MAX_EVENT_SIZE	260
 #define HCI_MAX_FRAME_SIZE	(HCI_MAX_ACL_SIZE + 4)
 
+#define HCI_MAX_AMP_KEY_SIZE	32
+
 /* HCI dev events */
 #define HCI_DEV_REG			1
 #define HCI_DEV_UNREG			2
@@ -467,6 +469,28 @@ struct hci_cp_io_capability_neg_reply {
 	__u8     reason;
 } __packed;
 
+#define HCI_OP_CREATE_PHY_LINK		0x0435
+struct hci_cp_create_phy_link {
+	__u8     handle;
+	__u8     key_len;
+	__u8     key_type;
+	__u8     key[HCI_MAX_AMP_KEY_SIZE];
+} __packed;
+
+#define HCI_OP_ACCEPT_PHY_LINK		0x0436
+struct hci_cp_accept_phy_link {
+	__u8	handle;
+	__u8	key_len;
+	__u8	key_type;
+	__u8	key[HCI_MAX_AMP_KEY_SIZE];
+} __packed;
+
+#define HCI_OP_DISC_PHY_LINK		0x0437
+struct hci_cp_disc_phy_link {
+	__u8     handle;
+	__u8     reason;
+} __packed;
+
 #define HCI_OP_SNIFF_MODE		0x0803
 struct hci_cp_sniff_mode {
 	__le16   handle;
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index b84458d..afd246e 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -315,6 +315,51 @@ static void hci_linkpol_req(struct hci_dev *hdev, unsigned long opt)
 	hci_send_cmd(hdev, HCI_OP_WRITE_DEF_LINK_POLICY, 2, &policy);
 }
 
+/* AMP HCI interface */
+void hci_phylink_create_req(struct hci_dev *hdev, __u8 handle, __u8 key_len,
+						__u8 key_type, __u8 *key)
+{
+	struct hci_cp_create_phy_link cp;
+
+	cp.handle	= handle;
+	cp.key_type	= key_type;
+	cp.key_len	= min_t(__u8, key_len, HCI_MAX_AMP_KEY_SIZE);
+
+	BT_DBG("key len %d, phy handle %d", cp.key_len, cp.handle);
+
+	memcpy(cp.key, key, cp.key_len);
+	hci_send_cmd(hdev, HCI_OP_CREATE_PHY_LINK, sizeof(cp), &cp);
+}
+EXPORT_SYMBOL(hci_phylink_create_req);
+
+void hci_phylink_accept_req(struct hci_dev *hdev, __u8 handle, __u8 key_len,
+						__u8 key_type, __u8 *key)
+{
+	struct hci_cp_accept_phy_link cp;
+
+	cp.handle	= handle;
+	cp.key_type	= key_type;
+	cp.key_len	= min_t(__u8, key_len, HCI_MAX_AMP_KEY_SIZE);
+
+	BT_DBG("key len %d, phy handle %d", cp.key_len, cp.handle);
+
+	memcpy(cp.key, key, cp.key_len);
+	hci_send_cmd(hdev, HCI_OP_ACCEPT_PHY_LINK, sizeof(cp), &cp);
+}
+EXPORT_SYMBOL(hci_phylink_accept_req);
+
+void hci_phylink_disc_req(struct hci_dev *hdev, __u8 handle, __u8 reason)
+{
+	struct hci_cp_disc_phy_link cp;
+
+	BT_DBG("handle %d reason %d", handle, reason);
+
+	cp.handle = handle;
+	cp.reason = reason;
+	hci_send_cmd(hdev, HCI_OP_DISC_PHY_LINK, sizeof(cp), &cp);
+}
+EXPORT_SYMBOL(hci_phylink_disc_req);
+
 /* Get HCI device by index.
  * Device is held on return. */
 struct hci_dev *hci_dev_get(int index)
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [RFCv0 4/4] Bluetooth: add A2MP fixed channel when hs_enabled
  2011-10-12  7:53 [RFCv0 0/4] L2CAP and HCI preparation code for A2MP Emeltchenko Andrei
                   ` (2 preceding siblings ...)
  2011-10-12  7:53 ` [RFCv0 3/4] Bluetooth: physical link HCI interface to AMP Emeltchenko Andrei
@ 2011-10-12  7:53 ` Emeltchenko Andrei
  3 siblings, 0 replies; 8+ messages in thread
From: Emeltchenko Andrei @ 2011-10-12  7:53 UTC (permalink / raw)
  To: linux-bluetooth

From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

Adds A2MP fixed channel in L2CAP fixed channel supported.
Remove magic numbers and simplify code as we need only 1 octet.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
---
 include/net/bluetooth/l2cap.h |    5 +++++
 net/bluetooth/l2cap_core.c    |   12 ++++++++++--
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index 45d1814..f195978 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -112,6 +112,10 @@ struct l2cap_conninfo {
 #define L2CAP_FCS_NONE		0x00
 #define L2CAP_FCS_CRC16		0x01
 
+/* L2CAP fixed channels */
+#define L2CAP_FC_L2CAP		0x02
+#define L2CAP_FC_A2MP		0x08
+
 /* L2CAP Control Field bit masks */
 #define L2CAP_CTRL_SAR			0xC000
 #define L2CAP_CTRL_REQSEQ		0x3F00
@@ -441,6 +445,7 @@ struct l2cap_conn {
 	unsigned int	mtu;
 
 	__u32		feat_mask;
+	__u8		fc_mask;
 
 	__u8		info_state;
 	__u8		info_ident;
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 9144d70..152b68f 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -60,7 +60,7 @@ int disable_ertm;
 int enable_hs;
 
 static u32 l2cap_feat_mask = L2CAP_FEAT_FIXED_CHAN;
-static u8 l2cap_fixed_chan[8] = { 0x02, };
+static u8 l2cap_fixed_chan = L2CAP_FC_L2CAP;
 
 static LIST_HEAD(chan_list);
 static DEFINE_RWLOCK(chan_list_lock);
@@ -2891,9 +2891,16 @@ static inline int l2cap_information_req(struct l2cap_conn *conn, struct l2cap_cm
 	} else if (type == L2CAP_IT_FIXED_CHAN) {
 		u8 buf[12];
 		struct l2cap_info_rsp *rsp = (struct l2cap_info_rsp *) buf;
+
+		memset(buf, 0, sizeof(buf));
 		rsp->type   = cpu_to_le16(L2CAP_IT_FIXED_CHAN);
 		rsp->result = cpu_to_le16(L2CAP_IR_SUCCESS);
-		memcpy(buf + 4, l2cap_fixed_chan, 8);
+
+		if (enable_hs)
+			l2cap_fixed_chan |= L2CAP_FC_A2MP;
+
+		rsp->data[0] = l2cap_fixed_chan;
+
 		l2cap_send_cmd(conn, cmd->ident,
 					L2CAP_INFO_RSP, sizeof(buf), buf);
 	} else {
@@ -2951,6 +2958,7 @@ static inline int l2cap_information_rsp(struct l2cap_conn *conn, struct l2cap_cm
 			l2cap_conn_start(conn);
 		}
 	} else if (type == L2CAP_IT_FIXED_CHAN) {
+		conn->fc_mask = rsp->data[0];
 		conn->info_state |= L2CAP_INFO_FEAT_MASK_REQ_DONE;
 		conn->info_ident = 0;
 
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [RFCv0 1/4] Bluetooth: L2CAP Create Chan Req/Rsp support
  2011-10-12  7:53 ` [RFCv0 1/4] Bluetooth: L2CAP Create Chan Req/Rsp support Emeltchenko Andrei
@ 2011-10-13 20:33   ` Gustavo Padovan
  0 siblings, 0 replies; 8+ messages in thread
From: Gustavo Padovan @ 2011-10-13 20:33 UTC (permalink / raw)
  To: Emeltchenko Andrei; +Cc: linux-bluetooth

Hi Andrei,

* Emeltchenko Andrei <Andrei.Emeltchenko.news@gmail.com> [2011-10-12 10:53:56 +0300]:

> From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
> 
> Backport l2cap create channel req/rsp from codeaurora tree

I think you mean upstream instead of backport.

> git://codeaurora.org/kernel/msm.git
> Currently functionality is the same like in l2cap connect req/rsp

Could you elaborate more?  and explain your patch better.

	Gustavo

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [RFCv0 2/4] Bluetooth: AMP: read local amp info HCI command
  2011-10-12  7:53 ` [RFCv0 2/4] Bluetooth: AMP: read local amp info HCI command Emeltchenko Andrei
@ 2011-10-13 20:35   ` Gustavo Padovan
  0 siblings, 0 replies; 8+ messages in thread
From: Gustavo Padovan @ 2011-10-13 20:35 UTC (permalink / raw)
  To: Emeltchenko Andrei; +Cc: linux-bluetooth

Hi Andrei,

* Emeltchenko Andrei <Andrei.Emeltchenko.news@gmail.com> [2011-10-12 10:53:57 +0300]:

> From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
> 
> Implementation of Read Local AMP Info Command
> 
> Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
> ---
>  include/net/bluetooth/hci.h      |   15 +++++++++++++++
>  include/net/bluetooth/hci_core.h |   11 +++++++++++
>  net/bluetooth/hci_event.c        |   28 ++++++++++++++++++++++++++++
>  3 files changed, 54 insertions(+), 0 deletions(-)

Applied, thanks.

	Gustavo

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [RFCv0 3/4] Bluetooth: physical link HCI interface to AMP
  2011-10-12  7:53 ` [RFCv0 3/4] Bluetooth: physical link HCI interface to AMP Emeltchenko Andrei
@ 2011-10-13 20:36   ` Gustavo Padovan
  0 siblings, 0 replies; 8+ messages in thread
From: Gustavo Padovan @ 2011-10-13 20:36 UTC (permalink / raw)
  To: Emeltchenko Andrei; +Cc: linux-bluetooth

Hi Andrei,

* Emeltchenko Andrei <Andrei.Emeltchenko.news@gmail.com> [2011-10-12 10:53:58 +0300]:

> From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
> 
> Adds support for physical link create/acceppt/disconnect AMP HCI
> commands. To be used by the upper layer.
> Backport from CodeAurora & Atheros
> 
> Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
> ---
>  include/net/bluetooth/hci.h |   24 ++++++++++++++++++++++
>  net/bluetooth/hci_core.c    |   45 +++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 69 insertions(+), 0 deletions(-)

I prefer to see this patch together with code that actually uses it.

	Gustavo

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2011-10-13 20:36 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-12  7:53 [RFCv0 0/4] L2CAP and HCI preparation code for A2MP Emeltchenko Andrei
2011-10-12  7:53 ` [RFCv0 1/4] Bluetooth: L2CAP Create Chan Req/Rsp support Emeltchenko Andrei
2011-10-13 20:33   ` Gustavo Padovan
2011-10-12  7:53 ` [RFCv0 2/4] Bluetooth: AMP: read local amp info HCI command Emeltchenko Andrei
2011-10-13 20:35   ` Gustavo Padovan
2011-10-12  7:53 ` [RFCv0 3/4] Bluetooth: physical link HCI interface to AMP Emeltchenko Andrei
2011-10-13 20:36   ` Gustavo Padovan
2011-10-12  7:53 ` [RFCv0 4/4] Bluetooth: add A2MP fixed channel when hs_enabled Emeltchenko Andrei

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).