diff options
author | John W. Linville <linville@tuxdriver.com> | 2012-01-03 15:16:34 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-01-03 15:16:34 -0500 |
commit | 57adc1fcbae2c13104ce291b40f23e40a414fa87 (patch) | |
tree | a22d95cd3a96cbd515cd24fb0833739576c5e92f /include/net | |
parent | faa85aa24286a9e14ae7cc797352350c3ac39986 (diff) | |
parent | dc0d633e35643662f27a0b1c531da3cd6b204b9c (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next into for-davem
Conflicts:
drivers/net/wireless/b43/dma.c
drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c
Diffstat (limited to 'include/net')
-rw-r--r-- | include/net/bluetooth/bluetooth.h | 22 | ||||
-rw-r--r-- | include/net/bluetooth/hci.h | 23 | ||||
-rw-r--r-- | include/net/bluetooth/hci_core.h | 280 | ||||
-rw-r--r-- | include/net/bluetooth/l2cap.h | 46 | ||||
-rw-r--r-- | include/net/bluetooth/mgmt.h | 191 | ||||
-rw-r--r-- | include/net/bluetooth/smp.h | 6 | ||||
-rw-r--r-- | include/net/cfg80211.h | 7 | ||||
-rw-r--r-- | include/net/mac80211.h | 5 |
8 files changed, 309 insertions, 271 deletions
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h index 980e59f37d4f..abaad6ed9b83 100644 --- a/include/net/bluetooth/bluetooth.h +++ b/include/net/bluetooth/bluetooth.h | |||
@@ -250,32 +250,10 @@ extern void bt_sysfs_cleanup(void); | |||
250 | 250 | ||
251 | extern struct dentry *bt_debugfs; | 251 | extern struct dentry *bt_debugfs; |
252 | 252 | ||
253 | #ifdef CONFIG_BT_L2CAP | ||
254 | int l2cap_init(void); | 253 | int l2cap_init(void); |
255 | void l2cap_exit(void); | 254 | void l2cap_exit(void); |
256 | #else | ||
257 | static inline int l2cap_init(void) | ||
258 | { | ||
259 | return 0; | ||
260 | } | ||
261 | |||
262 | static inline void l2cap_exit(void) | ||
263 | { | ||
264 | } | ||
265 | #endif | ||
266 | 255 | ||
267 | #ifdef CONFIG_BT_SCO | ||
268 | int sco_init(void); | 256 | int sco_init(void); |
269 | void sco_exit(void); | 257 | void sco_exit(void); |
270 | #else | ||
271 | static inline int sco_init(void) | ||
272 | { | ||
273 | return 0; | ||
274 | } | ||
275 | |||
276 | static inline void sco_exit(void) | ||
277 | { | ||
278 | } | ||
279 | #endif | ||
280 | 258 | ||
281 | #endif /* __BLUETOOTH_H */ | 259 | #endif /* __BLUETOOTH_H */ |
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index 67ad98430348..5b2fed5eebf2 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h | |||
@@ -210,6 +210,7 @@ enum { | |||
210 | 210 | ||
211 | #define LMP_EV4 0x01 | 211 | #define LMP_EV4 0x01 |
212 | #define LMP_EV5 0x02 | 212 | #define LMP_EV5 0x02 |
213 | #define LMP_NO_BREDR 0x20 | ||
213 | #define LMP_LE 0x40 | 214 | #define LMP_LE 0x40 |
214 | 215 | ||
215 | #define LMP_SNIFF_SUBR 0x02 | 216 | #define LMP_SNIFF_SUBR 0x02 |
@@ -279,6 +280,10 @@ enum { | |||
279 | #define HCI_ERROR_LOCAL_HOST_TERM 0x16 | 280 | #define HCI_ERROR_LOCAL_HOST_TERM 0x16 |
280 | #define HCI_ERROR_PAIRING_NOT_ALLOWED 0x18 | 281 | #define HCI_ERROR_PAIRING_NOT_ALLOWED 0x18 |
281 | 282 | ||
283 | /* Flow control modes */ | ||
284 | #define HCI_FLOW_CTL_MODE_PACKET_BASED 0x00 | ||
285 | #define HCI_FLOW_CTL_MODE_BLOCK_BASED 0x01 | ||
286 | |||
282 | /* ----- HCI Commands ---- */ | 287 | /* ----- HCI Commands ---- */ |
283 | #define HCI_OP_NOP 0x0000 | 288 | #define HCI_OP_NOP 0x0000 |
284 | 289 | ||
@@ -745,6 +750,14 @@ struct hci_rp_read_bd_addr { | |||
745 | bdaddr_t bdaddr; | 750 | bdaddr_t bdaddr; |
746 | } __packed; | 751 | } __packed; |
747 | 752 | ||
753 | #define HCI_OP_READ_DATA_BLOCK_SIZE 0x100a | ||
754 | struct hci_rp_read_data_block_size { | ||
755 | __u8 status; | ||
756 | __le16 max_acl_len; | ||
757 | __le16 block_len; | ||
758 | __le16 num_blocks; | ||
759 | } __packed; | ||
760 | |||
748 | #define HCI_OP_WRITE_PAGE_SCAN_ACTIVITY 0x0c1c | 761 | #define HCI_OP_WRITE_PAGE_SCAN_ACTIVITY 0x0c1c |
749 | struct hci_cp_write_page_scan_activity { | 762 | struct hci_cp_write_page_scan_activity { |
750 | __le16 interval; | 763 | __le16 interval; |
@@ -791,6 +804,9 @@ struct hci_cp_le_set_scan_param { | |||
791 | __u8 filter_policy; | 804 | __u8 filter_policy; |
792 | } __packed; | 805 | } __packed; |
793 | 806 | ||
807 | #define LE_SCANNING_DISABLED 0x00 | ||
808 | #define LE_SCANNING_ENABLED 0x01 | ||
809 | |||
794 | #define HCI_OP_LE_SET_SCAN_ENABLE 0x200c | 810 | #define HCI_OP_LE_SET_SCAN_ENABLE 0x200c |
795 | struct hci_cp_le_set_scan_enable { | 811 | struct hci_cp_le_set_scan_enable { |
796 | __u8 enable; | 812 | __u8 enable; |
@@ -966,9 +982,14 @@ struct hci_ev_role_change { | |||
966 | } __packed; | 982 | } __packed; |
967 | 983 | ||
968 | #define HCI_EV_NUM_COMP_PKTS 0x13 | 984 | #define HCI_EV_NUM_COMP_PKTS 0x13 |
985 | struct hci_comp_pkts_info { | ||
986 | __le16 handle; | ||
987 | __le16 count; | ||
988 | } __packed; | ||
989 | |||
969 | struct hci_ev_num_comp_pkts { | 990 | struct hci_ev_num_comp_pkts { |
970 | __u8 num_hndl; | 991 | __u8 num_hndl; |
971 | /* variable length part */ | 992 | struct hci_comp_pkts_info handles[0]; |
972 | } __packed; | 993 | } __packed; |
973 | 994 | ||
974 | #define HCI_EV_MODE_CHANGE 0x14 | 995 | #define HCI_EV_MODE_CHANGE 0x14 |
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index ea4395f1d260..5e2e98458496 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h | |||
@@ -28,10 +28,6 @@ | |||
28 | #include <linux/interrupt.h> | 28 | #include <linux/interrupt.h> |
29 | #include <net/bluetooth/hci.h> | 29 | #include <net/bluetooth/hci.h> |
30 | 30 | ||
31 | /* HCI upper protocols */ | ||
32 | #define HCI_PROTO_L2CAP 0 | ||
33 | #define HCI_PROTO_SCO 1 | ||
34 | |||
35 | /* HCI priority */ | 31 | /* HCI priority */ |
36 | #define HCI_PRIO_MAX 7 | 32 | #define HCI_PRIO_MAX 7 |
37 | 33 | ||
@@ -54,25 +50,17 @@ struct inquiry_entry { | |||
54 | }; | 50 | }; |
55 | 51 | ||
56 | struct inquiry_cache { | 52 | struct inquiry_cache { |
57 | spinlock_t lock; | ||
58 | __u32 timestamp; | 53 | __u32 timestamp; |
59 | struct inquiry_entry *list; | 54 | struct inquiry_entry *list; |
60 | }; | 55 | }; |
61 | 56 | ||
62 | struct hci_conn_hash { | 57 | struct hci_conn_hash { |
63 | struct list_head list; | 58 | struct list_head list; |
64 | spinlock_t lock; | ||
65 | unsigned int acl_num; | 59 | unsigned int acl_num; |
66 | unsigned int sco_num; | 60 | unsigned int sco_num; |
67 | unsigned int le_num; | 61 | unsigned int le_num; |
68 | }; | 62 | }; |
69 | 63 | ||
70 | struct hci_chan_hash { | ||
71 | struct list_head list; | ||
72 | spinlock_t lock; | ||
73 | unsigned int num; | ||
74 | }; | ||
75 | |||
76 | struct bdaddr_list { | 64 | struct bdaddr_list { |
77 | struct list_head list; | 65 | struct list_head list; |
78 | bdaddr_t bdaddr; | 66 | bdaddr_t bdaddr; |
@@ -124,7 +112,7 @@ struct adv_entry { | |||
124 | #define NUM_REASSEMBLY 4 | 112 | #define NUM_REASSEMBLY 4 |
125 | struct hci_dev { | 113 | struct hci_dev { |
126 | struct list_head list; | 114 | struct list_head list; |
127 | spinlock_t lock; | 115 | struct mutex lock; |
128 | atomic_t refcnt; | 116 | atomic_t refcnt; |
129 | 117 | ||
130 | char name[8]; | 118 | char name[8]; |
@@ -188,6 +176,11 @@ struct hci_dev { | |||
188 | unsigned int sco_pkts; | 176 | unsigned int sco_pkts; |
189 | unsigned int le_pkts; | 177 | unsigned int le_pkts; |
190 | 178 | ||
179 | __u16 block_len; | ||
180 | __u16 block_mtu; | ||
181 | __u16 num_blocks; | ||
182 | __u16 block_cnt; | ||
183 | |||
191 | unsigned long acl_last_tx; | 184 | unsigned long acl_last_tx; |
192 | unsigned long sco_last_tx; | 185 | unsigned long sco_last_tx; |
193 | unsigned long le_last_tx; | 186 | unsigned long le_last_tx; |
@@ -200,10 +193,13 @@ struct hci_dev { | |||
200 | __u16 discov_timeout; | 193 | __u16 discov_timeout; |
201 | struct delayed_work discov_off; | 194 | struct delayed_work discov_off; |
202 | 195 | ||
196 | struct delayed_work service_cache; | ||
197 | |||
203 | struct timer_list cmd_timer; | 198 | struct timer_list cmd_timer; |
204 | struct tasklet_struct cmd_task; | 199 | |
205 | struct tasklet_struct rx_task; | 200 | struct work_struct rx_work; |
206 | struct tasklet_struct tx_task; | 201 | struct work_struct cmd_work; |
202 | struct work_struct tx_work; | ||
207 | 203 | ||
208 | struct sk_buff_head rx_q; | 204 | struct sk_buff_head rx_q; |
209 | struct sk_buff_head raw_q; | 205 | struct sk_buff_head raw_q; |
@@ -232,7 +228,7 @@ struct hci_dev { | |||
232 | struct list_head remote_oob_data; | 228 | struct list_head remote_oob_data; |
233 | 229 | ||
234 | struct list_head adv_entries; | 230 | struct list_head adv_entries; |
235 | struct timer_list adv_timer; | 231 | struct delayed_work adv_work; |
236 | 232 | ||
237 | struct hci_dev_stats stat; | 233 | struct hci_dev_stats stat; |
238 | 234 | ||
@@ -301,21 +297,19 @@ struct hci_conn { | |||
301 | unsigned int sent; | 297 | unsigned int sent; |
302 | 298 | ||
303 | struct sk_buff_head data_q; | 299 | struct sk_buff_head data_q; |
304 | struct hci_chan_hash chan_hash; | 300 | struct list_head chan_list; |
305 | 301 | ||
306 | struct timer_list disc_timer; | 302 | struct delayed_work disc_work; |
307 | struct timer_list idle_timer; | 303 | struct timer_list idle_timer; |
308 | struct timer_list auto_accept_timer; | 304 | struct timer_list auto_accept_timer; |
309 | 305 | ||
310 | struct work_struct work_add; | ||
311 | struct work_struct work_del; | ||
312 | |||
313 | struct device dev; | 306 | struct device dev; |
314 | atomic_t devref; | 307 | atomic_t devref; |
315 | 308 | ||
316 | struct hci_dev *hdev; | 309 | struct hci_dev *hdev; |
317 | void *l2cap_data; | 310 | void *l2cap_data; |
318 | void *sco_data; | 311 | void *sco_data; |
312 | void *smp_conn; | ||
319 | 313 | ||
320 | struct hci_conn *link; | 314 | struct hci_conn *link; |
321 | 315 | ||
@@ -332,25 +326,31 @@ struct hci_chan { | |||
332 | unsigned int sent; | 326 | unsigned int sent; |
333 | }; | 327 | }; |
334 | 328 | ||
335 | extern struct hci_proto *hci_proto[]; | ||
336 | extern struct list_head hci_dev_list; | 329 | extern struct list_head hci_dev_list; |
337 | extern struct list_head hci_cb_list; | 330 | extern struct list_head hci_cb_list; |
338 | extern rwlock_t hci_dev_list_lock; | 331 | extern rwlock_t hci_dev_list_lock; |
339 | extern rwlock_t hci_cb_list_lock; | 332 | extern rwlock_t hci_cb_list_lock; |
340 | 333 | ||
334 | /* ----- HCI interface to upper protocols ----- */ | ||
335 | extern int l2cap_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr); | ||
336 | extern int l2cap_connect_cfm(struct hci_conn *hcon, u8 status); | ||
337 | extern int l2cap_disconn_ind(struct hci_conn *hcon); | ||
338 | extern int l2cap_disconn_cfm(struct hci_conn *hcon, u8 reason); | ||
339 | extern int l2cap_security_cfm(struct hci_conn *hcon, u8 status, u8 encrypt); | ||
340 | extern int l2cap_recv_acldata(struct hci_conn *hcon, struct sk_buff *skb, u16 flags); | ||
341 | |||
342 | extern int sco_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr); | ||
343 | extern int sco_connect_cfm(struct hci_conn *hcon, __u8 status); | ||
344 | extern int sco_disconn_cfm(struct hci_conn *hcon, __u8 reason); | ||
345 | extern int sco_recv_scodata(struct hci_conn *hcon, struct sk_buff *skb); | ||
346 | |||
341 | /* ----- Inquiry cache ----- */ | 347 | /* ----- Inquiry cache ----- */ |
342 | #define INQUIRY_CACHE_AGE_MAX (HZ*30) /* 30 seconds */ | 348 | #define INQUIRY_CACHE_AGE_MAX (HZ*30) /* 30 seconds */ |
343 | #define INQUIRY_ENTRY_AGE_MAX (HZ*60) /* 60 seconds */ | 349 | #define INQUIRY_ENTRY_AGE_MAX (HZ*60) /* 60 seconds */ |
344 | 350 | ||
345 | #define inquiry_cache_lock(c) spin_lock(&c->lock) | ||
346 | #define inquiry_cache_unlock(c) spin_unlock(&c->lock) | ||
347 | #define inquiry_cache_lock_bh(c) spin_lock_bh(&c->lock) | ||
348 | #define inquiry_cache_unlock_bh(c) spin_unlock_bh(&c->lock) | ||
349 | |||
350 | static inline void inquiry_cache_init(struct hci_dev *hdev) | 351 | static inline void inquiry_cache_init(struct hci_dev *hdev) |
351 | { | 352 | { |
352 | struct inquiry_cache *c = &hdev->inq_cache; | 353 | struct inquiry_cache *c = &hdev->inq_cache; |
353 | spin_lock_init(&c->lock); | ||
354 | c->list = NULL; | 354 | c->list = NULL; |
355 | } | 355 | } |
356 | 356 | ||
@@ -390,15 +390,15 @@ static inline void hci_conn_hash_init(struct hci_dev *hdev) | |||
390 | { | 390 | { |
391 | struct hci_conn_hash *h = &hdev->conn_hash; | 391 | struct hci_conn_hash *h = &hdev->conn_hash; |
392 | INIT_LIST_HEAD(&h->list); | 392 | INIT_LIST_HEAD(&h->list); |
393 | spin_lock_init(&h->lock); | ||
394 | h->acl_num = 0; | 393 | h->acl_num = 0; |
395 | h->sco_num = 0; | 394 | h->sco_num = 0; |
395 | h->le_num = 0; | ||
396 | } | 396 | } |
397 | 397 | ||
398 | static inline void hci_conn_hash_add(struct hci_dev *hdev, struct hci_conn *c) | 398 | static inline void hci_conn_hash_add(struct hci_dev *hdev, struct hci_conn *c) |
399 | { | 399 | { |
400 | struct hci_conn_hash *h = &hdev->conn_hash; | 400 | struct hci_conn_hash *h = &hdev->conn_hash; |
401 | list_add(&c->list, &h->list); | 401 | list_add_rcu(&c->list, &h->list); |
402 | switch (c->type) { | 402 | switch (c->type) { |
403 | case ACL_LINK: | 403 | case ACL_LINK: |
404 | h->acl_num++; | 404 | h->acl_num++; |
@@ -416,7 +416,10 @@ static inline void hci_conn_hash_add(struct hci_dev *hdev, struct hci_conn *c) | |||
416 | static inline void hci_conn_hash_del(struct hci_dev *hdev, struct hci_conn *c) | 416 | static inline void hci_conn_hash_del(struct hci_dev *hdev, struct hci_conn *c) |
417 | { | 417 | { |
418 | struct hci_conn_hash *h = &hdev->conn_hash; | 418 | struct hci_conn_hash *h = &hdev->conn_hash; |
419 | list_del(&c->list); | 419 | |
420 | list_del_rcu(&c->list); | ||
421 | synchronize_rcu(); | ||
422 | |||
420 | switch (c->type) { | 423 | switch (c->type) { |
421 | case ACL_LINK: | 424 | case ACL_LINK: |
422 | h->acl_num--; | 425 | h->acl_num--; |
@@ -451,14 +454,18 @@ static inline struct hci_conn *hci_conn_hash_lookup_handle(struct hci_dev *hdev, | |||
451 | __u16 handle) | 454 | __u16 handle) |
452 | { | 455 | { |
453 | struct hci_conn_hash *h = &hdev->conn_hash; | 456 | struct hci_conn_hash *h = &hdev->conn_hash; |
454 | struct list_head *p; | ||
455 | struct hci_conn *c; | 457 | struct hci_conn *c; |
456 | 458 | ||
457 | list_for_each(p, &h->list) { | 459 | rcu_read_lock(); |
458 | c = list_entry(p, struct hci_conn, list); | 460 | |
459 | if (c->handle == handle) | 461 | list_for_each_entry_rcu(c, &h->list, list) { |
462 | if (c->handle == handle) { | ||
463 | rcu_read_unlock(); | ||
460 | return c; | 464 | return c; |
465 | } | ||
461 | } | 466 | } |
467 | rcu_read_unlock(); | ||
468 | |||
462 | return NULL; | 469 | return NULL; |
463 | } | 470 | } |
464 | 471 | ||
@@ -466,14 +473,19 @@ static inline struct hci_conn *hci_conn_hash_lookup_ba(struct hci_dev *hdev, | |||
466 | __u8 type, bdaddr_t *ba) | 473 | __u8 type, bdaddr_t *ba) |
467 | { | 474 | { |
468 | struct hci_conn_hash *h = &hdev->conn_hash; | 475 | struct hci_conn_hash *h = &hdev->conn_hash; |
469 | struct list_head *p; | ||
470 | struct hci_conn *c; | 476 | struct hci_conn *c; |
471 | 477 | ||
472 | list_for_each(p, &h->list) { | 478 | rcu_read_lock(); |
473 | c = list_entry(p, struct hci_conn, list); | 479 | |
474 | if (c->type == type && !bacmp(&c->dst, ba)) | 480 | list_for_each_entry_rcu(c, &h->list, list) { |
481 | if (c->type == type && !bacmp(&c->dst, ba)) { | ||
482 | rcu_read_unlock(); | ||
475 | return c; | 483 | return c; |
484 | } | ||
476 | } | 485 | } |
486 | |||
487 | rcu_read_unlock(); | ||
488 | |||
477 | return NULL; | 489 | return NULL; |
478 | } | 490 | } |
479 | 491 | ||
@@ -481,37 +493,20 @@ static inline struct hci_conn *hci_conn_hash_lookup_state(struct hci_dev *hdev, | |||
481 | __u8 type, __u16 state) | 493 | __u8 type, __u16 state) |
482 | { | 494 | { |
483 | struct hci_conn_hash *h = &hdev->conn_hash; | 495 | struct hci_conn_hash *h = &hdev->conn_hash; |
484 | struct list_head *p; | ||
485 | struct hci_conn *c; | 496 | struct hci_conn *c; |
486 | 497 | ||
487 | list_for_each(p, &h->list) { | 498 | rcu_read_lock(); |
488 | c = list_entry(p, struct hci_conn, list); | 499 | |
489 | if (c->type == type && c->state == state) | 500 | list_for_each_entry_rcu(c, &h->list, list) { |
501 | if (c->type == type && c->state == state) { | ||
502 | rcu_read_unlock(); | ||
490 | return c; | 503 | return c; |
504 | } | ||
491 | } | 505 | } |
492 | return NULL; | ||
493 | } | ||
494 | 506 | ||
495 | static inline void hci_chan_hash_init(struct hci_conn *c) | 507 | rcu_read_unlock(); |
496 | { | ||
497 | struct hci_chan_hash *h = &c->chan_hash; | ||
498 | INIT_LIST_HEAD(&h->list); | ||
499 | spin_lock_init(&h->lock); | ||
500 | h->num = 0; | ||
501 | } | ||
502 | 508 | ||
503 | static inline void hci_chan_hash_add(struct hci_conn *c, struct hci_chan *chan) | 509 | return NULL; |
504 | { | ||
505 | struct hci_chan_hash *h = &c->chan_hash; | ||
506 | list_add(&chan->list, &h->list); | ||
507 | h->num++; | ||
508 | } | ||
509 | |||
510 | static inline void hci_chan_hash_del(struct hci_conn *c, struct hci_chan *chan) | ||
511 | { | ||
512 | struct hci_chan_hash *h = &c->chan_hash; | ||
513 | list_del(&chan->list); | ||
514 | h->num--; | ||
515 | } | 510 | } |
516 | 511 | ||
517 | void hci_acl_connect(struct hci_conn *conn); | 512 | void hci_acl_connect(struct hci_conn *conn); |
@@ -527,7 +522,7 @@ void hci_conn_check_pending(struct hci_dev *hdev); | |||
527 | 522 | ||
528 | struct hci_chan *hci_chan_create(struct hci_conn *conn); | 523 | struct hci_chan *hci_chan_create(struct hci_conn *conn); |
529 | int hci_chan_del(struct hci_chan *chan); | 524 | int hci_chan_del(struct hci_chan *chan); |
530 | void hci_chan_hash_flush(struct hci_conn *conn); | 525 | void hci_chan_list_flush(struct hci_conn *conn); |
531 | 526 | ||
532 | struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst, | 527 | struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst, |
533 | __u8 sec_level, __u8 auth_type); | 528 | __u8 sec_level, __u8 auth_type); |
@@ -538,7 +533,6 @@ int hci_conn_change_link_key(struct hci_conn *conn); | |||
538 | int hci_conn_switch_role(struct hci_conn *conn, __u8 role); | 533 | int hci_conn_switch_role(struct hci_conn *conn, __u8 role); |
539 | 534 | ||
540 | void hci_conn_enter_active_mode(struct hci_conn *conn, __u8 force_active); | 535 | void hci_conn_enter_active_mode(struct hci_conn *conn, __u8 force_active); |
541 | void hci_conn_enter_sniff_mode(struct hci_conn *conn); | ||
542 | 536 | ||
543 | void hci_conn_hold_device(struct hci_conn *conn); | 537 | void hci_conn_hold_device(struct hci_conn *conn); |
544 | void hci_conn_put_device(struct hci_conn *conn); | 538 | void hci_conn_put_device(struct hci_conn *conn); |
@@ -546,7 +540,7 @@ void hci_conn_put_device(struct hci_conn *conn); | |||
546 | static inline void hci_conn_hold(struct hci_conn *conn) | 540 | static inline void hci_conn_hold(struct hci_conn *conn) |
547 | { | 541 | { |
548 | atomic_inc(&conn->refcnt); | 542 | atomic_inc(&conn->refcnt); |
549 | del_timer(&conn->disc_timer); | 543 | cancel_delayed_work_sync(&conn->disc_work); |
550 | } | 544 | } |
551 | 545 | ||
552 | static inline void hci_conn_put(struct hci_conn *conn) | 546 | static inline void hci_conn_put(struct hci_conn *conn) |
@@ -565,7 +559,9 @@ static inline void hci_conn_put(struct hci_conn *conn) | |||
565 | } else { | 559 | } else { |
566 | timeo = msecs_to_jiffies(10); | 560 | timeo = msecs_to_jiffies(10); |
567 | } | 561 | } |
568 | mod_timer(&conn->disc_timer, jiffies + timeo); | 562 | cancel_delayed_work_sync(&conn->disc_work); |
563 | queue_delayed_work(conn->hdev->workqueue, | ||
564 | &conn->disc_work, jiffies + timeo); | ||
569 | } | 565 | } |
570 | } | 566 | } |
571 | 567 | ||
@@ -597,10 +593,8 @@ static inline struct hci_dev *__hci_dev_hold(struct hci_dev *d) | |||
597 | try_module_get(d->owner) ? __hci_dev_hold(d) : NULL; \ | 593 | try_module_get(d->owner) ? __hci_dev_hold(d) : NULL; \ |
598 | }) | 594 | }) |
599 | 595 | ||
600 | #define hci_dev_lock(d) spin_lock(&d->lock) | 596 | #define hci_dev_lock(d) mutex_lock(&d->lock) |
601 | #define hci_dev_unlock(d) spin_unlock(&d->lock) | 597 | #define hci_dev_unlock(d) mutex_unlock(&d->lock) |
602 | #define hci_dev_lock_bh(d) spin_lock_bh(&d->lock) | ||
603 | #define hci_dev_unlock_bh(d) spin_unlock_bh(&d->lock) | ||
604 | 598 | ||
605 | struct hci_dev *hci_dev_get(int index); | 599 | struct hci_dev *hci_dev_get(int index); |
606 | struct hci_dev *hci_get_route(bdaddr_t *src, bdaddr_t *dst); | 600 | struct hci_dev *hci_get_route(bdaddr_t *src, bdaddr_t *dst); |
@@ -685,53 +679,40 @@ void hci_conn_del_sysfs(struct hci_conn *conn); | |||
685 | #define lmp_host_le_capable(dev) ((dev)->extfeatures[0] & LMP_HOST_LE) | 679 | #define lmp_host_le_capable(dev) ((dev)->extfeatures[0] & LMP_HOST_LE) |
686 | 680 | ||
687 | /* ----- HCI protocols ----- */ | 681 | /* ----- HCI protocols ----- */ |
688 | struct hci_proto { | ||
689 | char *name; | ||
690 | unsigned int id; | ||
691 | unsigned long flags; | ||
692 | |||
693 | void *priv; | ||
694 | |||
695 | int (*connect_ind) (struct hci_dev *hdev, bdaddr_t *bdaddr, | ||
696 | __u8 type); | ||
697 | int (*connect_cfm) (struct hci_conn *conn, __u8 status); | ||
698 | int (*disconn_ind) (struct hci_conn *conn); | ||
699 | int (*disconn_cfm) (struct hci_conn *conn, __u8 reason); | ||
700 | int (*recv_acldata) (struct hci_conn *conn, struct sk_buff *skb, | ||
701 | __u16 flags); | ||
702 | int (*recv_scodata) (struct hci_conn *conn, struct sk_buff *skb); | ||
703 | int (*security_cfm) (struct hci_conn *conn, __u8 status, | ||
704 | __u8 encrypt); | ||
705 | }; | ||
706 | |||
707 | static inline int hci_proto_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr, | 682 | static inline int hci_proto_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr, |
708 | __u8 type) | 683 | __u8 type) |
709 | { | 684 | { |
710 | register struct hci_proto *hp; | 685 | switch (type) { |
711 | int mask = 0; | 686 | case ACL_LINK: |
712 | 687 | return l2cap_connect_ind(hdev, bdaddr); | |
713 | hp = hci_proto[HCI_PROTO_L2CAP]; | ||
714 | if (hp && hp->connect_ind) | ||
715 | mask |= hp->connect_ind(hdev, bdaddr, type); | ||
716 | 688 | ||
717 | hp = hci_proto[HCI_PROTO_SCO]; | 689 | case SCO_LINK: |
718 | if (hp && hp->connect_ind) | 690 | case ESCO_LINK: |
719 | mask |= hp->connect_ind(hdev, bdaddr, type); | 691 | return sco_connect_ind(hdev, bdaddr); |
720 | 692 | ||
721 | return mask; | 693 | default: |
694 | BT_ERR("unknown link type %d", type); | ||
695 | return -EINVAL; | ||
696 | } | ||
722 | } | 697 | } |
723 | 698 | ||
724 | static inline void hci_proto_connect_cfm(struct hci_conn *conn, __u8 status) | 699 | static inline void hci_proto_connect_cfm(struct hci_conn *conn, __u8 status) |
725 | { | 700 | { |
726 | register struct hci_proto *hp; | 701 | switch (conn->type) { |
702 | case ACL_LINK: | ||
703 | case LE_LINK: | ||
704 | l2cap_connect_cfm(conn, status); | ||
705 | break; | ||
727 | 706 | ||
728 | hp = hci_proto[HCI_PROTO_L2CAP]; | 707 | case SCO_LINK: |
729 | if (hp && hp->connect_cfm) | 708 | case ESCO_LINK: |
730 | hp->connect_cfm(conn, status); | 709 | sco_connect_cfm(conn, status); |
710 | break; | ||
731 | 711 | ||
732 | hp = hci_proto[HCI_PROTO_SCO]; | 712 | default: |
733 | if (hp && hp->connect_cfm) | 713 | BT_ERR("unknown link type %d", conn->type); |
734 | hp->connect_cfm(conn, status); | 714 | break; |
715 | } | ||
735 | 716 | ||
736 | if (conn->connect_cfm_cb) | 717 | if (conn->connect_cfm_cb) |
737 | conn->connect_cfm_cb(conn, status); | 718 | conn->connect_cfm_cb(conn, status); |
@@ -739,31 +720,29 @@ static inline void hci_proto_connect_cfm(struct hci_conn *conn, __u8 status) | |||
739 | 720 | ||
740 | static inline int hci_proto_disconn_ind(struct hci_conn *conn) | 721 | static inline int hci_proto_disconn_ind(struct hci_conn *conn) |
741 | { | 722 | { |
742 | register struct hci_proto *hp; | 723 | if (conn->type != ACL_LINK && conn->type != LE_LINK) |
743 | int reason = HCI_ERROR_REMOTE_USER_TERM; | 724 | return HCI_ERROR_REMOTE_USER_TERM; |
744 | |||
745 | hp = hci_proto[HCI_PROTO_L2CAP]; | ||
746 | if (hp && hp->disconn_ind) | ||
747 | reason = hp->disconn_ind(conn); | ||
748 | 725 | ||
749 | hp = hci_proto[HCI_PROTO_SCO]; | 726 | return l2cap_disconn_ind(conn); |
750 | if (hp && hp->disconn_ind) | ||
751 | reason = hp->disconn_ind(conn); | ||
752 | |||
753 | return reason; | ||
754 | } | 727 | } |
755 | 728 | ||
756 | static inline void hci_proto_disconn_cfm(struct hci_conn *conn, __u8 reason) | 729 | static inline void hci_proto_disconn_cfm(struct hci_conn *conn, __u8 reason) |
757 | { | 730 | { |
758 | register struct hci_proto *hp; | 731 | switch (conn->type) { |
732 | case ACL_LINK: | ||
733 | case LE_LINK: | ||
734 | l2cap_disconn_cfm(conn, reason); | ||
735 | break; | ||
759 | 736 | ||
760 | hp = hci_proto[HCI_PROTO_L2CAP]; | 737 | case SCO_LINK: |
761 | if (hp && hp->disconn_cfm) | 738 | case ESCO_LINK: |
762 | hp->disconn_cfm(conn, reason); | 739 | sco_disconn_cfm(conn, reason); |
740 | break; | ||
763 | 741 | ||
764 | hp = hci_proto[HCI_PROTO_SCO]; | 742 | default: |
765 | if (hp && hp->disconn_cfm) | 743 | BT_ERR("unknown link type %d", conn->type); |
766 | hp->disconn_cfm(conn, reason); | 744 | break; |
745 | } | ||
767 | 746 | ||
768 | if (conn->disconn_cfm_cb) | 747 | if (conn->disconn_cfm_cb) |
769 | conn->disconn_cfm_cb(conn, reason); | 748 | conn->disconn_cfm_cb(conn, reason); |
@@ -771,21 +750,16 @@ static inline void hci_proto_disconn_cfm(struct hci_conn *conn, __u8 reason) | |||
771 | 750 | ||
772 | static inline void hci_proto_auth_cfm(struct hci_conn *conn, __u8 status) | 751 | static inline void hci_proto_auth_cfm(struct hci_conn *conn, __u8 status) |
773 | { | 752 | { |
774 | register struct hci_proto *hp; | ||
775 | __u8 encrypt; | 753 | __u8 encrypt; |
776 | 754 | ||
755 | if (conn->type != ACL_LINK && conn->type != LE_LINK) | ||
756 | return; | ||
757 | |||
777 | if (test_bit(HCI_CONN_ENCRYPT_PEND, &conn->pend)) | 758 | if (test_bit(HCI_CONN_ENCRYPT_PEND, &conn->pend)) |
778 | return; | 759 | return; |
779 | 760 | ||
780 | encrypt = (conn->link_mode & HCI_LM_ENCRYPT) ? 0x01 : 0x00; | 761 | encrypt = (conn->link_mode & HCI_LM_ENCRYPT) ? 0x01 : 0x00; |
781 | 762 | l2cap_security_cfm(conn, status, encrypt); | |
782 | hp = hci_proto[HCI_PROTO_L2CAP]; | ||
783 | if (hp && hp->security_cfm) | ||
784 | hp->security_cfm(conn, status, encrypt); | ||
785 | |||
786 | hp = hci_proto[HCI_PROTO_SCO]; | ||
787 | if (hp && hp->security_cfm) | ||
788 | hp->security_cfm(conn, status, encrypt); | ||
789 | 763 | ||
790 | if (conn->security_cfm_cb) | 764 | if (conn->security_cfm_cb) |
791 | conn->security_cfm_cb(conn, status); | 765 | conn->security_cfm_cb(conn, status); |
@@ -794,23 +768,15 @@ static inline void hci_proto_auth_cfm(struct hci_conn *conn, __u8 status) | |||
794 | static inline void hci_proto_encrypt_cfm(struct hci_conn *conn, __u8 status, | 768 | static inline void hci_proto_encrypt_cfm(struct hci_conn *conn, __u8 status, |
795 | __u8 encrypt) | 769 | __u8 encrypt) |
796 | { | 770 | { |
797 | register struct hci_proto *hp; | 771 | if (conn->type != ACL_LINK && conn->type != LE_LINK) |
798 | 772 | return; | |
799 | hp = hci_proto[HCI_PROTO_L2CAP]; | ||
800 | if (hp && hp->security_cfm) | ||
801 | hp->security_cfm(conn, status, encrypt); | ||
802 | 773 | ||
803 | hp = hci_proto[HCI_PROTO_SCO]; | 774 | l2cap_security_cfm(conn, status, encrypt); |
804 | if (hp && hp->security_cfm) | ||
805 | hp->security_cfm(conn, status, encrypt); | ||
806 | 775 | ||
807 | if (conn->security_cfm_cb) | 776 | if (conn->security_cfm_cb) |
808 | conn->security_cfm_cb(conn, status); | 777 | conn->security_cfm_cb(conn, status); |
809 | } | 778 | } |
810 | 779 | ||
811 | int hci_register_proto(struct hci_proto *hproto); | ||
812 | int hci_unregister_proto(struct hci_proto *hproto); | ||
813 | |||
814 | /* ----- HCI callbacks ----- */ | 780 | /* ----- HCI callbacks ----- */ |
815 | struct hci_cb { | 781 | struct hci_cb { |
816 | struct list_head list; | 782 | struct list_head list; |
@@ -835,13 +801,13 @@ static inline void hci_auth_cfm(struct hci_conn *conn, __u8 status) | |||
835 | 801 | ||
836 | encrypt = (conn->link_mode & HCI_LM_ENCRYPT) ? 0x01 : 0x00; | 802 | encrypt = (conn->link_mode & HCI_LM_ENCRYPT) ? 0x01 : 0x00; |
837 | 803 | ||
838 | read_lock_bh(&hci_cb_list_lock); | 804 | read_lock(&hci_cb_list_lock); |
839 | list_for_each(p, &hci_cb_list) { | 805 | list_for_each(p, &hci_cb_list) { |
840 | struct hci_cb *cb = list_entry(p, struct hci_cb, list); | 806 | struct hci_cb *cb = list_entry(p, struct hci_cb, list); |
841 | if (cb->security_cfm) | 807 | if (cb->security_cfm) |
842 | cb->security_cfm(conn, status, encrypt); | 808 | cb->security_cfm(conn, status, encrypt); |
843 | } | 809 | } |
844 | read_unlock_bh(&hci_cb_list_lock); | 810 | read_unlock(&hci_cb_list_lock); |
845 | } | 811 | } |
846 | 812 | ||
847 | static inline void hci_encrypt_cfm(struct hci_conn *conn, __u8 status, | 813 | static inline void hci_encrypt_cfm(struct hci_conn *conn, __u8 status, |
@@ -857,26 +823,26 @@ static inline void hci_encrypt_cfm(struct hci_conn *conn, __u8 status, | |||
857 | 823 | ||
858 | hci_proto_encrypt_cfm(conn, status, encrypt); | 824 | hci_proto_encrypt_cfm(conn, status, encrypt); |
859 | 825 | ||
860 | read_lock_bh(&hci_cb_list_lock); | 826 | read_lock(&hci_cb_list_lock); |
861 | list_for_each(p, &hci_cb_list) { | 827 | list_for_each(p, &hci_cb_list) { |
862 | struct hci_cb *cb = list_entry(p, struct hci_cb, list); | 828 | struct hci_cb *cb = list_entry(p, struct hci_cb, list); |
863 | if (cb->security_cfm) | 829 | if (cb->security_cfm) |
864 | cb->security_cfm(conn, status, encrypt); | 830 | cb->security_cfm(conn, status, encrypt); |
865 | } | 831 | } |
866 | read_unlock_bh(&hci_cb_list_lock); | 832 | read_unlock(&hci_cb_list_lock); |
867 | } | 833 | } |
868 | 834 | ||
869 | static inline void hci_key_change_cfm(struct hci_conn *conn, __u8 status) | 835 | static inline void hci_key_change_cfm(struct hci_conn *conn, __u8 status) |
870 | { | 836 | { |
871 | struct list_head *p; | 837 | struct list_head *p; |
872 | 838 | ||
873 | read_lock_bh(&hci_cb_list_lock); | 839 | read_lock(&hci_cb_list_lock); |
874 | list_for_each(p, &hci_cb_list) { | 840 | list_for_each(p, &hci_cb_list) { |
875 | struct hci_cb *cb = list_entry(p, struct hci_cb, list); | 841 | struct hci_cb *cb = list_entry(p, struct hci_cb, list); |
876 | if (cb->key_change_cfm) | 842 | if (cb->key_change_cfm) |
877 | cb->key_change_cfm(conn, status); | 843 | cb->key_change_cfm(conn, status); |
878 | } | 844 | } |
879 | read_unlock_bh(&hci_cb_list_lock); | 845 | read_unlock(&hci_cb_list_lock); |
880 | } | 846 | } |
881 | 847 | ||
882 | static inline void hci_role_switch_cfm(struct hci_conn *conn, __u8 status, | 848 | static inline void hci_role_switch_cfm(struct hci_conn *conn, __u8 status, |
@@ -884,13 +850,13 @@ static inline void hci_role_switch_cfm(struct hci_conn *conn, __u8 status, | |||
884 | { | 850 | { |
885 | struct list_head *p; | 851 | struct list_head *p; |
886 | 852 | ||
887 | read_lock_bh(&hci_cb_list_lock); | 853 | read_lock(&hci_cb_list_lock); |
888 | list_for_each(p, &hci_cb_list) { | 854 | list_for_each(p, &hci_cb_list) { |
889 | struct hci_cb *cb = list_entry(p, struct hci_cb, list); | 855 | struct hci_cb *cb = list_entry(p, struct hci_cb, list); |
890 | if (cb->role_switch_cfm) | 856 | if (cb->role_switch_cfm) |
891 | cb->role_switch_cfm(conn, status, role); | 857 | cb->role_switch_cfm(conn, status, role); |
892 | } | 858 | } |
893 | read_unlock_bh(&hci_cb_list_lock); | 859 | read_unlock(&hci_cb_list_lock); |
894 | } | 860 | } |
895 | 861 | ||
896 | int hci_register_cb(struct hci_cb *hcb); | 862 | int hci_register_cb(struct hci_cb *hcb); |
@@ -960,12 +926,16 @@ int mgmt_device_unblocked(struct hci_dev *hdev, bdaddr_t *bdaddr); | |||
960 | /* HCI info for socket */ | 926 | /* HCI info for socket */ |
961 | #define hci_pi(sk) ((struct hci_pinfo *) sk) | 927 | #define hci_pi(sk) ((struct hci_pinfo *) sk) |
962 | 928 | ||
929 | /* HCI socket flags */ | ||
930 | #define HCI_PI_MGMT_INIT 0 | ||
931 | |||
963 | struct hci_pinfo { | 932 | struct hci_pinfo { |
964 | struct bt_sock bt; | 933 | struct bt_sock bt; |
965 | struct hci_dev *hdev; | 934 | struct hci_dev *hdev; |
966 | struct hci_filter filter; | 935 | struct hci_filter filter; |
967 | __u32 cmsg_mask; | 936 | __u32 cmsg_mask; |
968 | unsigned short channel; | 937 | unsigned short channel; |
938 | unsigned long flags; | ||
969 | }; | 939 | }; |
970 | 940 | ||
971 | /* HCI security filter */ | 941 | /* HCI security filter */ |
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h index 72632f155e43..68f589150692 100644 --- a/include/net/bluetooth/l2cap.h +++ b/include/net/bluetooth/l2cap.h | |||
@@ -482,10 +482,11 @@ struct l2cap_chan { | |||
482 | __u32 remote_acc_lat; | 482 | __u32 remote_acc_lat; |
483 | __u32 remote_flush_to; | 483 | __u32 remote_flush_to; |
484 | 484 | ||
485 | struct timer_list chan_timer; | 485 | struct delayed_work chan_timer; |
486 | struct timer_list retrans_timer; | 486 | struct delayed_work retrans_timer; |
487 | struct timer_list monitor_timer; | 487 | struct delayed_work monitor_timer; |
488 | struct timer_list ack_timer; | 488 | struct delayed_work ack_timer; |
489 | |||
489 | struct sk_buff *tx_send_head; | 490 | struct sk_buff *tx_send_head; |
490 | struct sk_buff_head tx_q; | 491 | struct sk_buff_head tx_q; |
491 | struct sk_buff_head srej_q; | 492 | struct sk_buff_head srej_q; |
@@ -521,7 +522,7 @@ struct l2cap_conn { | |||
521 | __u8 info_state; | 522 | __u8 info_state; |
522 | __u8 info_ident; | 523 | __u8 info_ident; |
523 | 524 | ||
524 | struct timer_list info_timer; | 525 | struct delayed_work info_timer; |
525 | 526 | ||
526 | spinlock_t lock; | 527 | spinlock_t lock; |
527 | 528 | ||
@@ -531,11 +532,11 @@ struct l2cap_conn { | |||
531 | 532 | ||
532 | __u8 disc_reason; | 533 | __u8 disc_reason; |
533 | 534 | ||
534 | struct timer_list security_timer; | 535 | struct delayed_work security_timer; |
535 | struct smp_chan *smp_chan; | 536 | struct smp_chan *smp_chan; |
536 | 537 | ||
537 | struct list_head chan_l; | 538 | struct list_head chan_l; |
538 | rwlock_t chan_lock; | 539 | struct mutex chan_lock; |
539 | }; | 540 | }; |
540 | 541 | ||
541 | #define L2CAP_INFO_CL_MTU_REQ_SENT 0x01 | 542 | #define L2CAP_INFO_CL_MTU_REQ_SENT 0x01 |
@@ -594,6 +595,34 @@ enum { | |||
594 | FLAG_EFS_ENABLE, | 595 | FLAG_EFS_ENABLE, |
595 | }; | 596 | }; |
596 | 597 | ||
598 | static inline void l2cap_chan_hold(struct l2cap_chan *c) | ||
599 | { | ||
600 | atomic_inc(&c->refcnt); | ||
601 | } | ||
602 | |||
603 | static inline void l2cap_chan_put(struct l2cap_chan *c) | ||
604 | { | ||
605 | if (atomic_dec_and_test(&c->refcnt)) | ||
606 | kfree(c); | ||
607 | } | ||
608 | |||
609 | static inline void l2cap_set_timer(struct l2cap_chan *chan, | ||
610 | struct delayed_work *work, long timeout) | ||
611 | { | ||
612 | BT_DBG("chan %p state %d timeout %ld", chan, chan->state, timeout); | ||
613 | |||
614 | if (!__cancel_delayed_work(work)) | ||
615 | l2cap_chan_hold(chan); | ||
616 | schedule_delayed_work(work, timeout); | ||
617 | } | ||
618 | |||
619 | static inline void l2cap_clear_timer(struct l2cap_chan *chan, | ||
620 | struct delayed_work *work) | ||
621 | { | ||
622 | if (__cancel_delayed_work(work)) | ||
623 | l2cap_chan_put(chan); | ||
624 | } | ||
625 | |||
597 | #define __set_chan_timer(c, t) l2cap_set_timer(c, &c->chan_timer, (t)) | 626 | #define __set_chan_timer(c, t) l2cap_set_timer(c, &c->chan_timer, (t)) |
598 | #define __clear_chan_timer(c) l2cap_clear_timer(c, &c->chan_timer) | 627 | #define __clear_chan_timer(c) l2cap_clear_timer(c, &c->chan_timer) |
599 | #define __set_retrans_timer(c) l2cap_set_timer(c, &c->retrans_timer, \ | 628 | #define __set_retrans_timer(c) l2cap_set_timer(c, &c->retrans_timer, \ |
@@ -805,7 +834,8 @@ int l2cap_add_scid(struct l2cap_chan *chan, __u16 scid); | |||
805 | struct l2cap_chan *l2cap_chan_create(struct sock *sk); | 834 | struct l2cap_chan *l2cap_chan_create(struct sock *sk); |
806 | void l2cap_chan_close(struct l2cap_chan *chan, int reason); | 835 | void l2cap_chan_close(struct l2cap_chan *chan, int reason); |
807 | void l2cap_chan_destroy(struct l2cap_chan *chan); | 836 | void l2cap_chan_destroy(struct l2cap_chan *chan); |
808 | int l2cap_chan_connect(struct l2cap_chan *chan); | 837 | inline int l2cap_chan_connect(struct l2cap_chan *chan, __le16 psm, u16 cid, |
838 | bdaddr_t *dst); | ||
809 | int l2cap_chan_send(struct l2cap_chan *chan, struct msghdr *msg, size_t len, | 839 | int l2cap_chan_send(struct l2cap_chan *chan, struct msghdr *msg, size_t len, |
810 | u32 priority); | 840 | u32 priority); |
811 | void l2cap_chan_busy(struct l2cap_chan *chan, int busy); | 841 | void l2cap_chan_busy(struct l2cap_chan *chan, int busy); |
diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h index 3b6880690a78..be65d3417883 100644 --- a/include/net/bluetooth/mgmt.h +++ b/include/net/bluetooth/mgmt.h | |||
@@ -61,22 +61,29 @@ struct mgmt_rp_read_index_list { | |||
61 | /* Reserve one extra byte for names in management messages so that they | 61 | /* Reserve one extra byte for names in management messages so that they |
62 | * are always guaranteed to be nul-terminated */ | 62 | * are always guaranteed to be nul-terminated */ |
63 | #define MGMT_MAX_NAME_LENGTH (HCI_MAX_NAME_LENGTH + 1) | 63 | #define MGMT_MAX_NAME_LENGTH (HCI_MAX_NAME_LENGTH + 1) |
64 | #define MGMT_MAX_SHORT_NAME_LENGTH (10 + 1) | ||
65 | |||
66 | #define MGMT_SETTING_POWERED 0x00000001 | ||
67 | #define MGMT_SETTING_CONNECTABLE 0x00000002 | ||
68 | #define MGMT_SETTING_FAST_CONNECTABLE 0x00000004 | ||
69 | #define MGMT_SETTING_DISCOVERABLE 0x00000008 | ||
70 | #define MGMT_SETTING_PAIRABLE 0x00000010 | ||
71 | #define MGMT_SETTING_LINK_SECURITY 0x00000020 | ||
72 | #define MGMT_SETTING_SSP 0x00000040 | ||
73 | #define MGMT_SETTING_BREDR 0x00000080 | ||
74 | #define MGMT_SETTING_HS 0x00000100 | ||
75 | #define MGMT_SETTING_LE 0x00000200 | ||
64 | 76 | ||
65 | #define MGMT_OP_READ_INFO 0x0004 | 77 | #define MGMT_OP_READ_INFO 0x0004 |
66 | struct mgmt_rp_read_info { | 78 | struct mgmt_rp_read_info { |
67 | __u8 type; | ||
68 | __u8 powered; | ||
69 | __u8 connectable; | ||
70 | __u8 discoverable; | ||
71 | __u8 pairable; | ||
72 | __u8 sec_mode; | ||
73 | bdaddr_t bdaddr; | 79 | bdaddr_t bdaddr; |
80 | __u8 version; | ||
81 | __le16 manufacturer; | ||
82 | __le32 supported_settings; | ||
83 | __le32 current_settings; | ||
74 | __u8 dev_class[3]; | 84 | __u8 dev_class[3]; |
75 | __u8 features[8]; | ||
76 | __u16 manufacturer; | ||
77 | __u8 hci_ver; | ||
78 | __u16 hci_rev; | ||
79 | __u8 name[MGMT_MAX_NAME_LENGTH]; | 85 | __u8 name[MGMT_MAX_NAME_LENGTH]; |
86 | __u8 short_name[MGMT_MAX_SHORT_NAME_LENGTH]; | ||
80 | } __packed; | 87 | } __packed; |
81 | 88 | ||
82 | struct mgmt_mode { | 89 | struct mgmt_mode { |
@@ -93,28 +100,38 @@ struct mgmt_cp_set_discoverable { | |||
93 | 100 | ||
94 | #define MGMT_OP_SET_CONNECTABLE 0x0007 | 101 | #define MGMT_OP_SET_CONNECTABLE 0x0007 |
95 | 102 | ||
96 | #define MGMT_OP_SET_PAIRABLE 0x0008 | 103 | #define MGMT_OP_SET_FAST_CONNECTABLE 0x0008 |
97 | 104 | ||
98 | #define MGMT_OP_ADD_UUID 0x0009 | 105 | #define MGMT_OP_SET_PAIRABLE 0x0009 |
99 | struct mgmt_cp_add_uuid { | ||
100 | __u8 uuid[16]; | ||
101 | __u8 svc_hint; | ||
102 | } __packed; | ||
103 | 106 | ||
104 | #define MGMT_OP_REMOVE_UUID 0x000A | 107 | #define MGMT_OP_SET_LINK_SECURITY 0x000A |
105 | struct mgmt_cp_remove_uuid { | ||
106 | __u8 uuid[16]; | ||
107 | } __packed; | ||
108 | 108 | ||
109 | #define MGMT_OP_SET_DEV_CLASS 0x000B | 109 | #define MGMT_OP_SET_SSP 0x000B |
110 | |||
111 | #define MGMT_OP_SET_HS 0x000C | ||
112 | |||
113 | #define MGMT_OP_SET_LE 0x000D | ||
114 | |||
115 | #define MGMT_OP_SET_DEV_CLASS 0x000E | ||
110 | struct mgmt_cp_set_dev_class { | 116 | struct mgmt_cp_set_dev_class { |
111 | __u8 major; | 117 | __u8 major; |
112 | __u8 minor; | 118 | __u8 minor; |
113 | } __packed; | 119 | } __packed; |
114 | 120 | ||
115 | #define MGMT_OP_SET_SERVICE_CACHE 0x000C | 121 | #define MGMT_OP_SET_LOCAL_NAME 0x000F |
116 | struct mgmt_cp_set_service_cache { | 122 | struct mgmt_cp_set_local_name { |
117 | __u8 enable; | 123 | __u8 name[MGMT_MAX_NAME_LENGTH]; |
124 | } __packed; | ||
125 | |||
126 | #define MGMT_OP_ADD_UUID 0x0010 | ||
127 | struct mgmt_cp_add_uuid { | ||
128 | __u8 uuid[16]; | ||
129 | __u8 svc_hint; | ||
130 | } __packed; | ||
131 | |||
132 | #define MGMT_OP_REMOVE_UUID 0x0011 | ||
133 | struct mgmt_cp_remove_uuid { | ||
134 | __u8 uuid[16]; | ||
118 | } __packed; | 135 | } __packed; |
119 | 136 | ||
120 | struct mgmt_link_key_info { | 137 | struct mgmt_link_key_info { |
@@ -124,14 +141,14 @@ struct mgmt_link_key_info { | |||
124 | u8 pin_len; | 141 | u8 pin_len; |
125 | } __packed; | 142 | } __packed; |
126 | 143 | ||
127 | #define MGMT_OP_LOAD_LINK_KEYS 0x000D | 144 | #define MGMT_OP_LOAD_LINK_KEYS 0x0012 |
128 | struct mgmt_cp_load_link_keys { | 145 | struct mgmt_cp_load_link_keys { |
129 | __u8 debug_keys; | 146 | __u8 debug_keys; |
130 | __le16 key_count; | 147 | __le16 key_count; |
131 | struct mgmt_link_key_info keys[0]; | 148 | struct mgmt_link_key_info keys[0]; |
132 | } __packed; | 149 | } __packed; |
133 | 150 | ||
134 | #define MGMT_OP_REMOVE_KEYS 0x000E | 151 | #define MGMT_OP_REMOVE_KEYS 0x0013 |
135 | struct mgmt_cp_remove_keys { | 152 | struct mgmt_cp_remove_keys { |
136 | bdaddr_t bdaddr; | 153 | bdaddr_t bdaddr; |
137 | __u8 disconnect; | 154 | __u8 disconnect; |
@@ -141,7 +158,7 @@ struct mgmt_rp_remove_keys { | |||
141 | __u8 status; | 158 | __u8 status; |
142 | }; | 159 | }; |
143 | 160 | ||
144 | #define MGMT_OP_DISCONNECT 0x000F | 161 | #define MGMT_OP_DISCONNECT 0x0014 |
145 | struct mgmt_cp_disconnect { | 162 | struct mgmt_cp_disconnect { |
146 | bdaddr_t bdaddr; | 163 | bdaddr_t bdaddr; |
147 | } __packed; | 164 | } __packed; |
@@ -160,13 +177,13 @@ struct mgmt_addr_info { | |||
160 | __u8 type; | 177 | __u8 type; |
161 | } __packed; | 178 | } __packed; |
162 | 179 | ||
163 | #define MGMT_OP_GET_CONNECTIONS 0x0010 | 180 | #define MGMT_OP_GET_CONNECTIONS 0x0015 |
164 | struct mgmt_rp_get_connections { | 181 | struct mgmt_rp_get_connections { |
165 | __le16 conn_count; | 182 | __le16 conn_count; |
166 | struct mgmt_addr_info addr[0]; | 183 | struct mgmt_addr_info addr[0]; |
167 | } __packed; | 184 | } __packed; |
168 | 185 | ||
169 | #define MGMT_OP_PIN_CODE_REPLY 0x0011 | 186 | #define MGMT_OP_PIN_CODE_REPLY 0x0016 |
170 | struct mgmt_cp_pin_code_reply { | 187 | struct mgmt_cp_pin_code_reply { |
171 | bdaddr_t bdaddr; | 188 | bdaddr_t bdaddr; |
172 | __u8 pin_len; | 189 | __u8 pin_len; |
@@ -177,17 +194,17 @@ struct mgmt_rp_pin_code_reply { | |||
177 | uint8_t status; | 194 | uint8_t status; |
178 | } __packed; | 195 | } __packed; |
179 | 196 | ||
180 | #define MGMT_OP_PIN_CODE_NEG_REPLY 0x0012 | 197 | #define MGMT_OP_PIN_CODE_NEG_REPLY 0x0017 |
181 | struct mgmt_cp_pin_code_neg_reply { | 198 | struct mgmt_cp_pin_code_neg_reply { |
182 | bdaddr_t bdaddr; | 199 | bdaddr_t bdaddr; |
183 | } __packed; | 200 | } __packed; |
184 | 201 | ||
185 | #define MGMT_OP_SET_IO_CAPABILITY 0x0013 | 202 | #define MGMT_OP_SET_IO_CAPABILITY 0x0018 |
186 | struct mgmt_cp_set_io_capability { | 203 | struct mgmt_cp_set_io_capability { |
187 | __u8 io_capability; | 204 | __u8 io_capability; |
188 | } __packed; | 205 | } __packed; |
189 | 206 | ||
190 | #define MGMT_OP_PAIR_DEVICE 0x0014 | 207 | #define MGMT_OP_PAIR_DEVICE 0x0019 |
191 | struct mgmt_cp_pair_device { | 208 | struct mgmt_cp_pair_device { |
192 | struct mgmt_addr_info addr; | 209 | struct mgmt_addr_info addr; |
193 | __u8 io_cap; | 210 | __u8 io_cap; |
@@ -197,7 +214,7 @@ struct mgmt_rp_pair_device { | |||
197 | __u8 status; | 214 | __u8 status; |
198 | } __packed; | 215 | } __packed; |
199 | 216 | ||
200 | #define MGMT_OP_USER_CONFIRM_REPLY 0x0015 | 217 | #define MGMT_OP_USER_CONFIRM_REPLY 0x001A |
201 | struct mgmt_cp_user_confirm_reply { | 218 | struct mgmt_cp_user_confirm_reply { |
202 | bdaddr_t bdaddr; | 219 | bdaddr_t bdaddr; |
203 | } __packed; | 220 | } __packed; |
@@ -206,61 +223,68 @@ struct mgmt_rp_user_confirm_reply { | |||
206 | __u8 status; | 223 | __u8 status; |
207 | } __packed; | 224 | } __packed; |
208 | 225 | ||
209 | #define MGMT_OP_USER_CONFIRM_NEG_REPLY 0x0016 | 226 | #define MGMT_OP_USER_CONFIRM_NEG_REPLY 0x001B |
227 | struct mgmt_cp_user_confirm_neg_reply { | ||
228 | bdaddr_t bdaddr; | ||
229 | } __packed; | ||
210 | 230 | ||
211 | #define MGMT_OP_SET_LOCAL_NAME 0x0017 | 231 | #define MGMT_OP_USER_PASSKEY_REPLY 0x001C |
212 | struct mgmt_cp_set_local_name { | 232 | struct mgmt_cp_user_passkey_reply { |
213 | __u8 name[MGMT_MAX_NAME_LENGTH]; | 233 | bdaddr_t bdaddr; |
234 | __le32 passkey; | ||
235 | } __packed; | ||
236 | struct mgmt_rp_user_passkey_reply { | ||
237 | bdaddr_t bdaddr; | ||
238 | __u8 status; | ||
214 | } __packed; | 239 | } __packed; |
215 | 240 | ||
216 | #define MGMT_OP_READ_LOCAL_OOB_DATA 0x0018 | 241 | #define MGMT_OP_USER_PASSKEY_NEG_REPLY 0x001D |
242 | struct mgmt_cp_user_passkey_neg_reply { | ||
243 | bdaddr_t bdaddr; | ||
244 | } __packed; | ||
245 | |||
246 | #define MGMT_OP_READ_LOCAL_OOB_DATA 0x001E | ||
217 | struct mgmt_rp_read_local_oob_data { | 247 | struct mgmt_rp_read_local_oob_data { |
218 | __u8 hash[16]; | 248 | __u8 hash[16]; |
219 | __u8 randomizer[16]; | 249 | __u8 randomizer[16]; |
220 | } __packed; | 250 | } __packed; |
221 | 251 | ||
222 | #define MGMT_OP_ADD_REMOTE_OOB_DATA 0x0019 | 252 | #define MGMT_OP_ADD_REMOTE_OOB_DATA 0x001F |
223 | struct mgmt_cp_add_remote_oob_data { | 253 | struct mgmt_cp_add_remote_oob_data { |
224 | bdaddr_t bdaddr; | 254 | bdaddr_t bdaddr; |
225 | __u8 hash[16]; | 255 | __u8 hash[16]; |
226 | __u8 randomizer[16]; | 256 | __u8 randomizer[16]; |
227 | } __packed; | 257 | } __packed; |
228 | 258 | ||
229 | #define MGMT_OP_REMOVE_REMOTE_OOB_DATA 0x001A | 259 | #define MGMT_OP_REMOVE_REMOTE_OOB_DATA 0x0020 |
230 | struct mgmt_cp_remove_remote_oob_data { | 260 | struct mgmt_cp_remove_remote_oob_data { |
231 | bdaddr_t bdaddr; | 261 | bdaddr_t bdaddr; |
232 | } __packed; | 262 | } __packed; |
233 | 263 | ||
234 | #define MGMT_OP_START_DISCOVERY 0x001B | 264 | #define MGMT_OP_START_DISCOVERY 0x0021 |
235 | struct mgmt_cp_start_discovery { | 265 | struct mgmt_cp_start_discovery { |
236 | __u8 type; | 266 | __u8 type; |
237 | } __packed; | 267 | } __packed; |
238 | 268 | ||
239 | #define MGMT_OP_STOP_DISCOVERY 0x001C | 269 | #define MGMT_OP_STOP_DISCOVERY 0x0022 |
240 | 270 | ||
241 | #define MGMT_OP_BLOCK_DEVICE 0x001D | 271 | #define MGMT_OP_CONFIRM_NAME 0x0023 |
242 | struct mgmt_cp_block_device { | 272 | struct mgmt_cp_confirm_name { |
243 | bdaddr_t bdaddr; | 273 | bdaddr_t bdaddr; |
274 | __u8 name_known; | ||
244 | } __packed; | 275 | } __packed; |
245 | 276 | struct mgmt_rp_confirm_name { | |
246 | #define MGMT_OP_UNBLOCK_DEVICE 0x001E | ||
247 | struct mgmt_cp_unblock_device { | ||
248 | bdaddr_t bdaddr; | 277 | bdaddr_t bdaddr; |
278 | __u8 status; | ||
249 | } __packed; | 279 | } __packed; |
250 | 280 | ||
251 | #define MGMT_OP_SET_FAST_CONNECTABLE 0x001F | 281 | #define MGMT_OP_BLOCK_DEVICE 0x0024 |
252 | struct mgmt_cp_set_fast_connectable { | 282 | struct mgmt_cp_block_device { |
253 | __u8 enable; | ||
254 | } __packed; | ||
255 | |||
256 | #define MGMT_OP_USER_PASSKEY_REPLY 0x0020 | ||
257 | struct mgmt_cp_user_passkey_reply { | ||
258 | bdaddr_t bdaddr; | 283 | bdaddr_t bdaddr; |
259 | __le32 passkey; | ||
260 | } __packed; | 284 | } __packed; |
261 | 285 | ||
262 | #define MGMT_OP_USER_PASSKEY_NEG_REPLY 0x0021 | 286 | #define MGMT_OP_UNBLOCK_DEVICE 0x0025 |
263 | struct mgmt_cp_user_passkey_neg_reply { | 287 | struct mgmt_cp_unblock_device { |
264 | bdaddr_t bdaddr; | 288 | bdaddr_t bdaddr; |
265 | } __packed; | 289 | } __packed; |
266 | 290 | ||
@@ -285,81 +309,82 @@ struct mgmt_ev_controller_error { | |||
285 | 309 | ||
286 | #define MGMT_EV_INDEX_REMOVED 0x0005 | 310 | #define MGMT_EV_INDEX_REMOVED 0x0005 |
287 | 311 | ||
288 | #define MGMT_EV_POWERED 0x0006 | 312 | #define MGMT_EV_NEW_SETTINGS 0x0006 |
289 | 313 | ||
290 | #define MGMT_EV_DISCOVERABLE 0x0007 | 314 | #define MGMT_EV_CLASS_OF_DEV_CHANGED 0x0007 |
291 | 315 | struct mgmt_ev_class_of_dev_changed { | |
292 | #define MGMT_EV_CONNECTABLE 0x0008 | 316 | __u8 dev_class[3]; |
317 | }; | ||
293 | 318 | ||
294 | #define MGMT_EV_PAIRABLE 0x0009 | 319 | #define MGMT_EV_LOCAL_NAME_CHANGED 0x0008 |
320 | struct mgmt_ev_local_name_changed { | ||
321 | __u8 name[MGMT_MAX_NAME_LENGTH]; | ||
322 | __u8 short_name[MGMT_MAX_SHORT_NAME_LENGTH]; | ||
323 | } __packed; | ||
295 | 324 | ||
296 | #define MGMT_EV_NEW_LINK_KEY 0x000A | 325 | #define MGMT_EV_NEW_LINK_KEY 0x0009 |
297 | struct mgmt_ev_new_link_key { | 326 | struct mgmt_ev_new_link_key { |
298 | __u8 store_hint; | 327 | __u8 store_hint; |
299 | struct mgmt_link_key_info key; | 328 | struct mgmt_link_key_info key; |
300 | } __packed; | 329 | } __packed; |
301 | 330 | ||
302 | #define MGMT_EV_CONNECTED 0x000B | 331 | #define MGMT_EV_CONNECTED 0x000A |
303 | 332 | ||
304 | #define MGMT_EV_DISCONNECTED 0x000C | 333 | #define MGMT_EV_DISCONNECTED 0x000B |
305 | 334 | ||
306 | #define MGMT_EV_CONNECT_FAILED 0x000D | 335 | #define MGMT_EV_CONNECT_FAILED 0x000C |
307 | struct mgmt_ev_connect_failed { | 336 | struct mgmt_ev_connect_failed { |
308 | struct mgmt_addr_info addr; | 337 | struct mgmt_addr_info addr; |
309 | __u8 status; | 338 | __u8 status; |
310 | } __packed; | 339 | } __packed; |
311 | 340 | ||
312 | #define MGMT_EV_PIN_CODE_REQUEST 0x000E | 341 | #define MGMT_EV_PIN_CODE_REQUEST 0x000D |
313 | struct mgmt_ev_pin_code_request { | 342 | struct mgmt_ev_pin_code_request { |
314 | bdaddr_t bdaddr; | 343 | bdaddr_t bdaddr; |
315 | __u8 secure; | 344 | __u8 secure; |
316 | } __packed; | 345 | } __packed; |
317 | 346 | ||
318 | #define MGMT_EV_USER_CONFIRM_REQUEST 0x000F | 347 | #define MGMT_EV_USER_CONFIRM_REQUEST 0x000E |
319 | struct mgmt_ev_user_confirm_request { | 348 | struct mgmt_ev_user_confirm_request { |
320 | bdaddr_t bdaddr; | 349 | bdaddr_t bdaddr; |
321 | __u8 confirm_hint; | 350 | __u8 confirm_hint; |
322 | __le32 value; | 351 | __le32 value; |
323 | } __packed; | 352 | } __packed; |
324 | 353 | ||
354 | #define MGMT_EV_USER_PASSKEY_REQUEST 0x000F | ||
355 | struct mgmt_ev_user_passkey_request { | ||
356 | bdaddr_t bdaddr; | ||
357 | } __packed; | ||
358 | |||
325 | #define MGMT_EV_AUTH_FAILED 0x0010 | 359 | #define MGMT_EV_AUTH_FAILED 0x0010 |
326 | struct mgmt_ev_auth_failed { | 360 | struct mgmt_ev_auth_failed { |
327 | bdaddr_t bdaddr; | 361 | bdaddr_t bdaddr; |
328 | __u8 status; | 362 | __u8 status; |
329 | } __packed; | 363 | } __packed; |
330 | 364 | ||
331 | #define MGMT_EV_LOCAL_NAME_CHANGED 0x0011 | 365 | #define MGMT_EV_DEVICE_FOUND 0x0011 |
332 | struct mgmt_ev_local_name_changed { | ||
333 | __u8 name[MGMT_MAX_NAME_LENGTH]; | ||
334 | } __packed; | ||
335 | |||
336 | #define MGMT_EV_DEVICE_FOUND 0x0012 | ||
337 | struct mgmt_ev_device_found { | 366 | struct mgmt_ev_device_found { |
338 | struct mgmt_addr_info addr; | 367 | struct mgmt_addr_info addr; |
339 | __u8 dev_class[3]; | 368 | __u8 dev_class[3]; |
340 | __s8 rssi; | 369 | __s8 rssi; |
370 | __u8 confirm_name; | ||
341 | __u8 eir[HCI_MAX_EIR_LENGTH]; | 371 | __u8 eir[HCI_MAX_EIR_LENGTH]; |
342 | } __packed; | 372 | } __packed; |
343 | 373 | ||
344 | #define MGMT_EV_REMOTE_NAME 0x0013 | 374 | #define MGMT_EV_REMOTE_NAME 0x0012 |
345 | struct mgmt_ev_remote_name { | 375 | struct mgmt_ev_remote_name { |
346 | bdaddr_t bdaddr; | 376 | bdaddr_t bdaddr; |
347 | __u8 name[MGMT_MAX_NAME_LENGTH]; | 377 | __u8 name[MGMT_MAX_NAME_LENGTH]; |
348 | } __packed; | 378 | } __packed; |
349 | 379 | ||
350 | #define MGMT_EV_DISCOVERING 0x0014 | 380 | #define MGMT_EV_DISCOVERING 0x0013 |
351 | 381 | ||
352 | #define MGMT_EV_DEVICE_BLOCKED 0x0015 | 382 | #define MGMT_EV_DEVICE_BLOCKED 0x0014 |
353 | struct mgmt_ev_device_blocked { | 383 | struct mgmt_ev_device_blocked { |
354 | bdaddr_t bdaddr; | 384 | bdaddr_t bdaddr; |
355 | } __packed; | 385 | } __packed; |
356 | 386 | ||
357 | #define MGMT_EV_DEVICE_UNBLOCKED 0x0016 | 387 | #define MGMT_EV_DEVICE_UNBLOCKED 0x0015 |
358 | struct mgmt_ev_device_unblocked { | 388 | struct mgmt_ev_device_unblocked { |
359 | bdaddr_t bdaddr; | 389 | bdaddr_t bdaddr; |
360 | } __packed; | 390 | } __packed; |
361 | |||
362 | #define MGMT_EV_USER_PASSKEY_REQUEST 0x0017 | ||
363 | struct mgmt_ev_user_passkey_request { | ||
364 | bdaddr_t bdaddr; | ||
365 | } __packed; | ||
diff --git a/include/net/bluetooth/smp.h b/include/net/bluetooth/smp.h index 15b97d549441..aeaf5fa2b9f1 100644 --- a/include/net/bluetooth/smp.h +++ b/include/net/bluetooth/smp.h | |||
@@ -115,6 +115,10 @@ struct smp_cmd_security_req { | |||
115 | #define SMP_MIN_ENC_KEY_SIZE 7 | 115 | #define SMP_MIN_ENC_KEY_SIZE 7 |
116 | #define SMP_MAX_ENC_KEY_SIZE 16 | 116 | #define SMP_MAX_ENC_KEY_SIZE 16 |
117 | 117 | ||
118 | #define SMP_FLAG_TK_VALID 1 | ||
119 | #define SMP_FLAG_CFM_PENDING 2 | ||
120 | #define SMP_FLAG_MITM_AUTH 3 | ||
121 | |||
118 | struct smp_chan { | 122 | struct smp_chan { |
119 | struct l2cap_conn *conn; | 123 | struct l2cap_conn *conn; |
120 | u8 preq[7]; /* SMP Pairing Request */ | 124 | u8 preq[7]; /* SMP Pairing Request */ |
@@ -124,6 +128,7 @@ struct smp_chan { | |||
124 | u8 pcnf[16]; /* SMP Pairing Confirm */ | 128 | u8 pcnf[16]; /* SMP Pairing Confirm */ |
125 | u8 tk[16]; /* SMP Temporary Key */ | 129 | u8 tk[16]; /* SMP Temporary Key */ |
126 | u8 smp_key_size; | 130 | u8 smp_key_size; |
131 | unsigned long smp_flags; | ||
127 | struct crypto_blkcipher *tfm; | 132 | struct crypto_blkcipher *tfm; |
128 | struct work_struct confirm; | 133 | struct work_struct confirm; |
129 | struct work_struct random; | 134 | struct work_struct random; |
@@ -134,6 +139,7 @@ struct smp_chan { | |||
134 | int smp_conn_security(struct l2cap_conn *conn, __u8 sec_level); | 139 | int smp_conn_security(struct l2cap_conn *conn, __u8 sec_level); |
135 | int smp_sig_channel(struct l2cap_conn *conn, struct sk_buff *skb); | 140 | int smp_sig_channel(struct l2cap_conn *conn, struct sk_buff *skb); |
136 | int smp_distribute_keys(struct l2cap_conn *conn, __u8 force); | 141 | int smp_distribute_keys(struct l2cap_conn *conn, __u8 force); |
142 | int smp_user_confirm_reply(struct hci_conn *conn, u16 mgmt_op, __le32 passkey); | ||
137 | 143 | ||
138 | void smp_chan_destroy(struct l2cap_conn *conn); | 144 | void smp_chan_destroy(struct l2cap_conn *conn); |
139 | 145 | ||
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 9f85fca0b676..15f4be7d768e 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h | |||
@@ -505,6 +505,7 @@ struct station_parameters { | |||
505 | * @STATION_INFO_CONNECTED_TIME: @connected_time filled | 505 | * @STATION_INFO_CONNECTED_TIME: @connected_time filled |
506 | * @STATION_INFO_ASSOC_REQ_IES: @assoc_req_ies filled | 506 | * @STATION_INFO_ASSOC_REQ_IES: @assoc_req_ies filled |
507 | * @STATION_INFO_STA_FLAGS: @sta_flags filled | 507 | * @STATION_INFO_STA_FLAGS: @sta_flags filled |
508 | * @STATION_INFO_BEACON_LOSS_COUNT: @beacon_loss_count filled | ||
508 | */ | 509 | */ |
509 | enum station_info_flags { | 510 | enum station_info_flags { |
510 | STATION_INFO_INACTIVE_TIME = 1<<0, | 511 | STATION_INFO_INACTIVE_TIME = 1<<0, |
@@ -525,7 +526,8 @@ enum station_info_flags { | |||
525 | STATION_INFO_BSS_PARAM = 1<<15, | 526 | STATION_INFO_BSS_PARAM = 1<<15, |
526 | STATION_INFO_CONNECTED_TIME = 1<<16, | 527 | STATION_INFO_CONNECTED_TIME = 1<<16, |
527 | STATION_INFO_ASSOC_REQ_IES = 1<<17, | 528 | STATION_INFO_ASSOC_REQ_IES = 1<<17, |
528 | STATION_INFO_STA_FLAGS = 1<<18 | 529 | STATION_INFO_STA_FLAGS = 1<<18, |
530 | STATION_INFO_BEACON_LOSS_COUNT = 1<<19 | ||
529 | }; | 531 | }; |
530 | 532 | ||
531 | /** | 533 | /** |
@@ -623,6 +625,7 @@ struct sta_bss_parameters { | |||
623 | * the cfg80211_new_sta() calls to notify user space of the IEs. | 625 | * the cfg80211_new_sta() calls to notify user space of the IEs. |
624 | * @assoc_req_ies_len: Length of assoc_req_ies buffer in octets. | 626 | * @assoc_req_ies_len: Length of assoc_req_ies buffer in octets. |
625 | * @sta_flags: station flags mask & values | 627 | * @sta_flags: station flags mask & values |
628 | * @beacon_loss_count: Number of times beacon loss event has triggered. | ||
626 | */ | 629 | */ |
627 | struct station_info { | 630 | struct station_info { |
628 | u32 filled; | 631 | u32 filled; |
@@ -650,6 +653,8 @@ struct station_info { | |||
650 | const u8 *assoc_req_ies; | 653 | const u8 *assoc_req_ies; |
651 | size_t assoc_req_ies_len; | 654 | size_t assoc_req_ies_len; |
652 | 655 | ||
656 | u32 beacon_loss_count; | ||
657 | |||
653 | /* | 658 | /* |
654 | * Note: Add a new enum station_info_flags value for each new field and | 659 | * Note: Add a new enum station_info_flags value for each new field and |
655 | * use it to check which fields are initialized. | 660 | * use it to check which fields are initialized. |
diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 5b5c8a7e26d7..2a7523edd9b5 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h | |||
@@ -3502,9 +3502,12 @@ void ieee80211_send_bar(struct ieee80211_vif *vif, u8 *ra, u16 tid, u16 ssn); | |||
3502 | * | 3502 | * |
3503 | * @IEEE80211_RC_HT_CHANGED: The HT parameters of the operating channel have | 3503 | * @IEEE80211_RC_HT_CHANGED: The HT parameters of the operating channel have |
3504 | * changed, rate control algorithm can update its internal state if needed. | 3504 | * changed, rate control algorithm can update its internal state if needed. |
3505 | * @IEEE80211_RC_SMPS_CHANGED: The SMPS state of the station changed, the rate | ||
3506 | * control algorithm needs to adjust accordingly. | ||
3505 | */ | 3507 | */ |
3506 | enum rate_control_changed { | 3508 | enum rate_control_changed { |
3507 | IEEE80211_RC_HT_CHANGED = BIT(0) | 3509 | IEEE80211_RC_HT_CHANGED = BIT(0), |
3510 | IEEE80211_RC_SMPS_CHANGED = BIT(1), | ||
3508 | }; | 3511 | }; |
3509 | 3512 | ||
3510 | /** | 3513 | /** |