diff options
author | John W. Linville <linville@tuxdriver.com> | 2011-02-22 15:10:22 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-02-22 15:10:22 -0500 |
commit | 5db5e44cdcdc5ee9cc821bd4d63445af0bb34bce (patch) | |
tree | b5e5787a6d5c15e589d275c7434ebbf341257234 /include/net/bluetooth/hci_core.h | |
parent | db62983a1e4b2af9e79c97af768f0c8b80bd93f0 (diff) | |
parent | 320d6c1b56de5f461c6062625b9664095f90ee95 (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next-2.6 into for-davem
Diffstat (limited to 'include/net/bluetooth/hci_core.h')
-rw-r--r-- | include/net/bluetooth/hci_core.h | 152 |
1 files changed, 117 insertions, 35 deletions
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index d2cf88407690..d5d8454236bf 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h | |||
@@ -60,12 +60,28 @@ struct hci_conn_hash { | |||
60 | spinlock_t lock; | 60 | spinlock_t lock; |
61 | unsigned int acl_num; | 61 | unsigned int acl_num; |
62 | unsigned int sco_num; | 62 | unsigned int sco_num; |
63 | unsigned int le_num; | ||
63 | }; | 64 | }; |
64 | 65 | ||
65 | struct bdaddr_list { | 66 | struct bdaddr_list { |
66 | struct list_head list; | 67 | struct list_head list; |
67 | bdaddr_t bdaddr; | 68 | bdaddr_t bdaddr; |
68 | }; | 69 | }; |
70 | |||
71 | struct bt_uuid { | ||
72 | struct list_head list; | ||
73 | u8 uuid[16]; | ||
74 | u8 svc_hint; | ||
75 | }; | ||
76 | |||
77 | struct link_key { | ||
78 | struct list_head list; | ||
79 | bdaddr_t bdaddr; | ||
80 | u8 type; | ||
81 | u8 val[16]; | ||
82 | u8 pin_len; | ||
83 | }; | ||
84 | |||
69 | #define NUM_REASSEMBLY 4 | 85 | #define NUM_REASSEMBLY 4 |
70 | struct hci_dev { | 86 | struct hci_dev { |
71 | struct list_head list; | 87 | struct list_head list; |
@@ -80,13 +96,18 @@ struct hci_dev { | |||
80 | bdaddr_t bdaddr; | 96 | bdaddr_t bdaddr; |
81 | __u8 dev_name[248]; | 97 | __u8 dev_name[248]; |
82 | __u8 dev_class[3]; | 98 | __u8 dev_class[3]; |
99 | __u8 major_class; | ||
100 | __u8 minor_class; | ||
83 | __u8 features[8]; | 101 | __u8 features[8]; |
84 | __u8 commands[64]; | 102 | __u8 commands[64]; |
85 | __u8 ssp_mode; | 103 | __u8 ssp_mode; |
86 | __u8 hci_ver; | 104 | __u8 hci_ver; |
87 | __u16 hci_rev; | 105 | __u16 hci_rev; |
106 | __u8 lmp_ver; | ||
88 | __u16 manufacturer; | 107 | __u16 manufacturer; |
108 | __le16 lmp_subver; | ||
89 | __u16 voice_setting; | 109 | __u16 voice_setting; |
110 | __u8 io_capability; | ||
90 | 111 | ||
91 | __u16 pkt_type; | 112 | __u16 pkt_type; |
92 | __u16 esco_type; | 113 | __u16 esco_type; |
@@ -102,18 +123,26 @@ struct hci_dev { | |||
102 | atomic_t cmd_cnt; | 123 | atomic_t cmd_cnt; |
103 | unsigned int acl_cnt; | 124 | unsigned int acl_cnt; |
104 | unsigned int sco_cnt; | 125 | unsigned int sco_cnt; |
126 | unsigned int le_cnt; | ||
105 | 127 | ||
106 | unsigned int acl_mtu; | 128 | unsigned int acl_mtu; |
107 | unsigned int sco_mtu; | 129 | unsigned int sco_mtu; |
130 | unsigned int le_mtu; | ||
108 | unsigned int acl_pkts; | 131 | unsigned int acl_pkts; |
109 | unsigned int sco_pkts; | 132 | unsigned int sco_pkts; |
133 | unsigned int le_pkts; | ||
110 | 134 | ||
111 | unsigned long cmd_last_tx; | ||
112 | unsigned long acl_last_tx; | 135 | unsigned long acl_last_tx; |
113 | unsigned long sco_last_tx; | 136 | unsigned long sco_last_tx; |
137 | unsigned long le_last_tx; | ||
114 | 138 | ||
115 | struct workqueue_struct *workqueue; | 139 | struct workqueue_struct *workqueue; |
116 | 140 | ||
141 | struct work_struct power_on; | ||
142 | struct work_struct power_off; | ||
143 | struct timer_list off_timer; | ||
144 | |||
145 | struct timer_list cmd_timer; | ||
117 | struct tasklet_struct cmd_task; | 146 | struct tasklet_struct cmd_task; |
118 | struct tasklet_struct rx_task; | 147 | struct tasklet_struct rx_task; |
119 | struct tasklet_struct tx_task; | 148 | struct tasklet_struct tx_task; |
@@ -129,12 +158,17 @@ struct hci_dev { | |||
129 | wait_queue_head_t req_wait_q; | 158 | wait_queue_head_t req_wait_q; |
130 | __u32 req_status; | 159 | __u32 req_status; |
131 | __u32 req_result; | 160 | __u32 req_result; |
132 | __u16 req_last_cmd; | 161 | |
162 | __u16 init_last_cmd; | ||
133 | 163 | ||
134 | struct inquiry_cache inq_cache; | 164 | struct inquiry_cache inq_cache; |
135 | struct hci_conn_hash conn_hash; | 165 | struct hci_conn_hash conn_hash; |
136 | struct list_head blacklist; | 166 | struct list_head blacklist; |
137 | 167 | ||
168 | struct list_head uuids; | ||
169 | |||
170 | struct list_head link_keys; | ||
171 | |||
138 | struct hci_dev_stats stat; | 172 | struct hci_dev_stats stat; |
139 | 173 | ||
140 | struct sk_buff_head driver_init; | 174 | struct sk_buff_head driver_init; |
@@ -165,31 +199,37 @@ struct hci_dev { | |||
165 | struct hci_conn { | 199 | struct hci_conn { |
166 | struct list_head list; | 200 | struct list_head list; |
167 | 201 | ||
168 | atomic_t refcnt; | 202 | atomic_t refcnt; |
169 | spinlock_t lock; | 203 | spinlock_t lock; |
170 | 204 | ||
171 | bdaddr_t dst; | 205 | bdaddr_t dst; |
172 | __u16 handle; | 206 | __u16 handle; |
173 | __u16 state; | 207 | __u16 state; |
174 | __u8 mode; | 208 | __u8 mode; |
175 | __u8 type; | 209 | __u8 type; |
176 | __u8 out; | 210 | __u8 out; |
177 | __u8 attempt; | 211 | __u8 attempt; |
178 | __u8 dev_class[3]; | 212 | __u8 dev_class[3]; |
179 | __u8 features[8]; | 213 | __u8 features[8]; |
180 | __u8 ssp_mode; | 214 | __u8 ssp_mode; |
181 | __u16 interval; | 215 | __u16 interval; |
182 | __u16 pkt_type; | 216 | __u16 pkt_type; |
183 | __u16 link_policy; | 217 | __u16 link_policy; |
184 | __u32 link_mode; | 218 | __u32 link_mode; |
185 | __u8 auth_type; | 219 | __u8 auth_type; |
186 | __u8 sec_level; | 220 | __u8 sec_level; |
187 | __u8 pending_sec_level; | 221 | __u8 pending_sec_level; |
188 | __u8 power_save; | 222 | __u8 pin_length; |
189 | __u16 disc_timeout; | 223 | __u8 io_capability; |
190 | unsigned long pend; | 224 | __u8 power_save; |
191 | 225 | __u16 disc_timeout; | |
192 | unsigned int sent; | 226 | unsigned long pend; |
227 | |||
228 | __u8 remote_cap; | ||
229 | __u8 remote_oob; | ||
230 | __u8 remote_auth; | ||
231 | |||
232 | unsigned int sent; | ||
193 | 233 | ||
194 | struct sk_buff_head data_q; | 234 | struct sk_buff_head data_q; |
195 | 235 | ||
@@ -274,24 +314,40 @@ static inline void hci_conn_hash_add(struct hci_dev *hdev, struct hci_conn *c) | |||
274 | { | 314 | { |
275 | struct hci_conn_hash *h = &hdev->conn_hash; | 315 | struct hci_conn_hash *h = &hdev->conn_hash; |
276 | list_add(&c->list, &h->list); | 316 | list_add(&c->list, &h->list); |
277 | if (c->type == ACL_LINK) | 317 | switch (c->type) { |
318 | case ACL_LINK: | ||
278 | h->acl_num++; | 319 | h->acl_num++; |
279 | else | 320 | break; |
321 | case LE_LINK: | ||
322 | h->le_num++; | ||
323 | break; | ||
324 | case SCO_LINK: | ||
325 | case ESCO_LINK: | ||
280 | h->sco_num++; | 326 | h->sco_num++; |
327 | break; | ||
328 | } | ||
281 | } | 329 | } |
282 | 330 | ||
283 | static inline void hci_conn_hash_del(struct hci_dev *hdev, struct hci_conn *c) | 331 | static inline void hci_conn_hash_del(struct hci_dev *hdev, struct hci_conn *c) |
284 | { | 332 | { |
285 | struct hci_conn_hash *h = &hdev->conn_hash; | 333 | struct hci_conn_hash *h = &hdev->conn_hash; |
286 | list_del(&c->list); | 334 | list_del(&c->list); |
287 | if (c->type == ACL_LINK) | 335 | switch (c->type) { |
336 | case ACL_LINK: | ||
288 | h->acl_num--; | 337 | h->acl_num--; |
289 | else | 338 | break; |
339 | case LE_LINK: | ||
340 | h->le_num--; | ||
341 | break; | ||
342 | case SCO_LINK: | ||
343 | case ESCO_LINK: | ||
290 | h->sco_num--; | 344 | h->sco_num--; |
345 | break; | ||
346 | } | ||
291 | } | 347 | } |
292 | 348 | ||
293 | static inline struct hci_conn *hci_conn_hash_lookup_handle(struct hci_dev *hdev, | 349 | static inline struct hci_conn *hci_conn_hash_lookup_handle(struct hci_dev *hdev, |
294 | __u16 handle) | 350 | __u16 handle) |
295 | { | 351 | { |
296 | struct hci_conn_hash *h = &hdev->conn_hash; | 352 | struct hci_conn_hash *h = &hdev->conn_hash; |
297 | struct list_head *p; | 353 | struct list_head *p; |
@@ -306,7 +362,7 @@ static inline struct hci_conn *hci_conn_hash_lookup_handle(struct hci_dev *hdev, | |||
306 | } | 362 | } |
307 | 363 | ||
308 | static inline struct hci_conn *hci_conn_hash_lookup_ba(struct hci_dev *hdev, | 364 | static inline struct hci_conn *hci_conn_hash_lookup_ba(struct hci_dev *hdev, |
309 | __u8 type, bdaddr_t *ba) | 365 | __u8 type, bdaddr_t *ba) |
310 | { | 366 | { |
311 | struct hci_conn_hash *h = &hdev->conn_hash; | 367 | struct hci_conn_hash *h = &hdev->conn_hash; |
312 | struct list_head *p; | 368 | struct list_head *p; |
@@ -321,7 +377,7 @@ static inline struct hci_conn *hci_conn_hash_lookup_ba(struct hci_dev *hdev, | |||
321 | } | 377 | } |
322 | 378 | ||
323 | static inline struct hci_conn *hci_conn_hash_lookup_state(struct hci_dev *hdev, | 379 | static inline struct hci_conn *hci_conn_hash_lookup_state(struct hci_dev *hdev, |
324 | __u8 type, __u16 state) | 380 | __u8 type, __u16 state) |
325 | { | 381 | { |
326 | struct hci_conn_hash *h = &hdev->conn_hash; | 382 | struct hci_conn_hash *h = &hdev->conn_hash; |
327 | struct list_head *p; | 383 | struct list_head *p; |
@@ -437,6 +493,16 @@ int hci_inquiry(void __user *arg); | |||
437 | struct bdaddr_list *hci_blacklist_lookup(struct hci_dev *hdev, bdaddr_t *bdaddr); | 493 | struct bdaddr_list *hci_blacklist_lookup(struct hci_dev *hdev, bdaddr_t *bdaddr); |
438 | int hci_blacklist_clear(struct hci_dev *hdev); | 494 | int hci_blacklist_clear(struct hci_dev *hdev); |
439 | 495 | ||
496 | int hci_uuids_clear(struct hci_dev *hdev); | ||
497 | |||
498 | int hci_link_keys_clear(struct hci_dev *hdev); | ||
499 | struct link_key *hci_find_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr); | ||
500 | int hci_add_link_key(struct hci_dev *hdev, int new_key, bdaddr_t *bdaddr, | ||
501 | u8 *key, u8 type, u8 pin_len); | ||
502 | int hci_remove_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr); | ||
503 | |||
504 | void hci_del_off_timer(struct hci_dev *hdev); | ||
505 | |||
440 | void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb); | 506 | void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb); |
441 | 507 | ||
442 | int hci_recv_frame(struct sk_buff *skb); | 508 | int hci_recv_frame(struct sk_buff *skb); |
@@ -458,6 +524,8 @@ void hci_conn_del_sysfs(struct hci_conn *conn); | |||
458 | #define lmp_sniffsubr_capable(dev) ((dev)->features[5] & LMP_SNIFF_SUBR) | 524 | #define lmp_sniffsubr_capable(dev) ((dev)->features[5] & LMP_SNIFF_SUBR) |
459 | #define lmp_esco_capable(dev) ((dev)->features[3] & LMP_ESCO) | 525 | #define lmp_esco_capable(dev) ((dev)->features[3] & LMP_ESCO) |
460 | #define lmp_ssp_capable(dev) ((dev)->features[6] & LMP_SIMPLE_PAIR) | 526 | #define lmp_ssp_capable(dev) ((dev)->features[6] & LMP_SIMPLE_PAIR) |
527 | #define lmp_no_flush_capable(dev) ((dev)->features[6] & LMP_NO_FLUSH) | ||
528 | #define lmp_le_capable(dev) ((dev)->features[4] & LMP_LE) | ||
461 | 529 | ||
462 | /* ----- HCI protocols ----- */ | 530 | /* ----- HCI protocols ----- */ |
463 | struct hci_proto { | 531 | struct hci_proto { |
@@ -660,12 +728,24 @@ void *hci_sent_cmd_data(struct hci_dev *hdev, __u16 opcode); | |||
660 | void hci_si_event(struct hci_dev *hdev, int type, int dlen, void *data); | 728 | void hci_si_event(struct hci_dev *hdev, int type, int dlen, void *data); |
661 | 729 | ||
662 | /* ----- HCI Sockets ----- */ | 730 | /* ----- HCI Sockets ----- */ |
663 | void hci_send_to_sock(struct hci_dev *hdev, struct sk_buff *skb); | 731 | void hci_send_to_sock(struct hci_dev *hdev, struct sk_buff *skb, |
732 | struct sock *skip_sk); | ||
664 | 733 | ||
665 | /* Management interface */ | 734 | /* Management interface */ |
666 | int mgmt_control(struct sock *sk, struct msghdr *msg, size_t len); | 735 | int mgmt_control(struct sock *sk, struct msghdr *msg, size_t len); |
667 | int mgmt_index_added(u16 index); | 736 | int mgmt_index_added(u16 index); |
668 | int mgmt_index_removed(u16 index); | 737 | int mgmt_index_removed(u16 index); |
738 | int mgmt_powered(u16 index, u8 powered); | ||
739 | int mgmt_discoverable(u16 index, u8 discoverable); | ||
740 | int mgmt_connectable(u16 index, u8 connectable); | ||
741 | int mgmt_new_key(u16 index, struct link_key *key, u8 old_key_type); | ||
742 | int mgmt_connected(u16 index, bdaddr_t *bdaddr); | ||
743 | int mgmt_disconnected(u16 index, bdaddr_t *bdaddr); | ||
744 | int mgmt_disconnect_failed(u16 index); | ||
745 | int mgmt_connect_failed(u16 index, bdaddr_t *bdaddr, u8 status); | ||
746 | int mgmt_pin_code_request(u16 index, bdaddr_t *bdaddr); | ||
747 | int mgmt_pin_code_reply_complete(u16 index, bdaddr_t *bdaddr, u8 status); | ||
748 | int mgmt_pin_code_neg_reply_complete(u16 index, bdaddr_t *bdaddr, u8 status); | ||
669 | 749 | ||
670 | /* HCI info for socket */ | 750 | /* HCI info for socket */ |
671 | #define hci_pi(sk) ((struct hci_pinfo *) sk) | 751 | #define hci_pi(sk) ((struct hci_pinfo *) sk) |
@@ -697,4 +777,6 @@ struct hci_sec_filter { | |||
697 | 777 | ||
698 | void hci_req_complete(struct hci_dev *hdev, __u16 cmd, int result); | 778 | void hci_req_complete(struct hci_dev *hdev, __u16 cmd, int result); |
699 | 779 | ||
780 | void hci_le_conn_update(struct hci_conn *conn, u16 min, u16 max, | ||
781 | u16 latency, u16 to_multiplier); | ||
700 | #endif /* __HCI_CORE_H */ | 782 | #endif /* __HCI_CORE_H */ |