diff options
author | John W. Linville <linville@tuxdriver.com> | 2011-12-19 14:28:22 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-12-19 14:28:22 -0500 |
commit | 9662cbc712babe3f7a792af2bdd47fa0c631f27f (patch) | |
tree | 9a19f5656fb83ab58a4a3773b12ed1036bf8753b /include/net | |
parent | 640f5950a7d9fd0d279d843b261eb934793605fb (diff) | |
parent | 4b0b2f088f12e2ada1297502d7bebde182cf65b0 (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/padovan/bluetooth-next
Diffstat (limited to 'include/net')
-rw-r--r-- | include/net/bluetooth/hci.h | 9 | ||||
-rw-r--r-- | include/net/bluetooth/hci_core.h | 118 | ||||
-rw-r--r-- | include/net/bluetooth/l2cap.h | 24 | ||||
-rw-r--r-- | include/net/bluetooth/mgmt.h | 191 |
4 files changed, 187 insertions, 155 deletions
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index 67ad98430348..2e48d326e365 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 |
@@ -745,6 +746,14 @@ struct hci_rp_read_bd_addr { | |||
745 | bdaddr_t bdaddr; | 746 | bdaddr_t bdaddr; |
746 | } __packed; | 747 | } __packed; |
747 | 748 | ||
749 | #define HCI_OP_READ_DATA_BLOCK_SIZE 0x100a | ||
750 | struct hci_rp_read_data_block_size { | ||
751 | __u8 status; | ||
752 | __le16 max_acl_len; | ||
753 | __le16 block_len; | ||
754 | __le16 num_blocks; | ||
755 | } __packed; | ||
756 | |||
748 | #define HCI_OP_WRITE_PAGE_SCAN_ACTIVITY 0x0c1c | 757 | #define HCI_OP_WRITE_PAGE_SCAN_ACTIVITY 0x0c1c |
749 | struct hci_cp_write_page_scan_activity { | 758 | struct hci_cp_write_page_scan_activity { |
750 | __le16 interval; | 759 | __le16 interval; |
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index ea4395f1d260..25c161ab6803 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h | |||
@@ -61,18 +61,11 @@ struct inquiry_cache { | |||
61 | 61 | ||
62 | struct hci_conn_hash { | 62 | struct hci_conn_hash { |
63 | struct list_head list; | 63 | struct list_head list; |
64 | spinlock_t lock; | ||
65 | unsigned int acl_num; | 64 | unsigned int acl_num; |
66 | unsigned int sco_num; | 65 | unsigned int sco_num; |
67 | unsigned int le_num; | 66 | unsigned int le_num; |
68 | }; | 67 | }; |
69 | 68 | ||
70 | struct hci_chan_hash { | ||
71 | struct list_head list; | ||
72 | spinlock_t lock; | ||
73 | unsigned int num; | ||
74 | }; | ||
75 | |||
76 | struct bdaddr_list { | 69 | struct bdaddr_list { |
77 | struct list_head list; | 70 | struct list_head list; |
78 | bdaddr_t bdaddr; | 71 | bdaddr_t bdaddr; |
@@ -124,7 +117,7 @@ struct adv_entry { | |||
124 | #define NUM_REASSEMBLY 4 | 117 | #define NUM_REASSEMBLY 4 |
125 | struct hci_dev { | 118 | struct hci_dev { |
126 | struct list_head list; | 119 | struct list_head list; |
127 | spinlock_t lock; | 120 | struct mutex lock; |
128 | atomic_t refcnt; | 121 | atomic_t refcnt; |
129 | 122 | ||
130 | char name[8]; | 123 | char name[8]; |
@@ -188,6 +181,11 @@ struct hci_dev { | |||
188 | unsigned int sco_pkts; | 181 | unsigned int sco_pkts; |
189 | unsigned int le_pkts; | 182 | unsigned int le_pkts; |
190 | 183 | ||
184 | __u16 block_len; | ||
185 | __u16 block_mtu; | ||
186 | __u16 num_blocks; | ||
187 | __u16 block_cnt; | ||
188 | |||
191 | unsigned long acl_last_tx; | 189 | unsigned long acl_last_tx; |
192 | unsigned long sco_last_tx; | 190 | unsigned long sco_last_tx; |
193 | unsigned long le_last_tx; | 191 | unsigned long le_last_tx; |
@@ -200,10 +198,13 @@ struct hci_dev { | |||
200 | __u16 discov_timeout; | 198 | __u16 discov_timeout; |
201 | struct delayed_work discov_off; | 199 | struct delayed_work discov_off; |
202 | 200 | ||
201 | struct delayed_work service_cache; | ||
202 | |||
203 | struct timer_list cmd_timer; | 203 | struct timer_list cmd_timer; |
204 | struct tasklet_struct cmd_task; | 204 | |
205 | struct tasklet_struct rx_task; | 205 | struct work_struct rx_work; |
206 | struct tasklet_struct tx_task; | 206 | struct work_struct cmd_work; |
207 | struct work_struct tx_work; | ||
207 | 208 | ||
208 | struct sk_buff_head rx_q; | 209 | struct sk_buff_head rx_q; |
209 | struct sk_buff_head raw_q; | 210 | struct sk_buff_head raw_q; |
@@ -232,7 +233,7 @@ struct hci_dev { | |||
232 | struct list_head remote_oob_data; | 233 | struct list_head remote_oob_data; |
233 | 234 | ||
234 | struct list_head adv_entries; | 235 | struct list_head adv_entries; |
235 | struct timer_list adv_timer; | 236 | struct delayed_work adv_work; |
236 | 237 | ||
237 | struct hci_dev_stats stat; | 238 | struct hci_dev_stats stat; |
238 | 239 | ||
@@ -301,15 +302,12 @@ struct hci_conn { | |||
301 | unsigned int sent; | 302 | unsigned int sent; |
302 | 303 | ||
303 | struct sk_buff_head data_q; | 304 | struct sk_buff_head data_q; |
304 | struct hci_chan_hash chan_hash; | 305 | struct list_head chan_list; |
305 | 306 | ||
306 | struct timer_list disc_timer; | 307 | struct delayed_work disc_work; |
307 | struct timer_list idle_timer; | 308 | struct timer_list idle_timer; |
308 | struct timer_list auto_accept_timer; | 309 | struct timer_list auto_accept_timer; |
309 | 310 | ||
310 | struct work_struct work_add; | ||
311 | struct work_struct work_del; | ||
312 | |||
313 | struct device dev; | 311 | struct device dev; |
314 | atomic_t devref; | 312 | atomic_t devref; |
315 | 313 | ||
@@ -390,15 +388,15 @@ static inline void hci_conn_hash_init(struct hci_dev *hdev) | |||
390 | { | 388 | { |
391 | struct hci_conn_hash *h = &hdev->conn_hash; | 389 | struct hci_conn_hash *h = &hdev->conn_hash; |
392 | INIT_LIST_HEAD(&h->list); | 390 | INIT_LIST_HEAD(&h->list); |
393 | spin_lock_init(&h->lock); | ||
394 | h->acl_num = 0; | 391 | h->acl_num = 0; |
395 | h->sco_num = 0; | 392 | h->sco_num = 0; |
393 | h->le_num = 0; | ||
396 | } | 394 | } |
397 | 395 | ||
398 | static inline void hci_conn_hash_add(struct hci_dev *hdev, struct hci_conn *c) | 396 | static inline void hci_conn_hash_add(struct hci_dev *hdev, struct hci_conn *c) |
399 | { | 397 | { |
400 | struct hci_conn_hash *h = &hdev->conn_hash; | 398 | struct hci_conn_hash *h = &hdev->conn_hash; |
401 | list_add(&c->list, &h->list); | 399 | list_add_rcu(&c->list, &h->list); |
402 | switch (c->type) { | 400 | switch (c->type) { |
403 | case ACL_LINK: | 401 | case ACL_LINK: |
404 | h->acl_num++; | 402 | h->acl_num++; |
@@ -416,7 +414,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) | 414 | static inline void hci_conn_hash_del(struct hci_dev *hdev, struct hci_conn *c) |
417 | { | 415 | { |
418 | struct hci_conn_hash *h = &hdev->conn_hash; | 416 | struct hci_conn_hash *h = &hdev->conn_hash; |
419 | list_del(&c->list); | 417 | |
418 | list_del_rcu(&c->list); | ||
419 | synchronize_rcu(); | ||
420 | |||
420 | switch (c->type) { | 421 | switch (c->type) { |
421 | case ACL_LINK: | 422 | case ACL_LINK: |
422 | h->acl_num--; | 423 | h->acl_num--; |
@@ -451,14 +452,18 @@ static inline struct hci_conn *hci_conn_hash_lookup_handle(struct hci_dev *hdev, | |||
451 | __u16 handle) | 452 | __u16 handle) |
452 | { | 453 | { |
453 | struct hci_conn_hash *h = &hdev->conn_hash; | 454 | struct hci_conn_hash *h = &hdev->conn_hash; |
454 | struct list_head *p; | ||
455 | struct hci_conn *c; | 455 | struct hci_conn *c; |
456 | 456 | ||
457 | list_for_each(p, &h->list) { | 457 | rcu_read_lock(); |
458 | c = list_entry(p, struct hci_conn, list); | 458 | |
459 | if (c->handle == handle) | 459 | list_for_each_entry_rcu(c, &h->list, list) { |
460 | if (c->handle == handle) { | ||
461 | rcu_read_unlock(); | ||
460 | return c; | 462 | return c; |
463 | } | ||
461 | } | 464 | } |
465 | rcu_read_unlock(); | ||
466 | |||
462 | return NULL; | 467 | return NULL; |
463 | } | 468 | } |
464 | 469 | ||
@@ -466,14 +471,19 @@ static inline struct hci_conn *hci_conn_hash_lookup_ba(struct hci_dev *hdev, | |||
466 | __u8 type, bdaddr_t *ba) | 471 | __u8 type, bdaddr_t *ba) |
467 | { | 472 | { |
468 | struct hci_conn_hash *h = &hdev->conn_hash; | 473 | struct hci_conn_hash *h = &hdev->conn_hash; |
469 | struct list_head *p; | ||
470 | struct hci_conn *c; | 474 | struct hci_conn *c; |
471 | 475 | ||
472 | list_for_each(p, &h->list) { | 476 | rcu_read_lock(); |
473 | c = list_entry(p, struct hci_conn, list); | 477 | |
474 | if (c->type == type && !bacmp(&c->dst, ba)) | 478 | list_for_each_entry_rcu(c, &h->list, list) { |
479 | if (c->type == type && !bacmp(&c->dst, ba)) { | ||
480 | rcu_read_unlock(); | ||
475 | return c; | 481 | return c; |
482 | } | ||
476 | } | 483 | } |
484 | |||
485 | rcu_read_unlock(); | ||
486 | |||
477 | return NULL; | 487 | return NULL; |
478 | } | 488 | } |
479 | 489 | ||
@@ -481,37 +491,20 @@ static inline struct hci_conn *hci_conn_hash_lookup_state(struct hci_dev *hdev, | |||
481 | __u8 type, __u16 state) | 491 | __u8 type, __u16 state) |
482 | { | 492 | { |
483 | struct hci_conn_hash *h = &hdev->conn_hash; | 493 | struct hci_conn_hash *h = &hdev->conn_hash; |
484 | struct list_head *p; | ||
485 | struct hci_conn *c; | 494 | struct hci_conn *c; |
486 | 495 | ||
487 | list_for_each(p, &h->list) { | 496 | rcu_read_lock(); |
488 | c = list_entry(p, struct hci_conn, list); | 497 | |
489 | if (c->type == type && c->state == state) | 498 | list_for_each_entry_rcu(c, &h->list, list) { |
499 | if (c->type == type && c->state == state) { | ||
500 | rcu_read_unlock(); | ||
490 | return c; | 501 | return c; |
502 | } | ||
491 | } | 503 | } |
492 | return NULL; | ||
493 | } | ||
494 | |||
495 | static inline void hci_chan_hash_init(struct hci_conn *c) | ||
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 | 504 | ||
503 | static inline void hci_chan_hash_add(struct hci_conn *c, struct hci_chan *chan) | 505 | rcu_read_unlock(); |
504 | { | ||
505 | struct hci_chan_hash *h = &c->chan_hash; | ||
506 | list_add(&chan->list, &h->list); | ||
507 | h->num++; | ||
508 | } | ||
509 | 506 | ||
510 | static inline void hci_chan_hash_del(struct hci_conn *c, struct hci_chan *chan) | 507 | return NULL; |
511 | { | ||
512 | struct hci_chan_hash *h = &c->chan_hash; | ||
513 | list_del(&chan->list); | ||
514 | h->num--; | ||
515 | } | 508 | } |
516 | 509 | ||
517 | void hci_acl_connect(struct hci_conn *conn); | 510 | void hci_acl_connect(struct hci_conn *conn); |
@@ -527,7 +520,7 @@ void hci_conn_check_pending(struct hci_dev *hdev); | |||
527 | 520 | ||
528 | struct hci_chan *hci_chan_create(struct hci_conn *conn); | 521 | struct hci_chan *hci_chan_create(struct hci_conn *conn); |
529 | int hci_chan_del(struct hci_chan *chan); | 522 | int hci_chan_del(struct hci_chan *chan); |
530 | void hci_chan_hash_flush(struct hci_conn *conn); | 523 | void hci_chan_list_flush(struct hci_conn *conn); |
531 | 524 | ||
532 | struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst, | 525 | struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst, |
533 | __u8 sec_level, __u8 auth_type); | 526 | __u8 sec_level, __u8 auth_type); |
@@ -538,7 +531,6 @@ int hci_conn_change_link_key(struct hci_conn *conn); | |||
538 | int hci_conn_switch_role(struct hci_conn *conn, __u8 role); | 531 | int hci_conn_switch_role(struct hci_conn *conn, __u8 role); |
539 | 532 | ||
540 | void hci_conn_enter_active_mode(struct hci_conn *conn, __u8 force_active); | 533 | 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 | 534 | ||
543 | void hci_conn_hold_device(struct hci_conn *conn); | 535 | void hci_conn_hold_device(struct hci_conn *conn); |
544 | void hci_conn_put_device(struct hci_conn *conn); | 536 | void hci_conn_put_device(struct hci_conn *conn); |
@@ -546,7 +538,7 @@ void hci_conn_put_device(struct hci_conn *conn); | |||
546 | static inline void hci_conn_hold(struct hci_conn *conn) | 538 | static inline void hci_conn_hold(struct hci_conn *conn) |
547 | { | 539 | { |
548 | atomic_inc(&conn->refcnt); | 540 | atomic_inc(&conn->refcnt); |
549 | del_timer(&conn->disc_timer); | 541 | cancel_delayed_work_sync(&conn->disc_work); |
550 | } | 542 | } |
551 | 543 | ||
552 | static inline void hci_conn_put(struct hci_conn *conn) | 544 | static inline void hci_conn_put(struct hci_conn *conn) |
@@ -565,7 +557,9 @@ static inline void hci_conn_put(struct hci_conn *conn) | |||
565 | } else { | 557 | } else { |
566 | timeo = msecs_to_jiffies(10); | 558 | timeo = msecs_to_jiffies(10); |
567 | } | 559 | } |
568 | mod_timer(&conn->disc_timer, jiffies + timeo); | 560 | cancel_delayed_work_sync(&conn->disc_work); |
561 | queue_delayed_work(conn->hdev->workqueue, | ||
562 | &conn->disc_work, jiffies + timeo); | ||
569 | } | 563 | } |
570 | } | 564 | } |
571 | 565 | ||
@@ -597,10 +591,8 @@ static inline struct hci_dev *__hci_dev_hold(struct hci_dev *d) | |||
597 | try_module_get(d->owner) ? __hci_dev_hold(d) : NULL; \ | 591 | try_module_get(d->owner) ? __hci_dev_hold(d) : NULL; \ |
598 | }) | 592 | }) |
599 | 593 | ||
600 | #define hci_dev_lock(d) spin_lock(&d->lock) | 594 | #define hci_dev_lock(d) mutex_lock(&d->lock) |
601 | #define hci_dev_unlock(d) spin_unlock(&d->lock) | 595 | #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 | 596 | ||
605 | struct hci_dev *hci_dev_get(int index); | 597 | struct hci_dev *hci_dev_get(int index); |
606 | struct hci_dev *hci_get_route(bdaddr_t *src, bdaddr_t *dst); | 598 | struct hci_dev *hci_get_route(bdaddr_t *src, bdaddr_t *dst); |
@@ -960,12 +952,16 @@ int mgmt_device_unblocked(struct hci_dev *hdev, bdaddr_t *bdaddr); | |||
960 | /* HCI info for socket */ | 952 | /* HCI info for socket */ |
961 | #define hci_pi(sk) ((struct hci_pinfo *) sk) | 953 | #define hci_pi(sk) ((struct hci_pinfo *) sk) |
962 | 954 | ||
955 | /* HCI socket flags */ | ||
956 | #define HCI_PI_MGMT_INIT 0 | ||
957 | |||
963 | struct hci_pinfo { | 958 | struct hci_pinfo { |
964 | struct bt_sock bt; | 959 | struct bt_sock bt; |
965 | struct hci_dev *hdev; | 960 | struct hci_dev *hdev; |
966 | struct hci_filter filter; | 961 | struct hci_filter filter; |
967 | __u32 cmsg_mask; | 962 | __u32 cmsg_mask; |
968 | unsigned short channel; | 963 | unsigned short channel; |
964 | unsigned long flags; | ||
969 | }; | 965 | }; |
970 | 966 | ||
971 | /* HCI security filter */ | 967 | /* HCI security filter */ |
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h index 30719eb2e77c..c0d168adf9be 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_work; |
525 | 526 | ||
526 | spinlock_t lock; | 527 | spinlock_t lock; |
527 | 528 | ||
@@ -535,7 +536,7 @@ struct l2cap_conn { | |||
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 |
@@ -595,16 +596,16 @@ enum { | |||
595 | }; | 596 | }; |
596 | 597 | ||
597 | #define __set_chan_timer(c, t) l2cap_set_timer(c, &c->chan_timer, (t)) | 598 | #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) | 599 | #define __clear_chan_timer(c) l2cap_clear_timer(&c->chan_timer) |
599 | #define __set_retrans_timer(c) l2cap_set_timer(c, &c->retrans_timer, \ | 600 | #define __set_retrans_timer(c) l2cap_set_timer(c, &c->retrans_timer, \ |
600 | L2CAP_DEFAULT_RETRANS_TO); | 601 | L2CAP_DEFAULT_RETRANS_TO); |
601 | #define __clear_retrans_timer(c) l2cap_clear_timer(c, &c->retrans_timer) | 602 | #define __clear_retrans_timer(c) l2cap_clear_timer(&c->retrans_timer) |
602 | #define __set_monitor_timer(c) l2cap_set_timer(c, &c->monitor_timer, \ | 603 | #define __set_monitor_timer(c) l2cap_set_timer(c, &c->monitor_timer, \ |
603 | L2CAP_DEFAULT_MONITOR_TO); | 604 | L2CAP_DEFAULT_MONITOR_TO); |
604 | #define __clear_monitor_timer(c) l2cap_clear_timer(c, &c->monitor_timer) | 605 | #define __clear_monitor_timer(c) l2cap_clear_timer(&c->monitor_timer) |
605 | #define __set_ack_timer(c) l2cap_set_timer(c, &chan->ack_timer, \ | 606 | #define __set_ack_timer(c) l2cap_set_timer(c, &chan->ack_timer, \ |
606 | L2CAP_DEFAULT_ACK_TO); | 607 | L2CAP_DEFAULT_ACK_TO); |
607 | #define __clear_ack_timer(c) l2cap_clear_timer(c, &c->ack_timer) | 608 | #define __clear_ack_timer(c) l2cap_clear_timer(&c->ack_timer) |
608 | 609 | ||
609 | static inline int __seq_offset(struct l2cap_chan *chan, __u16 seq1, __u16 seq2) | 610 | static inline int __seq_offset(struct l2cap_chan *chan, __u16 seq1, __u16 seq2) |
610 | { | 611 | { |
@@ -805,7 +806,8 @@ int l2cap_add_scid(struct l2cap_chan *chan, __u16 scid); | |||
805 | struct l2cap_chan *l2cap_chan_create(struct sock *sk); | 806 | struct l2cap_chan *l2cap_chan_create(struct sock *sk); |
806 | void l2cap_chan_close(struct l2cap_chan *chan, int reason); | 807 | void l2cap_chan_close(struct l2cap_chan *chan, int reason); |
807 | void l2cap_chan_destroy(struct l2cap_chan *chan); | 808 | void l2cap_chan_destroy(struct l2cap_chan *chan); |
808 | int l2cap_chan_connect(struct l2cap_chan *chan); | 809 | inline int l2cap_chan_connect(struct l2cap_chan *chan, __le16 psm, u16 cid, |
810 | bdaddr_t *dst); | ||
809 | int l2cap_chan_send(struct l2cap_chan *chan, struct msghdr *msg, size_t len, | 811 | int l2cap_chan_send(struct l2cap_chan *chan, struct msghdr *msg, size_t len, |
810 | u32 priority); | 812 | u32 priority); |
811 | void l2cap_chan_busy(struct l2cap_chan *chan, int busy); | 813 | 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; | ||