All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrei Emeltchenko <Andrei.Emeltchenko.news@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCHv1 3/6] Bluetooth: AMP: Add handle to hci_chan structure
Date: Wed, 10 Oct 2012 17:38:28 +0300	[thread overview]
Message-ID: <1349879912-23633-4-git-send-email-Andrei.Emeltchenko.news@gmail.com> (raw)
In-Reply-To: <1349879912-23633-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>

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

hci_chan will be identified by handle used in logical link creation
process. This handle is used in AMP ACL-U packet handle field.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
---
 include/net/bluetooth/hci_core.h |    3 ++-
 net/bluetooth/hci_conn.c         |   32 ++++++++++++++++++++++++++++++++
 2 files changed, 34 insertions(+), 1 deletion(-)

diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index dfa108c..b697ef3 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -350,7 +350,7 @@ struct hci_conn {
 
 struct hci_chan {
 	struct list_head list;
-
+	__u16 handle;
 	struct hci_conn *conn;
 	struct sk_buff_head data_q;
 	unsigned int	sent;
@@ -567,6 +567,7 @@ void hci_conn_check_pending(struct hci_dev *hdev);
 struct hci_chan *hci_chan_create(struct hci_conn *conn);
 void hci_chan_del(struct hci_chan *chan);
 void hci_chan_list_flush(struct hci_conn *conn);
+struct hci_chan *hci_chan_lookup_handle(struct hci_dev *hdev, __u16 handle);
 
 struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst,
 			     __u8 dst_type, __u8 sec_level, __u8 auth_type);
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index 6487579..fe64621 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -989,3 +989,35 @@ void hci_chan_list_flush(struct hci_conn *conn)
 	list_for_each_entry_safe(chan, n, &conn->chan_list, list)
 		hci_chan_del(chan);
 }
+
+static struct hci_chan *__hci_chan_lookup_handle(struct hci_conn *hcon,
+						 __u16 handle)
+{
+	struct hci_chan *hchan;
+
+	list_for_each_entry(hchan, &hcon->chan_list, list) {
+		if (hchan->handle == handle)
+			return hchan;
+	}
+
+	return NULL;
+}
+
+struct hci_chan *hci_chan_lookup_handle(struct hci_dev *hdev, __u16 handle)
+{
+	struct hci_conn_hash *h = &hdev->conn_hash;
+	struct hci_conn *hcon;
+	struct hci_chan *hchan = NULL;
+
+	rcu_read_lock();
+
+	list_for_each_entry_rcu(hcon, &h->list, list) {
+		hchan = __hci_chan_lookup_handle(hcon, handle);
+		if (hchan)
+			break;
+	}
+
+	rcu_read_unlock();
+
+	return hchan;
+}
-- 
1.7.9.5


  parent reply	other threads:[~2012-10-10 14:38 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-08 14:52 [RFCv1 0/6] Handle AMP_LINK Andrei Emeltchenko
2012-10-08 14:52 ` [RFCv1 1/6] Bluetooth: Allow to set flush timeout Andrei Emeltchenko
2012-10-08 14:52 ` [RFCv1 2/6] Bluetooth: AMP: Handle AMP_LINK timeout Andrei Emeltchenko
2012-10-09 14:39   ` Marcel Holtmann
2012-10-08 14:52 ` [RFCv1 3/6] Bluetooth: AMP: Add handle to hci_chan structure Andrei Emeltchenko
2012-10-09 14:46   ` Marcel Holtmann
2012-10-10  8:34     ` Andrei Emeltchenko
2012-10-10 10:07       ` Marcel Holtmann
2012-10-10 10:12         ` Andrei Emeltchenko
2012-10-08 14:52 ` [RFCv1 4/6] Bluetooth: Handle number of compl blocks for AMP_LINK Andrei Emeltchenko
2012-10-09 14:49   ` Marcel Holtmann
2012-10-10  8:22     ` Andrei Emeltchenko
2012-10-08 14:52 ` [RFCv1 5/6] Bluetooth: AMP: Handle AMP_LINK connection Andrei Emeltchenko
2012-10-08 14:52 ` [RFCv1 6/6] Bluetooth: AMP: Hanlde AMP_LINK case in conn_put Andrei Emeltchenko
2012-10-10 14:38 ` [PATCHv1 0/6] Handle AMP_LINK Andrei Emeltchenko
2012-10-10 14:38   ` [PATCHv1 1/6] Bluetooth: Allow to set flush timeout Andrei Emeltchenko
2012-10-10 14:38   ` [PATCHv1 2/6] Bluetooth: AMP: Handle AMP_LINK timeout Andrei Emeltchenko
2012-10-10 14:38   ` Andrei Emeltchenko [this message]
2012-10-10 14:38   ` [PATCHv1 4/6] Bluetooth: AMP: Handle number of compl blocks for AMP_LINK Andrei Emeltchenko
2012-10-10 14:38   ` [PATCHv1 5/6] Bluetooth: AMP: Handle AMP_LINK connection Andrei Emeltchenko
2012-10-10 14:38   ` [PATCHv1 6/6] Bluetooth: AMP: Hanlde AMP_LINK case in conn_put Andrei Emeltchenko
2012-10-11  6:36     ` Gustavo Padovan
2012-10-10 15:28   ` [PATCHv1 0/6] Handle AMP_LINK Marcel Holtmann

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=1349879912-23633-4-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.