aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJohn W. Linville <linville@tuxdriver.com>2012-10-19 15:22:27 -0400
committerJohn W. Linville <linville@tuxdriver.com>2012-10-19 15:22:27 -0400
commitbc27d5f14363a1065bf9437a5bca5409492b6c06 (patch)
treef99ab7eed550f28eec8c68a468c6161320fe9ee1 /include
parentddffeb8c4d0331609ef2581d84de4d763607bd37 (diff)
parentf706adfeade767d2194c9f39c0f75e944b0bdd23 (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next
Diffstat (limited to 'include')
-rw-r--r--include/net/bluetooth/a2mp.h24
-rw-r--r--include/net/bluetooth/amp.h50
-rw-r--r--include/net/bluetooth/bluetooth.h1
-rw-r--r--include/net/bluetooth/hci.h40
-rw-r--r--include/net/bluetooth/hci_core.h48
-rw-r--r--include/net/bluetooth/l2cap.h14
6 files changed, 166 insertions, 11 deletions
diff --git a/include/net/bluetooth/a2mp.h b/include/net/bluetooth/a2mp.h
index 6a76e0a0705e..42f21766c538 100644
--- a/include/net/bluetooth/a2mp.h
+++ b/include/net/bluetooth/a2mp.h
@@ -19,13 +19,25 @@
19 19
20#define A2MP_FEAT_EXT 0x8000 20#define A2MP_FEAT_EXT 0x8000
21 21
22enum amp_mgr_state {
23 READ_LOC_AMP_INFO,
24 READ_LOC_AMP_ASSOC,
25 READ_LOC_AMP_ASSOC_FINAL,
26};
27
22struct amp_mgr { 28struct amp_mgr {
29 struct list_head list;
23 struct l2cap_conn *l2cap_conn; 30 struct l2cap_conn *l2cap_conn;
24 struct l2cap_chan *a2mp_chan; 31 struct l2cap_chan *a2mp_chan;
32 struct l2cap_chan *bredr_chan;
25 struct kref kref; 33 struct kref kref;
26 __u8 ident; 34 __u8 ident;
27 __u8 handle; 35 __u8 handle;
36 enum amp_mgr_state state;
28 unsigned long flags; 37 unsigned long flags;
38
39 struct list_head amp_ctrls;
40 struct mutex amp_ctrls_lock;
29}; 41};
30 42
31struct a2mp_cmd { 43struct a2mp_cmd {
@@ -118,9 +130,19 @@ struct a2mp_physlink_rsp {
118#define A2MP_STATUS_PHYS_LINK_EXISTS 0x05 130#define A2MP_STATUS_PHYS_LINK_EXISTS 0x05
119#define A2MP_STATUS_SECURITY_VIOLATION 0x06 131#define A2MP_STATUS_SECURITY_VIOLATION 0x06
120 132
121void amp_mgr_get(struct amp_mgr *mgr); 133extern struct list_head amp_mgr_list;
134extern struct mutex amp_mgr_list_lock;
135
136struct amp_mgr *amp_mgr_get(struct amp_mgr *mgr);
122int amp_mgr_put(struct amp_mgr *mgr); 137int amp_mgr_put(struct amp_mgr *mgr);
138u8 __next_ident(struct amp_mgr *mgr);
123struct l2cap_chan *a2mp_channel_create(struct l2cap_conn *conn, 139struct l2cap_chan *a2mp_channel_create(struct l2cap_conn *conn,
124 struct sk_buff *skb); 140 struct sk_buff *skb);
141struct amp_mgr *amp_mgr_lookup_by_state(u8 state);
142void a2mp_send(struct amp_mgr *mgr, u8 code, u8 ident, u16 len, void *data);
143void a2mp_discover_amp(struct l2cap_chan *chan);
144void a2mp_send_getinfo_rsp(struct hci_dev *hdev);
145void a2mp_send_getampassoc_rsp(struct hci_dev *hdev, u8 status);
146void a2mp_send_create_phy_link_req(struct hci_dev *hdev, u8 status);
125 147
126#endif /* __A2MP_H */ 148#endif /* __A2MP_H */
diff --git a/include/net/bluetooth/amp.h b/include/net/bluetooth/amp.h
new file mode 100644
index 000000000000..2e7c79ea0463
--- /dev/null
+++ b/include/net/bluetooth/amp.h
@@ -0,0 +1,50 @@
1/*
2 Copyright (c) 2011,2012 Intel Corp.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License version 2 and
6 only version 2 as published by the Free Software Foundation.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12*/
13
14#ifndef __AMP_H
15#define __AMP_H
16
17struct amp_ctrl {
18 struct list_head list;
19 struct kref kref;
20 __u8 id;
21 __u16 assoc_len_so_far;
22 __u16 assoc_rem_len;
23 __u16 assoc_len;
24 __u8 *assoc;
25};
26
27int amp_ctrl_put(struct amp_ctrl *ctrl);
28void amp_ctrl_get(struct amp_ctrl *ctrl);
29struct amp_ctrl *amp_ctrl_add(struct amp_mgr *mgr, u8 id);
30struct amp_ctrl *amp_ctrl_lookup(struct amp_mgr *mgr, u8 id);
31void amp_ctrl_list_flush(struct amp_mgr *mgr);
32
33struct hci_conn *phylink_add(struct hci_dev *hdev, struct amp_mgr *mgr,
34 u8 remote_id, bool out);
35
36int phylink_gen_key(struct hci_conn *hcon, u8 *data, u8 *len, u8 *type);
37
38void amp_read_loc_info(struct hci_dev *hdev, struct amp_mgr *mgr);
39void amp_read_loc_assoc_frag(struct hci_dev *hdev, u8 phy_handle);
40void amp_read_loc_assoc(struct hci_dev *hdev, struct amp_mgr *mgr);
41void amp_read_loc_assoc_final_data(struct hci_dev *hdev,
42 struct hci_conn *hcon);
43void amp_create_phylink(struct hci_dev *hdev, struct amp_mgr *mgr,
44 struct hci_conn *hcon);
45void amp_accept_phylink(struct hci_dev *hdev, struct amp_mgr *mgr,
46 struct hci_conn *hcon);
47void amp_write_remote_assoc(struct hci_dev *hdev, u8 handle);
48void amp_write_rem_assoc_continue(struct hci_dev *hdev, u8 handle);
49
50#endif /* __AMP_H */
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
index ede036977ae8..2554b3f5222a 100644
--- a/include/net/bluetooth/bluetooth.h
+++ b/include/net/bluetooth/bluetooth.h
@@ -180,7 +180,6 @@ static inline void bacpy(bdaddr_t *dst, bdaddr_t *src)
180} 180}
181 181
182void baswap(bdaddr_t *dst, bdaddr_t *src); 182void baswap(bdaddr_t *dst, bdaddr_t *src);
183char *batostr(bdaddr_t *ba);
184 183
185/* Common socket structures and functions */ 184/* Common socket structures and functions */
186 185
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index 76b2b6bdcf36..88cbbda61027 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -33,6 +33,8 @@
33#define HCI_LINK_KEY_SIZE 16 33#define HCI_LINK_KEY_SIZE 16
34#define HCI_AMP_LINK_KEY_SIZE (2 * HCI_LINK_KEY_SIZE) 34#define HCI_AMP_LINK_KEY_SIZE (2 * HCI_LINK_KEY_SIZE)
35 35
36#define HCI_MAX_AMP_ASSOC_SIZE 672
37
36/* HCI dev events */ 38/* HCI dev events */
37#define HCI_DEV_REG 1 39#define HCI_DEV_REG 1
38#define HCI_DEV_UNREG 2 40#define HCI_DEV_UNREG 2
@@ -196,6 +198,7 @@ enum {
196#define ACL_START_NO_FLUSH 0x00 198#define ACL_START_NO_FLUSH 0x00
197#define ACL_CONT 0x01 199#define ACL_CONT 0x01
198#define ACL_START 0x02 200#define ACL_START 0x02
201#define ACL_COMPLETE 0x03
199#define ACL_ACTIVE_BCAST 0x04 202#define ACL_ACTIVE_BCAST 0x04
200#define ACL_PICO_BCAST 0x08 203#define ACL_PICO_BCAST 0x08
201 204
@@ -205,6 +208,7 @@ enum {
205#define ESCO_LINK 0x02 208#define ESCO_LINK 0x02
206/* Low Energy links do not have defined link type. Use invented one */ 209/* Low Energy links do not have defined link type. Use invented one */
207#define LE_LINK 0x80 210#define LE_LINK 0x80
211#define AMP_LINK 0x81
208 212
209/* LMP features */ 213/* LMP features */
210#define LMP_3SLOT 0x01 214#define LMP_3SLOT 0x01
@@ -556,12 +560,46 @@ struct hci_cp_accept_phy_link {
556 __u8 key[HCI_AMP_LINK_KEY_SIZE]; 560 __u8 key[HCI_AMP_LINK_KEY_SIZE];
557} __packed; 561} __packed;
558 562
559#define HCI_OP_DISCONN_PHY_LINK 0x0437 563#define HCI_OP_DISCONN_PHY_LINK 0x0437
560struct hci_cp_disconn_phy_link { 564struct hci_cp_disconn_phy_link {
561 __u8 phy_handle; 565 __u8 phy_handle;
562 __u8 reason; 566 __u8 reason;
563} __packed; 567} __packed;
564 568
569struct ext_flow_spec {
570 __u8 id;
571 __u8 stype;
572 __le16 msdu;
573 __le32 sdu_itime;
574 __le32 acc_lat;
575 __le32 flush_to;
576} __packed;
577
578#define HCI_OP_CREATE_LOGICAL_LINK 0x0438
579#define HCI_OP_ACCEPT_LOGICAL_LINK 0x0439
580struct hci_cp_create_accept_logical_link {
581 __u8 phy_handle;
582 struct ext_flow_spec tx_flow_spec;
583 struct ext_flow_spec rx_flow_spec;
584} __packed;
585
586#define HCI_OP_DISCONN_LOGICAL_LINK 0x043a
587struct hci_cp_disconn_logical_link {
588 __le16 log_handle;
589} __packed;
590
591#define HCI_OP_LOGICAL_LINK_CANCEL 0x043b
592struct hci_cp_logical_link_cancel {
593 __u8 phy_handle;
594 __u8 flow_spec_id;
595} __packed;
596
597struct hci_rp_logical_link_cancel {
598 __u8 status;
599 __u8 phy_handle;
600 __u8 flow_spec_id;
601} __packed;
602
565#define HCI_OP_SNIFF_MODE 0x0803 603#define HCI_OP_SNIFF_MODE 0x0803
566struct hci_cp_sniff_mode { 604struct hci_cp_sniff_mode {
567 __le16 handle; 605 __le16 handle;
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index e7d454609881..9fe8e2dec870 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -73,6 +73,7 @@ struct discovery_state {
73struct hci_conn_hash { 73struct hci_conn_hash {
74 struct list_head list; 74 struct list_head list;
75 unsigned int acl_num; 75 unsigned int acl_num;
76 unsigned int amp_num;
76 unsigned int sco_num; 77 unsigned int sco_num;
77 unsigned int le_num; 78 unsigned int le_num;
78}; 79};
@@ -124,6 +125,14 @@ struct le_scan_params {
124 125
125#define HCI_MAX_SHORT_NAME_LENGTH 10 126#define HCI_MAX_SHORT_NAME_LENGTH 10
126 127
128struct amp_assoc {
129 __u16 len;
130 __u16 offset;
131 __u16 rem_len;
132 __u16 len_so_far;
133 __u8 data[HCI_MAX_AMP_ASSOC_SIZE];
134};
135
127#define NUM_REASSEMBLY 4 136#define NUM_REASSEMBLY 4
128struct hci_dev { 137struct hci_dev {
129 struct list_head list; 138 struct list_head list;
@@ -177,6 +186,8 @@ struct hci_dev {
177 __u32 amp_max_flush_to; 186 __u32 amp_max_flush_to;
178 __u32 amp_be_flush_to; 187 __u32 amp_be_flush_to;
179 188
189 struct amp_assoc loc_assoc;
190
180 __u8 flow_ctl_mode; 191 __u8 flow_ctl_mode;
181 192
182 unsigned int auto_accept_delay; 193 unsigned int auto_accept_delay;
@@ -252,8 +263,6 @@ struct hci_dev {
252 263
253 struct sk_buff_head driver_init; 264 struct sk_buff_head driver_init;
254 265
255 void *core_data;
256
257 atomic_t promisc; 266 atomic_t promisc;
258 267
259 struct dentry *debugfs; 268 struct dentry *debugfs;
@@ -277,6 +286,8 @@ struct hci_dev {
277 int (*ioctl)(struct hci_dev *hdev, unsigned int cmd, unsigned long arg); 286 int (*ioctl)(struct hci_dev *hdev, unsigned int cmd, unsigned long arg);
278}; 287};
279 288
289#define HCI_PHY_HANDLE(handle) (handle & 0xff)
290
280struct hci_conn { 291struct hci_conn {
281 struct list_head list; 292 struct list_head list;
282 293
@@ -310,6 +321,7 @@ struct hci_conn {
310 321
311 __u8 remote_cap; 322 __u8 remote_cap;
312 __u8 remote_auth; 323 __u8 remote_auth;
324 __u8 remote_id;
313 bool flush_key; 325 bool flush_key;
314 326
315 unsigned int sent; 327 unsigned int sent;
@@ -339,7 +351,7 @@ struct hci_conn {
339 351
340struct hci_chan { 352struct hci_chan {
341 struct list_head list; 353 struct list_head list;
342 354 __u16 handle;
343 struct hci_conn *conn; 355 struct hci_conn *conn;
344 struct sk_buff_head data_q; 356 struct sk_buff_head data_q;
345 unsigned int sent; 357 unsigned int sent;
@@ -438,6 +450,9 @@ static inline void hci_conn_hash_add(struct hci_dev *hdev, struct hci_conn *c)
438 case ACL_LINK: 450 case ACL_LINK:
439 h->acl_num++; 451 h->acl_num++;
440 break; 452 break;
453 case AMP_LINK:
454 h->amp_num++;
455 break;
441 case LE_LINK: 456 case LE_LINK:
442 h->le_num++; 457 h->le_num++;
443 break; 458 break;
@@ -459,6 +474,9 @@ static inline void hci_conn_hash_del(struct hci_dev *hdev, struct hci_conn *c)
459 case ACL_LINK: 474 case ACL_LINK:
460 h->acl_num--; 475 h->acl_num--;
461 break; 476 break;
477 case AMP_LINK:
478 h->amp_num--;
479 break;
462 case LE_LINK: 480 case LE_LINK:
463 h->le_num--; 481 h->le_num--;
464 break; 482 break;
@@ -475,6 +493,8 @@ static inline unsigned int hci_conn_num(struct hci_dev *hdev, __u8 type)
475 switch (type) { 493 switch (type) {
476 case ACL_LINK: 494 case ACL_LINK:
477 return h->acl_num; 495 return h->acl_num;
496 case AMP_LINK:
497 return h->amp_num;
478 case LE_LINK: 498 case LE_LINK:
479 return h->le_num; 499 return h->le_num;
480 case SCO_LINK: 500 case SCO_LINK:
@@ -556,6 +576,7 @@ void hci_conn_check_pending(struct hci_dev *hdev);
556struct hci_chan *hci_chan_create(struct hci_conn *conn); 576struct hci_chan *hci_chan_create(struct hci_conn *conn);
557void hci_chan_del(struct hci_chan *chan); 577void hci_chan_del(struct hci_chan *chan);
558void hci_chan_list_flush(struct hci_conn *conn); 578void hci_chan_list_flush(struct hci_conn *conn);
579struct hci_chan *hci_chan_lookup_handle(struct hci_dev *hdev, __u16 handle);
559 580
560struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst, 581struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst,
561 __u8 dst_type, __u8 sec_level, __u8 auth_type); 582 __u8 dst_type, __u8 sec_level, __u8 auth_type);
@@ -584,7 +605,10 @@ static inline void hci_conn_put(struct hci_conn *conn)
584 605
585 if (atomic_dec_and_test(&conn->refcnt)) { 606 if (atomic_dec_and_test(&conn->refcnt)) {
586 unsigned long timeo; 607 unsigned long timeo;
587 if (conn->type == ACL_LINK || conn->type == LE_LINK) { 608
609 switch (conn->type) {
610 case ACL_LINK:
611 case LE_LINK:
588 del_timer(&conn->idle_timer); 612 del_timer(&conn->idle_timer);
589 if (conn->state == BT_CONNECTED) { 613 if (conn->state == BT_CONNECTED) {
590 timeo = conn->disc_timeout; 614 timeo = conn->disc_timeout;
@@ -593,12 +617,20 @@ static inline void hci_conn_put(struct hci_conn *conn)
593 } else { 617 } else {
594 timeo = msecs_to_jiffies(10); 618 timeo = msecs_to_jiffies(10);
595 } 619 }
596 } else { 620 break;
621
622 case AMP_LINK:
623 timeo = conn->disc_timeout;
624 break;
625
626 default:
597 timeo = msecs_to_jiffies(10); 627 timeo = msecs_to_jiffies(10);
628 break;
598 } 629 }
630
599 cancel_delayed_work(&conn->disc_work); 631 cancel_delayed_work(&conn->disc_work);
600 queue_delayed_work(conn->hdev->workqueue, 632 queue_delayed_work(conn->hdev->workqueue,
601 &conn->disc_work, timeo); 633 &conn->disc_work, timeo);
602 } 634 }
603} 635}
604 636
@@ -789,6 +821,10 @@ static inline void hci_proto_disconn_cfm(struct hci_conn *conn, __u8 reason)
789 sco_disconn_cfm(conn, reason); 821 sco_disconn_cfm(conn, reason);
790 break; 822 break;
791 823
824 /* L2CAP would be handled for BREDR chan */
825 case AMP_LINK:
826 break;
827
792 default: 828 default:
793 BT_ERR("unknown link type %d", conn->type); 829 BT_ERR("unknown link type %d", conn->type);
794 break; 830 break;
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index 7ed8e356425a..6e23afdf65c1 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -32,13 +32,14 @@
32/* L2CAP defaults */ 32/* L2CAP defaults */
33#define L2CAP_DEFAULT_MTU 672 33#define L2CAP_DEFAULT_MTU 672
34#define L2CAP_DEFAULT_MIN_MTU 48 34#define L2CAP_DEFAULT_MIN_MTU 48
35#define L2CAP_DEFAULT_FLUSH_TO 0xffff 35#define L2CAP_DEFAULT_FLUSH_TO 0xFFFF
36#define L2CAP_EFS_DEFAULT_FLUSH_TO 0xFFFFFFFF
36#define L2CAP_DEFAULT_TX_WINDOW 63 37#define L2CAP_DEFAULT_TX_WINDOW 63
37#define L2CAP_DEFAULT_EXT_WINDOW 0x3FFF 38#define L2CAP_DEFAULT_EXT_WINDOW 0x3FFF
38#define L2CAP_DEFAULT_MAX_TX 3 39#define L2CAP_DEFAULT_MAX_TX 3
39#define L2CAP_DEFAULT_RETRANS_TO 2000 /* 2 seconds */ 40#define L2CAP_DEFAULT_RETRANS_TO 2000 /* 2 seconds */
40#define L2CAP_DEFAULT_MONITOR_TO 12000 /* 12 seconds */ 41#define L2CAP_DEFAULT_MONITOR_TO 12000 /* 12 seconds */
41#define L2CAP_DEFAULT_MAX_PDU_SIZE 1009 /* Sized for 3-DH5 packet */ 42#define L2CAP_DEFAULT_MAX_PDU_SIZE 1492 /* Sized for AMP packet */
42#define L2CAP_DEFAULT_ACK_TO 200 43#define L2CAP_DEFAULT_ACK_TO 200
43#define L2CAP_DEFAULT_MAX_SDU_SIZE 0xFFFF 44#define L2CAP_DEFAULT_MAX_SDU_SIZE 0xFFFF
44#define L2CAP_DEFAULT_SDU_ITIME 0xFFFFFFFF 45#define L2CAP_DEFAULT_SDU_ITIME 0xFFFFFFFF
@@ -508,6 +509,8 @@ struct l2cap_chan {
508 __u32 remote_acc_lat; 509 __u32 remote_acc_lat;
509 __u32 remote_flush_to; 510 __u32 remote_flush_to;
510 511
512 __u8 ctrl_id;
513
511 struct delayed_work chan_timer; 514 struct delayed_work chan_timer;
512 struct delayed_work retrans_timer; 515 struct delayed_work retrans_timer;
513 struct delayed_work monitor_timer; 516 struct delayed_work monitor_timer;
@@ -538,6 +541,7 @@ struct l2cap_ops {
538 void (*state_change) (struct l2cap_chan *chan, 541 void (*state_change) (struct l2cap_chan *chan,
539 int state); 542 int state);
540 void (*ready) (struct l2cap_chan *chan); 543 void (*ready) (struct l2cap_chan *chan);
544 void (*defer) (struct l2cap_chan *chan);
541 struct sk_buff *(*alloc_skb) (struct l2cap_chan *chan, 545 struct sk_buff *(*alloc_skb) (struct l2cap_chan *chan,
542 unsigned long len, int nb); 546 unsigned long len, int nb);
543}; 547};
@@ -745,6 +749,10 @@ static inline void l2cap_chan_no_ready(struct l2cap_chan *chan)
745{ 749{
746} 750}
747 751
752static inline void l2cap_chan_no_defer(struct l2cap_chan *chan)
753{
754}
755
748extern bool disable_ertm; 756extern bool disable_ertm;
749 757
750int l2cap_init_sockets(void); 758int l2cap_init_sockets(void);
@@ -767,6 +775,8 @@ int l2cap_chan_check_security(struct l2cap_chan *chan);
767void l2cap_chan_set_defaults(struct l2cap_chan *chan); 775void l2cap_chan_set_defaults(struct l2cap_chan *chan);
768int l2cap_ertm_init(struct l2cap_chan *chan); 776int l2cap_ertm_init(struct l2cap_chan *chan);
769void l2cap_chan_add(struct l2cap_conn *conn, struct l2cap_chan *chan); 777void l2cap_chan_add(struct l2cap_conn *conn, struct l2cap_chan *chan);
778void __l2cap_chan_add(struct l2cap_conn *conn, struct l2cap_chan *chan);
770void l2cap_chan_del(struct l2cap_chan *chan, int err); 779void l2cap_chan_del(struct l2cap_chan *chan, int err);
780void l2cap_send_conn_req(struct l2cap_chan *chan);
771 781
772#endif /* __L2CAP_H */ 782#endif /* __L2CAP_H */