From: Emeltchenko Andrei <Andrei.Emeltchenko.news@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [RFCv3 09/34] Bluetooth: A2MP: Create A2MP channel
Date: Thu, 19 Jan 2012 11:19:58 +0200 [thread overview]
Message-ID: <1326964823-26747-10-git-send-email-Andrei.Emeltchenko.news@gmail.com> (raw)
In-Reply-To: <1326964823-26747-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Create fixed A2MP channel
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
---
include/net/bluetooth/l2cap.h | 3 ++
net/bluetooth/a2mp.c | 63 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 66 insertions(+), 0 deletions(-)
create mode 100644 net/bluetooth/a2mp.c
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index 33acd7d..cc6f299 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -51,6 +51,8 @@
#define L2CAP_CONN_TIMEOUT (40000) /* 40 seconds */
#define L2CAP_INFO_TIMEOUT (4000) /* 4 seconds */
+#define L2CAP_A2MP_DEFAULT_MTU 670
+
/* L2CAP socket address */
struct sockaddr_l2 {
sa_family_t l2_family;
@@ -224,6 +226,7 @@ struct l2cap_conn_rsp {
/* channel indentifier */
#define L2CAP_CID_SIGNALING 0x0001
#define L2CAP_CID_CONN_LESS 0x0002
+#define L2CAP_CID_A2MP 0x0003
#define L2CAP_CID_LE_DATA 0x0004
#define L2CAP_CID_LE_SIGNALING 0x0005
#define L2CAP_CID_SMP 0x0006
diff --git a/net/bluetooth/a2mp.c b/net/bluetooth/a2mp.c
new file mode 100644
index 0000000..52bb7d8
--- /dev/null
+++ b/net/bluetooth/a2mp.c
@@ -0,0 +1,63 @@
+/*
+ Copyright (c) 2010,2011 Code Aurora Forum. All rights reserved.
+ Copyright (c) 2011,2012 Intel Corp.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License version 2 and
+ only version 2 as published by the Free Software Foundation.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+*/
+
+#include <net/bluetooth/bluetooth.h>
+#include <net/bluetooth/l2cap.h>
+
+static struct l2cap_ops a2mp_chan_ops = {
+ .name = "L2CAP A2MP channel",
+};
+
+static struct l2cap_chan *open_a2mp_chan(struct l2cap_conn *conn)
+{
+ struct l2cap_chan *chan;
+
+ chan = l2cap_chan_create(NULL);
+
+ hci_conn_hold(conn->hcon);
+
+ BT_DBG("chan %p", chan);
+
+ chan->sec_level = BT_SECURITY_LOW;
+ chan->omtu = L2CAP_A2MP_DEFAULT_MTU;
+ chan->imtu = L2CAP_A2MP_DEFAULT_MTU;
+ chan->flush_to = L2CAP_DEFAULT_FLUSH_TO;
+ chan->fcs = L2CAP_FCS_CRC16;
+
+ chan->ops = &a2mp_chan_ops;
+
+ set_bit(FLAG_FORCE_ACTIVE, &chan->flags);
+
+ chan->max_tx = 0xFF;
+ chan->remote_max_tx = chan->max_tx;
+
+ /* Send 10 packets without ack */
+ chan->tx_win = 10;
+ chan->tx_win_max = L2CAP_DEFAULT_TX_WINDOW;
+ chan->remote_tx_win = chan->tx_win;
+
+ chan->retrans_timeout = L2CAP_DEFAULT_RETRANS_TO;
+ chan->monitor_timeout = L2CAP_DEFAULT_MONITOR_TO;
+
+ skb_queue_head_init(&chan->tx_q);
+
+ chan->mode = L2CAP_MODE_ERTM;
+ l2cap_ertm_init(chan);
+
+ l2cap_chan_add(conn, chan);
+ chan->remote_mps = chan->omtu;
+ chan->mps = chan->omtu;
+
+ return chan;
+}
--
1.7.4.1
next prev parent reply other threads:[~2012-01-19 9:19 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-19 9:19 [RFCv3 00/34] RFC Bluetooth A2MP implementation Emeltchenko Andrei
2012-01-19 9:19 ` [RFCv3 01/34] Bluetooth: trivial: space correction Emeltchenko Andrei
2012-01-19 9:50 ` Marcel Holtmann
2012-01-23 8:58 ` Johan Hedberg
2012-01-19 9:19 ` [RFCv3 02/34] Bluetooth: trivial: clean up of l2cap_chan_connect Emeltchenko Andrei
2012-01-19 9:51 ` Marcel Holtmann
2012-01-19 9:19 ` [RFCv3 03/34] Bluetooth: Make ertm_init available Emeltchenko Andrei
2012-01-19 9:19 ` [RFCv3 04/34] Bluetooth: Make l2cap_ertm_data_rcv available Emeltchenko Andrei
2012-01-19 9:19 ` [RFCv3 05/34] Bluetooth: Allocate skb depending on sk Emeltchenko Andrei
2012-01-19 9:56 ` Marcel Holtmann
2012-01-19 13:18 ` Emeltchenko Andrei
2012-01-19 9:19 ` [RFCv3 06/34] Bluetooth: Check sk before assigning sk_err Emeltchenko Andrei
2012-01-19 9:19 ` [RFCv3 07/34] Bluetooth: Add send function to chan ops Emeltchenko Andrei
2012-01-19 9:19 ` [RFCv3 08/34] Bluetooth: Make l2cap_chan_add available Emeltchenko Andrei
2012-01-19 9:19 ` Emeltchenko Andrei [this message]
2012-01-19 9:19 ` [RFCv3 10/34] Bluetooth: A2MP: AMP Manager basic functions Emeltchenko Andrei
2012-01-19 9:20 ` [RFCv3 11/34] Bluetooth: A2MP: Add channel close callback Emeltchenko Andrei
2012-01-19 9:20 ` [RFCv3 12/34] Bluetooth: Add state_change for A2MP channel Emeltchenko Andrei
2012-01-19 9:20 ` [RFCv3 13/34] Bluetooth: A2MP: Build and Send msg helpers Emeltchenko Andrei
2012-01-19 9:20 ` [RFCv3 14/34] Bluetooth: A2MP: Definitions for A2MP commands Emeltchenko Andrei
2012-01-19 9:20 ` [RFCv3 15/34] Bluetooth: A2MP: Define A2MP status codes Emeltchenko Andrei
2012-01-19 9:20 ` [RFCv3 16/34] Bluetooth: A2MP: Process A2MP messages Emeltchenko Andrei
2012-01-19 9:20 ` [RFCv3 17/34] Bluetooth: A2MP: Process A2MP Command Reject Emeltchenko Andrei
2012-01-19 9:20 ` [RFCv3 18/34] Bluetooth: A2MP: Helper functions to count HCI devs Emeltchenko Andrei
2012-01-19 9:20 ` [RFCv3 19/34] Bluetooth: A2MP: Process A2MP Discover Request Emeltchenko Andrei
2012-01-19 9:20 ` [RFCv3 20/34] Bluetooth: A2MP: Process A2MP Change Notify Emeltchenko Andrei
2012-01-19 9:20 ` [RFCv3 21/34] Bluetooth: A2MP: Process A2MP Get Info Request Emeltchenko Andrei
2012-01-19 9:20 ` [RFCv3 22/34] Bluetooth: A2MP: Process A2MP Get AMP Assoc Request Emeltchenko Andrei
2012-01-19 9:20 ` [RFCv3 23/34] Bluetooth: A2MP: Process A2MP Create Physlink Request Emeltchenko Andrei
2012-01-19 9:20 ` [RFCv3 24/34] Bluetooth: A2MP: Process A2MP Disc " Emeltchenko Andrei
2012-01-19 9:20 ` [RFCv3 25/34] Bluetooth: A2MP: Process A2MP Command Responses Emeltchenko Andrei
2012-01-19 9:20 ` [RFCv3 26/34] Bluetooth: Clean up l2cap_chan_add Emeltchenko Andrei
2012-01-19 9:20 ` [RFCv3 27/34] Bluetooth: A2MP: Handling fixed channels Emeltchenko Andrei
2012-01-19 9:20 ` [RFCv3 28/34] Bluetooth: A2MP: Manage incoming connections Emeltchenko Andrei
2012-01-19 9:20 ` [RFCv3 29/34] Bluetooth: physical link HCI interface to AMP Emeltchenko Andrei
2012-01-19 9:20 ` [RFCv3 30/34] Bluetooth: Define AMP controller statuses Emeltchenko Andrei
2012-01-19 9:20 ` [RFCv3 31/34] Bluetooth: General HCI callback implementation Emeltchenko Andrei
2012-01-19 9:20 ` [RFCv3 32/34] Bluetooth: Process HCI callbacks in a workqueue Emeltchenko Andrei
2012-01-19 9:20 ` [RFCv3 33/34] Bluetooth: AMP: Use HCI callback for Read AMP Info Emeltchenko Andrei
2012-01-19 9:20 ` [RFCv3 34/34] Bluetooth: AMP: Read Local Assoc support Emeltchenko Andrei
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=1326964823-26747-10-git-send-email-Andrei.Emeltchenko.news@gmail.com \
--to=andrei.emeltchenko.news@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).