Bluetooth: AMP: Add handle to hci_chan structure
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> Acked-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
This commit is contained in:
parent
53502d69be
commit
42c4e53e7a
2 changed files with 34 additions and 1 deletions
|
@ -350,7 +350,7 @@ struct hci_conn {
|
||||||
|
|
||||||
struct hci_chan {
|
struct hci_chan {
|
||||||
struct list_head list;
|
struct list_head list;
|
||||||
|
__u16 handle;
|
||||||
struct hci_conn *conn;
|
struct hci_conn *conn;
|
||||||
struct sk_buff_head data_q;
|
struct sk_buff_head data_q;
|
||||||
unsigned int sent;
|
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);
|
struct hci_chan *hci_chan_create(struct hci_conn *conn);
|
||||||
void hci_chan_del(struct hci_chan *chan);
|
void hci_chan_del(struct hci_chan *chan);
|
||||||
void hci_chan_list_flush(struct hci_conn *conn);
|
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,
|
struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst,
|
||||||
__u8 dst_type, __u8 sec_level, __u8 auth_type);
|
__u8 dst_type, __u8 sec_level, __u8 auth_type);
|
||||||
|
|
|
@ -989,3 +989,35 @@ void hci_chan_list_flush(struct hci_conn *conn)
|
||||||
list_for_each_entry_safe(chan, n, &conn->chan_list, list)
|
list_for_each_entry_safe(chan, n, &conn->chan_list, list)
|
||||||
hci_chan_del(chan);
|
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;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue