• Home
  • Raw
  • Download

Lines Matching refs:hdev

37 static void hci_cc_inquiry_cancel(struct hci_dev *hdev, struct sk_buff *skb)  in hci_cc_inquiry_cancel()  argument
41 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_inquiry_cancel()
44 hci_dev_lock(hdev); in hci_cc_inquiry_cancel()
45 mgmt_stop_discovery_failed(hdev, status); in hci_cc_inquiry_cancel()
46 hci_dev_unlock(hdev); in hci_cc_inquiry_cancel()
50 clear_bit(HCI_INQUIRY, &hdev->flags); in hci_cc_inquiry_cancel()
52 wake_up_bit(&hdev->flags, HCI_INQUIRY); in hci_cc_inquiry_cancel()
54 hci_dev_lock(hdev); in hci_cc_inquiry_cancel()
55 hci_discovery_set_state(hdev, DISCOVERY_STOPPED); in hci_cc_inquiry_cancel()
56 hci_dev_unlock(hdev); in hci_cc_inquiry_cancel()
58 hci_conn_check_pending(hdev); in hci_cc_inquiry_cancel()
61 static void hci_cc_periodic_inq(struct hci_dev *hdev, struct sk_buff *skb) in hci_cc_periodic_inq() argument
65 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_periodic_inq()
70 set_bit(HCI_PERIODIC_INQ, &hdev->dev_flags); in hci_cc_periodic_inq()
73 static void hci_cc_exit_periodic_inq(struct hci_dev *hdev, struct sk_buff *skb) in hci_cc_exit_periodic_inq() argument
77 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_exit_periodic_inq()
82 clear_bit(HCI_PERIODIC_INQ, &hdev->dev_flags); in hci_cc_exit_periodic_inq()
84 hci_conn_check_pending(hdev); in hci_cc_exit_periodic_inq()
87 static void hci_cc_remote_name_req_cancel(struct hci_dev *hdev, in hci_cc_remote_name_req_cancel() argument
90 BT_DBG("%s", hdev->name); in hci_cc_remote_name_req_cancel()
93 static void hci_cc_role_discovery(struct hci_dev *hdev, struct sk_buff *skb) in hci_cc_role_discovery() argument
98 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_role_discovery()
103 hci_dev_lock(hdev); in hci_cc_role_discovery()
105 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(rp->handle)); in hci_cc_role_discovery()
113 hci_dev_unlock(hdev); in hci_cc_role_discovery()
116 static void hci_cc_read_link_policy(struct hci_dev *hdev, struct sk_buff *skb) in hci_cc_read_link_policy() argument
121 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_read_link_policy()
126 hci_dev_lock(hdev); in hci_cc_read_link_policy()
128 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(rp->handle)); in hci_cc_read_link_policy()
132 hci_dev_unlock(hdev); in hci_cc_read_link_policy()
135 static void hci_cc_write_link_policy(struct hci_dev *hdev, struct sk_buff *skb) in hci_cc_write_link_policy() argument
141 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_write_link_policy()
146 sent = hci_sent_cmd_data(hdev, HCI_OP_WRITE_LINK_POLICY); in hci_cc_write_link_policy()
150 hci_dev_lock(hdev); in hci_cc_write_link_policy()
152 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(rp->handle)); in hci_cc_write_link_policy()
156 hci_dev_unlock(hdev); in hci_cc_write_link_policy()
159 static void hci_cc_read_def_link_policy(struct hci_dev *hdev, in hci_cc_read_def_link_policy() argument
164 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_read_def_link_policy()
169 hdev->link_policy = __le16_to_cpu(rp->policy); in hci_cc_read_def_link_policy()
172 static void hci_cc_write_def_link_policy(struct hci_dev *hdev, in hci_cc_write_def_link_policy() argument
178 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_write_def_link_policy()
180 sent = hci_sent_cmd_data(hdev, HCI_OP_WRITE_DEF_LINK_POLICY); in hci_cc_write_def_link_policy()
185 hdev->link_policy = get_unaligned_le16(sent); in hci_cc_write_def_link_policy()
188 static void hci_cc_reset(struct hci_dev *hdev, struct sk_buff *skb) in hci_cc_reset() argument
192 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_reset()
194 clear_bit(HCI_RESET, &hdev->flags); in hci_cc_reset()
197 hdev->dev_flags &= ~HCI_PERSISTENT_MASK; in hci_cc_reset()
199 hdev->discovery.state = DISCOVERY_STOPPED; in hci_cc_reset()
200 hdev->inq_tx_power = HCI_TX_POWER_INVALID; in hci_cc_reset()
201 hdev->adv_tx_power = HCI_TX_POWER_INVALID; in hci_cc_reset()
203 memset(hdev->adv_data, 0, sizeof(hdev->adv_data)); in hci_cc_reset()
204 hdev->adv_data_len = 0; in hci_cc_reset()
207 static void hci_cc_write_local_name(struct hci_dev *hdev, struct sk_buff *skb) in hci_cc_write_local_name() argument
212 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_write_local_name()
214 sent = hci_sent_cmd_data(hdev, HCI_OP_WRITE_LOCAL_NAME); in hci_cc_write_local_name()
218 hci_dev_lock(hdev); in hci_cc_write_local_name()
220 if (test_bit(HCI_MGMT, &hdev->dev_flags)) in hci_cc_write_local_name()
221 mgmt_set_local_name_complete(hdev, sent, status); in hci_cc_write_local_name()
223 memcpy(hdev->dev_name, sent, HCI_MAX_NAME_LENGTH); in hci_cc_write_local_name()
225 hci_dev_unlock(hdev); in hci_cc_write_local_name()
228 static void hci_cc_read_local_name(struct hci_dev *hdev, struct sk_buff *skb) in hci_cc_read_local_name() argument
232 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_read_local_name()
237 if (test_bit(HCI_SETUP, &hdev->dev_flags)) in hci_cc_read_local_name()
238 memcpy(hdev->dev_name, rp->name, HCI_MAX_NAME_LENGTH); in hci_cc_read_local_name()
241 static void hci_cc_write_auth_enable(struct hci_dev *hdev, struct sk_buff *skb) in hci_cc_write_auth_enable() argument
246 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_write_auth_enable()
248 sent = hci_sent_cmd_data(hdev, HCI_OP_WRITE_AUTH_ENABLE); in hci_cc_write_auth_enable()
256 set_bit(HCI_AUTH, &hdev->flags); in hci_cc_write_auth_enable()
258 clear_bit(HCI_AUTH, &hdev->flags); in hci_cc_write_auth_enable()
261 if (test_bit(HCI_MGMT, &hdev->dev_flags)) in hci_cc_write_auth_enable()
262 mgmt_auth_enable_complete(hdev, status); in hci_cc_write_auth_enable()
265 static void hci_cc_write_encrypt_mode(struct hci_dev *hdev, struct sk_buff *skb) in hci_cc_write_encrypt_mode() argument
270 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_write_encrypt_mode()
272 sent = hci_sent_cmd_data(hdev, HCI_OP_WRITE_ENCRYPT_MODE); in hci_cc_write_encrypt_mode()
280 set_bit(HCI_ENCRYPT, &hdev->flags); in hci_cc_write_encrypt_mode()
282 clear_bit(HCI_ENCRYPT, &hdev->flags); in hci_cc_write_encrypt_mode()
286 static void hci_cc_write_scan_enable(struct hci_dev *hdev, struct sk_buff *skb) in hci_cc_write_scan_enable() argument
292 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_write_scan_enable()
294 sent = hci_sent_cmd_data(hdev, HCI_OP_WRITE_SCAN_ENABLE); in hci_cc_write_scan_enable()
300 hci_dev_lock(hdev); in hci_cc_write_scan_enable()
303 mgmt_write_scan_failed(hdev, param, status); in hci_cc_write_scan_enable()
304 hdev->discov_timeout = 0; in hci_cc_write_scan_enable()
308 old_pscan = test_and_clear_bit(HCI_PSCAN, &hdev->flags); in hci_cc_write_scan_enable()
309 old_iscan = test_and_clear_bit(HCI_ISCAN, &hdev->flags); in hci_cc_write_scan_enable()
312 set_bit(HCI_ISCAN, &hdev->flags); in hci_cc_write_scan_enable()
314 mgmt_discoverable(hdev, 1); in hci_cc_write_scan_enable()
315 if (hdev->discov_timeout > 0) { in hci_cc_write_scan_enable()
316 int to = msecs_to_jiffies(hdev->discov_timeout * 1000); in hci_cc_write_scan_enable()
317 queue_delayed_work(hdev->workqueue, &hdev->discov_off, in hci_cc_write_scan_enable()
321 mgmt_discoverable(hdev, 0); in hci_cc_write_scan_enable()
324 set_bit(HCI_PSCAN, &hdev->flags); in hci_cc_write_scan_enable()
326 mgmt_connectable(hdev, 1); in hci_cc_write_scan_enable()
328 mgmt_connectable(hdev, 0); in hci_cc_write_scan_enable()
331 hci_dev_unlock(hdev); in hci_cc_write_scan_enable()
334 static void hci_cc_read_class_of_dev(struct hci_dev *hdev, struct sk_buff *skb) in hci_cc_read_class_of_dev() argument
338 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_read_class_of_dev()
343 memcpy(hdev->dev_class, rp->dev_class, 3); in hci_cc_read_class_of_dev()
345 BT_DBG("%s class 0x%.2x%.2x%.2x", hdev->name, in hci_cc_read_class_of_dev()
346 hdev->dev_class[2], hdev->dev_class[1], hdev->dev_class[0]); in hci_cc_read_class_of_dev()
349 static void hci_cc_write_class_of_dev(struct hci_dev *hdev, struct sk_buff *skb) in hci_cc_write_class_of_dev() argument
354 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_write_class_of_dev()
356 sent = hci_sent_cmd_data(hdev, HCI_OP_WRITE_CLASS_OF_DEV); in hci_cc_write_class_of_dev()
360 hci_dev_lock(hdev); in hci_cc_write_class_of_dev()
363 memcpy(hdev->dev_class, sent, 3); in hci_cc_write_class_of_dev()
365 if (test_bit(HCI_MGMT, &hdev->dev_flags)) in hci_cc_write_class_of_dev()
366 mgmt_set_class_of_dev_complete(hdev, sent, status); in hci_cc_write_class_of_dev()
368 hci_dev_unlock(hdev); in hci_cc_write_class_of_dev()
371 static void hci_cc_read_voice_setting(struct hci_dev *hdev, struct sk_buff *skb) in hci_cc_read_voice_setting() argument
376 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_read_voice_setting()
383 if (hdev->voice_setting == setting) in hci_cc_read_voice_setting()
386 hdev->voice_setting = setting; in hci_cc_read_voice_setting()
388 BT_DBG("%s voice setting 0x%4.4x", hdev->name, setting); in hci_cc_read_voice_setting()
390 if (hdev->notify) in hci_cc_read_voice_setting()
391 hdev->notify(hdev, HCI_NOTIFY_VOICE_SETTING); in hci_cc_read_voice_setting()
394 static void hci_cc_write_voice_setting(struct hci_dev *hdev, in hci_cc_write_voice_setting() argument
401 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_write_voice_setting()
406 sent = hci_sent_cmd_data(hdev, HCI_OP_WRITE_VOICE_SETTING); in hci_cc_write_voice_setting()
412 if (hdev->voice_setting == setting) in hci_cc_write_voice_setting()
415 hdev->voice_setting = setting; in hci_cc_write_voice_setting()
417 BT_DBG("%s voice setting 0x%4.4x", hdev->name, setting); in hci_cc_write_voice_setting()
419 if (hdev->notify) in hci_cc_write_voice_setting()
420 hdev->notify(hdev, HCI_NOTIFY_VOICE_SETTING); in hci_cc_write_voice_setting()
423 static void hci_cc_write_ssp_mode(struct hci_dev *hdev, struct sk_buff *skb) in hci_cc_write_ssp_mode() argument
428 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_write_ssp_mode()
430 sent = hci_sent_cmd_data(hdev, HCI_OP_WRITE_SSP_MODE); in hci_cc_write_ssp_mode()
436 hdev->features[1][0] |= LMP_HOST_SSP; in hci_cc_write_ssp_mode()
438 hdev->features[1][0] &= ~LMP_HOST_SSP; in hci_cc_write_ssp_mode()
441 if (test_bit(HCI_MGMT, &hdev->dev_flags)) in hci_cc_write_ssp_mode()
442 mgmt_ssp_enable_complete(hdev, sent->mode, status); in hci_cc_write_ssp_mode()
445 set_bit(HCI_SSP_ENABLED, &hdev->dev_flags); in hci_cc_write_ssp_mode()
447 clear_bit(HCI_SSP_ENABLED, &hdev->dev_flags); in hci_cc_write_ssp_mode()
451 static void hci_cc_read_local_version(struct hci_dev *hdev, struct sk_buff *skb) in hci_cc_read_local_version() argument
455 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_read_local_version()
460 hdev->hci_ver = rp->hci_ver; in hci_cc_read_local_version()
461 hdev->hci_rev = __le16_to_cpu(rp->hci_rev); in hci_cc_read_local_version()
462 hdev->lmp_ver = rp->lmp_ver; in hci_cc_read_local_version()
463 hdev->manufacturer = __le16_to_cpu(rp->manufacturer); in hci_cc_read_local_version()
464 hdev->lmp_subver = __le16_to_cpu(rp->lmp_subver); in hci_cc_read_local_version()
466 BT_DBG("%s manufacturer 0x%4.4x hci ver %d:%d", hdev->name, in hci_cc_read_local_version()
467 hdev->manufacturer, hdev->hci_ver, hdev->hci_rev); in hci_cc_read_local_version()
470 static void hci_cc_read_local_commands(struct hci_dev *hdev, in hci_cc_read_local_commands() argument
475 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_read_local_commands()
478 memcpy(hdev->commands, rp->commands, sizeof(hdev->commands)); in hci_cc_read_local_commands()
481 static void hci_cc_read_local_features(struct hci_dev *hdev, in hci_cc_read_local_features() argument
486 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_read_local_features()
491 memcpy(hdev->features, rp->features, 8); in hci_cc_read_local_features()
496 if (hdev->features[0][0] & LMP_3SLOT) in hci_cc_read_local_features()
497 hdev->pkt_type |= (HCI_DM3 | HCI_DH3); in hci_cc_read_local_features()
499 if (hdev->features[0][0] & LMP_5SLOT) in hci_cc_read_local_features()
500 hdev->pkt_type |= (HCI_DM5 | HCI_DH5); in hci_cc_read_local_features()
502 if (hdev->features[0][1] & LMP_HV2) { in hci_cc_read_local_features()
503 hdev->pkt_type |= (HCI_HV2); in hci_cc_read_local_features()
504 hdev->esco_type |= (ESCO_HV2); in hci_cc_read_local_features()
507 if (hdev->features[0][1] & LMP_HV3) { in hci_cc_read_local_features()
508 hdev->pkt_type |= (HCI_HV3); in hci_cc_read_local_features()
509 hdev->esco_type |= (ESCO_HV3); in hci_cc_read_local_features()
512 if (lmp_esco_capable(hdev)) in hci_cc_read_local_features()
513 hdev->esco_type |= (ESCO_EV3); in hci_cc_read_local_features()
515 if (hdev->features[0][4] & LMP_EV4) in hci_cc_read_local_features()
516 hdev->esco_type |= (ESCO_EV4); in hci_cc_read_local_features()
518 if (hdev->features[0][4] & LMP_EV5) in hci_cc_read_local_features()
519 hdev->esco_type |= (ESCO_EV5); in hci_cc_read_local_features()
521 if (hdev->features[0][5] & LMP_EDR_ESCO_2M) in hci_cc_read_local_features()
522 hdev->esco_type |= (ESCO_2EV3); in hci_cc_read_local_features()
524 if (hdev->features[0][5] & LMP_EDR_ESCO_3M) in hci_cc_read_local_features()
525 hdev->esco_type |= (ESCO_3EV3); in hci_cc_read_local_features()
527 if (hdev->features[0][5] & LMP_EDR_3S_ESCO) in hci_cc_read_local_features()
528 hdev->esco_type |= (ESCO_2EV5 | ESCO_3EV5); in hci_cc_read_local_features()
530 BT_DBG("%s features 0x%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x", hdev->name, in hci_cc_read_local_features()
531 hdev->features[0][0], hdev->features[0][1], in hci_cc_read_local_features()
532 hdev->features[0][2], hdev->features[0][3], in hci_cc_read_local_features()
533 hdev->features[0][4], hdev->features[0][5], in hci_cc_read_local_features()
534 hdev->features[0][6], hdev->features[0][7]); in hci_cc_read_local_features()
537 static void hci_cc_read_local_ext_features(struct hci_dev *hdev, in hci_cc_read_local_ext_features() argument
542 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_read_local_ext_features()
547 hdev->max_page = rp->max_page; in hci_cc_read_local_ext_features()
550 memcpy(hdev->features[rp->page], rp->features, 8); in hci_cc_read_local_ext_features()
553 static void hci_cc_read_flow_control_mode(struct hci_dev *hdev, in hci_cc_read_flow_control_mode() argument
558 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_read_flow_control_mode()
561 hdev->flow_ctl_mode = rp->mode; in hci_cc_read_flow_control_mode()
564 static void hci_cc_read_buffer_size(struct hci_dev *hdev, struct sk_buff *skb) in hci_cc_read_buffer_size() argument
568 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_read_buffer_size()
573 hdev->acl_mtu = __le16_to_cpu(rp->acl_mtu); in hci_cc_read_buffer_size()
574 hdev->sco_mtu = rp->sco_mtu; in hci_cc_read_buffer_size()
575 hdev->acl_pkts = __le16_to_cpu(rp->acl_max_pkt); in hci_cc_read_buffer_size()
576 hdev->sco_pkts = __le16_to_cpu(rp->sco_max_pkt); in hci_cc_read_buffer_size()
578 if (test_bit(HCI_QUIRK_FIXUP_BUFFER_SIZE, &hdev->quirks)) { in hci_cc_read_buffer_size()
579 hdev->sco_mtu = 64; in hci_cc_read_buffer_size()
580 hdev->sco_pkts = 8; in hci_cc_read_buffer_size()
583 hdev->acl_cnt = hdev->acl_pkts; in hci_cc_read_buffer_size()
584 hdev->sco_cnt = hdev->sco_pkts; in hci_cc_read_buffer_size()
586 BT_DBG("%s acl mtu %d:%d sco mtu %d:%d", hdev->name, hdev->acl_mtu, in hci_cc_read_buffer_size()
587 hdev->acl_pkts, hdev->sco_mtu, hdev->sco_pkts); in hci_cc_read_buffer_size()
590 static void hci_cc_read_bd_addr(struct hci_dev *hdev, struct sk_buff *skb) in hci_cc_read_bd_addr() argument
594 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_read_bd_addr()
597 bacpy(&hdev->bdaddr, &rp->bdaddr); in hci_cc_read_bd_addr()
600 static void hci_cc_read_page_scan_activity(struct hci_dev *hdev, in hci_cc_read_page_scan_activity() argument
605 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_read_page_scan_activity()
607 if (test_bit(HCI_INIT, &hdev->flags) && !rp->status) { in hci_cc_read_page_scan_activity()
608 hdev->page_scan_interval = __le16_to_cpu(rp->interval); in hci_cc_read_page_scan_activity()
609 hdev->page_scan_window = __le16_to_cpu(rp->window); in hci_cc_read_page_scan_activity()
613 static void hci_cc_write_page_scan_activity(struct hci_dev *hdev, in hci_cc_write_page_scan_activity() argument
619 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_write_page_scan_activity()
624 sent = hci_sent_cmd_data(hdev, HCI_OP_WRITE_PAGE_SCAN_ACTIVITY); in hci_cc_write_page_scan_activity()
628 hdev->page_scan_interval = __le16_to_cpu(sent->interval); in hci_cc_write_page_scan_activity()
629 hdev->page_scan_window = __le16_to_cpu(sent->window); in hci_cc_write_page_scan_activity()
632 static void hci_cc_read_page_scan_type(struct hci_dev *hdev, in hci_cc_read_page_scan_type() argument
637 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_read_page_scan_type()
639 if (test_bit(HCI_INIT, &hdev->flags) && !rp->status) in hci_cc_read_page_scan_type()
640 hdev->page_scan_type = rp->type; in hci_cc_read_page_scan_type()
643 static void hci_cc_write_page_scan_type(struct hci_dev *hdev, in hci_cc_write_page_scan_type() argument
649 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_write_page_scan_type()
654 type = hci_sent_cmd_data(hdev, HCI_OP_WRITE_PAGE_SCAN_TYPE); in hci_cc_write_page_scan_type()
656 hdev->page_scan_type = *type; in hci_cc_write_page_scan_type()
659 static void hci_cc_read_data_block_size(struct hci_dev *hdev, in hci_cc_read_data_block_size() argument
664 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_read_data_block_size()
669 hdev->block_mtu = __le16_to_cpu(rp->max_acl_len); in hci_cc_read_data_block_size()
670 hdev->block_len = __le16_to_cpu(rp->block_len); in hci_cc_read_data_block_size()
671 hdev->num_blocks = __le16_to_cpu(rp->num_blocks); in hci_cc_read_data_block_size()
673 hdev->block_cnt = hdev->num_blocks; in hci_cc_read_data_block_size()
675 BT_DBG("%s blk mtu %d cnt %d len %d", hdev->name, hdev->block_mtu, in hci_cc_read_data_block_size()
676 hdev->block_cnt, hdev->block_len); in hci_cc_read_data_block_size()
679 static void hci_cc_read_local_amp_info(struct hci_dev *hdev, in hci_cc_read_local_amp_info() argument
684 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_read_local_amp_info()
689 hdev->amp_status = rp->amp_status; in hci_cc_read_local_amp_info()
690 hdev->amp_total_bw = __le32_to_cpu(rp->total_bw); in hci_cc_read_local_amp_info()
691 hdev->amp_max_bw = __le32_to_cpu(rp->max_bw); in hci_cc_read_local_amp_info()
692 hdev->amp_min_latency = __le32_to_cpu(rp->min_latency); in hci_cc_read_local_amp_info()
693 hdev->amp_max_pdu = __le32_to_cpu(rp->max_pdu); in hci_cc_read_local_amp_info()
694 hdev->amp_type = rp->amp_type; in hci_cc_read_local_amp_info()
695 hdev->amp_pal_cap = __le16_to_cpu(rp->pal_cap); in hci_cc_read_local_amp_info()
696 hdev->amp_assoc_size = __le16_to_cpu(rp->max_assoc_size); in hci_cc_read_local_amp_info()
697 hdev->amp_be_flush_to = __le32_to_cpu(rp->be_flush_to); in hci_cc_read_local_amp_info()
698 hdev->amp_max_flush_to = __le32_to_cpu(rp->max_flush_to); in hci_cc_read_local_amp_info()
701 a2mp_send_getinfo_rsp(hdev); in hci_cc_read_local_amp_info()
704 static void hci_cc_read_local_amp_assoc(struct hci_dev *hdev, in hci_cc_read_local_amp_assoc() argument
708 struct amp_assoc *assoc = &hdev->loc_assoc; in hci_cc_read_local_amp_assoc()
711 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_read_local_amp_assoc()
726 amp_read_loc_assoc_frag(hdev, rp->phy_handle); in hci_cc_read_local_amp_assoc()
737 a2mp_send_getampassoc_rsp(hdev, rp->status); in hci_cc_read_local_amp_assoc()
738 a2mp_send_create_phy_link_req(hdev, rp->status); in hci_cc_read_local_amp_assoc()
741 static void hci_cc_read_inq_rsp_tx_power(struct hci_dev *hdev, in hci_cc_read_inq_rsp_tx_power() argument
746 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_read_inq_rsp_tx_power()
749 hdev->inq_tx_power = rp->tx_power; in hci_cc_read_inq_rsp_tx_power()
752 static void hci_cc_pin_code_reply(struct hci_dev *hdev, struct sk_buff *skb) in hci_cc_pin_code_reply() argument
758 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_pin_code_reply()
760 hci_dev_lock(hdev); in hci_cc_pin_code_reply()
762 if (test_bit(HCI_MGMT, &hdev->dev_flags)) in hci_cc_pin_code_reply()
763 mgmt_pin_code_reply_complete(hdev, &rp->bdaddr, rp->status); in hci_cc_pin_code_reply()
768 cp = hci_sent_cmd_data(hdev, HCI_OP_PIN_CODE_REPLY); in hci_cc_pin_code_reply()
772 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &cp->bdaddr); in hci_cc_pin_code_reply()
777 hci_dev_unlock(hdev); in hci_cc_pin_code_reply()
780 static void hci_cc_pin_code_neg_reply(struct hci_dev *hdev, struct sk_buff *skb) in hci_cc_pin_code_neg_reply() argument
784 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_pin_code_neg_reply()
786 hci_dev_lock(hdev); in hci_cc_pin_code_neg_reply()
788 if (test_bit(HCI_MGMT, &hdev->dev_flags)) in hci_cc_pin_code_neg_reply()
789 mgmt_pin_code_neg_reply_complete(hdev, &rp->bdaddr, in hci_cc_pin_code_neg_reply()
792 hci_dev_unlock(hdev); in hci_cc_pin_code_neg_reply()
795 static void hci_cc_le_read_buffer_size(struct hci_dev *hdev, in hci_cc_le_read_buffer_size() argument
800 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_le_read_buffer_size()
805 hdev->le_mtu = __le16_to_cpu(rp->le_mtu); in hci_cc_le_read_buffer_size()
806 hdev->le_pkts = rp->le_max_pkt; in hci_cc_le_read_buffer_size()
808 hdev->le_cnt = hdev->le_pkts; in hci_cc_le_read_buffer_size()
810 BT_DBG("%s le mtu %d:%d", hdev->name, hdev->le_mtu, hdev->le_pkts); in hci_cc_le_read_buffer_size()
813 static void hci_cc_le_read_local_features(struct hci_dev *hdev, in hci_cc_le_read_local_features() argument
818 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_le_read_local_features()
821 memcpy(hdev->le_features, rp->features, 8); in hci_cc_le_read_local_features()
824 static void hci_cc_le_read_adv_tx_power(struct hci_dev *hdev, in hci_cc_le_read_adv_tx_power() argument
829 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_le_read_adv_tx_power()
832 hdev->adv_tx_power = rp->tx_power; in hci_cc_le_read_adv_tx_power()
835 static void hci_cc_user_confirm_reply(struct hci_dev *hdev, struct sk_buff *skb) in hci_cc_user_confirm_reply() argument
839 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_user_confirm_reply()
841 hci_dev_lock(hdev); in hci_cc_user_confirm_reply()
843 if (test_bit(HCI_MGMT, &hdev->dev_flags)) in hci_cc_user_confirm_reply()
844 mgmt_user_confirm_reply_complete(hdev, &rp->bdaddr, ACL_LINK, 0, in hci_cc_user_confirm_reply()
847 hci_dev_unlock(hdev); in hci_cc_user_confirm_reply()
850 static void hci_cc_user_confirm_neg_reply(struct hci_dev *hdev, in hci_cc_user_confirm_neg_reply() argument
855 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_user_confirm_neg_reply()
857 hci_dev_lock(hdev); in hci_cc_user_confirm_neg_reply()
859 if (test_bit(HCI_MGMT, &hdev->dev_flags)) in hci_cc_user_confirm_neg_reply()
860 mgmt_user_confirm_neg_reply_complete(hdev, &rp->bdaddr, in hci_cc_user_confirm_neg_reply()
863 hci_dev_unlock(hdev); in hci_cc_user_confirm_neg_reply()
866 static void hci_cc_user_passkey_reply(struct hci_dev *hdev, struct sk_buff *skb) in hci_cc_user_passkey_reply() argument
870 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_user_passkey_reply()
872 hci_dev_lock(hdev); in hci_cc_user_passkey_reply()
874 if (test_bit(HCI_MGMT, &hdev->dev_flags)) in hci_cc_user_passkey_reply()
875 mgmt_user_passkey_reply_complete(hdev, &rp->bdaddr, ACL_LINK, in hci_cc_user_passkey_reply()
878 hci_dev_unlock(hdev); in hci_cc_user_passkey_reply()
881 static void hci_cc_user_passkey_neg_reply(struct hci_dev *hdev, in hci_cc_user_passkey_neg_reply() argument
886 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_user_passkey_neg_reply()
888 hci_dev_lock(hdev); in hci_cc_user_passkey_neg_reply()
890 if (test_bit(HCI_MGMT, &hdev->dev_flags)) in hci_cc_user_passkey_neg_reply()
891 mgmt_user_passkey_neg_reply_complete(hdev, &rp->bdaddr, in hci_cc_user_passkey_neg_reply()
894 hci_dev_unlock(hdev); in hci_cc_user_passkey_neg_reply()
897 static void hci_cc_read_local_oob_data_reply(struct hci_dev *hdev, in hci_cc_read_local_oob_data_reply() argument
902 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_read_local_oob_data_reply()
904 hci_dev_lock(hdev); in hci_cc_read_local_oob_data_reply()
905 mgmt_read_local_oob_data_reply_complete(hdev, rp->hash, in hci_cc_read_local_oob_data_reply()
907 hci_dev_unlock(hdev); in hci_cc_read_local_oob_data_reply()
910 static void hci_cc_le_set_adv_enable(struct hci_dev *hdev, struct sk_buff *skb) in hci_cc_le_set_adv_enable() argument
914 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_le_set_adv_enable()
916 sent = hci_sent_cmd_data(hdev, HCI_OP_LE_SET_ADV_ENABLE); in hci_cc_le_set_adv_enable()
920 hci_dev_lock(hdev); in hci_cc_le_set_adv_enable()
924 set_bit(HCI_LE_PERIPHERAL, &hdev->dev_flags); in hci_cc_le_set_adv_enable()
926 clear_bit(HCI_LE_PERIPHERAL, &hdev->dev_flags); in hci_cc_le_set_adv_enable()
929 if (!test_bit(HCI_INIT, &hdev->flags)) { in hci_cc_le_set_adv_enable()
932 hci_req_init(&req, hdev); in hci_cc_le_set_adv_enable()
937 hci_dev_unlock(hdev); in hci_cc_le_set_adv_enable()
940 static void hci_cc_le_set_scan_param(struct hci_dev *hdev, struct sk_buff *skb) in hci_cc_le_set_scan_param() argument
944 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_le_set_scan_param()
947 hci_dev_lock(hdev); in hci_cc_le_set_scan_param()
948 mgmt_start_discovery_failed(hdev, status); in hci_cc_le_set_scan_param()
949 hci_dev_unlock(hdev); in hci_cc_le_set_scan_param()
954 static void hci_cc_le_set_scan_enable(struct hci_dev *hdev, in hci_cc_le_set_scan_enable() argument
960 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_le_set_scan_enable()
962 cp = hci_sent_cmd_data(hdev, HCI_OP_LE_SET_SCAN_ENABLE); in hci_cc_le_set_scan_enable()
969 hci_dev_lock(hdev); in hci_cc_le_set_scan_enable()
970 mgmt_start_discovery_failed(hdev, status); in hci_cc_le_set_scan_enable()
971 hci_dev_unlock(hdev); in hci_cc_le_set_scan_enable()
975 set_bit(HCI_LE_SCAN, &hdev->dev_flags); in hci_cc_le_set_scan_enable()
977 hci_dev_lock(hdev); in hci_cc_le_set_scan_enable()
978 hci_discovery_set_state(hdev, DISCOVERY_FINDING); in hci_cc_le_set_scan_enable()
979 hci_dev_unlock(hdev); in hci_cc_le_set_scan_enable()
984 hci_dev_lock(hdev); in hci_cc_le_set_scan_enable()
985 mgmt_stop_discovery_failed(hdev, status); in hci_cc_le_set_scan_enable()
986 hci_dev_unlock(hdev); in hci_cc_le_set_scan_enable()
990 clear_bit(HCI_LE_SCAN, &hdev->dev_flags); in hci_cc_le_set_scan_enable()
992 if (hdev->discovery.type == DISCOV_TYPE_INTERLEAVED && in hci_cc_le_set_scan_enable()
993 hdev->discovery.state == DISCOVERY_FINDING) { in hci_cc_le_set_scan_enable()
994 mgmt_interleaved_discovery(hdev); in hci_cc_le_set_scan_enable()
996 hci_dev_lock(hdev); in hci_cc_le_set_scan_enable()
997 hci_discovery_set_state(hdev, DISCOVERY_STOPPED); in hci_cc_le_set_scan_enable()
998 hci_dev_unlock(hdev); in hci_cc_le_set_scan_enable()
1009 static void hci_cc_le_read_white_list_size(struct hci_dev *hdev, in hci_cc_le_read_white_list_size() argument
1014 BT_DBG("%s status 0x%2.2x size %u", hdev->name, rp->status, rp->size); in hci_cc_le_read_white_list_size()
1017 hdev->le_white_list_size = rp->size; in hci_cc_le_read_white_list_size()
1020 static void hci_cc_le_read_supported_states(struct hci_dev *hdev, in hci_cc_le_read_supported_states() argument
1025 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_le_read_supported_states()
1028 memcpy(hdev->le_states, rp->le_states, 8); in hci_cc_le_read_supported_states()
1031 static void hci_cc_write_le_host_supported(struct hci_dev *hdev, in hci_cc_write_le_host_supported() argument
1037 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_write_le_host_supported()
1039 sent = hci_sent_cmd_data(hdev, HCI_OP_WRITE_LE_HOST_SUPPORTED); in hci_cc_write_le_host_supported()
1045 hdev->features[1][0] |= LMP_HOST_LE; in hci_cc_write_le_host_supported()
1047 hdev->features[1][0] &= ~LMP_HOST_LE; in hci_cc_write_le_host_supported()
1050 hdev->features[1][0] |= LMP_HOST_LE_BREDR; in hci_cc_write_le_host_supported()
1052 hdev->features[1][0] &= ~LMP_HOST_LE_BREDR; in hci_cc_write_le_host_supported()
1055 if (test_bit(HCI_MGMT, &hdev->dev_flags) && in hci_cc_write_le_host_supported()
1056 !test_bit(HCI_INIT, &hdev->flags)) in hci_cc_write_le_host_supported()
1057 mgmt_le_enable_complete(hdev, sent->le, status); in hci_cc_write_le_host_supported()
1060 static void hci_cc_write_remote_amp_assoc(struct hci_dev *hdev, in hci_cc_write_remote_amp_assoc() argument
1066 hdev->name, rp->status, rp->phy_handle); in hci_cc_write_remote_amp_assoc()
1071 amp_write_rem_assoc_continue(hdev, rp->phy_handle); in hci_cc_write_remote_amp_assoc()
1074 static void hci_cs_inquiry(struct hci_dev *hdev, __u8 status) in hci_cs_inquiry() argument
1076 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cs_inquiry()
1079 hci_conn_check_pending(hdev); in hci_cs_inquiry()
1080 hci_dev_lock(hdev); in hci_cs_inquiry()
1081 if (test_bit(HCI_MGMT, &hdev->dev_flags)) in hci_cs_inquiry()
1082 mgmt_start_discovery_failed(hdev, status); in hci_cs_inquiry()
1083 hci_dev_unlock(hdev); in hci_cs_inquiry()
1087 set_bit(HCI_INQUIRY, &hdev->flags); in hci_cs_inquiry()
1089 hci_dev_lock(hdev); in hci_cs_inquiry()
1090 hci_discovery_set_state(hdev, DISCOVERY_FINDING); in hci_cs_inquiry()
1091 hci_dev_unlock(hdev); in hci_cs_inquiry()
1094 static void hci_cs_create_conn(struct hci_dev *hdev, __u8 status) in hci_cs_create_conn() argument
1099 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cs_create_conn()
1101 cp = hci_sent_cmd_data(hdev, HCI_OP_CREATE_CONN); in hci_cs_create_conn()
1105 hci_dev_lock(hdev); in hci_cs_create_conn()
1107 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &cp->bdaddr); in hci_cs_create_conn()
1109 BT_DBG("%s bdaddr %pMR hcon %p", hdev->name, &cp->bdaddr, conn); in hci_cs_create_conn()
1122 conn = hci_conn_add(hdev, ACL_LINK, 0, &cp->bdaddr); in hci_cs_create_conn()
1131 hci_dev_unlock(hdev); in hci_cs_create_conn()
1134 static void hci_cs_add_sco(struct hci_dev *hdev, __u8 status) in hci_cs_add_sco() argument
1140 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cs_add_sco()
1145 cp = hci_sent_cmd_data(hdev, HCI_OP_ADD_SCO); in hci_cs_add_sco()
1151 BT_DBG("%s handle 0x%4.4x", hdev->name, handle); in hci_cs_add_sco()
1153 hci_dev_lock(hdev); in hci_cs_add_sco()
1155 acl = hci_conn_hash_lookup_handle(hdev, handle); in hci_cs_add_sco()
1166 hci_dev_unlock(hdev); in hci_cs_add_sco()
1169 static void hci_cs_auth_requested(struct hci_dev *hdev, __u8 status) in hci_cs_auth_requested() argument
1174 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cs_auth_requested()
1179 cp = hci_sent_cmd_data(hdev, HCI_OP_AUTH_REQUESTED); in hci_cs_auth_requested()
1183 hci_dev_lock(hdev); in hci_cs_auth_requested()
1185 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(cp->handle)); in hci_cs_auth_requested()
1193 hci_dev_unlock(hdev); in hci_cs_auth_requested()
1196 static void hci_cs_set_conn_encrypt(struct hci_dev *hdev, __u8 status) in hci_cs_set_conn_encrypt() argument
1201 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cs_set_conn_encrypt()
1206 cp = hci_sent_cmd_data(hdev, HCI_OP_SET_CONN_ENCRYPT); in hci_cs_set_conn_encrypt()
1210 hci_dev_lock(hdev); in hci_cs_set_conn_encrypt()
1212 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(cp->handle)); in hci_cs_set_conn_encrypt()
1220 hci_dev_unlock(hdev); in hci_cs_set_conn_encrypt()
1223 static int hci_outgoing_auth_needed(struct hci_dev *hdev, in hci_outgoing_auth_needed() argument
1241 static int hci_resolve_name(struct hci_dev *hdev, in hci_resolve_name() argument
1253 return hci_send_cmd(hdev, HCI_OP_REMOTE_NAME_REQ, sizeof(cp), &cp); in hci_resolve_name()
1256 static bool hci_resolve_next_name(struct hci_dev *hdev) in hci_resolve_next_name() argument
1258 struct discovery_state *discov = &hdev->discovery; in hci_resolve_next_name()
1264 e = hci_inquiry_cache_lookup_resolve(hdev, BDADDR_ANY, NAME_NEEDED); in hci_resolve_next_name()
1268 if (hci_resolve_name(hdev, e) == 0) { in hci_resolve_next_name()
1276 static void hci_check_pending_name(struct hci_dev *hdev, struct hci_conn *conn, in hci_check_pending_name() argument
1279 struct discovery_state *discov = &hdev->discovery; in hci_check_pending_name()
1283 mgmt_device_connected(hdev, bdaddr, ACL_LINK, 0x00, 0, name, in hci_check_pending_name()
1295 e = hci_inquiry_cache_lookup_resolve(hdev, bdaddr, NAME_PENDING); in hci_check_pending_name()
1306 mgmt_remote_name(hdev, bdaddr, ACL_LINK, 0x00, in hci_check_pending_name()
1312 if (hci_resolve_next_name(hdev)) in hci_check_pending_name()
1316 hci_discovery_set_state(hdev, DISCOVERY_STOPPED); in hci_check_pending_name()
1319 static void hci_cs_remote_name_req(struct hci_dev *hdev, __u8 status) in hci_cs_remote_name_req() argument
1324 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cs_remote_name_req()
1331 cp = hci_sent_cmd_data(hdev, HCI_OP_REMOTE_NAME_REQ); in hci_cs_remote_name_req()
1335 hci_dev_lock(hdev); in hci_cs_remote_name_req()
1337 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &cp->bdaddr); in hci_cs_remote_name_req()
1339 if (test_bit(HCI_MGMT, &hdev->dev_flags)) in hci_cs_remote_name_req()
1340 hci_check_pending_name(hdev, conn, &cp->bdaddr, NULL, 0); in hci_cs_remote_name_req()
1345 if (!hci_outgoing_auth_needed(hdev, conn)) in hci_cs_remote_name_req()
1351 hci_send_cmd(hdev, HCI_OP_AUTH_REQUESTED, sizeof(cp), &cp); in hci_cs_remote_name_req()
1355 hci_dev_unlock(hdev); in hci_cs_remote_name_req()
1358 static void hci_cs_read_remote_features(struct hci_dev *hdev, __u8 status) in hci_cs_read_remote_features() argument
1363 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cs_read_remote_features()
1368 cp = hci_sent_cmd_data(hdev, HCI_OP_READ_REMOTE_FEATURES); in hci_cs_read_remote_features()
1372 hci_dev_lock(hdev); in hci_cs_read_remote_features()
1374 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(cp->handle)); in hci_cs_read_remote_features()
1382 hci_dev_unlock(hdev); in hci_cs_read_remote_features()
1385 static void hci_cs_read_remote_ext_features(struct hci_dev *hdev, __u8 status) in hci_cs_read_remote_ext_features() argument
1390 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cs_read_remote_ext_features()
1395 cp = hci_sent_cmd_data(hdev, HCI_OP_READ_REMOTE_EXT_FEATURES); in hci_cs_read_remote_ext_features()
1399 hci_dev_lock(hdev); in hci_cs_read_remote_ext_features()
1401 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(cp->handle)); in hci_cs_read_remote_ext_features()
1409 hci_dev_unlock(hdev); in hci_cs_read_remote_ext_features()
1412 static void hci_cs_setup_sync_conn(struct hci_dev *hdev, __u8 status) in hci_cs_setup_sync_conn() argument
1418 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cs_setup_sync_conn()
1423 cp = hci_sent_cmd_data(hdev, HCI_OP_SETUP_SYNC_CONN); in hci_cs_setup_sync_conn()
1429 BT_DBG("%s handle 0x%4.4x", hdev->name, handle); in hci_cs_setup_sync_conn()
1431 hci_dev_lock(hdev); in hci_cs_setup_sync_conn()
1433 acl = hci_conn_hash_lookup_handle(hdev, handle); in hci_cs_setup_sync_conn()
1444 hci_dev_unlock(hdev); in hci_cs_setup_sync_conn()
1447 static void hci_cs_sniff_mode(struct hci_dev *hdev, __u8 status) in hci_cs_sniff_mode() argument
1452 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cs_sniff_mode()
1457 cp = hci_sent_cmd_data(hdev, HCI_OP_SNIFF_MODE); in hci_cs_sniff_mode()
1461 hci_dev_lock(hdev); in hci_cs_sniff_mode()
1463 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(cp->handle)); in hci_cs_sniff_mode()
1471 hci_dev_unlock(hdev); in hci_cs_sniff_mode()
1474 static void hci_cs_exit_sniff_mode(struct hci_dev *hdev, __u8 status) in hci_cs_exit_sniff_mode() argument
1479 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cs_exit_sniff_mode()
1484 cp = hci_sent_cmd_data(hdev, HCI_OP_EXIT_SNIFF_MODE); in hci_cs_exit_sniff_mode()
1488 hci_dev_lock(hdev); in hci_cs_exit_sniff_mode()
1490 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(cp->handle)); in hci_cs_exit_sniff_mode()
1498 hci_dev_unlock(hdev); in hci_cs_exit_sniff_mode()
1501 static void hci_cs_disconnect(struct hci_dev *hdev, u8 status) in hci_cs_disconnect() argument
1509 cp = hci_sent_cmd_data(hdev, HCI_OP_DISCONNECT); in hci_cs_disconnect()
1513 hci_dev_lock(hdev); in hci_cs_disconnect()
1515 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(cp->handle)); in hci_cs_disconnect()
1517 mgmt_disconnect_failed(hdev, &conn->dst, conn->type, in hci_cs_disconnect()
1520 hci_dev_unlock(hdev); in hci_cs_disconnect()
1523 static void hci_cs_le_create_conn(struct hci_dev *hdev, __u8 status) in hci_cs_le_create_conn() argument
1527 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cs_le_create_conn()
1530 hci_dev_lock(hdev); in hci_cs_le_create_conn()
1532 conn = hci_conn_hash_lookup_state(hdev, LE_LINK, BT_CONNECT); in hci_cs_le_create_conn()
1534 hci_dev_unlock(hdev); in hci_cs_le_create_conn()
1538 BT_DBG("%s bdaddr %pMR conn %p", hdev->name, &conn->dst, conn); in hci_cs_le_create_conn()
1541 mgmt_connect_failed(hdev, &conn->dst, conn->type, in hci_cs_le_create_conn()
1546 hci_dev_unlock(hdev); in hci_cs_le_create_conn()
1550 static void hci_cs_create_phylink(struct hci_dev *hdev, u8 status) in hci_cs_create_phylink() argument
1554 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cs_create_phylink()
1556 cp = hci_sent_cmd_data(hdev, HCI_OP_CREATE_PHY_LINK); in hci_cs_create_phylink()
1560 hci_dev_lock(hdev); in hci_cs_create_phylink()
1565 hcon = hci_conn_hash_lookup_handle(hdev, cp->phy_handle); in hci_cs_create_phylink()
1569 amp_write_remote_assoc(hdev, cp->phy_handle); in hci_cs_create_phylink()
1572 hci_dev_unlock(hdev); in hci_cs_create_phylink()
1575 static void hci_cs_accept_phylink(struct hci_dev *hdev, u8 status) in hci_cs_accept_phylink() argument
1579 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cs_accept_phylink()
1584 cp = hci_sent_cmd_data(hdev, HCI_OP_ACCEPT_PHY_LINK); in hci_cs_accept_phylink()
1588 amp_write_remote_assoc(hdev, cp->phy_handle); in hci_cs_accept_phylink()
1591 static void hci_inquiry_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) in hci_inquiry_complete_evt() argument
1594 struct discovery_state *discov = &hdev->discovery; in hci_inquiry_complete_evt()
1597 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_inquiry_complete_evt()
1599 hci_conn_check_pending(hdev); in hci_inquiry_complete_evt()
1601 if (!test_and_clear_bit(HCI_INQUIRY, &hdev->flags)) in hci_inquiry_complete_evt()
1605 wake_up_bit(&hdev->flags, HCI_INQUIRY); in hci_inquiry_complete_evt()
1607 if (!test_bit(HCI_MGMT, &hdev->dev_flags)) in hci_inquiry_complete_evt()
1610 hci_dev_lock(hdev); in hci_inquiry_complete_evt()
1616 hci_discovery_set_state(hdev, DISCOVERY_STOPPED); in hci_inquiry_complete_evt()
1620 e = hci_inquiry_cache_lookup_resolve(hdev, BDADDR_ANY, NAME_NEEDED); in hci_inquiry_complete_evt()
1621 if (e && hci_resolve_name(hdev, e) == 0) { in hci_inquiry_complete_evt()
1623 hci_discovery_set_state(hdev, DISCOVERY_RESOLVING); in hci_inquiry_complete_evt()
1625 hci_discovery_set_state(hdev, DISCOVERY_STOPPED); in hci_inquiry_complete_evt()
1629 hci_dev_unlock(hdev); in hci_inquiry_complete_evt()
1632 static void hci_inquiry_result_evt(struct hci_dev *hdev, struct sk_buff *skb) in hci_inquiry_result_evt() argument
1638 BT_DBG("%s num_rsp %d", hdev->name, num_rsp); in hci_inquiry_result_evt()
1643 if (test_bit(HCI_PERIODIC_INQ, &hdev->dev_flags)) in hci_inquiry_result_evt()
1646 hci_dev_lock(hdev); in hci_inquiry_result_evt()
1660 name_known = hci_inquiry_cache_update(hdev, &data, false, &ssp); in hci_inquiry_result_evt()
1661 mgmt_device_found(hdev, &info->bdaddr, ACL_LINK, 0x00, in hci_inquiry_result_evt()
1666 hci_dev_unlock(hdev); in hci_inquiry_result_evt()
1669 static void hci_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) in hci_conn_complete_evt() argument
1674 BT_DBG("%s", hdev->name); in hci_conn_complete_evt()
1676 hci_dev_lock(hdev); in hci_conn_complete_evt()
1678 conn = hci_conn_hash_lookup_ba(hdev, ev->link_type, &ev->bdaddr); in hci_conn_complete_evt()
1683 conn = hci_conn_hash_lookup_ba(hdev, ESCO_LINK, &ev->bdaddr); in hci_conn_complete_evt()
1698 !hci_find_link_key(hdev, &ev->bdaddr)) in hci_conn_complete_evt()
1707 if (test_bit(HCI_AUTH, &hdev->flags)) in hci_conn_complete_evt()
1710 if (test_bit(HCI_ENCRYPT, &hdev->flags)) in hci_conn_complete_evt()
1717 hci_send_cmd(hdev, HCI_OP_READ_REMOTE_FEATURES, in hci_conn_complete_evt()
1722 if (!conn->out && hdev->hci_ver < BLUETOOTH_VER_2_0) { in hci_conn_complete_evt()
1726 hci_send_cmd(hdev, HCI_OP_CHANGE_CONN_PTYPE, sizeof(cp), in hci_conn_complete_evt()
1732 mgmt_connect_failed(hdev, &ev->bdaddr, conn->type, in hci_conn_complete_evt()
1746 hci_dev_unlock(hdev); in hci_conn_complete_evt()
1748 hci_conn_check_pending(hdev); in hci_conn_complete_evt()
1751 static inline bool is_sco_active(struct hci_dev *hdev) in is_sco_active() argument
1753 if (hci_conn_hash_lookup_state(hdev, SCO_LINK, BT_CONNECTED) || in is_sco_active()
1754 (hci_conn_hash_lookup_state(hdev, ESCO_LINK, in is_sco_active()
1760 static void hci_conn_request_evt(struct hci_dev *hdev, struct sk_buff *skb) in hci_conn_request_evt() argument
1763 int mask = hdev->link_mode; in hci_conn_request_evt()
1766 BT_DBG("%s bdaddr %pMR type 0x%x", hdev->name, &ev->bdaddr, in hci_conn_request_evt()
1769 mask |= hci_proto_connect_ind(hdev, &ev->bdaddr, ev->link_type, in hci_conn_request_evt()
1773 !hci_blacklist_lookup(hdev, &ev->bdaddr)) { in hci_conn_request_evt()
1778 hci_dev_lock(hdev); in hci_conn_request_evt()
1780 ie = hci_inquiry_cache_lookup(hdev, &ev->bdaddr); in hci_conn_request_evt()
1784 conn = hci_conn_hash_lookup_ba(hdev, ev->link_type, in hci_conn_request_evt()
1788 conn = hci_conn_add(hdev, ev->link_type, 0, &ev->bdaddr); in hci_conn_request_evt()
1791 hci_dev_unlock(hdev); in hci_conn_request_evt()
1798 hci_dev_unlock(hdev); in hci_conn_request_evt()
1801 (!(flags & HCI_PROTO_DEFER) && !lmp_esco_capable(hdev))) { in hci_conn_request_evt()
1807 if (lmp_rswitch_capable(hdev) && ((mask & HCI_LM_MASTER) in hci_conn_request_evt()
1808 || is_sco_active(hdev))) in hci_conn_request_evt()
1813 hci_send_cmd(hdev, HCI_OP_ACCEPT_CONN_REQ, sizeof(cp), in hci_conn_request_evt()
1825 cp.content_format = cpu_to_le16(hdev->voice_setting); in hci_conn_request_evt()
1828 hci_send_cmd(hdev, HCI_OP_ACCEPT_SYNC_CONN_REQ, in hci_conn_request_evt()
1840 hci_send_cmd(hdev, HCI_OP_REJECT_CONN_REQ, sizeof(cp), &cp); in hci_conn_request_evt()
1860 static void hci_disconn_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) in hci_disconn_complete_evt() argument
1865 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); in hci_disconn_complete_evt()
1867 hci_dev_lock(hdev); in hci_disconn_complete_evt()
1869 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); in hci_disconn_complete_evt()
1879 mgmt_disconnect_failed(hdev, &conn->dst, conn->type, in hci_disconn_complete_evt()
1884 mgmt_device_disconnected(hdev, &conn->dst, conn->type, in hci_disconn_complete_evt()
1891 hci_remove_link_key(hdev, &conn->dst); in hci_disconn_complete_evt()
1897 hci_dev_unlock(hdev); in hci_disconn_complete_evt()
1900 static void hci_auth_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) in hci_auth_complete_evt() argument
1905 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); in hci_auth_complete_evt()
1907 hci_dev_lock(hdev); in hci_auth_complete_evt()
1909 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); in hci_auth_complete_evt()
1922 mgmt_auth_failed(hdev, &conn->dst, conn->type, conn->dst_type, in hci_auth_complete_evt()
1934 hci_send_cmd(hdev, HCI_OP_SET_CONN_ENCRYPT, sizeof(cp), in hci_auth_complete_evt()
1954 hci_send_cmd(hdev, HCI_OP_SET_CONN_ENCRYPT, sizeof(cp), in hci_auth_complete_evt()
1963 hci_dev_unlock(hdev); in hci_auth_complete_evt()
1966 static void hci_remote_name_evt(struct hci_dev *hdev, struct sk_buff *skb) in hci_remote_name_evt() argument
1971 BT_DBG("%s", hdev->name); in hci_remote_name_evt()
1973 hci_conn_check_pending(hdev); in hci_remote_name_evt()
1975 hci_dev_lock(hdev); in hci_remote_name_evt()
1977 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); in hci_remote_name_evt()
1979 if (!test_bit(HCI_MGMT, &hdev->dev_flags)) in hci_remote_name_evt()
1983 hci_check_pending_name(hdev, conn, &ev->bdaddr, ev->name, in hci_remote_name_evt()
1986 hci_check_pending_name(hdev, conn, &ev->bdaddr, NULL, 0); in hci_remote_name_evt()
1992 if (!hci_outgoing_auth_needed(hdev, conn)) in hci_remote_name_evt()
1998 hci_send_cmd(hdev, HCI_OP_AUTH_REQUESTED, sizeof(cp), &cp); in hci_remote_name_evt()
2002 hci_dev_unlock(hdev); in hci_remote_name_evt()
2005 static void hci_encrypt_change_evt(struct hci_dev *hdev, struct sk_buff *skb) in hci_encrypt_change_evt() argument
2010 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); in hci_encrypt_change_evt()
2012 hci_dev_lock(hdev); in hci_encrypt_change_evt()
2014 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); in hci_encrypt_change_evt()
2045 hci_dev_unlock(hdev); in hci_encrypt_change_evt()
2048 static void hci_change_link_key_complete_evt(struct hci_dev *hdev, in hci_change_link_key_complete_evt() argument
2054 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); in hci_change_link_key_complete_evt()
2056 hci_dev_lock(hdev); in hci_change_link_key_complete_evt()
2058 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); in hci_change_link_key_complete_evt()
2068 hci_dev_unlock(hdev); in hci_change_link_key_complete_evt()
2071 static void hci_remote_features_evt(struct hci_dev *hdev, in hci_remote_features_evt() argument
2077 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); in hci_remote_features_evt()
2079 hci_dev_lock(hdev); in hci_remote_features_evt()
2081 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); in hci_remote_features_evt()
2091 if (!ev->status && lmp_ssp_capable(hdev) && lmp_ssp_capable(conn)) { in hci_remote_features_evt()
2095 hci_send_cmd(hdev, HCI_OP_READ_REMOTE_EXT_FEATURES, in hci_remote_features_evt()
2105 hci_send_cmd(hdev, HCI_OP_REMOTE_NAME_REQ, sizeof(cp), &cp); in hci_remote_features_evt()
2107 mgmt_device_connected(hdev, &conn->dst, conn->type, in hci_remote_features_evt()
2111 if (!hci_outgoing_auth_needed(hdev, conn)) { in hci_remote_features_evt()
2118 hci_dev_unlock(hdev); in hci_remote_features_evt()
2121 static void hci_cmd_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) in hci_cmd_complete_evt() argument
2133 hci_cc_inquiry_cancel(hdev, skb); in hci_cmd_complete_evt()
2137 hci_cc_periodic_inq(hdev, skb); in hci_cmd_complete_evt()
2141 hci_cc_exit_periodic_inq(hdev, skb); in hci_cmd_complete_evt()
2145 hci_cc_remote_name_req_cancel(hdev, skb); in hci_cmd_complete_evt()
2149 hci_cc_role_discovery(hdev, skb); in hci_cmd_complete_evt()
2153 hci_cc_read_link_policy(hdev, skb); in hci_cmd_complete_evt()
2157 hci_cc_write_link_policy(hdev, skb); in hci_cmd_complete_evt()
2161 hci_cc_read_def_link_policy(hdev, skb); in hci_cmd_complete_evt()
2165 hci_cc_write_def_link_policy(hdev, skb); in hci_cmd_complete_evt()
2169 hci_cc_reset(hdev, skb); in hci_cmd_complete_evt()
2173 hci_cc_write_local_name(hdev, skb); in hci_cmd_complete_evt()
2177 hci_cc_read_local_name(hdev, skb); in hci_cmd_complete_evt()
2181 hci_cc_write_auth_enable(hdev, skb); in hci_cmd_complete_evt()
2185 hci_cc_write_encrypt_mode(hdev, skb); in hci_cmd_complete_evt()
2189 hci_cc_write_scan_enable(hdev, skb); in hci_cmd_complete_evt()
2193 hci_cc_read_class_of_dev(hdev, skb); in hci_cmd_complete_evt()
2197 hci_cc_write_class_of_dev(hdev, skb); in hci_cmd_complete_evt()
2201 hci_cc_read_voice_setting(hdev, skb); in hci_cmd_complete_evt()
2205 hci_cc_write_voice_setting(hdev, skb); in hci_cmd_complete_evt()
2209 hci_cc_write_ssp_mode(hdev, skb); in hci_cmd_complete_evt()
2213 hci_cc_read_local_version(hdev, skb); in hci_cmd_complete_evt()
2217 hci_cc_read_local_commands(hdev, skb); in hci_cmd_complete_evt()
2221 hci_cc_read_local_features(hdev, skb); in hci_cmd_complete_evt()
2225 hci_cc_read_local_ext_features(hdev, skb); in hci_cmd_complete_evt()
2229 hci_cc_read_buffer_size(hdev, skb); in hci_cmd_complete_evt()
2233 hci_cc_read_bd_addr(hdev, skb); in hci_cmd_complete_evt()
2237 hci_cc_read_page_scan_activity(hdev, skb); in hci_cmd_complete_evt()
2241 hci_cc_write_page_scan_activity(hdev, skb); in hci_cmd_complete_evt()
2245 hci_cc_read_page_scan_type(hdev, skb); in hci_cmd_complete_evt()
2249 hci_cc_write_page_scan_type(hdev, skb); in hci_cmd_complete_evt()
2253 hci_cc_read_data_block_size(hdev, skb); in hci_cmd_complete_evt()
2257 hci_cc_read_flow_control_mode(hdev, skb); in hci_cmd_complete_evt()
2261 hci_cc_read_local_amp_info(hdev, skb); in hci_cmd_complete_evt()
2265 hci_cc_read_local_amp_assoc(hdev, skb); in hci_cmd_complete_evt()
2269 hci_cc_read_inq_rsp_tx_power(hdev, skb); in hci_cmd_complete_evt()
2273 hci_cc_pin_code_reply(hdev, skb); in hci_cmd_complete_evt()
2277 hci_cc_pin_code_neg_reply(hdev, skb); in hci_cmd_complete_evt()
2281 hci_cc_read_local_oob_data_reply(hdev, skb); in hci_cmd_complete_evt()
2285 hci_cc_le_read_buffer_size(hdev, skb); in hci_cmd_complete_evt()
2289 hci_cc_le_read_local_features(hdev, skb); in hci_cmd_complete_evt()
2293 hci_cc_le_read_adv_tx_power(hdev, skb); in hci_cmd_complete_evt()
2297 hci_cc_user_confirm_reply(hdev, skb); in hci_cmd_complete_evt()
2301 hci_cc_user_confirm_neg_reply(hdev, skb); in hci_cmd_complete_evt()
2305 hci_cc_user_passkey_reply(hdev, skb); in hci_cmd_complete_evt()
2309 hci_cc_user_passkey_neg_reply(hdev, skb); in hci_cmd_complete_evt()
2313 hci_cc_le_set_scan_param(hdev, skb); in hci_cmd_complete_evt()
2317 hci_cc_le_set_adv_enable(hdev, skb); in hci_cmd_complete_evt()
2321 hci_cc_le_set_scan_enable(hdev, skb); in hci_cmd_complete_evt()
2325 hci_cc_le_read_white_list_size(hdev, skb); in hci_cmd_complete_evt()
2329 hci_cc_le_read_supported_states(hdev, skb); in hci_cmd_complete_evt()
2333 hci_cc_write_le_host_supported(hdev, skb); in hci_cmd_complete_evt()
2337 hci_cc_write_remote_amp_assoc(hdev, skb); in hci_cmd_complete_evt()
2341 BT_DBG("%s opcode 0x%4.4x", hdev->name, opcode); in hci_cmd_complete_evt()
2346 del_timer(&hdev->cmd_timer); in hci_cmd_complete_evt()
2348 hci_req_cmd_complete(hdev, opcode, status); in hci_cmd_complete_evt()
2350 if (ev->ncmd && !test_bit(HCI_RESET, &hdev->flags)) { in hci_cmd_complete_evt()
2351 atomic_set(&hdev->cmd_cnt, 1); in hci_cmd_complete_evt()
2352 if (!skb_queue_empty(&hdev->cmd_q)) in hci_cmd_complete_evt()
2353 queue_work(hdev->workqueue, &hdev->cmd_work); in hci_cmd_complete_evt()
2357 static void hci_cmd_status_evt(struct hci_dev *hdev, struct sk_buff *skb) in hci_cmd_status_evt() argument
2368 hci_cs_inquiry(hdev, ev->status); in hci_cmd_status_evt()
2372 hci_cs_create_conn(hdev, ev->status); in hci_cmd_status_evt()
2376 hci_cs_add_sco(hdev, ev->status); in hci_cmd_status_evt()
2380 hci_cs_auth_requested(hdev, ev->status); in hci_cmd_status_evt()
2384 hci_cs_set_conn_encrypt(hdev, ev->status); in hci_cmd_status_evt()
2388 hci_cs_remote_name_req(hdev, ev->status); in hci_cmd_status_evt()
2392 hci_cs_read_remote_features(hdev, ev->status); in hci_cmd_status_evt()
2396 hci_cs_read_remote_ext_features(hdev, ev->status); in hci_cmd_status_evt()
2400 hci_cs_setup_sync_conn(hdev, ev->status); in hci_cmd_status_evt()
2404 hci_cs_sniff_mode(hdev, ev->status); in hci_cmd_status_evt()
2408 hci_cs_exit_sniff_mode(hdev, ev->status); in hci_cmd_status_evt()
2412 hci_cs_disconnect(hdev, ev->status); in hci_cmd_status_evt()
2416 hci_cs_le_create_conn(hdev, ev->status); in hci_cmd_status_evt()
2420 hci_cs_create_phylink(hdev, ev->status); in hci_cmd_status_evt()
2424 hci_cs_accept_phylink(hdev, ev->status); in hci_cmd_status_evt()
2428 BT_DBG("%s opcode 0x%4.4x", hdev->name, opcode); in hci_cmd_status_evt()
2433 del_timer(&hdev->cmd_timer); in hci_cmd_status_evt()
2436 (hdev->sent_cmd && !bt_cb(hdev->sent_cmd)->req.event)) in hci_cmd_status_evt()
2437 hci_req_cmd_complete(hdev, opcode, ev->status); in hci_cmd_status_evt()
2439 if (ev->ncmd && !test_bit(HCI_RESET, &hdev->flags)) { in hci_cmd_status_evt()
2440 atomic_set(&hdev->cmd_cnt, 1); in hci_cmd_status_evt()
2441 if (!skb_queue_empty(&hdev->cmd_q)) in hci_cmd_status_evt()
2442 queue_work(hdev->workqueue, &hdev->cmd_work); in hci_cmd_status_evt()
2446 static void hci_role_change_evt(struct hci_dev *hdev, struct sk_buff *skb) in hci_role_change_evt() argument
2451 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); in hci_role_change_evt()
2453 hci_dev_lock(hdev); in hci_role_change_evt()
2455 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); in hci_role_change_evt()
2469 hci_dev_unlock(hdev); in hci_role_change_evt()
2472 static void hci_num_comp_pkts_evt(struct hci_dev *hdev, struct sk_buff *skb) in hci_num_comp_pkts_evt() argument
2477 if (hdev->flow_ctl_mode != HCI_FLOW_CTL_MODE_PACKET_BASED) { in hci_num_comp_pkts_evt()
2478 BT_ERR("Wrong event for mode %d", hdev->flow_ctl_mode); in hci_num_comp_pkts_evt()
2484 BT_DBG("%s bad parameters", hdev->name); in hci_num_comp_pkts_evt()
2488 BT_DBG("%s num_hndl %d", hdev->name, ev->num_hndl); in hci_num_comp_pkts_evt()
2498 conn = hci_conn_hash_lookup_handle(hdev, handle); in hci_num_comp_pkts_evt()
2506 hdev->acl_cnt += count; in hci_num_comp_pkts_evt()
2507 if (hdev->acl_cnt > hdev->acl_pkts) in hci_num_comp_pkts_evt()
2508 hdev->acl_cnt = hdev->acl_pkts; in hci_num_comp_pkts_evt()
2512 if (hdev->le_pkts) { in hci_num_comp_pkts_evt()
2513 hdev->le_cnt += count; in hci_num_comp_pkts_evt()
2514 if (hdev->le_cnt > hdev->le_pkts) in hci_num_comp_pkts_evt()
2515 hdev->le_cnt = hdev->le_pkts; in hci_num_comp_pkts_evt()
2517 hdev->acl_cnt += count; in hci_num_comp_pkts_evt()
2518 if (hdev->acl_cnt > hdev->acl_pkts) in hci_num_comp_pkts_evt()
2519 hdev->acl_cnt = hdev->acl_pkts; in hci_num_comp_pkts_evt()
2524 hdev->sco_cnt += count; in hci_num_comp_pkts_evt()
2525 if (hdev->sco_cnt > hdev->sco_pkts) in hci_num_comp_pkts_evt()
2526 hdev->sco_cnt = hdev->sco_pkts; in hci_num_comp_pkts_evt()
2535 queue_work(hdev->workqueue, &hdev->tx_work); in hci_num_comp_pkts_evt()
2538 static struct hci_conn *__hci_conn_lookup_handle(struct hci_dev *hdev, in __hci_conn_lookup_handle() argument
2543 switch (hdev->dev_type) { in __hci_conn_lookup_handle()
2545 return hci_conn_hash_lookup_handle(hdev, handle); in __hci_conn_lookup_handle()
2547 chan = hci_chan_lookup_handle(hdev, handle); in __hci_conn_lookup_handle()
2552 BT_ERR("%s unknown dev_type %d", hdev->name, hdev->dev_type); in __hci_conn_lookup_handle()
2559 static void hci_num_comp_blocks_evt(struct hci_dev *hdev, struct sk_buff *skb) in hci_num_comp_blocks_evt() argument
2564 if (hdev->flow_ctl_mode != HCI_FLOW_CTL_MODE_BLOCK_BASED) { in hci_num_comp_blocks_evt()
2565 BT_ERR("Wrong event for mode %d", hdev->flow_ctl_mode); in hci_num_comp_blocks_evt()
2571 BT_DBG("%s bad parameters", hdev->name); in hci_num_comp_blocks_evt()
2575 BT_DBG("%s num_blocks %d num_hndl %d", hdev->name, ev->num_blocks, in hci_num_comp_blocks_evt()
2586 conn = __hci_conn_lookup_handle(hdev, handle); in hci_num_comp_blocks_evt()
2595 hdev->block_cnt += block_count; in hci_num_comp_blocks_evt()
2596 if (hdev->block_cnt > hdev->num_blocks) in hci_num_comp_blocks_evt()
2597 hdev->block_cnt = hdev->num_blocks; in hci_num_comp_blocks_evt()
2606 queue_work(hdev->workqueue, &hdev->tx_work); in hci_num_comp_blocks_evt()
2609 static void hci_mode_change_evt(struct hci_dev *hdev, struct sk_buff *skb) in hci_mode_change_evt() argument
2614 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); in hci_mode_change_evt()
2616 hci_dev_lock(hdev); in hci_mode_change_evt()
2618 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); in hci_mode_change_evt()
2635 hci_dev_unlock(hdev); in hci_mode_change_evt()
2638 static void hci_pin_code_request_evt(struct hci_dev *hdev, struct sk_buff *skb) in hci_pin_code_request_evt() argument
2643 BT_DBG("%s", hdev->name); in hci_pin_code_request_evt()
2645 hci_dev_lock(hdev); in hci_pin_code_request_evt()
2647 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); in hci_pin_code_request_evt()
2657 if (!test_bit(HCI_PAIRABLE, &hdev->dev_flags)) in hci_pin_code_request_evt()
2658 hci_send_cmd(hdev, HCI_OP_PIN_CODE_NEG_REPLY, in hci_pin_code_request_evt()
2660 else if (test_bit(HCI_MGMT, &hdev->dev_flags)) { in hci_pin_code_request_evt()
2668 mgmt_pin_code_request(hdev, &ev->bdaddr, secure); in hci_pin_code_request_evt()
2672 hci_dev_unlock(hdev); in hci_pin_code_request_evt()
2675 static void hci_link_key_request_evt(struct hci_dev *hdev, struct sk_buff *skb) in hci_link_key_request_evt() argument
2682 BT_DBG("%s", hdev->name); in hci_link_key_request_evt()
2684 if (!test_bit(HCI_LINK_KEYS, &hdev->dev_flags)) in hci_link_key_request_evt()
2687 hci_dev_lock(hdev); in hci_link_key_request_evt()
2689 key = hci_find_link_key(hdev, &ev->bdaddr); in hci_link_key_request_evt()
2691 BT_DBG("%s link key not found for %pMR", hdev->name, in hci_link_key_request_evt()
2696 BT_DBG("%s found key type %u for %pMR", hdev->name, key->type, in hci_link_key_request_evt()
2699 if (!test_bit(HCI_DEBUG_KEYS, &hdev->dev_flags) && in hci_link_key_request_evt()
2701 BT_DBG("%s ignoring debug key", hdev->name); in hci_link_key_request_evt()
2705 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); in hci_link_key_request_evt()
2709 BT_DBG("%s ignoring unauthenticated key", hdev->name); in hci_link_key_request_evt()
2716 hdev->name); in hci_link_key_request_evt()
2727 hci_send_cmd(hdev, HCI_OP_LINK_KEY_REPLY, sizeof(cp), &cp); in hci_link_key_request_evt()
2729 hci_dev_unlock(hdev); in hci_link_key_request_evt()
2734 hci_send_cmd(hdev, HCI_OP_LINK_KEY_NEG_REPLY, 6, &ev->bdaddr); in hci_link_key_request_evt()
2735 hci_dev_unlock(hdev); in hci_link_key_request_evt()
2738 static void hci_link_key_notify_evt(struct hci_dev *hdev, struct sk_buff *skb) in hci_link_key_notify_evt() argument
2744 BT_DBG("%s", hdev->name); in hci_link_key_notify_evt()
2746 hci_dev_lock(hdev); in hci_link_key_notify_evt()
2748 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); in hci_link_key_notify_evt()
2760 if (test_bit(HCI_LINK_KEYS, &hdev->dev_flags)) in hci_link_key_notify_evt()
2761 hci_add_link_key(hdev, conn, 1, &ev->bdaddr, ev->link_key, in hci_link_key_notify_evt()
2764 hci_dev_unlock(hdev); in hci_link_key_notify_evt()
2767 static void hci_clock_offset_evt(struct hci_dev *hdev, struct sk_buff *skb) in hci_clock_offset_evt() argument
2772 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); in hci_clock_offset_evt()
2774 hci_dev_lock(hdev); in hci_clock_offset_evt()
2776 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); in hci_clock_offset_evt()
2780 ie = hci_inquiry_cache_lookup(hdev, &conn->dst); in hci_clock_offset_evt()
2787 hci_dev_unlock(hdev); in hci_clock_offset_evt()
2790 static void hci_pkt_type_change_evt(struct hci_dev *hdev, struct sk_buff *skb) in hci_pkt_type_change_evt() argument
2795 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); in hci_pkt_type_change_evt()
2797 hci_dev_lock(hdev); in hci_pkt_type_change_evt()
2799 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); in hci_pkt_type_change_evt()
2803 hci_dev_unlock(hdev); in hci_pkt_type_change_evt()
2806 static void hci_pscan_rep_mode_evt(struct hci_dev *hdev, struct sk_buff *skb) in hci_pscan_rep_mode_evt() argument
2811 BT_DBG("%s", hdev->name); in hci_pscan_rep_mode_evt()
2813 hci_dev_lock(hdev); in hci_pscan_rep_mode_evt()
2815 ie = hci_inquiry_cache_lookup(hdev, &ev->bdaddr); in hci_pscan_rep_mode_evt()
2821 hci_dev_unlock(hdev); in hci_pscan_rep_mode_evt()
2824 static void hci_inquiry_result_with_rssi_evt(struct hci_dev *hdev, in hci_inquiry_result_with_rssi_evt() argument
2831 BT_DBG("%s num_rsp %d", hdev->name, num_rsp); in hci_inquiry_result_with_rssi_evt()
2836 if (test_bit(HCI_PERIODIC_INQ, &hdev->dev_flags)) in hci_inquiry_result_with_rssi_evt()
2839 hci_dev_lock(hdev); in hci_inquiry_result_with_rssi_evt()
2855 name_known = hci_inquiry_cache_update(hdev, &data, in hci_inquiry_result_with_rssi_evt()
2857 mgmt_device_found(hdev, &info->bdaddr, ACL_LINK, 0x00, in hci_inquiry_result_with_rssi_evt()
2873 name_known = hci_inquiry_cache_update(hdev, &data, in hci_inquiry_result_with_rssi_evt()
2875 mgmt_device_found(hdev, &info->bdaddr, ACL_LINK, 0x00, in hci_inquiry_result_with_rssi_evt()
2881 hci_dev_unlock(hdev); in hci_inquiry_result_with_rssi_evt()
2884 static void hci_remote_ext_features_evt(struct hci_dev *hdev, in hci_remote_ext_features_evt() argument
2890 BT_DBG("%s", hdev->name); in hci_remote_ext_features_evt()
2892 hci_dev_lock(hdev); in hci_remote_ext_features_evt()
2894 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); in hci_remote_ext_features_evt()
2904 ie = hci_inquiry_cache_lookup(hdev, &conn->dst); in hci_remote_ext_features_evt()
2931 hci_send_cmd(hdev, HCI_OP_REMOTE_NAME_REQ, sizeof(cp), &cp); in hci_remote_ext_features_evt()
2933 mgmt_device_connected(hdev, &conn->dst, conn->type, in hci_remote_ext_features_evt()
2937 if (!hci_outgoing_auth_needed(hdev, conn)) { in hci_remote_ext_features_evt()
2944 hci_dev_unlock(hdev); in hci_remote_ext_features_evt()
2947 static void hci_sync_conn_complete_evt(struct hci_dev *hdev, in hci_sync_conn_complete_evt() argument
2953 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); in hci_sync_conn_complete_evt()
2955 hci_dev_lock(hdev); in hci_sync_conn_complete_evt()
2957 conn = hci_conn_hash_lookup_ba(hdev, ev->link_type, &ev->bdaddr); in hci_sync_conn_complete_evt()
2962 conn = hci_conn_hash_lookup_ba(hdev, ESCO_LINK, &ev->bdaddr); in hci_sync_conn_complete_evt()
2983 conn->pkt_type = (hdev->esco_type & SCO_ESCO_MASK) | in hci_sync_conn_complete_evt()
2984 (hdev->esco_type & EDR_ESCO_MASK); in hci_sync_conn_complete_evt()
3000 hci_dev_unlock(hdev); in hci_sync_conn_complete_evt()
3003 static void hci_extended_inquiry_result_evt(struct hci_dev *hdev, in hci_extended_inquiry_result_evt() argument
3011 BT_DBG("%s num_rsp %d", hdev->name, num_rsp); in hci_extended_inquiry_result_evt()
3016 if (test_bit(HCI_PERIODIC_INQ, &hdev->dev_flags)) in hci_extended_inquiry_result_evt()
3019 hci_dev_lock(hdev); in hci_extended_inquiry_result_evt()
3033 if (test_bit(HCI_MGMT, &hdev->dev_flags)) in hci_extended_inquiry_result_evt()
3040 name_known = hci_inquiry_cache_update(hdev, &data, name_known, in hci_extended_inquiry_result_evt()
3043 mgmt_device_found(hdev, &info->bdaddr, ACL_LINK, 0x00, in hci_extended_inquiry_result_evt()
3048 hci_dev_unlock(hdev); in hci_extended_inquiry_result_evt()
3051 static void hci_key_refresh_complete_evt(struct hci_dev *hdev, in hci_key_refresh_complete_evt() argument
3057 BT_DBG("%s status 0x%2.2x handle 0x%4.4x", hdev->name, ev->status, in hci_key_refresh_complete_evt()
3060 hci_dev_lock(hdev); in hci_key_refresh_complete_evt()
3062 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); in hci_key_refresh_complete_evt()
3092 hci_dev_unlock(hdev); in hci_key_refresh_complete_evt()
3114 static void hci_io_capa_request_evt(struct hci_dev *hdev, struct sk_buff *skb) in hci_io_capa_request_evt() argument
3119 BT_DBG("%s", hdev->name); in hci_io_capa_request_evt()
3121 hci_dev_lock(hdev); in hci_io_capa_request_evt()
3123 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); in hci_io_capa_request_evt()
3129 if (!test_bit(HCI_MGMT, &hdev->dev_flags)) in hci_io_capa_request_evt()
3132 if (test_bit(HCI_PAIRABLE, &hdev->dev_flags) || in hci_io_capa_request_evt()
3144 if (hci_find_remote_oob_data(hdev, &conn->dst) && in hci_io_capa_request_evt()
3150 hci_send_cmd(hdev, HCI_OP_IO_CAPABILITY_REPLY, in hci_io_capa_request_evt()
3158 hci_send_cmd(hdev, HCI_OP_IO_CAPABILITY_NEG_REPLY, in hci_io_capa_request_evt()
3163 hci_dev_unlock(hdev); in hci_io_capa_request_evt()
3166 static void hci_io_capa_reply_evt(struct hci_dev *hdev, struct sk_buff *skb) in hci_io_capa_reply_evt() argument
3171 BT_DBG("%s", hdev->name); in hci_io_capa_reply_evt()
3173 hci_dev_lock(hdev); in hci_io_capa_reply_evt()
3175 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); in hci_io_capa_reply_evt()
3185 hci_dev_unlock(hdev); in hci_io_capa_reply_evt()
3188 static void hci_user_confirm_request_evt(struct hci_dev *hdev, in hci_user_confirm_request_evt() argument
3195 BT_DBG("%s", hdev->name); in hci_user_confirm_request_evt()
3197 hci_dev_lock(hdev); in hci_user_confirm_request_evt()
3199 if (!test_bit(HCI_MGMT, &hdev->dev_flags)) in hci_user_confirm_request_evt()
3202 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); in hci_user_confirm_request_evt()
3216 hci_send_cmd(hdev, HCI_OP_USER_CONFIRM_NEG_REPLY, in hci_user_confirm_request_evt()
3235 hdev->auto_accept_delay); in hci_user_confirm_request_evt()
3237 if (hdev->auto_accept_delay > 0) { in hci_user_confirm_request_evt()
3238 int delay = msecs_to_jiffies(hdev->auto_accept_delay); in hci_user_confirm_request_evt()
3243 hci_send_cmd(hdev, HCI_OP_USER_CONFIRM_REPLY, in hci_user_confirm_request_evt()
3249 mgmt_user_confirm_request(hdev, &ev->bdaddr, ACL_LINK, 0, ev->passkey, in hci_user_confirm_request_evt()
3253 hci_dev_unlock(hdev); in hci_user_confirm_request_evt()
3256 static void hci_user_passkey_request_evt(struct hci_dev *hdev, in hci_user_passkey_request_evt() argument
3261 BT_DBG("%s", hdev->name); in hci_user_passkey_request_evt()
3263 if (test_bit(HCI_MGMT, &hdev->dev_flags)) in hci_user_passkey_request_evt()
3264 mgmt_user_passkey_request(hdev, &ev->bdaddr, ACL_LINK, 0); in hci_user_passkey_request_evt()
3267 static void hci_user_passkey_notify_evt(struct hci_dev *hdev, in hci_user_passkey_notify_evt() argument
3273 BT_DBG("%s", hdev->name); in hci_user_passkey_notify_evt()
3275 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); in hci_user_passkey_notify_evt()
3282 if (test_bit(HCI_MGMT, &hdev->dev_flags)) in hci_user_passkey_notify_evt()
3283 mgmt_user_passkey_notify(hdev, &conn->dst, conn->type, in hci_user_passkey_notify_evt()
3288 static void hci_keypress_notify_evt(struct hci_dev *hdev, struct sk_buff *skb) in hci_keypress_notify_evt() argument
3293 BT_DBG("%s", hdev->name); in hci_keypress_notify_evt()
3295 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); in hci_keypress_notify_evt()
3320 if (test_bit(HCI_MGMT, &hdev->dev_flags)) in hci_keypress_notify_evt()
3321 mgmt_user_passkey_notify(hdev, &conn->dst, conn->type, in hci_keypress_notify_evt()
3326 static void hci_simple_pair_complete_evt(struct hci_dev *hdev, in hci_simple_pair_complete_evt() argument
3332 BT_DBG("%s", hdev->name); in hci_simple_pair_complete_evt()
3334 hci_dev_lock(hdev); in hci_simple_pair_complete_evt()
3336 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); in hci_simple_pair_complete_evt()
3346 mgmt_auth_failed(hdev, &conn->dst, conn->type, conn->dst_type, in hci_simple_pair_complete_evt()
3352 hci_dev_unlock(hdev); in hci_simple_pair_complete_evt()
3355 static void hci_remote_host_features_evt(struct hci_dev *hdev, in hci_remote_host_features_evt() argument
3362 BT_DBG("%s", hdev->name); in hci_remote_host_features_evt()
3364 hci_dev_lock(hdev); in hci_remote_host_features_evt()
3366 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); in hci_remote_host_features_evt()
3370 ie = hci_inquiry_cache_lookup(hdev, &ev->bdaddr); in hci_remote_host_features_evt()
3374 hci_dev_unlock(hdev); in hci_remote_host_features_evt()
3377 static void hci_remote_oob_data_request_evt(struct hci_dev *hdev, in hci_remote_oob_data_request_evt() argument
3383 BT_DBG("%s", hdev->name); in hci_remote_oob_data_request_evt()
3385 hci_dev_lock(hdev); in hci_remote_oob_data_request_evt()
3387 if (!test_bit(HCI_MGMT, &hdev->dev_flags)) in hci_remote_oob_data_request_evt()
3390 data = hci_find_remote_oob_data(hdev, &ev->bdaddr); in hci_remote_oob_data_request_evt()
3398 hci_send_cmd(hdev, HCI_OP_REMOTE_OOB_DATA_REPLY, sizeof(cp), in hci_remote_oob_data_request_evt()
3404 hci_send_cmd(hdev, HCI_OP_REMOTE_OOB_DATA_NEG_REPLY, sizeof(cp), in hci_remote_oob_data_request_evt()
3409 hci_dev_unlock(hdev); in hci_remote_oob_data_request_evt()
3412 static void hci_phy_link_complete_evt(struct hci_dev *hdev, in hci_phy_link_complete_evt() argument
3418 BT_DBG("%s handle 0x%2.2x status 0x%2.2x", hdev->name, ev->phy_handle, in hci_phy_link_complete_evt()
3421 hci_dev_lock(hdev); in hci_phy_link_complete_evt()
3423 hcon = hci_conn_hash_lookup_handle(hdev, ev->phy_handle); in hci_phy_link_complete_evt()
3425 hci_dev_unlock(hdev); in hci_phy_link_complete_evt()
3431 hci_dev_unlock(hdev); in hci_phy_link_complete_evt()
3448 hci_dev_unlock(hdev); in hci_phy_link_complete_evt()
3451 static void hci_loglink_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) in hci_loglink_complete_evt() argument
3459 hdev->name, le16_to_cpu(ev->handle), ev->phy_handle, in hci_loglink_complete_evt()
3462 hcon = hci_conn_hash_lookup_handle(hdev, ev->phy_handle); in hci_loglink_complete_evt()
3481 bredr_chan->conn->mtu = hdev->block_mtu; in hci_loglink_complete_evt()
3489 static void hci_disconn_loglink_complete_evt(struct hci_dev *hdev, in hci_disconn_loglink_complete_evt() argument
3495 BT_DBG("%s log handle 0x%4.4x status 0x%2.2x", hdev->name, in hci_disconn_loglink_complete_evt()
3501 hci_dev_lock(hdev); in hci_disconn_loglink_complete_evt()
3503 hchan = hci_chan_lookup_handle(hdev, le16_to_cpu(ev->handle)); in hci_disconn_loglink_complete_evt()
3510 hci_dev_unlock(hdev); in hci_disconn_loglink_complete_evt()
3513 static void hci_disconn_phylink_complete_evt(struct hci_dev *hdev, in hci_disconn_phylink_complete_evt() argument
3519 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); in hci_disconn_phylink_complete_evt()
3524 hci_dev_lock(hdev); in hci_disconn_phylink_complete_evt()
3526 hcon = hci_conn_hash_lookup_handle(hdev, ev->phy_handle); in hci_disconn_phylink_complete_evt()
3532 hci_dev_unlock(hdev); in hci_disconn_phylink_complete_evt()
3535 static void hci_le_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) in hci_le_conn_complete_evt() argument
3540 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); in hci_le_conn_complete_evt()
3542 hci_dev_lock(hdev); in hci_le_conn_complete_evt()
3544 conn = hci_conn_hash_lookup_state(hdev, LE_LINK, BT_CONNECT); in hci_le_conn_complete_evt()
3546 conn = hci_conn_add(hdev, LE_LINK, 0, &ev->bdaddr); in hci_le_conn_complete_evt()
3561 mgmt_connect_failed(hdev, &conn->dst, conn->type, in hci_le_conn_complete_evt()
3570 mgmt_device_connected(hdev, &ev->bdaddr, conn->type, in hci_le_conn_complete_evt()
3582 hci_dev_unlock(hdev); in hci_le_conn_complete_evt()
3585 static void hci_le_adv_report_evt(struct hci_dev *hdev, struct sk_buff *skb) in hci_le_adv_report_evt() argument
3595 mgmt_device_found(hdev, &ev->bdaddr, LE_LINK, ev->bdaddr_type, in hci_le_adv_report_evt()
3602 static void hci_le_ltk_request_evt(struct hci_dev *hdev, struct sk_buff *skb) in hci_le_ltk_request_evt() argument
3610 BT_DBG("%s handle 0x%4.4x", hdev->name, __le16_to_cpu(ev->handle)); in hci_le_ltk_request_evt()
3612 hci_dev_lock(hdev); in hci_le_ltk_request_evt()
3614 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); in hci_le_ltk_request_evt()
3618 ltk = hci_find_ltk(hdev, ev->ediv, ev->random); in hci_le_ltk_request_evt()
3628 hci_send_cmd(hdev, HCI_OP_LE_LTK_REPLY, sizeof(cp), &cp); in hci_le_ltk_request_evt()
3635 hci_dev_unlock(hdev); in hci_le_ltk_request_evt()
3641 hci_send_cmd(hdev, HCI_OP_LE_LTK_NEG_REPLY, sizeof(neg), &neg); in hci_le_ltk_request_evt()
3642 hci_dev_unlock(hdev); in hci_le_ltk_request_evt()
3645 static void hci_le_meta_evt(struct hci_dev *hdev, struct sk_buff *skb) in hci_le_meta_evt() argument
3653 hci_le_conn_complete_evt(hdev, skb); in hci_le_meta_evt()
3657 hci_le_adv_report_evt(hdev, skb); in hci_le_meta_evt()
3661 hci_le_ltk_request_evt(hdev, skb); in hci_le_meta_evt()
3669 static void hci_chan_selected_evt(struct hci_dev *hdev, struct sk_buff *skb) in hci_chan_selected_evt() argument
3674 BT_DBG("%s handle 0x%2.2x", hdev->name, ev->phy_handle); in hci_chan_selected_evt()
3678 hcon = hci_conn_hash_lookup_handle(hdev, ev->phy_handle); in hci_chan_selected_evt()
3682 amp_read_loc_assoc_final_data(hdev, hcon); in hci_chan_selected_evt()
3685 void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb) in hci_event_packet() argument
3690 hci_dev_lock(hdev); in hci_event_packet()
3695 if (hdev->req_status == HCI_REQ_PEND) { in hci_event_packet()
3696 kfree_skb(hdev->recv_evt); in hci_event_packet()
3697 hdev->recv_evt = skb_clone(skb, GFP_KERNEL); in hci_event_packet()
3700 hci_dev_unlock(hdev); in hci_event_packet()
3704 if (hdev->sent_cmd && bt_cb(hdev->sent_cmd)->req.event == event) { in hci_event_packet()
3705 struct hci_command_hdr *hdr = (void *) hdev->sent_cmd->data; in hci_event_packet()
3708 hci_req_cmd_complete(hdev, opcode, 0); in hci_event_packet()
3713 hci_inquiry_complete_evt(hdev, skb); in hci_event_packet()
3717 hci_inquiry_result_evt(hdev, skb); in hci_event_packet()
3721 hci_conn_complete_evt(hdev, skb); in hci_event_packet()
3725 hci_conn_request_evt(hdev, skb); in hci_event_packet()
3729 hci_disconn_complete_evt(hdev, skb); in hci_event_packet()
3733 hci_auth_complete_evt(hdev, skb); in hci_event_packet()
3737 hci_remote_name_evt(hdev, skb); in hci_event_packet()
3741 hci_encrypt_change_evt(hdev, skb); in hci_event_packet()
3745 hci_change_link_key_complete_evt(hdev, skb); in hci_event_packet()
3749 hci_remote_features_evt(hdev, skb); in hci_event_packet()
3753 hci_cmd_complete_evt(hdev, skb); in hci_event_packet()
3757 hci_cmd_status_evt(hdev, skb); in hci_event_packet()
3761 hci_role_change_evt(hdev, skb); in hci_event_packet()
3765 hci_num_comp_pkts_evt(hdev, skb); in hci_event_packet()
3769 hci_mode_change_evt(hdev, skb); in hci_event_packet()
3773 hci_pin_code_request_evt(hdev, skb); in hci_event_packet()
3777 hci_link_key_request_evt(hdev, skb); in hci_event_packet()
3781 hci_link_key_notify_evt(hdev, skb); in hci_event_packet()
3785 hci_clock_offset_evt(hdev, skb); in hci_event_packet()
3789 hci_pkt_type_change_evt(hdev, skb); in hci_event_packet()
3793 hci_pscan_rep_mode_evt(hdev, skb); in hci_event_packet()
3797 hci_inquiry_result_with_rssi_evt(hdev, skb); in hci_event_packet()
3801 hci_remote_ext_features_evt(hdev, skb); in hci_event_packet()
3805 hci_sync_conn_complete_evt(hdev, skb); in hci_event_packet()
3809 hci_extended_inquiry_result_evt(hdev, skb); in hci_event_packet()
3813 hci_key_refresh_complete_evt(hdev, skb); in hci_event_packet()
3817 hci_io_capa_request_evt(hdev, skb); in hci_event_packet()
3821 hci_io_capa_reply_evt(hdev, skb); in hci_event_packet()
3825 hci_user_confirm_request_evt(hdev, skb); in hci_event_packet()
3829 hci_user_passkey_request_evt(hdev, skb); in hci_event_packet()
3833 hci_user_passkey_notify_evt(hdev, skb); in hci_event_packet()
3837 hci_keypress_notify_evt(hdev, skb); in hci_event_packet()
3841 hci_simple_pair_complete_evt(hdev, skb); in hci_event_packet()
3845 hci_remote_host_features_evt(hdev, skb); in hci_event_packet()
3849 hci_le_meta_evt(hdev, skb); in hci_event_packet()
3853 hci_chan_selected_evt(hdev, skb); in hci_event_packet()
3857 hci_remote_oob_data_request_evt(hdev, skb); in hci_event_packet()
3861 hci_phy_link_complete_evt(hdev, skb); in hci_event_packet()
3865 hci_loglink_complete_evt(hdev, skb); in hci_event_packet()
3869 hci_disconn_loglink_complete_evt(hdev, skb); in hci_event_packet()
3873 hci_disconn_phylink_complete_evt(hdev, skb); in hci_event_packet()
3877 hci_num_comp_blocks_evt(hdev, skb); in hci_event_packet()
3881 BT_DBG("%s event 0x%2.2x", hdev->name, event); in hci_event_packet()
3886 hdev->stat.evt_rx++; in hci_event_packet()