diff options
-rw-r--r-- | net/bluetooth/hci_core.c | 103 |
1 files changed, 53 insertions, 50 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 411ace8e647b..d0a960dabd53 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c | |||
@@ -124,8 +124,9 @@ static void hci_req_cancel(struct hci_dev *hdev, int err) | |||
124 | } | 124 | } |
125 | 125 | ||
126 | /* Execute request and wait for completion. */ | 126 | /* Execute request and wait for completion. */ |
127 | static int __hci_request(struct hci_dev *hdev, void (*req)(struct hci_dev *hdev, unsigned long opt), | 127 | static int __hci_request(struct hci_dev *hdev, |
128 | unsigned long opt, __u32 timeout) | 128 | void (*req)(struct hci_dev *hdev, unsigned long opt), |
129 | unsigned long opt, __u32 timeout) | ||
129 | { | 130 | { |
130 | DECLARE_WAITQUEUE(wait, current); | 131 | DECLARE_WAITQUEUE(wait, current); |
131 | int err = 0; | 132 | int err = 0; |
@@ -417,7 +418,8 @@ static void inquiry_cache_flush(struct hci_dev *hdev) | |||
417 | INIT_LIST_HEAD(&cache->resolve); | 418 | INIT_LIST_HEAD(&cache->resolve); |
418 | } | 419 | } |
419 | 420 | ||
420 | struct inquiry_entry *hci_inquiry_cache_lookup(struct hci_dev *hdev, bdaddr_t *bdaddr) | 421 | struct inquiry_entry *hci_inquiry_cache_lookup(struct hci_dev *hdev, |
422 | bdaddr_t *bdaddr) | ||
421 | { | 423 | { |
422 | struct discovery_state *cache = &hdev->discovery; | 424 | struct discovery_state *cache = &hdev->discovery; |
423 | struct inquiry_entry *e; | 425 | struct inquiry_entry *e; |
@@ -478,7 +480,7 @@ void hci_inquiry_cache_update_resolve(struct hci_dev *hdev, | |||
478 | 480 | ||
479 | list_for_each_entry(p, &cache->resolve, list) { | 481 | list_for_each_entry(p, &cache->resolve, list) { |
480 | if (p->name_state != NAME_PENDING && | 482 | if (p->name_state != NAME_PENDING && |
481 | abs(p->data.rssi) >= abs(ie->data.rssi)) | 483 | abs(p->data.rssi) >= abs(ie->data.rssi)) |
482 | break; | 484 | break; |
483 | pos = &p->list; | 485 | pos = &p->list; |
484 | } | 486 | } |
@@ -503,7 +505,7 @@ bool hci_inquiry_cache_update(struct hci_dev *hdev, struct inquiry_data *data, | |||
503 | *ssp = true; | 505 | *ssp = true; |
504 | 506 | ||
505 | if (ie->name_state == NAME_NEEDED && | 507 | if (ie->name_state == NAME_NEEDED && |
506 | data->rssi != ie->data.rssi) { | 508 | data->rssi != ie->data.rssi) { |
507 | ie->data.rssi = data->rssi; | 509 | ie->data.rssi = data->rssi; |
508 | hci_inquiry_cache_update_resolve(hdev, ie); | 510 | hci_inquiry_cache_update_resolve(hdev, ie); |
509 | } | 511 | } |
@@ -527,7 +529,7 @@ bool hci_inquiry_cache_update(struct hci_dev *hdev, struct inquiry_data *data, | |||
527 | 529 | ||
528 | update: | 530 | update: |
529 | if (name_known && ie->name_state != NAME_KNOWN && | 531 | if (name_known && ie->name_state != NAME_KNOWN && |
530 | ie->name_state != NAME_PENDING) { | 532 | ie->name_state != NAME_PENDING) { |
531 | ie->name_state = NAME_KNOWN; | 533 | ie->name_state = NAME_KNOWN; |
532 | list_del(&ie->list); | 534 | list_del(&ie->list); |
533 | } | 535 | } |
@@ -605,8 +607,7 @@ int hci_inquiry(void __user *arg) | |||
605 | 607 | ||
606 | hci_dev_lock(hdev); | 608 | hci_dev_lock(hdev); |
607 | if (inquiry_cache_age(hdev) > INQUIRY_CACHE_AGE_MAX || | 609 | if (inquiry_cache_age(hdev) > INQUIRY_CACHE_AGE_MAX || |
608 | inquiry_cache_empty(hdev) || | 610 | inquiry_cache_empty(hdev) || ir.flags & IREQ_CACHE_FLUSH) { |
609 | ir.flags & IREQ_CACHE_FLUSH) { | ||
610 | inquiry_cache_flush(hdev); | 611 | inquiry_cache_flush(hdev); |
611 | do_inquiry = 1; | 612 | do_inquiry = 1; |
612 | } | 613 | } |
@@ -641,7 +642,7 @@ int hci_inquiry(void __user *arg) | |||
641 | if (!copy_to_user(ptr, &ir, sizeof(ir))) { | 642 | if (!copy_to_user(ptr, &ir, sizeof(ir))) { |
642 | ptr += sizeof(ir); | 643 | ptr += sizeof(ir); |
643 | if (copy_to_user(ptr, buf, sizeof(struct inquiry_info) * | 644 | if (copy_to_user(ptr, buf, sizeof(struct inquiry_info) * |
644 | ir.num_rsp)) | 645 | ir.num_rsp)) |
645 | err = -EFAULT; | 646 | err = -EFAULT; |
646 | } else | 647 | } else |
647 | err = -EFAULT; | 648 | err = -EFAULT; |
@@ -702,11 +703,11 @@ int hci_dev_open(__u16 dev) | |||
702 | hdev->init_last_cmd = 0; | 703 | hdev->init_last_cmd = 0; |
703 | 704 | ||
704 | ret = __hci_request(hdev, hci_init_req, 0, | 705 | ret = __hci_request(hdev, hci_init_req, 0, |
705 | msecs_to_jiffies(HCI_INIT_TIMEOUT)); | 706 | msecs_to_jiffies(HCI_INIT_TIMEOUT)); |
706 | 707 | ||
707 | if (lmp_host_le_capable(hdev)) | 708 | if (lmp_host_le_capable(hdev)) |
708 | ret = __hci_request(hdev, hci_le_init_req, 0, | 709 | ret = __hci_request(hdev, hci_le_init_req, 0, |
709 | msecs_to_jiffies(HCI_INIT_TIMEOUT)); | 710 | msecs_to_jiffies(HCI_INIT_TIMEOUT)); |
710 | 711 | ||
711 | clear_bit(HCI_INIT, &hdev->flags); | 712 | clear_bit(HCI_INIT, &hdev->flags); |
712 | } | 713 | } |
@@ -791,10 +792,10 @@ static int hci_dev_do_close(struct hci_dev *hdev) | |||
791 | skb_queue_purge(&hdev->cmd_q); | 792 | skb_queue_purge(&hdev->cmd_q); |
792 | atomic_set(&hdev->cmd_cnt, 1); | 793 | atomic_set(&hdev->cmd_cnt, 1); |
793 | if (!test_bit(HCI_RAW, &hdev->flags) && | 794 | if (!test_bit(HCI_RAW, &hdev->flags) && |
794 | test_bit(HCI_QUIRK_NO_RESET, &hdev->quirks)) { | 795 | test_bit(HCI_QUIRK_NO_RESET, &hdev->quirks)) { |
795 | set_bit(HCI_INIT, &hdev->flags); | 796 | set_bit(HCI_INIT, &hdev->flags); |
796 | __hci_request(hdev, hci_reset_req, 0, | 797 | __hci_request(hdev, hci_reset_req, 0, |
797 | msecs_to_jiffies(250)); | 798 | msecs_to_jiffies(250)); |
798 | clear_bit(HCI_INIT, &hdev->flags); | 799 | clear_bit(HCI_INIT, &hdev->flags); |
799 | } | 800 | } |
800 | 801 | ||
@@ -884,7 +885,7 @@ int hci_dev_reset(__u16 dev) | |||
884 | 885 | ||
885 | if (!test_bit(HCI_RAW, &hdev->flags)) | 886 | if (!test_bit(HCI_RAW, &hdev->flags)) |
886 | ret = __hci_request(hdev, hci_reset_req, 0, | 887 | ret = __hci_request(hdev, hci_reset_req, 0, |
887 | msecs_to_jiffies(HCI_INIT_TIMEOUT)); | 888 | msecs_to_jiffies(HCI_INIT_TIMEOUT)); |
888 | 889 | ||
889 | done: | 890 | done: |
890 | hci_req_unlock(hdev); | 891 | hci_req_unlock(hdev); |
@@ -924,7 +925,7 @@ int hci_dev_cmd(unsigned int cmd, void __user *arg) | |||
924 | switch (cmd) { | 925 | switch (cmd) { |
925 | case HCISETAUTH: | 926 | case HCISETAUTH: |
926 | err = hci_request(hdev, hci_auth_req, dr.dev_opt, | 927 | err = hci_request(hdev, hci_auth_req, dr.dev_opt, |
927 | msecs_to_jiffies(HCI_INIT_TIMEOUT)); | 928 | msecs_to_jiffies(HCI_INIT_TIMEOUT)); |
928 | break; | 929 | break; |
929 | 930 | ||
930 | case HCISETENCRYPT: | 931 | case HCISETENCRYPT: |
@@ -936,23 +937,23 @@ int hci_dev_cmd(unsigned int cmd, void __user *arg) | |||
936 | if (!test_bit(HCI_AUTH, &hdev->flags)) { | 937 | if (!test_bit(HCI_AUTH, &hdev->flags)) { |
937 | /* Auth must be enabled first */ | 938 | /* Auth must be enabled first */ |
938 | err = hci_request(hdev, hci_auth_req, dr.dev_opt, | 939 | err = hci_request(hdev, hci_auth_req, dr.dev_opt, |
939 | msecs_to_jiffies(HCI_INIT_TIMEOUT)); | 940 | msecs_to_jiffies(HCI_INIT_TIMEOUT)); |
940 | if (err) | 941 | if (err) |
941 | break; | 942 | break; |
942 | } | 943 | } |
943 | 944 | ||
944 | err = hci_request(hdev, hci_encrypt_req, dr.dev_opt, | 945 | err = hci_request(hdev, hci_encrypt_req, dr.dev_opt, |
945 | msecs_to_jiffies(HCI_INIT_TIMEOUT)); | 946 | msecs_to_jiffies(HCI_INIT_TIMEOUT)); |
946 | break; | 947 | break; |
947 | 948 | ||
948 | case HCISETSCAN: | 949 | case HCISETSCAN: |
949 | err = hci_request(hdev, hci_scan_req, dr.dev_opt, | 950 | err = hci_request(hdev, hci_scan_req, dr.dev_opt, |
950 | msecs_to_jiffies(HCI_INIT_TIMEOUT)); | 951 | msecs_to_jiffies(HCI_INIT_TIMEOUT)); |
951 | break; | 952 | break; |
952 | 953 | ||
953 | case HCISETLINKPOL: | 954 | case HCISETLINKPOL: |
954 | err = hci_request(hdev, hci_linkpol_req, dr.dev_opt, | 955 | err = hci_request(hdev, hci_linkpol_req, dr.dev_opt, |
955 | msecs_to_jiffies(HCI_INIT_TIMEOUT)); | 956 | msecs_to_jiffies(HCI_INIT_TIMEOUT)); |
956 | break; | 957 | break; |
957 | 958 | ||
958 | case HCISETLINKMODE: | 959 | case HCISETLINKMODE: |
@@ -1103,7 +1104,7 @@ static void hci_power_on(struct work_struct *work) | |||
1103 | 1104 | ||
1104 | if (test_bit(HCI_AUTO_OFF, &hdev->dev_flags)) | 1105 | if (test_bit(HCI_AUTO_OFF, &hdev->dev_flags)) |
1105 | schedule_delayed_work(&hdev->power_off, | 1106 | schedule_delayed_work(&hdev->power_off, |
1106 | msecs_to_jiffies(AUTO_OFF_TIMEOUT)); | 1107 | msecs_to_jiffies(AUTO_OFF_TIMEOUT)); |
1107 | 1108 | ||
1108 | if (test_and_clear_bit(HCI_SETUP, &hdev->dev_flags)) | 1109 | if (test_and_clear_bit(HCI_SETUP, &hdev->dev_flags)) |
1109 | mgmt_index_added(hdev); | 1110 | mgmt_index_added(hdev); |
@@ -1112,7 +1113,7 @@ static void hci_power_on(struct work_struct *work) | |||
1112 | static void hci_power_off(struct work_struct *work) | 1113 | static void hci_power_off(struct work_struct *work) |
1113 | { | 1114 | { |
1114 | struct hci_dev *hdev = container_of(work, struct hci_dev, | 1115 | struct hci_dev *hdev = container_of(work, struct hci_dev, |
1115 | power_off.work); | 1116 | power_off.work); |
1116 | 1117 | ||
1117 | BT_DBG("%s", hdev->name); | 1118 | BT_DBG("%s", hdev->name); |
1118 | 1119 | ||
@@ -1193,7 +1194,7 @@ struct link_key *hci_find_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr) | |||
1193 | } | 1194 | } |
1194 | 1195 | ||
1195 | static bool hci_persistent_key(struct hci_dev *hdev, struct hci_conn *conn, | 1196 | static bool hci_persistent_key(struct hci_dev *hdev, struct hci_conn *conn, |
1196 | u8 key_type, u8 old_key_type) | 1197 | u8 key_type, u8 old_key_type) |
1197 | { | 1198 | { |
1198 | /* Legacy key */ | 1199 | /* Legacy key */ |
1199 | if (key_type < 0x03) | 1200 | if (key_type < 0x03) |
@@ -1234,7 +1235,7 @@ struct smp_ltk *hci_find_ltk(struct hci_dev *hdev, __le16 ediv, u8 rand[8]) | |||
1234 | 1235 | ||
1235 | list_for_each_entry(k, &hdev->long_term_keys, list) { | 1236 | list_for_each_entry(k, &hdev->long_term_keys, list) { |
1236 | if (k->ediv != ediv || | 1237 | if (k->ediv != ediv || |
1237 | memcmp(rand, k->rand, sizeof(k->rand))) | 1238 | memcmp(rand, k->rand, sizeof(k->rand))) |
1238 | continue; | 1239 | continue; |
1239 | 1240 | ||
1240 | return k; | 1241 | return k; |
@@ -1251,7 +1252,7 @@ struct smp_ltk *hci_find_ltk_by_addr(struct hci_dev *hdev, bdaddr_t *bdaddr, | |||
1251 | 1252 | ||
1252 | list_for_each_entry(k, &hdev->long_term_keys, list) | 1253 | list_for_each_entry(k, &hdev->long_term_keys, list) |
1253 | if (addr_type == k->bdaddr_type && | 1254 | if (addr_type == k->bdaddr_type && |
1254 | bacmp(bdaddr, &k->bdaddr) == 0) | 1255 | bacmp(bdaddr, &k->bdaddr) == 0) |
1255 | return k; | 1256 | return k; |
1256 | 1257 | ||
1257 | return NULL; | 1258 | return NULL; |
@@ -1283,8 +1284,7 @@ int hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn, int new_key, | |||
1283 | * combination key for legacy pairing even when there's no | 1284 | * combination key for legacy pairing even when there's no |
1284 | * previous key */ | 1285 | * previous key */ |
1285 | if (type == HCI_LK_CHANGED_COMBINATION && | 1286 | if (type == HCI_LK_CHANGED_COMBINATION && |
1286 | (!conn || conn->remote_auth == 0xff) && | 1287 | (!conn || conn->remote_auth == 0xff) && old_key_type == 0xff) { |
1287 | old_key_type == 0xff) { | ||
1288 | type = HCI_LK_COMBINATION; | 1288 | type = HCI_LK_COMBINATION; |
1289 | if (conn) | 1289 | if (conn) |
1290 | conn->key_type = type; | 1290 | conn->key_type = type; |
@@ -1741,7 +1741,7 @@ int hci_register_dev(struct hci_dev *hdev) | |||
1741 | write_unlock(&hci_dev_list_lock); | 1741 | write_unlock(&hci_dev_list_lock); |
1742 | 1742 | ||
1743 | hdev->workqueue = alloc_workqueue(hdev->name, WQ_HIGHPRI | WQ_UNBOUND | | 1743 | hdev->workqueue = alloc_workqueue(hdev->name, WQ_HIGHPRI | WQ_UNBOUND | |
1744 | WQ_MEM_RECLAIM, 1); | 1744 | WQ_MEM_RECLAIM, 1); |
1745 | if (!hdev->workqueue) { | 1745 | if (!hdev->workqueue) { |
1746 | error = -ENOMEM; | 1746 | error = -ENOMEM; |
1747 | goto err; | 1747 | goto err; |
@@ -1752,7 +1752,8 @@ int hci_register_dev(struct hci_dev *hdev) | |||
1752 | goto err_wqueue; | 1752 | goto err_wqueue; |
1753 | 1753 | ||
1754 | hdev->rfkill = rfkill_alloc(hdev->name, &hdev->dev, | 1754 | hdev->rfkill = rfkill_alloc(hdev->name, &hdev->dev, |
1755 | RFKILL_TYPE_BLUETOOTH, &hci_rfkill_ops, hdev); | 1755 | RFKILL_TYPE_BLUETOOTH, &hci_rfkill_ops, |
1756 | hdev); | ||
1756 | if (hdev->rfkill) { | 1757 | if (hdev->rfkill) { |
1757 | if (rfkill_register(hdev->rfkill) < 0) { | 1758 | if (rfkill_register(hdev->rfkill) < 0) { |
1758 | rfkill_destroy(hdev->rfkill); | 1759 | rfkill_destroy(hdev->rfkill); |
@@ -1799,7 +1800,7 @@ void hci_unregister_dev(struct hci_dev *hdev) | |||
1799 | kfree_skb(hdev->reassembly[i]); | 1800 | kfree_skb(hdev->reassembly[i]); |
1800 | 1801 | ||
1801 | if (!test_bit(HCI_INIT, &hdev->flags) && | 1802 | if (!test_bit(HCI_INIT, &hdev->flags) && |
1802 | !test_bit(HCI_SETUP, &hdev->dev_flags)) { | 1803 | !test_bit(HCI_SETUP, &hdev->dev_flags)) { |
1803 | hci_dev_lock(hdev); | 1804 | hci_dev_lock(hdev); |
1804 | mgmt_index_removed(hdev); | 1805 | mgmt_index_removed(hdev); |
1805 | hci_dev_unlock(hdev); | 1806 | hci_dev_unlock(hdev); |
@@ -1853,7 +1854,7 @@ int hci_recv_frame(struct sk_buff *skb) | |||
1853 | { | 1854 | { |
1854 | struct hci_dev *hdev = (struct hci_dev *) skb->dev; | 1855 | struct hci_dev *hdev = (struct hci_dev *) skb->dev; |
1855 | if (!hdev || (!test_bit(HCI_UP, &hdev->flags) | 1856 | if (!hdev || (!test_bit(HCI_UP, &hdev->flags) |
1856 | && !test_bit(HCI_INIT, &hdev->flags))) { | 1857 | && !test_bit(HCI_INIT, &hdev->flags))) { |
1857 | kfree_skb(skb); | 1858 | kfree_skb(skb); |
1858 | return -ENXIO; | 1859 | return -ENXIO; |
1859 | } | 1860 | } |
@@ -1872,7 +1873,7 @@ int hci_recv_frame(struct sk_buff *skb) | |||
1872 | EXPORT_SYMBOL(hci_recv_frame); | 1873 | EXPORT_SYMBOL(hci_recv_frame); |
1873 | 1874 | ||
1874 | static int hci_reassembly(struct hci_dev *hdev, int type, void *data, | 1875 | static int hci_reassembly(struct hci_dev *hdev, int type, void *data, |
1875 | int count, __u8 index) | 1876 | int count, __u8 index) |
1876 | { | 1877 | { |
1877 | int len = 0; | 1878 | int len = 0; |
1878 | int hlen = 0; | 1879 | int hlen = 0; |
@@ -1881,7 +1882,7 @@ static int hci_reassembly(struct hci_dev *hdev, int type, void *data, | |||
1881 | struct bt_skb_cb *scb; | 1882 | struct bt_skb_cb *scb; |
1882 | 1883 | ||
1883 | if ((type < HCI_ACLDATA_PKT || type > HCI_EVENT_PKT) || | 1884 | if ((type < HCI_ACLDATA_PKT || type > HCI_EVENT_PKT) || |
1884 | index >= NUM_REASSEMBLY) | 1885 | index >= NUM_REASSEMBLY) |
1885 | return -EILSEQ; | 1886 | return -EILSEQ; |
1886 | 1887 | ||
1887 | skb = hdev->reassembly[index]; | 1888 | skb = hdev->reassembly[index]; |
@@ -2023,7 +2024,7 @@ int hci_recv_stream_fragment(struct hci_dev *hdev, void *data, int count) | |||
2023 | type = bt_cb(skb)->pkt_type; | 2024 | type = bt_cb(skb)->pkt_type; |
2024 | 2025 | ||
2025 | rem = hci_reassembly(hdev, type, data, count, | 2026 | rem = hci_reassembly(hdev, type, data, count, |
2026 | STREAM_REASSEMBLY); | 2027 | STREAM_REASSEMBLY); |
2027 | if (rem < 0) | 2028 | if (rem < 0) |
2028 | return rem; | 2029 | return rem; |
2029 | 2030 | ||
@@ -2157,7 +2158,7 @@ static void hci_add_acl_hdr(struct sk_buff *skb, __u16 handle, __u16 flags) | |||
2157 | } | 2158 | } |
2158 | 2159 | ||
2159 | static void hci_queue_acl(struct hci_conn *conn, struct sk_buff_head *queue, | 2160 | static void hci_queue_acl(struct hci_conn *conn, struct sk_buff_head *queue, |
2160 | struct sk_buff *skb, __u16 flags) | 2161 | struct sk_buff *skb, __u16 flags) |
2161 | { | 2162 | { |
2162 | struct hci_dev *hdev = conn->hdev; | 2163 | struct hci_dev *hdev = conn->hdev; |
2163 | struct sk_buff *list; | 2164 | struct sk_buff *list; |
@@ -2244,7 +2245,8 @@ EXPORT_SYMBOL(hci_send_sco); | |||
2244 | /* ---- HCI TX task (outgoing data) ---- */ | 2245 | /* ---- HCI TX task (outgoing data) ---- */ |
2245 | 2246 | ||
2246 | /* HCI Connection scheduler */ | 2247 | /* HCI Connection scheduler */ |
2247 | static inline struct hci_conn *hci_low_sent(struct hci_dev *hdev, __u8 type, int *quote) | 2248 | static inline struct hci_conn *hci_low_sent(struct hci_dev *hdev, __u8 type, |
2249 | int *quote) | ||
2248 | { | 2250 | { |
2249 | struct hci_conn_hash *h = &hdev->conn_hash; | 2251 | struct hci_conn_hash *h = &hdev->conn_hash; |
2250 | struct hci_conn *conn = NULL, *c; | 2252 | struct hci_conn *conn = NULL, *c; |
@@ -2316,7 +2318,7 @@ static inline void hci_link_tx_to(struct hci_dev *hdev, __u8 type) | |||
2316 | list_for_each_entry_rcu(c, &h->list, list) { | 2318 | list_for_each_entry_rcu(c, &h->list, list) { |
2317 | if (c->type == type && c->sent) { | 2319 | if (c->type == type && c->sent) { |
2318 | BT_ERR("%s killing stalled connection %s", | 2320 | BT_ERR("%s killing stalled connection %s", |
2319 | hdev->name, batostr(&c->dst)); | 2321 | hdev->name, batostr(&c->dst)); |
2320 | hci_acl_disconn(c, 0x13); | 2322 | hci_acl_disconn(c, 0x13); |
2321 | } | 2323 | } |
2322 | } | 2324 | } |
@@ -2325,7 +2327,7 @@ static inline void hci_link_tx_to(struct hci_dev *hdev, __u8 type) | |||
2325 | } | 2327 | } |
2326 | 2328 | ||
2327 | static inline struct hci_chan *hci_chan_sent(struct hci_dev *hdev, __u8 type, | 2329 | static inline struct hci_chan *hci_chan_sent(struct hci_dev *hdev, __u8 type, |
2328 | int *quote) | 2330 | int *quote) |
2329 | { | 2331 | { |
2330 | struct hci_conn_hash *h = &hdev->conn_hash; | 2332 | struct hci_conn_hash *h = &hdev->conn_hash; |
2331 | struct hci_chan *chan = NULL; | 2333 | struct hci_chan *chan = NULL; |
@@ -2442,7 +2444,7 @@ static void hci_prio_recalculate(struct hci_dev *hdev, __u8 type) | |||
2442 | skb->priority = HCI_PRIO_MAX - 1; | 2444 | skb->priority = HCI_PRIO_MAX - 1; |
2443 | 2445 | ||
2444 | BT_DBG("chan %p skb %p promoted to %d", chan, skb, | 2446 | BT_DBG("chan %p skb %p promoted to %d", chan, skb, |
2445 | skb->priority); | 2447 | skb->priority); |
2446 | } | 2448 | } |
2447 | 2449 | ||
2448 | if (hci_conn_num(hdev, type) == num) | 2450 | if (hci_conn_num(hdev, type) == num) |
@@ -2465,7 +2467,7 @@ static inline void __check_timeout(struct hci_dev *hdev, unsigned int cnt) | |||
2465 | /* ACL tx timeout must be longer than maximum | 2467 | /* ACL tx timeout must be longer than maximum |
2466 | * link supervision timeout (40.9 seconds) */ | 2468 | * link supervision timeout (40.9 seconds) */ |
2467 | if (!cnt && time_after(jiffies, hdev->acl_last_tx + | 2469 | if (!cnt && time_after(jiffies, hdev->acl_last_tx + |
2468 | msecs_to_jiffies(HCI_ACL_TX_TIMEOUT))) | 2470 | msecs_to_jiffies(HCI_ACL_TX_TIMEOUT))) |
2469 | hci_link_tx_to(hdev, ACL_LINK); | 2471 | hci_link_tx_to(hdev, ACL_LINK); |
2470 | } | 2472 | } |
2471 | } | 2473 | } |
@@ -2480,11 +2482,11 @@ static inline void hci_sched_acl_pkt(struct hci_dev *hdev) | |||
2480 | __check_timeout(hdev, cnt); | 2482 | __check_timeout(hdev, cnt); |
2481 | 2483 | ||
2482 | while (hdev->acl_cnt && | 2484 | while (hdev->acl_cnt && |
2483 | (chan = hci_chan_sent(hdev, ACL_LINK, "e))) { | 2485 | (chan = hci_chan_sent(hdev, ACL_LINK, "e))) { |
2484 | u32 priority = (skb_peek(&chan->data_q))->priority; | 2486 | u32 priority = (skb_peek(&chan->data_q))->priority; |
2485 | while (quote-- && (skb = skb_peek(&chan->data_q))) { | 2487 | while (quote-- && (skb = skb_peek(&chan->data_q))) { |
2486 | BT_DBG("chan %p skb %p len %d priority %u", chan, skb, | 2488 | BT_DBG("chan %p skb %p len %d priority %u", chan, skb, |
2487 | skb->len, skb->priority); | 2489 | skb->len, skb->priority); |
2488 | 2490 | ||
2489 | /* Stop if priority has changed */ | 2491 | /* Stop if priority has changed */ |
2490 | if (skb->priority < priority) | 2492 | if (skb->priority < priority) |
@@ -2518,13 +2520,13 @@ static inline void hci_sched_acl_blk(struct hci_dev *hdev) | |||
2518 | __check_timeout(hdev, cnt); | 2520 | __check_timeout(hdev, cnt); |
2519 | 2521 | ||
2520 | while (hdev->block_cnt > 0 && | 2522 | while (hdev->block_cnt > 0 && |
2521 | (chan = hci_chan_sent(hdev, ACL_LINK, "e))) { | 2523 | (chan = hci_chan_sent(hdev, ACL_LINK, "e))) { |
2522 | u32 priority = (skb_peek(&chan->data_q))->priority; | 2524 | u32 priority = (skb_peek(&chan->data_q))->priority; |
2523 | while (quote > 0 && (skb = skb_peek(&chan->data_q))) { | 2525 | while (quote > 0 && (skb = skb_peek(&chan->data_q))) { |
2524 | int blocks; | 2526 | int blocks; |
2525 | 2527 | ||
2526 | BT_DBG("chan %p skb %p len %d priority %u", chan, skb, | 2528 | BT_DBG("chan %p skb %p len %d priority %u", chan, skb, |
2527 | skb->len, skb->priority); | 2529 | skb->len, skb->priority); |
2528 | 2530 | ||
2529 | /* Stop if priority has changed */ | 2531 | /* Stop if priority has changed */ |
2530 | if (skb->priority < priority) | 2532 | if (skb->priority < priority) |
@@ -2537,7 +2539,7 @@ static inline void hci_sched_acl_blk(struct hci_dev *hdev) | |||
2537 | return; | 2539 | return; |
2538 | 2540 | ||
2539 | hci_conn_enter_active_mode(chan->conn, | 2541 | hci_conn_enter_active_mode(chan->conn, |
2540 | bt_cb(skb)->force_active); | 2542 | bt_cb(skb)->force_active); |
2541 | 2543 | ||
2542 | hci_send_frame(skb); | 2544 | hci_send_frame(skb); |
2543 | hdev->acl_last_tx = jiffies; | 2545 | hdev->acl_last_tx = jiffies; |
@@ -2634,7 +2636,7 @@ static inline void hci_sched_le(struct hci_dev *hdev) | |||
2634 | /* LE tx timeout must be longer than maximum | 2636 | /* LE tx timeout must be longer than maximum |
2635 | * link supervision timeout (40.9 seconds) */ | 2637 | * link supervision timeout (40.9 seconds) */ |
2636 | if (!hdev->le_cnt && hdev->le_pkts && | 2638 | if (!hdev->le_cnt && hdev->le_pkts && |
2637 | time_after(jiffies, hdev->le_last_tx + HZ * 45)) | 2639 | time_after(jiffies, hdev->le_last_tx + HZ * 45)) |
2638 | hci_link_tx_to(hdev, LE_LINK); | 2640 | hci_link_tx_to(hdev, LE_LINK); |
2639 | } | 2641 | } |
2640 | 2642 | ||
@@ -2644,7 +2646,7 @@ static inline void hci_sched_le(struct hci_dev *hdev) | |||
2644 | u32 priority = (skb_peek(&chan->data_q))->priority; | 2646 | u32 priority = (skb_peek(&chan->data_q))->priority; |
2645 | while (quote-- && (skb = skb_peek(&chan->data_q))) { | 2647 | while (quote-- && (skb = skb_peek(&chan->data_q))) { |
2646 | BT_DBG("chan %p skb %p len %d priority %u", chan, skb, | 2648 | BT_DBG("chan %p skb %p len %d priority %u", chan, skb, |
2647 | skb->len, skb->priority); | 2649 | skb->len, skb->priority); |
2648 | 2650 | ||
2649 | /* Stop if priority has changed */ | 2651 | /* Stop if priority has changed */ |
2650 | if (skb->priority < priority) | 2652 | if (skb->priority < priority) |
@@ -2676,7 +2678,7 @@ static void hci_tx_work(struct work_struct *work) | |||
2676 | struct sk_buff *skb; | 2678 | struct sk_buff *skb; |
2677 | 2679 | ||
2678 | BT_DBG("%s acl %d sco %d le %d", hdev->name, hdev->acl_cnt, | 2680 | BT_DBG("%s acl %d sco %d le %d", hdev->name, hdev->acl_cnt, |
2679 | hdev->sco_cnt, hdev->le_cnt); | 2681 | hdev->sco_cnt, hdev->le_cnt); |
2680 | 2682 | ||
2681 | /* Schedule queues and send stuff to HCI driver */ | 2683 | /* Schedule queues and send stuff to HCI driver */ |
2682 | 2684 | ||
@@ -2708,7 +2710,8 @@ static inline void hci_acldata_packet(struct hci_dev *hdev, struct sk_buff *skb) | |||
2708 | flags = hci_flags(handle); | 2710 | flags = hci_flags(handle); |
2709 | handle = hci_handle(handle); | 2711 | handle = hci_handle(handle); |
2710 | 2712 | ||
2711 | BT_DBG("%s len %d handle 0x%x flags 0x%x", hdev->name, skb->len, handle, flags); | 2713 | BT_DBG("%s len %d handle 0x%x flags 0x%x", hdev->name, skb->len, |
2714 | handle, flags); | ||
2712 | 2715 | ||
2713 | hdev->stat.acl_rx++; | 2716 | hdev->stat.acl_rx++; |
2714 | 2717 | ||
@@ -2732,7 +2735,7 @@ static inline void hci_acldata_packet(struct hci_dev *hdev, struct sk_buff *skb) | |||
2732 | return; | 2735 | return; |
2733 | } else { | 2736 | } else { |
2734 | BT_ERR("%s ACL packet for unknown connection handle %d", | 2737 | BT_ERR("%s ACL packet for unknown connection handle %d", |
2735 | hdev->name, handle); | 2738 | hdev->name, handle); |
2736 | } | 2739 | } |
2737 | 2740 | ||
2738 | kfree_skb(skb); | 2741 | kfree_skb(skb); |
@@ -2763,7 +2766,7 @@ static inline void hci_scodata_packet(struct hci_dev *hdev, struct sk_buff *skb) | |||
2763 | return; | 2766 | return; |
2764 | } else { | 2767 | } else { |
2765 | BT_ERR("%s SCO packet for unknown connection handle %d", | 2768 | BT_ERR("%s SCO packet for unknown connection handle %d", |
2766 | hdev->name, handle); | 2769 | hdev->name, handle); |
2767 | } | 2770 | } |
2768 | 2771 | ||
2769 | kfree_skb(skb); | 2772 | kfree_skb(skb); |