Lines Matching +full:x +full:- +full:rp
2 BlueZ - Bluetooth protocol stack for Linux
3 Copyright (c) 2000-2001, 2010, Code Aurora Forum. All rights reserved.
50 __u8 status = *((__u8 *) skb->data); in hci_cc_inquiry_cancel()
52 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_inquiry_cancel()
61 if (status == 0x0c && !test_bit(HCI_INQUIRY, &hdev->flags)) { in hci_cc_inquiry_cancel()
71 clear_bit(HCI_INQUIRY, &hdev->flags); in hci_cc_inquiry_cancel()
73 wake_up_bit(&hdev->flags, HCI_INQUIRY); in hci_cc_inquiry_cancel()
80 hdev->le_scan_type != LE_SCAN_ACTIVE) in hci_cc_inquiry_cancel()
89 __u8 status = *((__u8 *) skb->data); in hci_cc_periodic_inq()
91 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_periodic_inq()
101 __u8 status = *((__u8 *) skb->data); in hci_cc_exit_periodic_inq()
103 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_exit_periodic_inq()
116 BT_DBG("%s", hdev->name); in hci_cc_remote_name_req_cancel()
121 struct hci_rp_role_discovery *rp = (void *) skb->data; in hci_cc_role_discovery() local
124 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_role_discovery()
126 if (rp->status) in hci_cc_role_discovery()
131 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(rp->handle)); in hci_cc_role_discovery()
133 conn->role = rp->role; in hci_cc_role_discovery()
140 struct hci_rp_read_link_policy *rp = (void *) skb->data; in hci_cc_read_link_policy() local
143 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_read_link_policy()
145 if (rp->status) in hci_cc_read_link_policy()
150 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(rp->handle)); in hci_cc_read_link_policy()
152 conn->link_policy = __le16_to_cpu(rp->policy); in hci_cc_read_link_policy()
159 struct hci_rp_write_link_policy *rp = (void *) skb->data; in hci_cc_write_link_policy() local
163 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_write_link_policy()
165 if (rp->status) in hci_cc_write_link_policy()
174 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(rp->handle)); in hci_cc_write_link_policy()
176 conn->link_policy = get_unaligned_le16(sent + 2); in hci_cc_write_link_policy()
184 struct hci_rp_read_def_link_policy *rp = (void *) skb->data; in hci_cc_read_def_link_policy() local
186 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_read_def_link_policy()
188 if (rp->status) in hci_cc_read_def_link_policy()
191 hdev->link_policy = __le16_to_cpu(rp->policy); in hci_cc_read_def_link_policy()
197 __u8 status = *((__u8 *) skb->data); in hci_cc_write_def_link_policy()
200 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_write_def_link_policy()
209 hdev->link_policy = get_unaligned_le16(sent); in hci_cc_write_def_link_policy()
214 __u8 status = *((__u8 *) skb->data); in hci_cc_reset()
216 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_reset()
218 clear_bit(HCI_RESET, &hdev->flags); in hci_cc_reset()
223 /* Reset all non-persistent flags */ in hci_cc_reset()
228 hdev->inq_tx_power = HCI_TX_POWER_INVALID; in hci_cc_reset()
229 hdev->adv_tx_power = HCI_TX_POWER_INVALID; in hci_cc_reset()
231 memset(hdev->adv_data, 0, sizeof(hdev->adv_data)); in hci_cc_reset()
232 hdev->adv_data_len = 0; in hci_cc_reset()
234 memset(hdev->scan_rsp_data, 0, sizeof(hdev->scan_rsp_data)); in hci_cc_reset()
235 hdev->scan_rsp_data_len = 0; in hci_cc_reset()
237 hdev->le_scan_type = LE_SCAN_PASSIVE; in hci_cc_reset()
239 hdev->ssp_debug_mode = 0; in hci_cc_reset()
241 hci_bdaddr_list_clear(&hdev->le_accept_list); in hci_cc_reset()
242 hci_bdaddr_list_clear(&hdev->le_resolv_list); in hci_cc_reset()
248 struct hci_rp_read_stored_link_key *rp = (void *)skb->data; in hci_cc_read_stored_link_key() local
251 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_read_stored_link_key()
257 if (!rp->status && sent->read_all == 0x01) { in hci_cc_read_stored_link_key()
258 hdev->stored_max_keys = rp->max_keys; in hci_cc_read_stored_link_key()
259 hdev->stored_num_keys = rp->num_keys; in hci_cc_read_stored_link_key()
266 struct hci_rp_delete_stored_link_key *rp = (void *)skb->data; in hci_cc_delete_stored_link_key() local
268 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_delete_stored_link_key()
270 if (rp->status) in hci_cc_delete_stored_link_key()
273 if (rp->num_keys <= hdev->stored_num_keys) in hci_cc_delete_stored_link_key()
274 hdev->stored_num_keys -= rp->num_keys; in hci_cc_delete_stored_link_key()
276 hdev->stored_num_keys = 0; in hci_cc_delete_stored_link_key()
281 __u8 status = *((__u8 *) skb->data); in hci_cc_write_local_name()
284 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_write_local_name()
295 memcpy(hdev->dev_name, sent, HCI_MAX_NAME_LENGTH); in hci_cc_write_local_name()
302 struct hci_rp_read_local_name *rp = (void *) skb->data; in hci_cc_read_local_name() local
304 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_read_local_name()
306 if (rp->status) in hci_cc_read_local_name()
311 memcpy(hdev->dev_name, rp->name, HCI_MAX_NAME_LENGTH); in hci_cc_read_local_name()
316 __u8 status = *((__u8 *) skb->data); in hci_cc_write_auth_enable()
319 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_write_auth_enable()
331 set_bit(HCI_AUTH, &hdev->flags); in hci_cc_write_auth_enable()
333 clear_bit(HCI_AUTH, &hdev->flags); in hci_cc_write_auth_enable()
344 __u8 status = *((__u8 *) skb->data); in hci_cc_write_encrypt_mode()
348 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_write_encrypt_mode()
360 set_bit(HCI_ENCRYPT, &hdev->flags); in hci_cc_write_encrypt_mode()
362 clear_bit(HCI_ENCRYPT, &hdev->flags); in hci_cc_write_encrypt_mode()
367 __u8 status = *((__u8 *) skb->data); in hci_cc_write_scan_enable()
371 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_write_scan_enable()
382 hdev->discov_timeout = 0; in hci_cc_write_scan_enable()
387 set_bit(HCI_ISCAN, &hdev->flags); in hci_cc_write_scan_enable()
389 clear_bit(HCI_ISCAN, &hdev->flags); in hci_cc_write_scan_enable()
392 set_bit(HCI_PSCAN, &hdev->flags); in hci_cc_write_scan_enable()
394 clear_bit(HCI_PSCAN, &hdev->flags); in hci_cc_write_scan_enable()
402 __u8 status = *((__u8 *)skb->data); in hci_cc_set_event_filter()
406 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_set_event_filter()
417 if (cp->flt_type == HCI_FLT_CLEAR_ALL) in hci_cc_set_event_filter()
425 struct hci_rp_read_class_of_dev *rp = (void *) skb->data; in hci_cc_read_class_of_dev() local
427 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_read_class_of_dev()
429 if (rp->status) in hci_cc_read_class_of_dev()
432 memcpy(hdev->dev_class, rp->dev_class, 3); in hci_cc_read_class_of_dev()
434 BT_DBG("%s class 0x%.2x%.2x%.2x", hdev->name, in hci_cc_read_class_of_dev()
435 hdev->dev_class[2], hdev->dev_class[1], hdev->dev_class[0]); in hci_cc_read_class_of_dev()
440 __u8 status = *((__u8 *) skb->data); in hci_cc_write_class_of_dev()
443 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_write_class_of_dev()
452 memcpy(hdev->dev_class, sent, 3); in hci_cc_write_class_of_dev()
462 struct hci_rp_read_voice_setting *rp = (void *) skb->data; in hci_cc_read_voice_setting() local
465 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_read_voice_setting()
467 if (rp->status) in hci_cc_read_voice_setting()
470 setting = __le16_to_cpu(rp->voice_setting); in hci_cc_read_voice_setting()
472 if (hdev->voice_setting == setting) in hci_cc_read_voice_setting()
475 hdev->voice_setting = setting; in hci_cc_read_voice_setting()
477 BT_DBG("%s voice setting 0x%4.4x", hdev->name, setting); in hci_cc_read_voice_setting()
479 if (hdev->notify) in hci_cc_read_voice_setting()
480 hdev->notify(hdev, HCI_NOTIFY_VOICE_SETTING); in hci_cc_read_voice_setting()
486 __u8 status = *((__u8 *) skb->data); in hci_cc_write_voice_setting()
490 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_write_voice_setting()
501 if (hdev->voice_setting == setting) in hci_cc_write_voice_setting()
504 hdev->voice_setting = setting; in hci_cc_write_voice_setting()
506 BT_DBG("%s voice setting 0x%4.4x", hdev->name, setting); in hci_cc_write_voice_setting()
508 if (hdev->notify) in hci_cc_write_voice_setting()
509 hdev->notify(hdev, HCI_NOTIFY_VOICE_SETTING); in hci_cc_write_voice_setting()
515 struct hci_rp_read_num_supported_iac *rp = (void *) skb->data; in hci_cc_read_num_supported_iac() local
517 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_read_num_supported_iac()
519 if (rp->status) in hci_cc_read_num_supported_iac()
522 hdev->num_iac = rp->num_iac; in hci_cc_read_num_supported_iac()
524 BT_DBG("%s num iac %d", hdev->name, hdev->num_iac); in hci_cc_read_num_supported_iac()
529 __u8 status = *((__u8 *) skb->data); in hci_cc_write_ssp_mode()
532 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_write_ssp_mode()
541 if (sent->mode) in hci_cc_write_ssp_mode()
542 hdev->features[1][0] |= LMP_HOST_SSP; in hci_cc_write_ssp_mode()
544 hdev->features[1][0] &= ~LMP_HOST_SSP; in hci_cc_write_ssp_mode()
548 mgmt_ssp_enable_complete(hdev, sent->mode, status); in hci_cc_write_ssp_mode()
550 if (sent->mode) in hci_cc_write_ssp_mode()
561 u8 status = *((u8 *) skb->data); in hci_cc_write_sc_support()
564 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_write_sc_support()
573 if (sent->support) in hci_cc_write_sc_support()
574 hdev->features[1][0] |= LMP_HOST_SC; in hci_cc_write_sc_support()
576 hdev->features[1][0] &= ~LMP_HOST_SC; in hci_cc_write_sc_support()
580 if (sent->support) in hci_cc_write_sc_support()
591 struct hci_rp_read_local_version *rp = (void *) skb->data; in hci_cc_read_local_version() local
593 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_read_local_version()
595 if (rp->status) in hci_cc_read_local_version()
600 hdev->hci_ver = rp->hci_ver; in hci_cc_read_local_version()
601 hdev->hci_rev = __le16_to_cpu(rp->hci_rev); in hci_cc_read_local_version()
602 hdev->lmp_ver = rp->lmp_ver; in hci_cc_read_local_version()
603 hdev->manufacturer = __le16_to_cpu(rp->manufacturer); in hci_cc_read_local_version()
604 hdev->lmp_subver = __le16_to_cpu(rp->lmp_subver); in hci_cc_read_local_version()
611 struct hci_rp_read_local_commands *rp = (void *) skb->data; in hci_cc_read_local_commands() local
613 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_read_local_commands()
615 if (rp->status) in hci_cc_read_local_commands()
620 memcpy(hdev->commands, rp->commands, sizeof(hdev->commands)); in hci_cc_read_local_commands()
626 struct hci_rp_read_auth_payload_to *rp = (void *)skb->data; in hci_cc_read_auth_payload_timeout() local
629 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_read_auth_payload_timeout()
631 if (rp->status) in hci_cc_read_auth_payload_timeout()
636 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(rp->handle)); in hci_cc_read_auth_payload_timeout()
638 conn->auth_payload_timeout = __le16_to_cpu(rp->timeout); in hci_cc_read_auth_payload_timeout()
646 struct hci_rp_write_auth_payload_to *rp = (void *)skb->data; in hci_cc_write_auth_payload_timeout() local
650 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_write_auth_payload_timeout()
652 if (rp->status) in hci_cc_write_auth_payload_timeout()
661 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(rp->handle)); in hci_cc_write_auth_payload_timeout()
663 conn->auth_payload_timeout = get_unaligned_le16(sent + 2); in hci_cc_write_auth_payload_timeout()
671 struct hci_rp_read_local_features *rp = (void *) skb->data; in hci_cc_read_local_features() local
673 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_read_local_features()
675 if (rp->status) in hci_cc_read_local_features()
678 memcpy(hdev->features, rp->features, 8); in hci_cc_read_local_features()
683 if (hdev->features[0][0] & LMP_3SLOT) in hci_cc_read_local_features()
684 hdev->pkt_type |= (HCI_DM3 | HCI_DH3); in hci_cc_read_local_features()
686 if (hdev->features[0][0] & LMP_5SLOT) in hci_cc_read_local_features()
687 hdev->pkt_type |= (HCI_DM5 | HCI_DH5); in hci_cc_read_local_features()
689 if (hdev->features[0][1] & LMP_HV2) { in hci_cc_read_local_features()
690 hdev->pkt_type |= (HCI_HV2); in hci_cc_read_local_features()
691 hdev->esco_type |= (ESCO_HV2); in hci_cc_read_local_features()
694 if (hdev->features[0][1] & LMP_HV3) { in hci_cc_read_local_features()
695 hdev->pkt_type |= (HCI_HV3); in hci_cc_read_local_features()
696 hdev->esco_type |= (ESCO_HV3); in hci_cc_read_local_features()
700 hdev->esco_type |= (ESCO_EV3); in hci_cc_read_local_features()
702 if (hdev->features[0][4] & LMP_EV4) in hci_cc_read_local_features()
703 hdev->esco_type |= (ESCO_EV4); in hci_cc_read_local_features()
705 if (hdev->features[0][4] & LMP_EV5) in hci_cc_read_local_features()
706 hdev->esco_type |= (ESCO_EV5); in hci_cc_read_local_features()
708 if (hdev->features[0][5] & LMP_EDR_ESCO_2M) in hci_cc_read_local_features()
709 hdev->esco_type |= (ESCO_2EV3); in hci_cc_read_local_features()
711 if (hdev->features[0][5] & LMP_EDR_ESCO_3M) in hci_cc_read_local_features()
712 hdev->esco_type |= (ESCO_3EV3); in hci_cc_read_local_features()
714 if (hdev->features[0][5] & LMP_EDR_3S_ESCO) in hci_cc_read_local_features()
715 hdev->esco_type |= (ESCO_2EV5 | ESCO_3EV5); in hci_cc_read_local_features()
721 struct hci_rp_read_local_ext_features *rp = (void *) skb->data; in hci_cc_read_local_ext_features() local
723 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_read_local_ext_features()
725 if (rp->status) in hci_cc_read_local_ext_features()
728 if (hdev->max_page < rp->max_page) in hci_cc_read_local_ext_features()
729 hdev->max_page = rp->max_page; in hci_cc_read_local_ext_features()
731 if (rp->page < HCI_MAX_PAGES) in hci_cc_read_local_ext_features()
732 memcpy(hdev->features[rp->page], rp->features, 8); in hci_cc_read_local_ext_features()
738 struct hci_rp_read_flow_control_mode *rp = (void *) skb->data; in hci_cc_read_flow_control_mode() local
740 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_read_flow_control_mode()
742 if (rp->status) in hci_cc_read_flow_control_mode()
745 hdev->flow_ctl_mode = rp->mode; in hci_cc_read_flow_control_mode()
750 struct hci_rp_read_buffer_size *rp = (void *) skb->data; in hci_cc_read_buffer_size() local
752 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_read_buffer_size()
754 if (rp->status) in hci_cc_read_buffer_size()
757 hdev->acl_mtu = __le16_to_cpu(rp->acl_mtu); in hci_cc_read_buffer_size()
758 hdev->sco_mtu = rp->sco_mtu; in hci_cc_read_buffer_size()
759 hdev->acl_pkts = __le16_to_cpu(rp->acl_max_pkt); in hci_cc_read_buffer_size()
760 hdev->sco_pkts = __le16_to_cpu(rp->sco_max_pkt); in hci_cc_read_buffer_size()
762 if (test_bit(HCI_QUIRK_FIXUP_BUFFER_SIZE, &hdev->quirks)) { in hci_cc_read_buffer_size()
763 hdev->sco_mtu = 64; in hci_cc_read_buffer_size()
764 hdev->sco_pkts = 8; in hci_cc_read_buffer_size()
767 hdev->acl_cnt = hdev->acl_pkts; in hci_cc_read_buffer_size()
768 hdev->sco_cnt = hdev->sco_pkts; in hci_cc_read_buffer_size()
770 BT_DBG("%s acl mtu %d:%d sco mtu %d:%d", hdev->name, hdev->acl_mtu, in hci_cc_read_buffer_size()
771 hdev->acl_pkts, hdev->sco_mtu, hdev->sco_pkts); in hci_cc_read_buffer_size()
776 struct hci_rp_read_bd_addr *rp = (void *) skb->data; in hci_cc_read_bd_addr() local
778 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_read_bd_addr()
780 if (rp->status) in hci_cc_read_bd_addr()
783 if (test_bit(HCI_INIT, &hdev->flags)) in hci_cc_read_bd_addr()
784 bacpy(&hdev->bdaddr, &rp->bdaddr); in hci_cc_read_bd_addr()
787 bacpy(&hdev->setup_addr, &rp->bdaddr); in hci_cc_read_bd_addr()
793 struct hci_rp_read_local_pairing_opts *rp = (void *) skb->data; in hci_cc_read_local_pairing_opts() local
795 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_read_local_pairing_opts()
797 if (rp->status) in hci_cc_read_local_pairing_opts()
802 hdev->pairing_opts = rp->pairing_opts; in hci_cc_read_local_pairing_opts()
803 hdev->max_enc_key_size = rp->max_key_size; in hci_cc_read_local_pairing_opts()
810 struct hci_rp_read_page_scan_activity *rp = (void *) skb->data; in hci_cc_read_page_scan_activity() local
812 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_read_page_scan_activity()
814 if (rp->status) in hci_cc_read_page_scan_activity()
817 if (test_bit(HCI_INIT, &hdev->flags)) { in hci_cc_read_page_scan_activity()
818 hdev->page_scan_interval = __le16_to_cpu(rp->interval); in hci_cc_read_page_scan_activity()
819 hdev->page_scan_window = __le16_to_cpu(rp->window); in hci_cc_read_page_scan_activity()
826 u8 status = *((u8 *) skb->data); in hci_cc_write_page_scan_activity()
829 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_write_page_scan_activity()
838 hdev->page_scan_interval = __le16_to_cpu(sent->interval); in hci_cc_write_page_scan_activity()
839 hdev->page_scan_window = __le16_to_cpu(sent->window); in hci_cc_write_page_scan_activity()
845 struct hci_rp_read_page_scan_type *rp = (void *) skb->data; in hci_cc_read_page_scan_type() local
847 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_read_page_scan_type()
849 if (rp->status) in hci_cc_read_page_scan_type()
852 if (test_bit(HCI_INIT, &hdev->flags)) in hci_cc_read_page_scan_type()
853 hdev->page_scan_type = rp->type; in hci_cc_read_page_scan_type()
859 u8 status = *((u8 *) skb->data); in hci_cc_write_page_scan_type()
862 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_write_page_scan_type()
869 hdev->page_scan_type = *type; in hci_cc_write_page_scan_type()
875 struct hci_rp_read_data_block_size *rp = (void *) skb->data; in hci_cc_read_data_block_size() local
877 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_read_data_block_size()
879 if (rp->status) in hci_cc_read_data_block_size()
882 hdev->block_mtu = __le16_to_cpu(rp->max_acl_len); in hci_cc_read_data_block_size()
883 hdev->block_len = __le16_to_cpu(rp->block_len); in hci_cc_read_data_block_size()
884 hdev->num_blocks = __le16_to_cpu(rp->num_blocks); in hci_cc_read_data_block_size()
886 hdev->block_cnt = hdev->num_blocks; in hci_cc_read_data_block_size()
888 BT_DBG("%s blk mtu %d cnt %d len %d", hdev->name, hdev->block_mtu, in hci_cc_read_data_block_size()
889 hdev->block_cnt, hdev->block_len); in hci_cc_read_data_block_size()
894 struct hci_rp_read_clock *rp = (void *) skb->data; in hci_cc_read_clock() local
898 BT_DBG("%s", hdev->name); in hci_cc_read_clock()
900 if (skb->len < sizeof(*rp)) in hci_cc_read_clock()
903 if (rp->status) in hci_cc_read_clock()
912 if (cp->which == 0x00) { in hci_cc_read_clock()
913 hdev->clock = le32_to_cpu(rp->clock); in hci_cc_read_clock()
917 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(rp->handle)); in hci_cc_read_clock()
919 conn->clock = le32_to_cpu(rp->clock); in hci_cc_read_clock()
920 conn->clock_accuracy = le16_to_cpu(rp->accuracy); in hci_cc_read_clock()
930 struct hci_rp_read_local_amp_info *rp = (void *) skb->data; in hci_cc_read_local_amp_info() local
932 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_read_local_amp_info()
934 if (rp->status) in hci_cc_read_local_amp_info()
937 hdev->amp_status = rp->amp_status; in hci_cc_read_local_amp_info()
938 hdev->amp_total_bw = __le32_to_cpu(rp->total_bw); in hci_cc_read_local_amp_info()
939 hdev->amp_max_bw = __le32_to_cpu(rp->max_bw); in hci_cc_read_local_amp_info()
940 hdev->amp_min_latency = __le32_to_cpu(rp->min_latency); in hci_cc_read_local_amp_info()
941 hdev->amp_max_pdu = __le32_to_cpu(rp->max_pdu); in hci_cc_read_local_amp_info()
942 hdev->amp_type = rp->amp_type; in hci_cc_read_local_amp_info()
943 hdev->amp_pal_cap = __le16_to_cpu(rp->pal_cap); in hci_cc_read_local_amp_info()
944 hdev->amp_assoc_size = __le16_to_cpu(rp->max_assoc_size); in hci_cc_read_local_amp_info()
945 hdev->amp_be_flush_to = __le32_to_cpu(rp->be_flush_to); in hci_cc_read_local_amp_info()
946 hdev->amp_max_flush_to = __le32_to_cpu(rp->max_flush_to); in hci_cc_read_local_amp_info()
952 struct hci_rp_read_inq_rsp_tx_power *rp = (void *) skb->data; in hci_cc_read_inq_rsp_tx_power() local
954 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_read_inq_rsp_tx_power()
956 if (rp->status) in hci_cc_read_inq_rsp_tx_power()
959 hdev->inq_tx_power = rp->tx_power; in hci_cc_read_inq_rsp_tx_power()
965 struct hci_rp_read_def_err_data_reporting *rp = (void *)skb->data; in hci_cc_read_def_err_data_reporting() local
967 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_read_def_err_data_reporting()
969 if (rp->status) in hci_cc_read_def_err_data_reporting()
972 hdev->err_data_reporting = rp->err_data_reporting; in hci_cc_read_def_err_data_reporting()
978 __u8 status = *((__u8 *)skb->data); in hci_cc_write_def_err_data_reporting()
981 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_write_def_err_data_reporting()
990 hdev->err_data_reporting = cp->err_data_reporting; in hci_cc_write_def_err_data_reporting()
995 struct hci_rp_pin_code_reply *rp = (void *) skb->data; in hci_cc_pin_code_reply() local
999 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_pin_code_reply()
1004 mgmt_pin_code_reply_complete(hdev, &rp->bdaddr, rp->status); in hci_cc_pin_code_reply()
1006 if (rp->status) in hci_cc_pin_code_reply()
1013 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &cp->bdaddr); in hci_cc_pin_code_reply()
1015 conn->pin_length = cp->pin_len; in hci_cc_pin_code_reply()
1023 struct hci_rp_pin_code_neg_reply *rp = (void *) skb->data; in hci_cc_pin_code_neg_reply() local
1025 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_pin_code_neg_reply()
1030 mgmt_pin_code_neg_reply_complete(hdev, &rp->bdaddr, in hci_cc_pin_code_neg_reply()
1031 rp->status); in hci_cc_pin_code_neg_reply()
1039 struct hci_rp_le_read_buffer_size *rp = (void *) skb->data; in hci_cc_le_read_buffer_size() local
1041 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_le_read_buffer_size()
1043 if (rp->status) in hci_cc_le_read_buffer_size()
1046 hdev->le_mtu = __le16_to_cpu(rp->le_mtu); in hci_cc_le_read_buffer_size()
1047 hdev->le_pkts = rp->le_max_pkt; in hci_cc_le_read_buffer_size()
1049 hdev->le_cnt = hdev->le_pkts; in hci_cc_le_read_buffer_size()
1051 BT_DBG("%s le mtu %d:%d", hdev->name, hdev->le_mtu, hdev->le_pkts); in hci_cc_le_read_buffer_size()
1057 struct hci_rp_le_read_local_features *rp = (void *) skb->data; in hci_cc_le_read_local_features() local
1059 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_le_read_local_features()
1061 if (rp->status) in hci_cc_le_read_local_features()
1064 memcpy(hdev->le_features, rp->features, 8); in hci_cc_le_read_local_features()
1070 struct hci_rp_le_read_adv_tx_power *rp = (void *) skb->data; in hci_cc_le_read_adv_tx_power() local
1072 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_le_read_adv_tx_power()
1074 if (rp->status) in hci_cc_le_read_adv_tx_power()
1077 hdev->adv_tx_power = rp->tx_power; in hci_cc_le_read_adv_tx_power()
1082 struct hci_rp_user_confirm_reply *rp = (void *) skb->data; in hci_cc_user_confirm_reply() local
1084 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_user_confirm_reply()
1089 mgmt_user_confirm_reply_complete(hdev, &rp->bdaddr, ACL_LINK, 0, in hci_cc_user_confirm_reply()
1090 rp->status); in hci_cc_user_confirm_reply()
1098 struct hci_rp_user_confirm_reply *rp = (void *) skb->data; in hci_cc_user_confirm_neg_reply() local
1100 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_user_confirm_neg_reply()
1105 mgmt_user_confirm_neg_reply_complete(hdev, &rp->bdaddr, in hci_cc_user_confirm_neg_reply()
1106 ACL_LINK, 0, rp->status); in hci_cc_user_confirm_neg_reply()
1113 struct hci_rp_user_confirm_reply *rp = (void *) skb->data; in hci_cc_user_passkey_reply() local
1115 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_user_passkey_reply()
1120 mgmt_user_passkey_reply_complete(hdev, &rp->bdaddr, ACL_LINK, in hci_cc_user_passkey_reply()
1121 0, rp->status); in hci_cc_user_passkey_reply()
1129 struct hci_rp_user_confirm_reply *rp = (void *) skb->data; in hci_cc_user_passkey_neg_reply() local
1131 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_user_passkey_neg_reply()
1136 mgmt_user_passkey_neg_reply_complete(hdev, &rp->bdaddr, in hci_cc_user_passkey_neg_reply()
1137 ACL_LINK, 0, rp->status); in hci_cc_user_passkey_neg_reply()
1145 struct hci_rp_read_local_oob_data *rp = (void *) skb->data; in hci_cc_read_local_oob_data() local
1147 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_read_local_oob_data()
1153 struct hci_rp_read_local_oob_ext_data *rp = (void *) skb->data; in hci_cc_read_local_oob_ext_data() local
1155 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_read_local_oob_ext_data()
1160 __u8 status = *((__u8 *) skb->data); in hci_cc_le_set_random_addr()
1163 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_le_set_random_addr()
1174 bacpy(&hdev->random_addr, sent); in hci_cc_le_set_random_addr()
1176 if (!bacmp(&hdev->rpa, sent)) { in hci_cc_le_set_random_addr()
1178 queue_delayed_work(hdev->workqueue, &hdev->rpa_expired, in hci_cc_le_set_random_addr()
1179 secs_to_jiffies(hdev->rpa_timeout)); in hci_cc_le_set_random_addr()
1187 __u8 status = *((__u8 *) skb->data); in hci_cc_le_set_default_phy()
1190 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_le_set_default_phy()
1201 hdev->le_tx_def_phys = cp->tx_phys; in hci_cc_le_set_default_phy()
1202 hdev->le_rx_def_phys = cp->rx_phys; in hci_cc_le_set_default_phy()
1210 __u8 status = *((__u8 *) skb->data); in hci_cc_le_set_adv_set_random_addr()
1220 * non-extended adverting. in hci_cc_le_set_adv_set_random_addr()
1222 if (!cp || !cp->handle) in hci_cc_le_set_adv_set_random_addr()
1227 adv = hci_find_adv_instance(hdev, cp->handle); in hci_cc_le_set_adv_set_random_addr()
1229 bacpy(&adv->random_addr, &cp->bdaddr); in hci_cc_le_set_adv_set_random_addr()
1230 if (!bacmp(&hdev->rpa, &cp->bdaddr)) { in hci_cc_le_set_adv_set_random_addr()
1231 adv->rpa_expired = false; in hci_cc_le_set_adv_set_random_addr()
1232 queue_delayed_work(hdev->workqueue, in hci_cc_le_set_adv_set_random_addr()
1233 &adv->rpa_expired_cb, in hci_cc_le_set_adv_set_random_addr()
1234 secs_to_jiffies(hdev->rpa_timeout)); in hci_cc_le_set_adv_set_random_addr()
1244 struct hci_rp_le_read_transmit_power *rp = (void *)skb->data; in hci_cc_le_read_transmit_power() local
1246 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_le_read_transmit_power()
1248 if (rp->status) in hci_cc_le_read_transmit_power()
1251 hdev->min_le_tx_power = rp->min_le_tx_power; in hci_cc_le_read_transmit_power()
1252 hdev->max_le_tx_power = rp->max_le_tx_power; in hci_cc_le_read_transmit_power()
1257 __u8 *sent, status = *((__u8 *) skb->data); in hci_cc_le_set_adv_enable()
1259 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_le_set_adv_enable()
1280 queue_delayed_work(hdev->workqueue, in hci_cc_le_set_adv_enable()
1281 &conn->le_conn_timeout, in hci_cc_le_set_adv_enable()
1282 conn->conn_timeout); in hci_cc_le_set_adv_enable()
1295 __u8 status = *((__u8 *) skb->data); in hci_cc_le_set_ext_adv_enable()
1298 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_le_set_ext_adv_enable()
1307 set = (void *)cp->data; in hci_cc_le_set_ext_adv_enable()
1311 if (cp->num_of_sets) in hci_cc_le_set_ext_adv_enable()
1312 adv = hci_find_adv_instance(hdev, set->handle); in hci_cc_le_set_ext_adv_enable()
1314 if (cp->enable) { in hci_cc_le_set_ext_adv_enable()
1320 adv->enabled = true; in hci_cc_le_set_ext_adv_enable()
1324 queue_delayed_work(hdev->workqueue, in hci_cc_le_set_ext_adv_enable()
1325 &conn->le_conn_timeout, in hci_cc_le_set_ext_adv_enable()
1326 conn->conn_timeout); in hci_cc_le_set_ext_adv_enable()
1329 adv->enabled = false; in hci_cc_le_set_ext_adv_enable()
1333 list_for_each_entry_safe(adv, n, &hdev->adv_instances, in hci_cc_le_set_ext_adv_enable()
1335 if (adv->enabled) in hci_cc_le_set_ext_adv_enable()
1340 list_for_each_entry_safe(adv, n, &hdev->adv_instances, in hci_cc_le_set_ext_adv_enable()
1342 adv->enabled = false; in hci_cc_le_set_ext_adv_enable()
1355 __u8 status = *((__u8 *) skb->data); in hci_cc_le_set_scan_param()
1357 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_le_set_scan_param()
1368 hdev->le_scan_type = cp->type; in hci_cc_le_set_scan_param()
1377 __u8 status = *((__u8 *) skb->data); in hci_cc_le_set_ext_scan_param()
1380 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_le_set_ext_scan_param()
1389 phy_param = (void *)cp->data; in hci_cc_le_set_ext_scan_param()
1393 hdev->le_scan_type = phy_param->type; in hci_cc_le_set_ext_scan_param()
1400 struct discovery_state *d = &hdev->discovery; in has_pending_adv_report()
1402 return bacmp(&d->last_adv_addr, BDADDR_ANY); in has_pending_adv_report()
1407 struct discovery_state *d = &hdev->discovery; in clear_pending_adv_report()
1409 bacpy(&d->last_adv_addr, BDADDR_ANY); in clear_pending_adv_report()
1410 d->last_adv_data_len = 0; in clear_pending_adv_report()
1417 struct discovery_state *d = &hdev->discovery; in store_pending_adv_report()
1422 bacpy(&d->last_adv_addr, bdaddr); in store_pending_adv_report()
1423 d->last_adv_addr_type = bdaddr_type; in store_pending_adv_report()
1424 d->last_adv_rssi = rssi; in store_pending_adv_report()
1425 d->last_adv_flags = flags; in store_pending_adv_report()
1426 memcpy(d->last_adv_data, data, len); in store_pending_adv_report()
1427 d->last_adv_data_len = len; in store_pending_adv_report()
1437 if (hdev->le_scan_type == LE_SCAN_ACTIVE) in le_set_scan_enable_complete()
1447 struct discovery_state *d = &hdev->discovery; in le_set_scan_enable_complete()
1449 mgmt_device_found(hdev, &d->last_adv_addr, LE_LINK, in le_set_scan_enable_complete()
1450 d->last_adv_addr_type, NULL, in le_set_scan_enable_complete()
1451 d->last_adv_rssi, d->last_adv_flags, in le_set_scan_enable_complete()
1452 d->last_adv_data, in le_set_scan_enable_complete()
1453 d->last_adv_data_len, NULL, 0); in le_set_scan_enable_complete()
1459 cancel_delayed_work(&hdev->le_scan_disable); in le_set_scan_enable_complete()
1468 * re-enable it again if necessary. in le_set_scan_enable_complete()
1473 hdev->discovery.state == DISCOVERY_FINDING) in le_set_scan_enable_complete()
1491 __u8 status = *((__u8 *) skb->data); in hci_cc_le_set_scan_enable()
1493 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_le_set_scan_enable()
1502 le_set_scan_enable_complete(hdev, cp->enable); in hci_cc_le_set_scan_enable()
1509 __u8 status = *((__u8 *) skb->data); in hci_cc_le_set_ext_scan_enable()
1511 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_le_set_ext_scan_enable()
1520 le_set_scan_enable_complete(hdev, cp->enable); in hci_cc_le_set_ext_scan_enable()
1526 struct hci_rp_le_read_num_supported_adv_sets *rp = (void *) skb->data; in hci_cc_le_read_num_adv_sets() local
1528 BT_DBG("%s status 0x%2.2x No of Adv sets %u", hdev->name, rp->status, in hci_cc_le_read_num_adv_sets()
1529 rp->num_of_sets); in hci_cc_le_read_num_adv_sets()
1531 if (rp->status) in hci_cc_le_read_num_adv_sets()
1534 hdev->le_num_of_adv_sets = rp->num_of_sets; in hci_cc_le_read_num_adv_sets()
1540 struct hci_rp_le_read_accept_list_size *rp = (void *)skb->data; in hci_cc_le_read_accept_list_size() local
1542 BT_DBG("%s status 0x%2.2x size %u", hdev->name, rp->status, rp->size); in hci_cc_le_read_accept_list_size()
1544 if (rp->status) in hci_cc_le_read_accept_list_size()
1547 hdev->le_accept_list_size = rp->size; in hci_cc_le_read_accept_list_size()
1553 __u8 status = *((__u8 *) skb->data); in hci_cc_le_clear_accept_list()
1555 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_le_clear_accept_list()
1560 hci_bdaddr_list_clear(&hdev->le_accept_list); in hci_cc_le_clear_accept_list()
1567 __u8 status = *((__u8 *) skb->data); in hci_cc_le_add_to_accept_list()
1569 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_le_add_to_accept_list()
1578 hci_bdaddr_list_add(&hdev->le_accept_list, &sent->bdaddr, in hci_cc_le_add_to_accept_list()
1579 sent->bdaddr_type); in hci_cc_le_add_to_accept_list()
1586 __u8 status = *((__u8 *) skb->data); in hci_cc_le_del_from_accept_list()
1588 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_le_del_from_accept_list()
1597 hci_bdaddr_list_del(&hdev->le_accept_list, &sent->bdaddr, in hci_cc_le_del_from_accept_list()
1598 sent->bdaddr_type); in hci_cc_le_del_from_accept_list()
1604 struct hci_rp_le_read_supported_states *rp = (void *) skb->data; in hci_cc_le_read_supported_states() local
1606 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_le_read_supported_states()
1608 if (rp->status) in hci_cc_le_read_supported_states()
1611 memcpy(hdev->le_states, rp->le_states, 8); in hci_cc_le_read_supported_states()
1617 struct hci_rp_le_read_def_data_len *rp = (void *) skb->data; in hci_cc_le_read_def_data_len() local
1619 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_le_read_def_data_len()
1621 if (rp->status) in hci_cc_le_read_def_data_len()
1624 hdev->le_def_tx_len = le16_to_cpu(rp->tx_len); in hci_cc_le_read_def_data_len()
1625 hdev->le_def_tx_time = le16_to_cpu(rp->tx_time); in hci_cc_le_read_def_data_len()
1632 __u8 status = *((__u8 *) skb->data); in hci_cc_le_write_def_data_len()
1634 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_le_write_def_data_len()
1643 hdev->le_def_tx_len = le16_to_cpu(sent->tx_len); in hci_cc_le_write_def_data_len()
1644 hdev->le_def_tx_time = le16_to_cpu(sent->tx_time); in hci_cc_le_write_def_data_len()
1651 __u8 status = *((__u8 *) skb->data); in hci_cc_le_add_to_resolv_list()
1653 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_le_add_to_resolv_list()
1662 hci_bdaddr_list_add_with_irk(&hdev->le_resolv_list, &sent->bdaddr, in hci_cc_le_add_to_resolv_list()
1663 sent->bdaddr_type, sent->peer_irk, in hci_cc_le_add_to_resolv_list()
1664 sent->local_irk); in hci_cc_le_add_to_resolv_list()
1671 __u8 status = *((__u8 *) skb->data); in hci_cc_le_del_from_resolv_list()
1673 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_le_del_from_resolv_list()
1682 hci_bdaddr_list_del_with_irk(&hdev->le_resolv_list, &sent->bdaddr, in hci_cc_le_del_from_resolv_list()
1683 sent->bdaddr_type); in hci_cc_le_del_from_resolv_list()
1689 __u8 status = *((__u8 *) skb->data); in hci_cc_le_clear_resolv_list()
1691 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_le_clear_resolv_list()
1696 hci_bdaddr_list_clear(&hdev->le_resolv_list); in hci_cc_le_clear_resolv_list()
1702 struct hci_rp_le_read_resolv_list_size *rp = (void *) skb->data; in hci_cc_le_read_resolv_list_size() local
1704 BT_DBG("%s status 0x%2.2x size %u", hdev->name, rp->status, rp->size); in hci_cc_le_read_resolv_list_size()
1706 if (rp->status) in hci_cc_le_read_resolv_list_size()
1709 hdev->le_resolv_list_size = rp->size; in hci_cc_le_read_resolv_list_size()
1715 __u8 *sent, status = *((__u8 *) skb->data); in hci_cc_le_set_addr_resolution_enable()
1717 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_le_set_addr_resolution_enable()
1739 struct hci_rp_le_read_max_data_len *rp = (void *) skb->data; in hci_cc_le_read_max_data_len() local
1741 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_le_read_max_data_len()
1743 if (rp->status) in hci_cc_le_read_max_data_len()
1746 hdev->le_max_tx_len = le16_to_cpu(rp->tx_len); in hci_cc_le_read_max_data_len()
1747 hdev->le_max_tx_time = le16_to_cpu(rp->tx_time); in hci_cc_le_read_max_data_len()
1748 hdev->le_max_rx_len = le16_to_cpu(rp->rx_len); in hci_cc_le_read_max_data_len()
1749 hdev->le_max_rx_time = le16_to_cpu(rp->rx_time); in hci_cc_le_read_max_data_len()
1756 __u8 status = *((__u8 *) skb->data); in hci_cc_write_le_host_supported()
1758 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_write_le_host_supported()
1769 if (sent->le) { in hci_cc_write_le_host_supported()
1770 hdev->features[1][0] |= LMP_HOST_LE; in hci_cc_write_le_host_supported()
1773 hdev->features[1][0] &= ~LMP_HOST_LE; in hci_cc_write_le_host_supported()
1778 if (sent->simul) in hci_cc_write_le_host_supported()
1779 hdev->features[1][0] |= LMP_HOST_LE_BREDR; in hci_cc_write_le_host_supported()
1781 hdev->features[1][0] &= ~LMP_HOST_LE_BREDR; in hci_cc_write_le_host_supported()
1789 u8 status = *((u8 *) skb->data); in hci_cc_set_adv_param()
1791 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_set_adv_param()
1801 hdev->adv_addr_type = cp->own_address_type; in hci_cc_set_adv_param()
1807 struct hci_rp_le_set_ext_adv_params *rp = (void *) skb->data; in hci_cc_set_ext_adv_param() local
1811 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_set_ext_adv_param()
1813 if (rp->status) in hci_cc_set_ext_adv_param()
1821 hdev->adv_addr_type = cp->own_addr_type; in hci_cc_set_ext_adv_param()
1822 if (!cp->handle) { in hci_cc_set_ext_adv_param()
1824 hdev->adv_tx_power = rp->tx_power; in hci_cc_set_ext_adv_param()
1826 adv_instance = hci_find_adv_instance(hdev, cp->handle); in hci_cc_set_ext_adv_param()
1828 adv_instance->tx_power = rp->tx_power; in hci_cc_set_ext_adv_param()
1831 hci_req_update_adv_data(hdev, cp->handle); in hci_cc_set_ext_adv_param()
1838 struct hci_rp_read_rssi *rp = (void *) skb->data; in hci_cc_read_rssi() local
1841 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_read_rssi()
1843 if (rp->status) in hci_cc_read_rssi()
1848 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(rp->handle)); in hci_cc_read_rssi()
1850 conn->rssi = rp->rssi; in hci_cc_read_rssi()
1858 struct hci_rp_read_tx_power *rp = (void *) skb->data; in hci_cc_read_tx_power() local
1861 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_read_tx_power()
1863 if (rp->status) in hci_cc_read_tx_power()
1872 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(rp->handle)); in hci_cc_read_tx_power()
1876 switch (sent->type) { in hci_cc_read_tx_power()
1878 conn->tx_power = rp->tx_power; in hci_cc_read_tx_power()
1881 conn->max_tx_power = rp->tx_power; in hci_cc_read_tx_power()
1891 u8 status = *((u8 *) skb->data); in hci_cc_write_ssp_debug_mode()
1894 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_write_ssp_debug_mode()
1901 hdev->ssp_debug_mode = *mode; in hci_cc_write_ssp_debug_mode()
1906 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cs_inquiry()
1913 set_bit(HCI_INQUIRY, &hdev->flags); in hci_cs_inquiry()
1921 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cs_create_conn()
1929 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &cp->bdaddr); in hci_cs_create_conn()
1931 BT_DBG("%s bdaddr %pMR hcon %p", hdev->name, &cp->bdaddr, conn); in hci_cs_create_conn()
1934 if (conn && conn->state == BT_CONNECT) { in hci_cs_create_conn()
1935 if (status != 0x0c || conn->attempt > 2) { in hci_cs_create_conn()
1936 conn->state = BT_CLOSED; in hci_cs_create_conn()
1940 conn->state = BT_CONNECT2; in hci_cs_create_conn()
1944 conn = hci_conn_add(hdev, ACL_LINK, &cp->bdaddr, in hci_cs_create_conn()
1960 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cs_add_sco()
1969 handle = __le16_to_cpu(cp->handle); in hci_cs_add_sco()
1971 BT_DBG("%s handle 0x%4.4x", hdev->name, handle); in hci_cs_add_sco()
1977 sco = acl->link; in hci_cs_add_sco()
1979 sco->state = BT_CLOSED; in hci_cs_add_sco()
1994 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cs_auth_requested()
2005 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(cp->handle)); in hci_cs_auth_requested()
2007 if (conn->state == BT_CONFIG) { in hci_cs_auth_requested()
2021 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cs_set_conn_encrypt()
2032 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(cp->handle)); in hci_cs_set_conn_encrypt()
2034 if (conn->state == BT_CONFIG) { in hci_cs_set_conn_encrypt()
2046 if (conn->state != BT_CONFIG || !conn->out) in hci_outgoing_auth_needed()
2049 if (conn->pending_sec_level == BT_SECURITY_SDP) in hci_outgoing_auth_needed()
2052 /* Only request authentication for SSP connections or non-SSP in hci_outgoing_auth_needed()
2056 if (!hci_conn_ssp_enabled(conn) && !(conn->auth_type & 0x01) && in hci_outgoing_auth_needed()
2057 conn->pending_sec_level != BT_SECURITY_FIPS && in hci_outgoing_auth_needed()
2058 conn->pending_sec_level != BT_SECURITY_HIGH && in hci_outgoing_auth_needed()
2059 conn->pending_sec_level != BT_SECURITY_MEDIUM) in hci_outgoing_auth_needed()
2072 bacpy(&cp.bdaddr, &e->data.bdaddr); in hci_resolve_name()
2073 cp.pscan_rep_mode = e->data.pscan_rep_mode; in hci_resolve_name()
2074 cp.pscan_mode = e->data.pscan_mode; in hci_resolve_name()
2075 cp.clock_offset = e->data.clock_offset; in hci_resolve_name()
2082 struct discovery_state *discov = &hdev->discovery; in hci_resolve_next_name()
2085 if (list_empty(&discov->resolve)) in hci_resolve_next_name()
2093 e->name_state = NAME_PENDING; in hci_resolve_next_name()
2103 struct discovery_state *discov = &hdev->discovery; in hci_check_pending_name()
2112 (conn->state == BT_CONFIG || conn->state == BT_CONNECTED) && in hci_check_pending_name()
2113 !test_and_set_bit(HCI_CONN_MGMT_CONNECTED, &conn->flags)) in hci_check_pending_name()
2116 if (discov->state == DISCOVERY_STOPPED) in hci_check_pending_name()
2119 if (discov->state == DISCOVERY_STOPPING) in hci_check_pending_name()
2122 if (discov->state != DISCOVERY_RESOLVING) in hci_check_pending_name()
2133 list_del(&e->list); in hci_check_pending_name()
2135 e->name_state = NAME_KNOWN; in hci_check_pending_name()
2137 e->data.rssi, name, name_len); in hci_check_pending_name()
2139 e->name_state = NAME_NOT_KNOWN; in hci_check_pending_name()
2154 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cs_remote_name_req()
2167 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &cp->bdaddr); in hci_cs_remote_name_req()
2170 hci_check_pending_name(hdev, conn, &cp->bdaddr, NULL, 0); in hci_cs_remote_name_req()
2178 if (!test_and_set_bit(HCI_CONN_AUTH_PEND, &conn->flags)) { in hci_cs_remote_name_req()
2181 set_bit(HCI_CONN_AUTH_INITIATOR, &conn->flags); in hci_cs_remote_name_req()
2183 auth_cp.handle = __cpu_to_le16(conn->handle); in hci_cs_remote_name_req()
2197 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cs_read_remote_features()
2208 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(cp->handle)); in hci_cs_read_remote_features()
2210 if (conn->state == BT_CONFIG) { in hci_cs_read_remote_features()
2224 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cs_read_remote_ext_features()
2235 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(cp->handle)); in hci_cs_read_remote_ext_features()
2237 if (conn->state == BT_CONFIG) { in hci_cs_read_remote_ext_features()
2252 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cs_setup_sync_conn()
2261 handle = __le16_to_cpu(cp->handle); in hci_cs_setup_sync_conn()
2263 BT_DBG("%s handle 0x%4.4x", hdev->name, handle); in hci_cs_setup_sync_conn()
2269 sco = acl->link; in hci_cs_setup_sync_conn()
2271 sco->state = BT_CLOSED; in hci_cs_setup_sync_conn()
2286 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cs_sniff_mode()
2297 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(cp->handle)); in hci_cs_sniff_mode()
2299 clear_bit(HCI_CONN_MODE_CHANGE_PEND, &conn->flags); in hci_cs_sniff_mode()
2301 if (test_and_clear_bit(HCI_CONN_SCO_SETUP_PEND, &conn->flags)) in hci_cs_sniff_mode()
2313 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cs_exit_sniff_mode()
2324 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(cp->handle)); in hci_cs_exit_sniff_mode()
2326 clear_bit(HCI_CONN_MODE_CHANGE_PEND, &conn->flags); in hci_cs_exit_sniff_mode()
2328 if (test_and_clear_bit(HCI_CONN_SCO_SETUP_PEND, &conn->flags)) in hci_cs_exit_sniff_mode()
2349 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(cp->handle)); in hci_cs_disconnect()
2351 mgmt_disconnect_failed(hdev, &conn->dst, conn->type, in hci_cs_disconnect()
2352 conn->dst_type, status); in hci_cs_disconnect()
2354 if (conn->type == LE_LINK) { in hci_cs_disconnect()
2355 hdev->cur_adv_instance = conn->adv_instance; in hci_cs_disconnect()
2361 * Hence, we need to do some basic cleanup here and re-enable in hci_cs_disconnect()
2401 conn->init_addr_type = own_address_type; in cs_le_create_conn()
2403 bacpy(&conn->init_addr, &hdev->random_addr); in cs_le_create_conn()
2405 bacpy(&conn->init_addr, &hdev->bdaddr); in cs_le_create_conn()
2407 conn->resp_addr_type = peer_addr_type; in cs_le_create_conn()
2408 bacpy(&conn->resp_addr, peer_addr); in cs_le_create_conn()
2416 queue_delayed_work(conn->hdev->workqueue, in cs_le_create_conn()
2417 &conn->le_conn_timeout, in cs_le_create_conn()
2418 conn->conn_timeout); in cs_le_create_conn()
2425 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cs_le_create_conn()
2440 cs_le_create_conn(hdev, &cp->peer_addr, cp->peer_addr_type, in hci_cs_le_create_conn()
2441 cp->own_address_type, cp->filter_policy); in hci_cs_le_create_conn()
2450 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cs_le_ext_create_conn()
2465 cs_le_create_conn(hdev, &cp->peer_addr, cp->peer_addr_type, in hci_cs_le_ext_create_conn()
2466 cp->own_addr_type, cp->filter_policy); in hci_cs_le_ext_create_conn()
2476 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cs_le_read_remote_features()
2487 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(cp->handle)); in hci_cs_le_read_remote_features()
2489 if (conn->state == BT_CONFIG) { in hci_cs_le_read_remote_features()
2503 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cs_le_start_enc()
2514 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(cp->handle)); in hci_cs_le_start_enc()
2518 if (conn->state != BT_CONNECTED) in hci_cs_le_start_enc()
2533 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cs_switch_role()
2544 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &cp->bdaddr); in hci_cs_switch_role()
2546 clear_bit(HCI_CONN_RSWITCH_PEND, &conn->flags); in hci_cs_switch_role()
2553 __u8 status = *((__u8 *) skb->data); in hci_inquiry_complete_evt()
2554 struct discovery_state *discov = &hdev->discovery; in hci_inquiry_complete_evt()
2557 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_inquiry_complete_evt()
2561 if (!test_and_clear_bit(HCI_INQUIRY, &hdev->flags)) in hci_inquiry_complete_evt()
2565 wake_up_bit(&hdev->flags, HCI_INQUIRY); in hci_inquiry_complete_evt()
2572 if (discov->state != DISCOVERY_FINDING) in hci_inquiry_complete_evt()
2575 if (list_empty(&discov->resolve)) { in hci_inquiry_complete_evt()
2584 !test_bit(HCI_QUIRK_SIMULTANEOUS_DISCOVERY, &hdev->quirks)) in hci_inquiry_complete_evt()
2591 e->name_state = NAME_PENDING; in hci_inquiry_complete_evt()
2602 !test_bit(HCI_QUIRK_SIMULTANEOUS_DISCOVERY, &hdev->quirks)) in hci_inquiry_complete_evt()
2613 struct inquiry_info *info = (void *) (skb->data + 1); in hci_inquiry_result_evt()
2614 int num_rsp = *((__u8 *) skb->data); in hci_inquiry_result_evt()
2616 BT_DBG("%s num_rsp %d", hdev->name, num_rsp); in hci_inquiry_result_evt()
2618 if (!num_rsp || skb->len < num_rsp * sizeof(*info) + 1) in hci_inquiry_result_evt()
2626 for (; num_rsp; num_rsp--, info++) { in hci_inquiry_result_evt()
2629 bacpy(&data.bdaddr, &info->bdaddr); in hci_inquiry_result_evt()
2630 data.pscan_rep_mode = info->pscan_rep_mode; in hci_inquiry_result_evt()
2631 data.pscan_period_mode = info->pscan_period_mode; in hci_inquiry_result_evt()
2632 data.pscan_mode = info->pscan_mode; in hci_inquiry_result_evt()
2633 memcpy(data.dev_class, info->dev_class, 3); in hci_inquiry_result_evt()
2634 data.clock_offset = info->clock_offset; in hci_inquiry_result_evt()
2640 mgmt_device_found(hdev, &info->bdaddr, ACL_LINK, 0x00, in hci_inquiry_result_evt()
2641 info->dev_class, HCI_RSSI_INVALID, in hci_inquiry_result_evt()
2650 struct hci_ev_conn_complete *ev = (void *) skb->data; in hci_conn_complete_evt()
2653 BT_DBG("%s", hdev->name); in hci_conn_complete_evt()
2657 conn = hci_conn_hash_lookup_ba(hdev, ev->link_type, &ev->bdaddr); in hci_conn_complete_evt()
2659 /* Connection may not exist if auto-connected. Check the bredr in hci_conn_complete_evt()
2664 * Auto-connect will only occur if the event filter is in hci_conn_complete_evt()
2668 if (ev->link_type == ACL_LINK && in hci_conn_complete_evt()
2669 hci_bdaddr_list_lookup_with_flags(&hdev->accept_list, in hci_conn_complete_evt()
2670 &ev->bdaddr, in hci_conn_complete_evt()
2672 conn = hci_conn_add(hdev, ev->link_type, &ev->bdaddr, in hci_conn_complete_evt()
2679 if (ev->link_type != SCO_LINK) in hci_conn_complete_evt()
2683 &ev->bdaddr); in hci_conn_complete_evt()
2687 conn->type = SCO_LINK; in hci_conn_complete_evt()
2691 if (!ev->status) { in hci_conn_complete_evt()
2692 conn->handle = __le16_to_cpu(ev->handle); in hci_conn_complete_evt()
2694 if (conn->type == ACL_LINK) { in hci_conn_complete_evt()
2695 conn->state = BT_CONFIG; in hci_conn_complete_evt()
2698 if (!conn->out && !hci_conn_ssp_enabled(conn) && in hci_conn_complete_evt()
2699 !hci_find_link_key(hdev, &ev->bdaddr)) in hci_conn_complete_evt()
2700 conn->disc_timeout = HCI_PAIRING_TIMEOUT; in hci_conn_complete_evt()
2702 conn->disc_timeout = HCI_DISCONN_TIMEOUT; in hci_conn_complete_evt()
2704 conn->state = BT_CONNECTED; in hci_conn_complete_evt()
2709 if (test_bit(HCI_AUTH, &hdev->flags)) in hci_conn_complete_evt()
2710 set_bit(HCI_CONN_AUTH, &conn->flags); in hci_conn_complete_evt()
2712 if (test_bit(HCI_ENCRYPT, &hdev->flags)) in hci_conn_complete_evt()
2713 set_bit(HCI_CONN_ENCRYPT, &conn->flags); in hci_conn_complete_evt()
2716 if (conn->type == ACL_LINK) { in hci_conn_complete_evt()
2718 cp.handle = ev->handle; in hci_conn_complete_evt()
2726 if (!conn->out && hdev->hci_ver < BLUETOOTH_VER_2_0) { in hci_conn_complete_evt()
2728 cp.handle = ev->handle; in hci_conn_complete_evt()
2729 cp.pkt_type = cpu_to_le16(conn->pkt_type); in hci_conn_complete_evt()
2734 conn->state = BT_CLOSED; in hci_conn_complete_evt()
2735 if (conn->type == ACL_LINK) in hci_conn_complete_evt()
2736 mgmt_connect_failed(hdev, &conn->dst, conn->type, in hci_conn_complete_evt()
2737 conn->dst_type, ev->status); in hci_conn_complete_evt()
2740 if (conn->type == ACL_LINK) in hci_conn_complete_evt()
2741 hci_sco_setup(conn, ev->status); in hci_conn_complete_evt()
2743 if (ev->status) { in hci_conn_complete_evt()
2744 hci_connect_cfm(conn, ev->status); in hci_conn_complete_evt()
2746 } else if (ev->link_type == SCO_LINK) { in hci_conn_complete_evt()
2747 switch (conn->setting & SCO_AIRMODE_MASK) { in hci_conn_complete_evt()
2749 if (hdev->notify) in hci_conn_complete_evt()
2750 hdev->notify(hdev, HCI_NOTIFY_ENABLE_SCO_CVSD); in hci_conn_complete_evt()
2754 hci_connect_cfm(conn, ev->status); in hci_conn_complete_evt()
2774 struct hci_ev_conn_request *ev = (void *) skb->data; in hci_conn_request_evt()
2775 int mask = hdev->link_mode; in hci_conn_request_evt()
2780 BT_DBG("%s bdaddr %pMR type 0x%x", hdev->name, &ev->bdaddr, in hci_conn_request_evt()
2781 ev->link_type); in hci_conn_request_evt()
2783 mask |= hci_proto_connect_ind(hdev, &ev->bdaddr, ev->link_type, in hci_conn_request_evt()
2787 hci_reject_conn(hdev, &ev->bdaddr); in hci_conn_request_evt()
2791 if (hci_bdaddr_list_lookup(&hdev->reject_list, &ev->bdaddr, in hci_conn_request_evt()
2793 hci_reject_conn(hdev, &ev->bdaddr); in hci_conn_request_evt()
2803 !hci_bdaddr_list_lookup_with_flags(&hdev->accept_list, &ev->bdaddr, in hci_conn_request_evt()
2805 hci_reject_conn(hdev, &ev->bdaddr); in hci_conn_request_evt()
2813 ie = hci_inquiry_cache_lookup(hdev, &ev->bdaddr); in hci_conn_request_evt()
2815 memcpy(ie->data.dev_class, ev->dev_class, 3); in hci_conn_request_evt()
2817 conn = hci_conn_hash_lookup_ba(hdev, ev->link_type, in hci_conn_request_evt()
2818 &ev->bdaddr); in hci_conn_request_evt()
2820 conn = hci_conn_add(hdev, ev->link_type, &ev->bdaddr, in hci_conn_request_evt()
2829 memcpy(conn->dev_class, ev->dev_class, 3); in hci_conn_request_evt()
2833 if (ev->link_type == ACL_LINK || in hci_conn_request_evt()
2836 conn->state = BT_CONNECT; in hci_conn_request_evt()
2838 bacpy(&cp.bdaddr, &ev->bdaddr); in hci_conn_request_evt()
2848 conn->state = BT_CONNECT; in hci_conn_request_evt()
2850 bacpy(&cp.bdaddr, &ev->bdaddr); in hci_conn_request_evt()
2851 cp.pkt_type = cpu_to_le16(conn->pkt_type); in hci_conn_request_evt()
2856 cp.content_format = cpu_to_le16(hdev->voice_setting); in hci_conn_request_evt()
2862 conn->state = BT_CONNECT2; in hci_conn_request_evt()
2885 struct hci_ev_disconn_complete *ev = (void *) skb->data; in hci_disconn_complete_evt()
2891 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); in hci_disconn_complete_evt()
2895 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); in hci_disconn_complete_evt()
2899 if (ev->status) { in hci_disconn_complete_evt()
2900 mgmt_disconnect_failed(hdev, &conn->dst, conn->type, in hci_disconn_complete_evt()
2901 conn->dst_type, ev->status); in hci_disconn_complete_evt()
2905 conn->state = BT_CLOSED; in hci_disconn_complete_evt()
2907 mgmt_connected = test_and_clear_bit(HCI_CONN_MGMT_CONNECTED, &conn->flags); in hci_disconn_complete_evt()
2909 if (test_bit(HCI_CONN_AUTH_FAILURE, &conn->flags)) in hci_disconn_complete_evt()
2912 reason = hci_to_mgmt_reason(ev->reason); in hci_disconn_complete_evt()
2914 mgmt_device_disconnected(hdev, &conn->dst, conn->type, conn->dst_type, in hci_disconn_complete_evt()
2917 if (conn->type == ACL_LINK) { in hci_disconn_complete_evt()
2918 if (test_bit(HCI_CONN_FLUSH_KEY, &conn->flags)) in hci_disconn_complete_evt()
2919 hci_remove_link_key(hdev, &conn->dst); in hci_disconn_complete_evt()
2924 params = hci_conn_params_lookup(hdev, &conn->dst, conn->dst_type); in hci_disconn_complete_evt()
2926 switch (params->auto_connect) { in hci_disconn_complete_evt()
2928 if (ev->reason != HCI_ERROR_CONNECTION_TIMEOUT) in hci_disconn_complete_evt()
2934 list_del_init(¶ms->action); in hci_disconn_complete_evt()
2935 list_add(¶ms->action, &hdev->pend_le_conns); in hci_disconn_complete_evt()
2944 hci_disconn_cfm(conn, ev->reason); in hci_disconn_complete_evt()
2949 if (list_empty(&hdev->conn_hash.list) && in hci_disconn_complete_evt()
2950 test_and_clear_bit(SUSPEND_DISCONNECTING, hdev->suspend_tasks)) { in hci_disconn_complete_evt()
2951 wake_up(&hdev->suspend_wait_q); in hci_disconn_complete_evt()
2954 /* Re-enable advertising if necessary, since it might in hci_disconn_complete_evt()
2964 if (conn->type == LE_LINK) { in hci_disconn_complete_evt()
2965 hdev->cur_adv_instance = conn->adv_instance; in hci_disconn_complete_evt()
2977 struct hci_ev_auth_complete *ev = (void *) skb->data; in hci_auth_complete_evt()
2980 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); in hci_auth_complete_evt()
2984 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); in hci_auth_complete_evt()
2988 if (!ev->status) { in hci_auth_complete_evt()
2989 clear_bit(HCI_CONN_AUTH_FAILURE, &conn->flags); in hci_auth_complete_evt()
2992 test_bit(HCI_CONN_REAUTH_PEND, &conn->flags)) { in hci_auth_complete_evt()
2993 bt_dev_info(hdev, "re-auth of legacy device is not possible."); in hci_auth_complete_evt()
2995 set_bit(HCI_CONN_AUTH, &conn->flags); in hci_auth_complete_evt()
2996 conn->sec_level = conn->pending_sec_level; in hci_auth_complete_evt()
2999 if (ev->status == HCI_ERROR_PIN_OR_KEY_MISSING) in hci_auth_complete_evt()
3000 set_bit(HCI_CONN_AUTH_FAILURE, &conn->flags); in hci_auth_complete_evt()
3002 mgmt_auth_failed(conn, ev->status); in hci_auth_complete_evt()
3005 clear_bit(HCI_CONN_AUTH_PEND, &conn->flags); in hci_auth_complete_evt()
3006 clear_bit(HCI_CONN_REAUTH_PEND, &conn->flags); in hci_auth_complete_evt()
3008 if (conn->state == BT_CONFIG) { in hci_auth_complete_evt()
3009 if (!ev->status && hci_conn_ssp_enabled(conn)) { in hci_auth_complete_evt()
3011 cp.handle = ev->handle; in hci_auth_complete_evt()
3016 conn->state = BT_CONNECTED; in hci_auth_complete_evt()
3017 hci_connect_cfm(conn, ev->status); in hci_auth_complete_evt()
3021 hci_auth_cfm(conn, ev->status); in hci_auth_complete_evt()
3024 conn->disc_timeout = HCI_DISCONN_TIMEOUT; in hci_auth_complete_evt()
3028 if (test_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags)) { in hci_auth_complete_evt()
3029 if (!ev->status) { in hci_auth_complete_evt()
3031 cp.handle = ev->handle; in hci_auth_complete_evt()
3036 clear_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags); in hci_auth_complete_evt()
3037 hci_encrypt_cfm(conn, ev->status); in hci_auth_complete_evt()
3047 struct hci_ev_remote_name *ev = (void *) skb->data; in hci_remote_name_evt()
3050 BT_DBG("%s", hdev->name); in hci_remote_name_evt()
3056 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); in hci_remote_name_evt()
3061 if (ev->status == 0) in hci_remote_name_evt()
3062 hci_check_pending_name(hdev, conn, &ev->bdaddr, ev->name, in hci_remote_name_evt()
3063 strnlen(ev->name, HCI_MAX_NAME_LENGTH)); in hci_remote_name_evt()
3065 hci_check_pending_name(hdev, conn, &ev->bdaddr, NULL, 0); in hci_remote_name_evt()
3074 if (!test_and_set_bit(HCI_CONN_AUTH_PEND, &conn->flags)) { in hci_remote_name_evt()
3077 set_bit(HCI_CONN_AUTH_INITIATOR, &conn->flags); in hci_remote_name_evt()
3079 cp.handle = __cpu_to_le16(conn->handle); in hci_remote_name_evt()
3090 const struct hci_rp_read_enc_key_size *rp; in read_enc_key_size_complete() local
3094 BT_DBG("%s status 0x%02x", hdev->name, status); in read_enc_key_size_complete()
3096 if (!skb || skb->len < sizeof(*rp)) { in read_enc_key_size_complete()
3101 rp = (void *)skb->data; in read_enc_key_size_complete()
3102 handle = le16_to_cpu(rp->handle); in read_enc_key_size_complete()
3114 if (rp->status) { in read_enc_key_size_complete()
3117 conn->enc_key_size = 0; in read_enc_key_size_complete()
3119 conn->enc_key_size = rp->key_size; in read_enc_key_size_complete()
3130 struct hci_ev_encrypt_change *ev = (void *) skb->data; in hci_encrypt_change_evt()
3133 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); in hci_encrypt_change_evt()
3137 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); in hci_encrypt_change_evt()
3141 if (!ev->status) { in hci_encrypt_change_evt()
3142 if (ev->encrypt) { in hci_encrypt_change_evt()
3144 set_bit(HCI_CONN_AUTH, &conn->flags); in hci_encrypt_change_evt()
3145 set_bit(HCI_CONN_ENCRYPT, &conn->flags); in hci_encrypt_change_evt()
3146 conn->sec_level = conn->pending_sec_level; in hci_encrypt_change_evt()
3148 /* P-256 authentication key implies FIPS */ in hci_encrypt_change_evt()
3149 if (conn->key_type == HCI_LK_AUTH_COMBINATION_P256) in hci_encrypt_change_evt()
3150 set_bit(HCI_CONN_FIPS, &conn->flags); in hci_encrypt_change_evt()
3152 if ((conn->type == ACL_LINK && ev->encrypt == 0x02) || in hci_encrypt_change_evt()
3153 conn->type == LE_LINK) in hci_encrypt_change_evt()
3154 set_bit(HCI_CONN_AES_CCM, &conn->flags); in hci_encrypt_change_evt()
3156 clear_bit(HCI_CONN_ENCRYPT, &conn->flags); in hci_encrypt_change_evt()
3157 clear_bit(HCI_CONN_AES_CCM, &conn->flags); in hci_encrypt_change_evt()
3164 if (ev->status && conn->type == LE_LINK) { in hci_encrypt_change_evt()
3169 clear_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags); in hci_encrypt_change_evt()
3173 ev->status = HCI_ERROR_AUTH_FAILURE; in hci_encrypt_change_evt()
3175 if (ev->status && conn->state == BT_CONNECTED) { in hci_encrypt_change_evt()
3176 if (ev->status == HCI_ERROR_PIN_OR_KEY_MISSING) in hci_encrypt_change_evt()
3177 set_bit(HCI_CONN_AUTH_FAILURE, &conn->flags); in hci_encrypt_change_evt()
3182 hci_encrypt_cfm(conn, ev->status); in hci_encrypt_change_evt()
3189 if (!ev->status && ev->encrypt && conn->type == ACL_LINK) { in hci_encrypt_change_evt()
3197 if (!(hdev->commands[20] & 0x10)) { in hci_encrypt_change_evt()
3198 conn->enc_key_size = HCI_LINK_KEY_SIZE; in hci_encrypt_change_evt()
3204 cp.handle = cpu_to_le16(conn->handle); in hci_encrypt_change_evt()
3209 conn->enc_key_size = HCI_LINK_KEY_SIZE; in hci_encrypt_change_evt()
3221 * Ensure for AES-CCM encryption as well. in hci_encrypt_change_evt()
3223 if (test_bit(HCI_CONN_ENCRYPT, &conn->flags) && in hci_encrypt_change_evt()
3224 test_bit(HCI_CONN_AES_CCM, &conn->flags) && in hci_encrypt_change_evt()
3225 ((conn->type == ACL_LINK && lmp_ping_capable(hdev)) || in hci_encrypt_change_evt()
3226 (conn->type == LE_LINK && (hdev->le_features[0] & HCI_LE_PING)))) { in hci_encrypt_change_evt()
3229 cp.handle = cpu_to_le16(conn->handle); in hci_encrypt_change_evt()
3230 cp.timeout = cpu_to_le16(hdev->auth_payload_timeout); in hci_encrypt_change_evt()
3231 hci_send_cmd(conn->hdev, HCI_OP_WRITE_AUTH_PAYLOAD_TO, in hci_encrypt_change_evt()
3236 hci_encrypt_cfm(conn, ev->status); in hci_encrypt_change_evt()
3245 struct hci_ev_change_link_key_complete *ev = (void *) skb->data; in hci_change_link_key_complete_evt()
3248 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); in hci_change_link_key_complete_evt()
3252 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); in hci_change_link_key_complete_evt()
3254 if (!ev->status) in hci_change_link_key_complete_evt()
3255 set_bit(HCI_CONN_SECURE, &conn->flags); in hci_change_link_key_complete_evt()
3257 clear_bit(HCI_CONN_AUTH_PEND, &conn->flags); in hci_change_link_key_complete_evt()
3259 hci_key_change_cfm(conn, ev->status); in hci_change_link_key_complete_evt()
3268 struct hci_ev_remote_features *ev = (void *) skb->data; in hci_remote_features_evt()
3271 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); in hci_remote_features_evt()
3275 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); in hci_remote_features_evt()
3279 if (!ev->status) in hci_remote_features_evt()
3280 memcpy(conn->features[0], ev->features, 8); in hci_remote_features_evt()
3282 if (conn->state != BT_CONFIG) in hci_remote_features_evt()
3285 if (!ev->status && lmp_ext_feat_capable(hdev) && in hci_remote_features_evt()
3288 cp.handle = ev->handle; in hci_remote_features_evt()
3295 if (!ev->status && !test_bit(HCI_CONN_MGMT_CONNECTED, &conn->flags)) { in hci_remote_features_evt()
3298 bacpy(&cp.bdaddr, &conn->dst); in hci_remote_features_evt()
3301 } else if (!test_and_set_bit(HCI_CONN_MGMT_CONNECTED, &conn->flags)) in hci_remote_features_evt()
3305 conn->state = BT_CONNECTED; in hci_remote_features_evt()
3306 hci_connect_cfm(conn, ev->status); in hci_remote_features_evt()
3316 cancel_delayed_work(&hdev->cmd_timer); in handle_cmd_cnt_and_timer()
3318 if (!test_bit(HCI_RESET, &hdev->flags)) { in handle_cmd_cnt_and_timer()
3320 cancel_delayed_work(&hdev->ncmd_timer); in handle_cmd_cnt_and_timer()
3321 atomic_set(&hdev->cmd_cnt, 1); in handle_cmd_cnt_and_timer()
3323 schedule_delayed_work(&hdev->ncmd_timer, in handle_cmd_cnt_and_timer()
3334 struct hci_ev_cmd_complete *ev = (void *) skb->data; in hci_cmd_complete_evt()
3336 *opcode = __le16_to_cpu(ev->opcode); in hci_cmd_complete_evt()
3337 *status = skb->data[sizeof(*ev)]; in hci_cmd_complete_evt()
3687 BT_DBG("%s opcode 0x%4.4x", hdev->name, *opcode); in hci_cmd_complete_evt()
3691 handle_cmd_cnt_and_timer(hdev, ev->ncmd); in hci_cmd_complete_evt()
3698 "unexpected event for opcode 0x%4.4x", *opcode); in hci_cmd_complete_evt()
3702 if (atomic_read(&hdev->cmd_cnt) && !skb_queue_empty(&hdev->cmd_q)) in hci_cmd_complete_evt()
3703 queue_work(hdev->workqueue, &hdev->cmd_work); in hci_cmd_complete_evt()
3711 struct hci_ev_cmd_status *ev = (void *) skb->data; in hci_cmd_status_evt()
3715 *opcode = __le16_to_cpu(ev->opcode); in hci_cmd_status_evt()
3716 *status = ev->status; in hci_cmd_status_evt()
3720 hci_cs_inquiry(hdev, ev->status); in hci_cmd_status_evt()
3724 hci_cs_create_conn(hdev, ev->status); in hci_cmd_status_evt()
3728 hci_cs_disconnect(hdev, ev->status); in hci_cmd_status_evt()
3732 hci_cs_add_sco(hdev, ev->status); in hci_cmd_status_evt()
3736 hci_cs_auth_requested(hdev, ev->status); in hci_cmd_status_evt()
3740 hci_cs_set_conn_encrypt(hdev, ev->status); in hci_cmd_status_evt()
3744 hci_cs_remote_name_req(hdev, ev->status); in hci_cmd_status_evt()
3748 hci_cs_read_remote_features(hdev, ev->status); in hci_cmd_status_evt()
3752 hci_cs_read_remote_ext_features(hdev, ev->status); in hci_cmd_status_evt()
3756 hci_cs_setup_sync_conn(hdev, ev->status); in hci_cmd_status_evt()
3760 hci_cs_sniff_mode(hdev, ev->status); in hci_cmd_status_evt()
3764 hci_cs_exit_sniff_mode(hdev, ev->status); in hci_cmd_status_evt()
3768 hci_cs_switch_role(hdev, ev->status); in hci_cmd_status_evt()
3772 hci_cs_le_create_conn(hdev, ev->status); in hci_cmd_status_evt()
3776 hci_cs_le_read_remote_features(hdev, ev->status); in hci_cmd_status_evt()
3780 hci_cs_le_start_enc(hdev, ev->status); in hci_cmd_status_evt()
3784 hci_cs_le_ext_create_conn(hdev, ev->status); in hci_cmd_status_evt()
3788 BT_DBG("%s opcode 0x%4.4x", hdev->name, *opcode); in hci_cmd_status_evt()
3792 handle_cmd_cnt_and_timer(hdev, ev->ncmd); in hci_cmd_status_evt()
3800 if (ev->status || in hci_cmd_status_evt()
3801 (hdev->sent_cmd && !bt_cb(hdev->sent_cmd)->hci.req_event)) in hci_cmd_status_evt()
3802 hci_req_cmd_complete(hdev, *opcode, ev->status, req_complete, in hci_cmd_status_evt()
3807 "unexpected event for opcode 0x%4.4x", *opcode); in hci_cmd_status_evt()
3811 if (atomic_read(&hdev->cmd_cnt) && !skb_queue_empty(&hdev->cmd_q)) in hci_cmd_status_evt()
3812 queue_work(hdev->workqueue, &hdev->cmd_work); in hci_cmd_status_evt()
3817 struct hci_ev_hardware_error *ev = (void *) skb->data; in hci_hardware_error_evt()
3819 hdev->hw_error_code = ev->code; in hci_hardware_error_evt()
3821 queue_work(hdev->req_workqueue, &hdev->error_reset); in hci_hardware_error_evt()
3826 struct hci_ev_role_change *ev = (void *) skb->data; in hci_role_change_evt()
3829 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); in hci_role_change_evt()
3833 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); in hci_role_change_evt()
3835 if (!ev->status) in hci_role_change_evt()
3836 conn->role = ev->role; in hci_role_change_evt()
3838 clear_bit(HCI_CONN_RSWITCH_PEND, &conn->flags); in hci_role_change_evt()
3840 hci_role_switch_cfm(conn, ev->status, ev->role); in hci_role_change_evt()
3848 struct hci_ev_num_comp_pkts *ev = (void *) skb->data; in hci_num_comp_pkts_evt()
3851 if (hdev->flow_ctl_mode != HCI_FLOW_CTL_MODE_PACKET_BASED) { in hci_num_comp_pkts_evt()
3852 bt_dev_err(hdev, "wrong event for mode %d", hdev->flow_ctl_mode); in hci_num_comp_pkts_evt()
3856 if (skb->len < sizeof(*ev) || in hci_num_comp_pkts_evt()
3857 skb->len < struct_size(ev, handles, ev->num_hndl)) { in hci_num_comp_pkts_evt()
3858 BT_DBG("%s bad parameters", hdev->name); in hci_num_comp_pkts_evt()
3862 BT_DBG("%s num_hndl %d", hdev->name, ev->num_hndl); in hci_num_comp_pkts_evt()
3864 for (i = 0; i < ev->num_hndl; i++) { in hci_num_comp_pkts_evt()
3865 struct hci_comp_pkts_info *info = &ev->handles[i]; in hci_num_comp_pkts_evt()
3869 handle = __le16_to_cpu(info->handle); in hci_num_comp_pkts_evt()
3870 count = __le16_to_cpu(info->count); in hci_num_comp_pkts_evt()
3876 conn->sent -= count; in hci_num_comp_pkts_evt()
3878 switch (conn->type) { in hci_num_comp_pkts_evt()
3880 hdev->acl_cnt += count; in hci_num_comp_pkts_evt()
3881 if (hdev->acl_cnt > hdev->acl_pkts) in hci_num_comp_pkts_evt()
3882 hdev->acl_cnt = hdev->acl_pkts; in hci_num_comp_pkts_evt()
3886 if (hdev->le_pkts) { in hci_num_comp_pkts_evt()
3887 hdev->le_cnt += count; in hci_num_comp_pkts_evt()
3888 if (hdev->le_cnt > hdev->le_pkts) in hci_num_comp_pkts_evt()
3889 hdev->le_cnt = hdev->le_pkts; in hci_num_comp_pkts_evt()
3891 hdev->acl_cnt += count; in hci_num_comp_pkts_evt()
3892 if (hdev->acl_cnt > hdev->acl_pkts) in hci_num_comp_pkts_evt()
3893 hdev->acl_cnt = hdev->acl_pkts; in hci_num_comp_pkts_evt()
3898 hdev->sco_cnt += count; in hci_num_comp_pkts_evt()
3899 if (hdev->sco_cnt > hdev->sco_pkts) in hci_num_comp_pkts_evt()
3900 hdev->sco_cnt = hdev->sco_pkts; in hci_num_comp_pkts_evt()
3905 conn->type, conn); in hci_num_comp_pkts_evt()
3910 queue_work(hdev->workqueue, &hdev->tx_work); in hci_num_comp_pkts_evt()
3918 switch (hdev->dev_type) { in __hci_conn_lookup_handle()
3924 return chan->conn; in __hci_conn_lookup_handle()
3927 bt_dev_err(hdev, "unknown dev_type %d", hdev->dev_type); in __hci_conn_lookup_handle()
3936 struct hci_ev_num_comp_blocks *ev = (void *) skb->data; in hci_num_comp_blocks_evt()
3939 if (hdev->flow_ctl_mode != HCI_FLOW_CTL_MODE_BLOCK_BASED) { in hci_num_comp_blocks_evt()
3940 bt_dev_err(hdev, "wrong event for mode %d", hdev->flow_ctl_mode); in hci_num_comp_blocks_evt()
3944 if (skb->len < sizeof(*ev) || in hci_num_comp_blocks_evt()
3945 skb->len < struct_size(ev, handles, ev->num_hndl)) { in hci_num_comp_blocks_evt()
3946 BT_DBG("%s bad parameters", hdev->name); in hci_num_comp_blocks_evt()
3950 BT_DBG("%s num_blocks %d num_hndl %d", hdev->name, ev->num_blocks, in hci_num_comp_blocks_evt()
3951 ev->num_hndl); in hci_num_comp_blocks_evt()
3953 for (i = 0; i < ev->num_hndl; i++) { in hci_num_comp_blocks_evt()
3954 struct hci_comp_blocks_info *info = &ev->handles[i]; in hci_num_comp_blocks_evt()
3958 handle = __le16_to_cpu(info->handle); in hci_num_comp_blocks_evt()
3959 block_count = __le16_to_cpu(info->blocks); in hci_num_comp_blocks_evt()
3965 conn->sent -= block_count; in hci_num_comp_blocks_evt()
3967 switch (conn->type) { in hci_num_comp_blocks_evt()
3970 hdev->block_cnt += block_count; in hci_num_comp_blocks_evt()
3971 if (hdev->block_cnt > hdev->num_blocks) in hci_num_comp_blocks_evt()
3972 hdev->block_cnt = hdev->num_blocks; in hci_num_comp_blocks_evt()
3977 conn->type, conn); in hci_num_comp_blocks_evt()
3982 queue_work(hdev->workqueue, &hdev->tx_work); in hci_num_comp_blocks_evt()
3987 struct hci_ev_mode_change *ev = (void *) skb->data; in hci_mode_change_evt()
3990 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); in hci_mode_change_evt()
3994 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); in hci_mode_change_evt()
3996 conn->mode = ev->mode; in hci_mode_change_evt()
3999 &conn->flags)) { in hci_mode_change_evt()
4000 if (conn->mode == HCI_CM_ACTIVE) in hci_mode_change_evt()
4001 set_bit(HCI_CONN_POWER_SAVE, &conn->flags); in hci_mode_change_evt()
4003 clear_bit(HCI_CONN_POWER_SAVE, &conn->flags); in hci_mode_change_evt()
4006 if (test_and_clear_bit(HCI_CONN_SCO_SETUP_PEND, &conn->flags)) in hci_mode_change_evt()
4007 hci_sco_setup(conn, ev->status); in hci_mode_change_evt()
4015 struct hci_ev_pin_code_req *ev = (void *) skb->data; in hci_pin_code_request_evt()
4018 BT_DBG("%s", hdev->name); in hci_pin_code_request_evt()
4022 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); in hci_pin_code_request_evt()
4026 if (conn->state == BT_CONNECTED) { in hci_pin_code_request_evt()
4028 conn->disc_timeout = HCI_PAIRING_TIMEOUT; in hci_pin_code_request_evt()
4033 !test_bit(HCI_CONN_AUTH_INITIATOR, &conn->flags)) { in hci_pin_code_request_evt()
4035 sizeof(ev->bdaddr), &ev->bdaddr); in hci_pin_code_request_evt()
4039 if (conn->pending_sec_level == BT_SECURITY_HIGH) in hci_pin_code_request_evt()
4044 mgmt_pin_code_request(hdev, &ev->bdaddr, secure); in hci_pin_code_request_evt()
4056 conn->pin_length = pin_len; in conn_set_key()
4057 conn->key_type = key_type; in conn_set_key()
4066 conn->pending_sec_level = BT_SECURITY_HIGH; in conn_set_key()
4068 conn->pending_sec_level = BT_SECURITY_MEDIUM; in conn_set_key()
4072 conn->pending_sec_level = BT_SECURITY_MEDIUM; in conn_set_key()
4075 conn->pending_sec_level = BT_SECURITY_HIGH; in conn_set_key()
4078 conn->pending_sec_level = BT_SECURITY_FIPS; in conn_set_key()
4085 struct hci_ev_link_key_req *ev = (void *) skb->data; in hci_link_key_request_evt()
4090 BT_DBG("%s", hdev->name); in hci_link_key_request_evt()
4097 key = hci_find_link_key(hdev, &ev->bdaddr); in hci_link_key_request_evt()
4099 BT_DBG("%s link key not found for %pMR", hdev->name, in hci_link_key_request_evt()
4100 &ev->bdaddr); in hci_link_key_request_evt()
4104 BT_DBG("%s found key type %u for %pMR", hdev->name, key->type, in hci_link_key_request_evt()
4105 &ev->bdaddr); in hci_link_key_request_evt()
4107 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); in hci_link_key_request_evt()
4109 clear_bit(HCI_CONN_NEW_LINK_KEY, &conn->flags); in hci_link_key_request_evt()
4111 if ((key->type == HCI_LK_UNAUTH_COMBINATION_P192 || in hci_link_key_request_evt()
4112 key->type == HCI_LK_UNAUTH_COMBINATION_P256) && in hci_link_key_request_evt()
4113 conn->auth_type != 0xff && (conn->auth_type & 0x01)) { in hci_link_key_request_evt()
4114 BT_DBG("%s ignoring unauthenticated key", hdev->name); in hci_link_key_request_evt()
4118 if (key->type == HCI_LK_COMBINATION && key->pin_len < 16 && in hci_link_key_request_evt()
4119 (conn->pending_sec_level == BT_SECURITY_HIGH || in hci_link_key_request_evt()
4120 conn->pending_sec_level == BT_SECURITY_FIPS)) { in hci_link_key_request_evt()
4122 hdev->name); in hci_link_key_request_evt()
4126 conn_set_key(conn, key->type, key->pin_len); in hci_link_key_request_evt()
4129 bacpy(&cp.bdaddr, &ev->bdaddr); in hci_link_key_request_evt()
4130 memcpy(cp.link_key, key->val, HCI_LINK_KEY_SIZE); in hci_link_key_request_evt()
4139 hci_send_cmd(hdev, HCI_OP_LINK_KEY_NEG_REPLY, 6, &ev->bdaddr); in hci_link_key_request_evt()
4145 struct hci_ev_link_key_notify *ev = (void *) skb->data; in hci_link_key_notify_evt()
4151 BT_DBG("%s", hdev->name); in hci_link_key_notify_evt()
4155 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); in hci_link_key_notify_evt()
4160 conn->disc_timeout = HCI_DISCONN_TIMEOUT; in hci_link_key_notify_evt()
4163 set_bit(HCI_CONN_NEW_LINK_KEY, &conn->flags); in hci_link_key_notify_evt()
4164 conn_set_key(conn, ev->key_type, conn->pin_length); in hci_link_key_notify_evt()
4169 key = hci_add_link_key(hdev, conn, &ev->bdaddr, ev->link_key, in hci_link_key_notify_evt()
4170 ev->key_type, pin_len, &persistent); in hci_link_key_notify_evt()
4177 if (ev->key_type == HCI_LK_CHANGED_COMBINATION) in hci_link_key_notify_evt()
4178 conn_set_key(conn, key->type, key->pin_len); in hci_link_key_notify_evt()
4187 if (key->type == HCI_LK_DEBUG_COMBINATION && in hci_link_key_notify_evt()
4189 list_del_rcu(&key->list); in hci_link_key_notify_evt()
4195 clear_bit(HCI_CONN_FLUSH_KEY, &conn->flags); in hci_link_key_notify_evt()
4197 set_bit(HCI_CONN_FLUSH_KEY, &conn->flags); in hci_link_key_notify_evt()
4205 struct hci_ev_clock_offset *ev = (void *) skb->data; in hci_clock_offset_evt()
4208 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); in hci_clock_offset_evt()
4212 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); in hci_clock_offset_evt()
4213 if (conn && !ev->status) { in hci_clock_offset_evt()
4216 ie = hci_inquiry_cache_lookup(hdev, &conn->dst); in hci_clock_offset_evt()
4218 ie->data.clock_offset = ev->clock_offset; in hci_clock_offset_evt()
4219 ie->timestamp = jiffies; in hci_clock_offset_evt()
4228 struct hci_ev_pkt_type_change *ev = (void *) skb->data; in hci_pkt_type_change_evt()
4231 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); in hci_pkt_type_change_evt()
4235 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); in hci_pkt_type_change_evt()
4236 if (conn && !ev->status) in hci_pkt_type_change_evt()
4237 conn->pkt_type = __le16_to_cpu(ev->pkt_type); in hci_pkt_type_change_evt()
4244 struct hci_ev_pscan_rep_mode *ev = (void *) skb->data; in hci_pscan_rep_mode_evt()
4247 BT_DBG("%s", hdev->name); in hci_pscan_rep_mode_evt()
4251 ie = hci_inquiry_cache_lookup(hdev, &ev->bdaddr); in hci_pscan_rep_mode_evt()
4253 ie->data.pscan_rep_mode = ev->pscan_rep_mode; in hci_pscan_rep_mode_evt()
4254 ie->timestamp = jiffies; in hci_pscan_rep_mode_evt()
4264 int num_rsp = *((__u8 *) skb->data); in hci_inquiry_result_with_rssi_evt()
4266 BT_DBG("%s num_rsp %d", hdev->name, num_rsp); in hci_inquiry_result_with_rssi_evt()
4276 if ((skb->len - 1) / num_rsp != sizeof(struct inquiry_info_with_rssi)) { in hci_inquiry_result_with_rssi_evt()
4278 info = (void *) (skb->data + 1); in hci_inquiry_result_with_rssi_evt()
4280 if (skb->len < num_rsp * sizeof(*info) + 1) in hci_inquiry_result_with_rssi_evt()
4283 for (; num_rsp; num_rsp--, info++) { in hci_inquiry_result_with_rssi_evt()
4286 bacpy(&data.bdaddr, &info->bdaddr); in hci_inquiry_result_with_rssi_evt()
4287 data.pscan_rep_mode = info->pscan_rep_mode; in hci_inquiry_result_with_rssi_evt()
4288 data.pscan_period_mode = info->pscan_period_mode; in hci_inquiry_result_with_rssi_evt()
4289 data.pscan_mode = info->pscan_mode; in hci_inquiry_result_with_rssi_evt()
4290 memcpy(data.dev_class, info->dev_class, 3); in hci_inquiry_result_with_rssi_evt()
4291 data.clock_offset = info->clock_offset; in hci_inquiry_result_with_rssi_evt()
4292 data.rssi = info->rssi; in hci_inquiry_result_with_rssi_evt()
4297 mgmt_device_found(hdev, &info->bdaddr, ACL_LINK, 0x00, in hci_inquiry_result_with_rssi_evt()
4298 info->dev_class, info->rssi, in hci_inquiry_result_with_rssi_evt()
4302 struct inquiry_info_with_rssi *info = (void *) (skb->data + 1); in hci_inquiry_result_with_rssi_evt()
4304 if (skb->len < num_rsp * sizeof(*info) + 1) in hci_inquiry_result_with_rssi_evt()
4307 for (; num_rsp; num_rsp--, info++) { in hci_inquiry_result_with_rssi_evt()
4310 bacpy(&data.bdaddr, &info->bdaddr); in hci_inquiry_result_with_rssi_evt()
4311 data.pscan_rep_mode = info->pscan_rep_mode; in hci_inquiry_result_with_rssi_evt()
4312 data.pscan_period_mode = info->pscan_period_mode; in hci_inquiry_result_with_rssi_evt()
4314 memcpy(data.dev_class, info->dev_class, 3); in hci_inquiry_result_with_rssi_evt()
4315 data.clock_offset = info->clock_offset; in hci_inquiry_result_with_rssi_evt()
4316 data.rssi = info->rssi; in hci_inquiry_result_with_rssi_evt()
4321 mgmt_device_found(hdev, &info->bdaddr, ACL_LINK, 0x00, in hci_inquiry_result_with_rssi_evt()
4322 info->dev_class, info->rssi, in hci_inquiry_result_with_rssi_evt()
4334 struct hci_ev_remote_ext_features *ev = (void *) skb->data; in hci_remote_ext_features_evt()
4337 BT_DBG("%s", hdev->name); in hci_remote_ext_features_evt()
4341 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); in hci_remote_ext_features_evt()
4345 if (ev->page < HCI_MAX_PAGES) in hci_remote_ext_features_evt()
4346 memcpy(conn->features[ev->page], ev->features, 8); in hci_remote_ext_features_evt()
4348 if (!ev->status && ev->page == 0x01) { in hci_remote_ext_features_evt()
4351 ie = hci_inquiry_cache_lookup(hdev, &conn->dst); in hci_remote_ext_features_evt()
4353 ie->data.ssp_mode = (ev->features[0] & LMP_HOST_SSP); in hci_remote_ext_features_evt()
4355 if (ev->features[0] & LMP_HOST_SSP) { in hci_remote_ext_features_evt()
4356 set_bit(HCI_CONN_SSP_ENABLED, &conn->flags); in hci_remote_ext_features_evt()
4366 clear_bit(HCI_CONN_SSP_ENABLED, &conn->flags); in hci_remote_ext_features_evt()
4369 if (ev->features[0] & LMP_HOST_SC) in hci_remote_ext_features_evt()
4370 set_bit(HCI_CONN_SC_ENABLED, &conn->flags); in hci_remote_ext_features_evt()
4373 if (conn->state != BT_CONFIG) in hci_remote_ext_features_evt()
4376 if (!ev->status && !test_bit(HCI_CONN_MGMT_CONNECTED, &conn->flags)) { in hci_remote_ext_features_evt()
4379 bacpy(&cp.bdaddr, &conn->dst); in hci_remote_ext_features_evt()
4382 } else if (!test_and_set_bit(HCI_CONN_MGMT_CONNECTED, &conn->flags)) in hci_remote_ext_features_evt()
4386 conn->state = BT_CONNECTED; in hci_remote_ext_features_evt()
4387 hci_connect_cfm(conn, ev->status); in hci_remote_ext_features_evt()
4398 struct hci_ev_sync_conn_complete *ev = (void *) skb->data; in hci_sync_conn_complete_evt()
4401 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); in hci_sync_conn_complete_evt()
4405 conn = hci_conn_hash_lookup_ba(hdev, ev->link_type, &ev->bdaddr); in hci_sync_conn_complete_evt()
4407 if (ev->link_type == ESCO_LINK) in hci_sync_conn_complete_evt()
4419 conn = hci_conn_hash_lookup_ba(hdev, ESCO_LINK, &ev->bdaddr); in hci_sync_conn_complete_evt()
4424 switch (ev->status) { in hci_sync_conn_complete_evt()
4436 if (conn->state == BT_CONNECTED) { in hci_sync_conn_complete_evt()
4441 conn->handle = __le16_to_cpu(ev->handle); in hci_sync_conn_complete_evt()
4442 conn->state = BT_CONNECTED; in hci_sync_conn_complete_evt()
4443 conn->type = ev->link_type; in hci_sync_conn_complete_evt()
4457 if (conn->out) { in hci_sync_conn_complete_evt()
4458 conn->pkt_type = (hdev->esco_type & SCO_ESCO_MASK) | in hci_sync_conn_complete_evt()
4459 (hdev->esco_type & EDR_ESCO_MASK); in hci_sync_conn_complete_evt()
4460 if (hci_setup_sync(conn, conn->link->handle)) in hci_sync_conn_complete_evt()
4466 conn->state = BT_CLOSED; in hci_sync_conn_complete_evt()
4470 bt_dev_dbg(hdev, "SCO connected with air mode: %02x", ev->air_mode); in hci_sync_conn_complete_evt()
4472 switch (ev->air_mode) { in hci_sync_conn_complete_evt()
4474 if (hdev->notify) in hci_sync_conn_complete_evt()
4475 hdev->notify(hdev, HCI_NOTIFY_ENABLE_SCO_CVSD); in hci_sync_conn_complete_evt()
4478 if (hdev->notify) in hci_sync_conn_complete_evt()
4479 hdev->notify(hdev, HCI_NOTIFY_ENABLE_SCO_TRANSP); in hci_sync_conn_complete_evt()
4483 hci_connect_cfm(conn, ev->status); in hci_sync_conn_complete_evt()
4484 if (ev->status) in hci_sync_conn_complete_evt()
4512 struct extended_inquiry_info *info = (void *) (skb->data + 1); in hci_extended_inquiry_result_evt()
4513 int num_rsp = *((__u8 *) skb->data); in hci_extended_inquiry_result_evt()
4516 BT_DBG("%s num_rsp %d", hdev->name, num_rsp); in hci_extended_inquiry_result_evt()
4518 if (!num_rsp || skb->len < num_rsp * sizeof(*info) + 1) in hci_extended_inquiry_result_evt()
4526 for (; num_rsp; num_rsp--, info++) { in hci_extended_inquiry_result_evt()
4530 bacpy(&data.bdaddr, &info->bdaddr); in hci_extended_inquiry_result_evt()
4531 data.pscan_rep_mode = info->pscan_rep_mode; in hci_extended_inquiry_result_evt()
4532 data.pscan_period_mode = info->pscan_period_mode; in hci_extended_inquiry_result_evt()
4534 memcpy(data.dev_class, info->dev_class, 3); in hci_extended_inquiry_result_evt()
4535 data.clock_offset = info->clock_offset; in hci_extended_inquiry_result_evt()
4536 data.rssi = info->rssi; in hci_extended_inquiry_result_evt()
4540 name_known = eir_get_data(info->data, in hci_extended_inquiry_result_evt()
4541 sizeof(info->data), in hci_extended_inquiry_result_evt()
4548 eir_len = eir_get_length(info->data, sizeof(info->data)); in hci_extended_inquiry_result_evt()
4550 mgmt_device_found(hdev, &info->bdaddr, ACL_LINK, 0x00, in hci_extended_inquiry_result_evt()
4551 info->dev_class, info->rssi, in hci_extended_inquiry_result_evt()
4552 flags, info->data, eir_len, NULL, 0); in hci_extended_inquiry_result_evt()
4561 struct hci_ev_key_refresh_complete *ev = (void *) skb->data; in hci_key_refresh_complete_evt()
4564 BT_DBG("%s status 0x%2.2x handle 0x%4.4x", hdev->name, ev->status, in hci_key_refresh_complete_evt()
4565 __le16_to_cpu(ev->handle)); in hci_key_refresh_complete_evt()
4569 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); in hci_key_refresh_complete_evt()
4576 if (conn->type != LE_LINK) in hci_key_refresh_complete_evt()
4579 if (!ev->status) in hci_key_refresh_complete_evt()
4580 conn->sec_level = conn->pending_sec_level; in hci_key_refresh_complete_evt()
4582 clear_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags); in hci_key_refresh_complete_evt()
4584 if (ev->status && conn->state == BT_CONNECTED) { in hci_key_refresh_complete_evt()
4590 if (conn->state == BT_CONFIG) { in hci_key_refresh_complete_evt()
4591 if (!ev->status) in hci_key_refresh_complete_evt()
4592 conn->state = BT_CONNECTED; in hci_key_refresh_complete_evt()
4594 hci_connect_cfm(conn, ev->status); in hci_key_refresh_complete_evt()
4597 hci_auth_cfm(conn, ev->status); in hci_key_refresh_complete_evt()
4600 conn->disc_timeout = HCI_DISCONN_TIMEOUT; in hci_key_refresh_complete_evt()
4610 /* If remote requests no-bonding follow that lead */ in hci_get_auth_req()
4611 if (conn->remote_auth == HCI_AT_NO_BONDING || in hci_get_auth_req()
4612 conn->remote_auth == HCI_AT_NO_BONDING_MITM) in hci_get_auth_req()
4613 return conn->remote_auth | (conn->auth_type & 0x01); in hci_get_auth_req()
4618 if (conn->remote_cap != HCI_IO_NO_INPUT_OUTPUT && in hci_get_auth_req()
4619 conn->io_capability != HCI_IO_NO_INPUT_OUTPUT) in hci_get_auth_req()
4620 return conn->remote_auth | 0x01; in hci_get_auth_req()
4623 return (conn->remote_auth & ~0x01) | (conn->auth_type & 0x01); in hci_get_auth_req()
4628 struct hci_dev *hdev = conn->hdev; in bredr_oob_data_present()
4631 data = hci_find_remote_oob_data(hdev, &conn->dst, BDADDR_BREDR); in bredr_oob_data_present()
4643 return data->present; in bredr_oob_data_present()
4646 * the P-256 values are required. If they are not in bredr_oob_data_present()
4650 if (!memcmp(data->rand256, ZERO_KEY, 16) || in bredr_oob_data_present()
4651 !memcmp(data->hash256, ZERO_KEY, 16)) in bredr_oob_data_present()
4659 * P-192 data values are present. in bredr_oob_data_present()
4661 if (!memcmp(data->rand192, ZERO_KEY, 16) || in bredr_oob_data_present()
4662 !memcmp(data->hash192, ZERO_KEY, 16)) in bredr_oob_data_present()
4670 struct hci_ev_io_capa_request *ev = (void *) skb->data; in hci_io_capa_request_evt()
4673 BT_DBG("%s", hdev->name); in hci_io_capa_request_evt()
4677 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); in hci_io_capa_request_evt()
4690 test_bit(HCI_CONN_AUTH_INITIATOR, &conn->flags) || in hci_io_capa_request_evt()
4691 (conn->remote_auth & ~0x01) == HCI_AT_NO_BONDING) { in hci_io_capa_request_evt()
4694 bacpy(&cp.bdaddr, &ev->bdaddr); in hci_io_capa_request_evt()
4697 cp.capability = (conn->io_capability == 0x04) ? in hci_io_capa_request_evt()
4698 HCI_IO_DISPLAY_YESNO : conn->io_capability; in hci_io_capa_request_evt()
4701 if (conn->remote_auth == 0xff) { in hci_io_capa_request_evt()
4703 * except for the no-bonding case. in hci_io_capa_request_evt()
4705 if (conn->io_capability != HCI_IO_NO_INPUT_OUTPUT && in hci_io_capa_request_evt()
4706 conn->auth_type != HCI_AT_NO_BONDING) in hci_io_capa_request_evt()
4707 conn->auth_type |= 0x01; in hci_io_capa_request_evt()
4709 conn->auth_type = hci_get_auth_req(conn); in hci_io_capa_request_evt()
4712 /* If we're not bondable, force one of the non-bondable in hci_io_capa_request_evt()
4716 conn->auth_type &= HCI_AT_NO_BONDING_MITM; in hci_io_capa_request_evt()
4718 cp.authentication = conn->auth_type; in hci_io_capa_request_evt()
4726 bacpy(&cp.bdaddr, &ev->bdaddr); in hci_io_capa_request_evt()
4739 struct hci_ev_io_capa_reply *ev = (void *) skb->data; in hci_io_capa_reply_evt()
4742 BT_DBG("%s", hdev->name); in hci_io_capa_reply_evt()
4746 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); in hci_io_capa_reply_evt()
4750 conn->remote_cap = ev->capability; in hci_io_capa_reply_evt()
4751 conn->remote_auth = ev->authentication; in hci_io_capa_reply_evt()
4760 struct hci_ev_user_confirm_req *ev = (void *) skb->data; in hci_user_confirm_request_evt()
4764 BT_DBG("%s", hdev->name); in hci_user_confirm_request_evt()
4771 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); in hci_user_confirm_request_evt()
4775 loc_mitm = (conn->auth_type & 0x01); in hci_user_confirm_request_evt()
4776 rem_mitm = (conn->remote_auth & 0x01); in hci_user_confirm_request_evt()
4781 * necessarily match conn->auth_type. in hci_user_confirm_request_evt()
4783 if (conn->pending_sec_level > BT_SECURITY_MEDIUM && in hci_user_confirm_request_evt()
4784 conn->remote_cap == HCI_IO_NO_INPUT_OUTPUT) { in hci_user_confirm_request_evt()
4787 sizeof(ev->bdaddr), &ev->bdaddr); in hci_user_confirm_request_evt()
4791 /* If no side requires MITM protection; auto-accept */ in hci_user_confirm_request_evt()
4792 if ((!loc_mitm || conn->remote_cap == HCI_IO_NO_INPUT_OUTPUT) && in hci_user_confirm_request_evt()
4793 (!rem_mitm || conn->io_capability == HCI_IO_NO_INPUT_OUTPUT)) { in hci_user_confirm_request_evt()
4799 * NoInputNoOutput, in which case we do auto-accept in hci_user_confirm_request_evt()
4801 if (!test_bit(HCI_CONN_AUTH_PEND, &conn->flags) && in hci_user_confirm_request_evt()
4802 conn->io_capability != HCI_IO_NO_INPUT_OUTPUT && in hci_user_confirm_request_evt()
4804 BT_DBG("Confirming auto-accept as acceptor"); in hci_user_confirm_request_evt()
4813 if (hci_find_link_key(hdev, &ev->bdaddr)) { in hci_user_confirm_request_evt()
4819 BT_DBG("Auto-accept of user confirmation with %ums delay", in hci_user_confirm_request_evt()
4820 hdev->auto_accept_delay); in hci_user_confirm_request_evt()
4822 if (hdev->auto_accept_delay > 0) { in hci_user_confirm_request_evt()
4823 int delay = msecs_to_jiffies(hdev->auto_accept_delay); in hci_user_confirm_request_evt()
4824 queue_delayed_work(conn->hdev->workqueue, in hci_user_confirm_request_evt()
4825 &conn->auto_accept_work, delay); in hci_user_confirm_request_evt()
4830 sizeof(ev->bdaddr), &ev->bdaddr); in hci_user_confirm_request_evt()
4835 mgmt_user_confirm_request(hdev, &ev->bdaddr, ACL_LINK, 0, in hci_user_confirm_request_evt()
4836 le32_to_cpu(ev->passkey), confirm_hint); in hci_user_confirm_request_evt()
4845 struct hci_ev_user_passkey_req *ev = (void *) skb->data; in hci_user_passkey_request_evt()
4847 BT_DBG("%s", hdev->name); in hci_user_passkey_request_evt()
4850 mgmt_user_passkey_request(hdev, &ev->bdaddr, ACL_LINK, 0); in hci_user_passkey_request_evt()
4856 struct hci_ev_user_passkey_notify *ev = (void *) skb->data; in hci_user_passkey_notify_evt()
4859 BT_DBG("%s", hdev->name); in hci_user_passkey_notify_evt()
4861 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); in hci_user_passkey_notify_evt()
4865 conn->passkey_notify = __le32_to_cpu(ev->passkey); in hci_user_passkey_notify_evt()
4866 conn->passkey_entered = 0; in hci_user_passkey_notify_evt()
4869 mgmt_user_passkey_notify(hdev, &conn->dst, conn->type, in hci_user_passkey_notify_evt()
4870 conn->dst_type, conn->passkey_notify, in hci_user_passkey_notify_evt()
4871 conn->passkey_entered); in hci_user_passkey_notify_evt()
4876 struct hci_ev_keypress_notify *ev = (void *) skb->data; in hci_keypress_notify_evt()
4879 BT_DBG("%s", hdev->name); in hci_keypress_notify_evt()
4881 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); in hci_keypress_notify_evt()
4885 switch (ev->type) { in hci_keypress_notify_evt()
4887 conn->passkey_entered = 0; in hci_keypress_notify_evt()
4891 conn->passkey_entered++; in hci_keypress_notify_evt()
4895 conn->passkey_entered--; in hci_keypress_notify_evt()
4899 conn->passkey_entered = 0; in hci_keypress_notify_evt()
4907 mgmt_user_passkey_notify(hdev, &conn->dst, conn->type, in hci_keypress_notify_evt()
4908 conn->dst_type, conn->passkey_notify, in hci_keypress_notify_evt()
4909 conn->passkey_entered); in hci_keypress_notify_evt()
4915 struct hci_ev_simple_pair_complete *ev = (void *) skb->data; in hci_simple_pair_complete_evt()
4918 BT_DBG("%s", hdev->name); in hci_simple_pair_complete_evt()
4922 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); in hci_simple_pair_complete_evt()
4927 conn->remote_auth = 0xff; in hci_simple_pair_complete_evt()
4934 if (!test_bit(HCI_CONN_AUTH_PEND, &conn->flags) && ev->status) in hci_simple_pair_complete_evt()
4935 mgmt_auth_failed(conn, ev->status); in hci_simple_pair_complete_evt()
4946 struct hci_ev_remote_host_features *ev = (void *) skb->data; in hci_remote_host_features_evt()
4950 BT_DBG("%s", hdev->name); in hci_remote_host_features_evt()
4954 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); in hci_remote_host_features_evt()
4956 memcpy(conn->features[1], ev->features, 8); in hci_remote_host_features_evt()
4958 ie = hci_inquiry_cache_lookup(hdev, &ev->bdaddr); in hci_remote_host_features_evt()
4960 ie->data.ssp_mode = (ev->features[0] & LMP_HOST_SSP); in hci_remote_host_features_evt()
4968 struct hci_ev_remote_oob_data_request *ev = (void *) skb->data; in hci_remote_oob_data_request_evt()
4971 BT_DBG("%s", hdev->name); in hci_remote_oob_data_request_evt()
4978 data = hci_find_remote_oob_data(hdev, &ev->bdaddr, BDADDR_BREDR); in hci_remote_oob_data_request_evt()
4982 bacpy(&cp.bdaddr, &ev->bdaddr); in hci_remote_oob_data_request_evt()
4991 bacpy(&cp.bdaddr, &ev->bdaddr); in hci_remote_oob_data_request_evt()
4996 memcpy(cp.hash192, data->hash192, sizeof(cp.hash192)); in hci_remote_oob_data_request_evt()
4997 memcpy(cp.rand192, data->rand192, sizeof(cp.rand192)); in hci_remote_oob_data_request_evt()
4999 memcpy(cp.hash256, data->hash256, sizeof(cp.hash256)); in hci_remote_oob_data_request_evt()
5000 memcpy(cp.rand256, data->rand256, sizeof(cp.rand256)); in hci_remote_oob_data_request_evt()
5007 bacpy(&cp.bdaddr, &ev->bdaddr); in hci_remote_oob_data_request_evt()
5008 memcpy(cp.hash, data->hash192, sizeof(cp.hash)); in hci_remote_oob_data_request_evt()
5009 memcpy(cp.rand, data->rand192, sizeof(cp.rand)); in hci_remote_oob_data_request_evt()
5022 struct hci_ev_channel_selected *ev = (void *)skb->data; in hci_chan_selected_evt()
5025 BT_DBG("%s handle 0x%2.2x", hdev->name, ev->phy_handle); in hci_chan_selected_evt()
5029 hcon = hci_conn_hash_lookup_handle(hdev, ev->phy_handle); in hci_chan_selected_evt()
5039 struct hci_ev_phy_link_complete *ev = (void *) skb->data; in hci_phy_link_complete_evt()
5042 BT_DBG("%s handle 0x%2.2x status 0x%2.2x", hdev->name, ev->phy_handle, in hci_phy_link_complete_evt()
5043 ev->status); in hci_phy_link_complete_evt()
5047 hcon = hci_conn_hash_lookup_handle(hdev, ev->phy_handle); in hci_phy_link_complete_evt()
5051 if (!hcon->amp_mgr) in hci_phy_link_complete_evt()
5054 if (ev->status) { in hci_phy_link_complete_evt()
5059 bredr_hcon = hcon->amp_mgr->l2cap_conn->hcon; in hci_phy_link_complete_evt()
5061 hcon->state = BT_CONNECTED; in hci_phy_link_complete_evt()
5062 bacpy(&hcon->dst, &bredr_hcon->dst); in hci_phy_link_complete_evt()
5065 hcon->disc_timeout = HCI_DISCONN_TIMEOUT; in hci_phy_link_complete_evt()
5079 struct hci_ev_logical_link_complete *ev = (void *) skb->data; in hci_loglink_complete_evt()
5084 BT_DBG("%s log_handle 0x%4.4x phy_handle 0x%2.2x status 0x%2.2x", in hci_loglink_complete_evt()
5085 hdev->name, le16_to_cpu(ev->handle), ev->phy_handle, in hci_loglink_complete_evt()
5086 ev->status); in hci_loglink_complete_evt()
5088 hcon = hci_conn_hash_lookup_handle(hdev, ev->phy_handle); in hci_loglink_complete_evt()
5097 hchan->handle = le16_to_cpu(ev->handle); in hci_loglink_complete_evt()
5098 hchan->amp = true; in hci_loglink_complete_evt()
5100 BT_DBG("hcon %p mgr %p hchan %p", hcon, hcon->amp_mgr, hchan); in hci_loglink_complete_evt()
5102 mgr = hcon->amp_mgr; in hci_loglink_complete_evt()
5103 if (mgr && mgr->bredr_chan) { in hci_loglink_complete_evt()
5104 struct l2cap_chan *bredr_chan = mgr->bredr_chan; in hci_loglink_complete_evt()
5108 bredr_chan->conn->mtu = hdev->block_mtu; in hci_loglink_complete_evt()
5119 struct hci_ev_disconn_logical_link_complete *ev = (void *) skb->data; in hci_disconn_loglink_complete_evt()
5122 BT_DBG("%s log handle 0x%4.4x status 0x%2.2x", hdev->name, in hci_disconn_loglink_complete_evt()
5123 le16_to_cpu(ev->handle), ev->status); in hci_disconn_loglink_complete_evt()
5125 if (ev->status) in hci_disconn_loglink_complete_evt()
5130 hchan = hci_chan_lookup_handle(hdev, le16_to_cpu(ev->handle)); in hci_disconn_loglink_complete_evt()
5131 if (!hchan || !hchan->amp) in hci_disconn_loglink_complete_evt()
5134 amp_destroy_logical_link(hchan, ev->reason); in hci_disconn_loglink_complete_evt()
5143 struct hci_ev_disconn_phy_link_complete *ev = (void *) skb->data; in hci_disconn_phylink_complete_evt()
5146 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); in hci_disconn_phylink_complete_evt()
5148 if (ev->status) in hci_disconn_phylink_complete_evt()
5153 hcon = hci_conn_hash_lookup_handle(hdev, ev->phy_handle); in hci_disconn_phylink_complete_evt()
5155 hcon->state = BT_CLOSED; in hci_disconn_phylink_complete_evt()
5166 if (conn->out) { in le_conn_update_addr()
5167 conn->dst_type = bdaddr_type; in le_conn_update_addr()
5168 conn->resp_addr_type = bdaddr_type; in le_conn_update_addr()
5169 bacpy(&conn->resp_addr, bdaddr); in le_conn_update_addr()
5172 * used instead or hdev->rpa. in le_conn_update_addr()
5175 conn->init_addr_type = ADDR_LE_DEV_RANDOM; in le_conn_update_addr()
5176 bacpy(&conn->init_addr, local_rpa); in le_conn_update_addr()
5177 } else if (hci_dev_test_flag(conn->hdev, HCI_PRIVACY)) { in le_conn_update_addr()
5178 conn->init_addr_type = ADDR_LE_DEV_RANDOM; in le_conn_update_addr()
5179 bacpy(&conn->init_addr, &conn->hdev->rpa); in le_conn_update_addr()
5181 hci_copy_identity_address(conn->hdev, &conn->init_addr, in le_conn_update_addr()
5182 &conn->init_addr_type); in le_conn_update_addr()
5185 conn->resp_addr_type = conn->hdev->adv_addr_type; in le_conn_update_addr()
5187 * used instead or hdev->rpa. in le_conn_update_addr()
5190 conn->resp_addr_type = ADDR_LE_DEV_RANDOM; in le_conn_update_addr()
5191 bacpy(&conn->resp_addr, local_rpa); in le_conn_update_addr()
5192 } else if (conn->hdev->adv_addr_type == ADDR_LE_DEV_RANDOM) { in le_conn_update_addr()
5196 if (!ext_adv_capable(conn->hdev)) in le_conn_update_addr()
5197 bacpy(&conn->resp_addr, in le_conn_update_addr()
5198 &conn->hdev->random_addr); in le_conn_update_addr()
5200 bacpy(&conn->resp_addr, &conn->hdev->bdaddr); in le_conn_update_addr()
5203 conn->init_addr_type = bdaddr_type; in le_conn_update_addr()
5204 bacpy(&conn->init_addr, bdaddr); in le_conn_update_addr()
5211 conn->le_conn_min_interval = conn->hdev->le_conn_min_interval; in le_conn_update_addr()
5212 conn->le_conn_max_interval = conn->hdev->le_conn_max_interval; in le_conn_update_addr()
5242 conn->dst_type = bdaddr_type; in le_conn_complete_evt()
5252 if (conn->out) { in le_conn_complete_evt()
5253 conn->resp_addr_type = bdaddr_type; in le_conn_complete_evt()
5254 bacpy(&conn->resp_addr, bdaddr); in le_conn_complete_evt()
5256 conn->init_addr_type = ADDR_LE_DEV_RANDOM; in le_conn_complete_evt()
5257 bacpy(&conn->init_addr, &hdev->rpa); in le_conn_complete_evt()
5260 &conn->init_addr, in le_conn_complete_evt()
5261 &conn->init_addr_type); in le_conn_complete_evt()
5265 cancel_delayed_work(&conn->le_conn_timeout); in le_conn_complete_evt()
5279 irk = hci_get_irk(hdev, &conn->dst, conn->dst_type); in le_conn_complete_evt()
5281 bacpy(&conn->dst, &irk->bdaddr); in le_conn_complete_evt()
5282 conn->dst_type = irk->addr_type; in le_conn_complete_evt()
5292 switch (conn->dst_type) { in le_conn_complete_evt()
5294 conn->dst_type = ADDR_LE_DEV_PUBLIC; in le_conn_complete_evt()
5297 conn->dst_type = ADDR_LE_DEV_RANDOM; in le_conn_complete_evt()
5307 if (conn->dst_type == ADDR_LE_DEV_PUBLIC) in le_conn_complete_evt()
5313 if (hci_bdaddr_list_lookup(&hdev->reject_list, &conn->dst, addr_type)) { in le_conn_complete_evt()
5318 if (!test_and_set_bit(HCI_CONN_MGMT_CONNECTED, &conn->flags)) in le_conn_complete_evt()
5321 conn->sec_level = BT_SECURITY_LOW; in le_conn_complete_evt()
5322 conn->handle = handle; in le_conn_complete_evt()
5323 conn->state = BT_CONFIG; in le_conn_complete_evt()
5326 * when sotfware rotation is in use so it can be re-enabled when in le_conn_complete_evt()
5330 conn->adv_instance = hdev->cur_adv_instance; in le_conn_complete_evt()
5332 conn->le_conn_interval = interval; in le_conn_complete_evt()
5333 conn->le_conn_latency = latency; in le_conn_complete_evt()
5334 conn->le_supv_timeout = supervision_timeout; in le_conn_complete_evt()
5343 * If the local controller supports peripheral-initiated features in le_conn_complete_evt()
5348 if (conn->out || in le_conn_complete_evt()
5349 (hdev->le_features[0] & HCI_LE_PERIPHERAL_FEATURES)) { in le_conn_complete_evt()
5352 cp.handle = __cpu_to_le16(conn->handle); in le_conn_complete_evt()
5359 conn->state = BT_CONNECTED; in le_conn_complete_evt()
5363 params = hci_pend_le_action_lookup(&hdev->pend_le_conns, &conn->dst, in le_conn_complete_evt()
5364 conn->dst_type); in le_conn_complete_evt()
5366 list_del_init(¶ms->action); in le_conn_complete_evt()
5367 if (params->conn) { in le_conn_complete_evt()
5368 hci_conn_drop(params->conn); in le_conn_complete_evt()
5369 hci_conn_put(params->conn); in le_conn_complete_evt()
5370 params->conn = NULL; in le_conn_complete_evt()
5381 struct hci_ev_le_conn_complete *ev = (void *) skb->data; in hci_le_conn_complete_evt()
5383 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); in hci_le_conn_complete_evt()
5385 le_conn_complete_evt(hdev, ev->status, &ev->bdaddr, ev->bdaddr_type, in hci_le_conn_complete_evt()
5386 NULL, ev->role, le16_to_cpu(ev->handle), in hci_le_conn_complete_evt()
5387 le16_to_cpu(ev->interval), in hci_le_conn_complete_evt()
5388 le16_to_cpu(ev->latency), in hci_le_conn_complete_evt()
5389 le16_to_cpu(ev->supervision_timeout)); in hci_le_conn_complete_evt()
5395 struct hci_ev_le_enh_conn_complete *ev = (void *) skb->data; in hci_le_enh_conn_complete_evt()
5397 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); in hci_le_enh_conn_complete_evt()
5399 le_conn_complete_evt(hdev, ev->status, &ev->bdaddr, ev->bdaddr_type, in hci_le_enh_conn_complete_evt()
5400 &ev->local_rpa, ev->role, le16_to_cpu(ev->handle), in hci_le_enh_conn_complete_evt()
5401 le16_to_cpu(ev->interval), in hci_le_enh_conn_complete_evt()
5402 le16_to_cpu(ev->latency), in hci_le_enh_conn_complete_evt()
5403 le16_to_cpu(ev->supervision_timeout)); in hci_le_enh_conn_complete_evt()
5413 struct hci_evt_le_ext_adv_set_term *ev = (void *) skb->data; in hci_le_ext_adv_term_evt()
5417 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); in hci_le_ext_adv_term_evt()
5419 adv = hci_find_adv_instance(hdev, ev->handle); in hci_le_ext_adv_term_evt()
5421 if (ev->status) { in hci_le_ext_adv_term_evt()
5426 hci_remove_adv_instance(hdev, ev->handle); in hci_le_ext_adv_term_evt()
5427 mgmt_advertising_removed(NULL, hdev, ev->handle); in hci_le_ext_adv_term_evt()
5433 adv->enabled = false; in hci_le_ext_adv_term_evt()
5435 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->conn_handle)); in hci_le_ext_adv_term_evt()
5438 * instance can be re-enabled when disconnected. in hci_le_ext_adv_term_evt()
5440 conn->adv_instance = ev->handle; in hci_le_ext_adv_term_evt()
5442 if (hdev->adv_addr_type != ADDR_LE_DEV_RANDOM || in hci_le_ext_adv_term_evt()
5443 bacmp(&conn->resp_addr, BDADDR_ANY)) in hci_le_ext_adv_term_evt()
5446 if (!ev->handle) { in hci_le_ext_adv_term_evt()
5447 bacpy(&conn->resp_addr, &hdev->random_addr); in hci_le_ext_adv_term_evt()
5452 bacpy(&conn->resp_addr, &adv->random_addr); in hci_le_ext_adv_term_evt()
5459 struct hci_ev_le_conn_update_complete *ev = (void *) skb->data; in hci_le_conn_update_complete_evt()
5462 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); in hci_le_conn_update_complete_evt()
5464 if (ev->status) in hci_le_conn_update_complete_evt()
5469 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); in hci_le_conn_update_complete_evt()
5471 conn->le_conn_interval = le16_to_cpu(ev->interval); in hci_le_conn_update_complete_evt()
5472 conn->le_conn_latency = le16_to_cpu(ev->latency); in hci_le_conn_update_complete_evt()
5473 conn->le_supv_timeout = le16_to_cpu(ev->supervision_timeout); in hci_le_conn_update_complete_evt()
5479 /* This function requires the caller holds hdev->lock */
5493 if (hci_bdaddr_list_lookup(&hdev->reject_list, addr, addr_type)) in check_pending_le_conn()
5499 if (hdev->conn_hash.le_num_peripheral > 0 && in check_pending_le_conn()
5500 (!test_bit(HCI_QUIRK_VALID_LE_STATES, &hdev->quirks) || in check_pending_le_conn()
5501 !(hdev->le_states[3] & 0x10))) in check_pending_le_conn()
5507 params = hci_pend_le_action_lookup(&hdev->pend_le_conns, addr, in check_pending_le_conn()
5512 if (!params->explicit_connect) { in check_pending_le_conn()
5513 switch (params->auto_connect) { in check_pending_le_conn()
5536 hdev->def_le_autoconnect_timeout, HCI_ROLE_MASTER, in check_pending_le_conn()
5548 if (!params->explicit_connect) in check_pending_le_conn()
5549 params->conn = hci_conn_get(conn); in check_pending_le_conn()
5555 case -EBUSY: in check_pending_le_conn()
5556 /* If hci_connect() returns -EBUSY it means there is already in check_pending_le_conn()
5575 struct discovery_state *d = &hdev->discovery; in process_adv_report()
5591 "type: 0x%02x", type); in process_adv_report()
5614 len = ptr - data; in process_adv_report()
5638 if (!smp_irk_matches(hdev, hdev->irk, direct_addr)) in process_adv_report()
5645 bdaddr = &irk->bdaddr; in process_adv_report()
5646 bdaddr_type = irk->addr_type; in process_adv_report()
5660 memcpy(conn->le_adv_data, data, len); in process_adv_report()
5661 conn->le_adv_data_len = len; in process_adv_report()
5668 if (hdev->le_scan_type == LE_SCAN_PASSIVE) { in process_adv_report()
5672 if (!hci_pend_le_action_lookup(&hdev->pend_le_reports, in process_adv_report()
5674 idr_is_empty(&hdev->adv_monitors_idr)) in process_adv_report()
5686 /* When receiving non-connectable or scannable undirected in process_adv_report()
5727 match = (!bacmp(bdaddr, &d->last_adv_addr) && in process_adv_report()
5728 bdaddr_type == d->last_adv_addr_type); in process_adv_report()
5737 mgmt_device_found(hdev, &d->last_adv_addr, LE_LINK, in process_adv_report()
5738 d->last_adv_addr_type, NULL, in process_adv_report()
5739 d->last_adv_rssi, d->last_adv_flags, in process_adv_report()
5740 d->last_adv_data, in process_adv_report()
5741 d->last_adv_data_len, NULL, 0); in process_adv_report()
5766 mgmt_device_found(hdev, &d->last_adv_addr, LE_LINK, in process_adv_report()
5767 d->last_adv_addr_type, NULL, rssi, d->last_adv_flags, in process_adv_report()
5768 d->last_adv_data, d->last_adv_data_len, data, len); in process_adv_report()
5774 u8 num_reports = skb->data[0]; in hci_le_adv_report_evt()
5775 void *ptr = &skb->data[1]; in hci_le_adv_report_evt()
5779 while (num_reports--) { in hci_le_adv_report_evt()
5783 if (ev->length <= HCI_MAX_AD_LENGTH) { in hci_le_adv_report_evt()
5784 rssi = ev->data[ev->length]; in hci_le_adv_report_evt()
5785 process_adv_report(hdev, ev->evt_type, &ev->bdaddr, in hci_le_adv_report_evt()
5786 ev->bdaddr_type, NULL, 0, rssi, in hci_le_adv_report_evt()
5787 ev->data, ev->length, false); in hci_le_adv_report_evt()
5792 ptr += sizeof(*ev) + ev->length + 1; in hci_le_adv_report_evt()
5836 bt_dev_err_ratelimited(hdev, "Unknown advertising packet type: 0x%02x", in ext_evt_type_to_legacy()
5844 u8 num_reports = skb->data[0]; in hci_le_ext_adv_report_evt()
5845 void *ptr = &skb->data[1]; in hci_le_ext_adv_report_evt()
5849 while (num_reports--) { in hci_le_ext_adv_report_evt()
5854 evt_type = __le16_to_cpu(ev->evt_type); in hci_le_ext_adv_report_evt()
5857 process_adv_report(hdev, legacy_evt_type, &ev->bdaddr, in hci_le_ext_adv_report_evt()
5858 ev->bdaddr_type, NULL, 0, ev->rssi, in hci_le_ext_adv_report_evt()
5859 ev->data, ev->length, in hci_le_ext_adv_report_evt()
5863 ptr += sizeof(*ev) + ev->length; in hci_le_ext_adv_report_evt()
5872 struct hci_ev_le_remote_feat_complete *ev = (void *)skb->data; in hci_le_remote_feat_complete_evt()
5875 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); in hci_le_remote_feat_complete_evt()
5879 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); in hci_le_remote_feat_complete_evt()
5881 if (!ev->status) in hci_le_remote_feat_complete_evt()
5882 memcpy(conn->features[0], ev->features, 8); in hci_le_remote_feat_complete_evt()
5884 if (conn->state == BT_CONFIG) { in hci_le_remote_feat_complete_evt()
5887 /* If the local controller supports peripheral-initiated in hci_le_remote_feat_complete_evt()
5896 if (!conn->out && ev->status == 0x1a && in hci_le_remote_feat_complete_evt()
5897 (hdev->le_features[0] & HCI_LE_PERIPHERAL_FEATURES)) in hci_le_remote_feat_complete_evt()
5900 status = ev->status; in hci_le_remote_feat_complete_evt()
5902 conn->state = BT_CONNECTED; in hci_le_remote_feat_complete_evt()
5913 struct hci_ev_le_ltk_req *ev = (void *) skb->data; in hci_le_ltk_request_evt()
5919 BT_DBG("%s handle 0x%4.4x", hdev->name, __le16_to_cpu(ev->handle)); in hci_le_ltk_request_evt()
5923 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); in hci_le_ltk_request_evt()
5927 ltk = hci_find_ltk(hdev, &conn->dst, conn->dst_type, conn->role); in hci_le_ltk_request_evt()
5933 if (ev->ediv || ev->rand) in hci_le_ltk_request_evt()
5936 /* For non-SC keys check that EDiv and Rand match */ in hci_le_ltk_request_evt()
5937 if (ev->ediv != ltk->ediv || ev->rand != ltk->rand) in hci_le_ltk_request_evt()
5941 memcpy(cp.ltk, ltk->val, ltk->enc_size); in hci_le_ltk_request_evt()
5942 memset(cp.ltk + ltk->enc_size, 0, sizeof(cp.ltk) - ltk->enc_size); in hci_le_ltk_request_evt()
5943 cp.handle = cpu_to_le16(conn->handle); in hci_le_ltk_request_evt()
5945 conn->pending_sec_level = smp_ltk_sec_level(ltk); in hci_le_ltk_request_evt()
5947 conn->enc_key_size = ltk->enc_size; in hci_le_ltk_request_evt()
5954 * distribute the keys. Later, security can be re-established in hci_le_ltk_request_evt()
5957 if (ltk->type == SMP_STK) { in hci_le_ltk_request_evt()
5958 set_bit(HCI_CONN_STK_ENCRYPT, &conn->flags); in hci_le_ltk_request_evt()
5959 list_del_rcu(<k->list); in hci_le_ltk_request_evt()
5962 clear_bit(HCI_CONN_STK_ENCRYPT, &conn->flags); in hci_le_ltk_request_evt()
5970 neg.handle = ev->handle; in hci_le_ltk_request_evt()
5990 struct hci_ev_le_remote_conn_param_req *ev = (void *) skb->data; in hci_le_remote_conn_param_req_evt()
5995 handle = le16_to_cpu(ev->handle); in hci_le_remote_conn_param_req_evt()
5996 min = le16_to_cpu(ev->interval_min); in hci_le_remote_conn_param_req_evt()
5997 max = le16_to_cpu(ev->interval_max); in hci_le_remote_conn_param_req_evt()
5998 latency = le16_to_cpu(ev->latency); in hci_le_remote_conn_param_req_evt()
5999 timeout = le16_to_cpu(ev->timeout); in hci_le_remote_conn_param_req_evt()
6002 if (!hcon || hcon->state != BT_CONNECTED) in hci_le_remote_conn_param_req_evt()
6010 if (hcon->role == HCI_ROLE_MASTER) { in hci_le_remote_conn_param_req_evt()
6016 params = hci_conn_params_lookup(hdev, &hcon->dst, in hci_le_remote_conn_param_req_evt()
6017 hcon->dst_type); in hci_le_remote_conn_param_req_evt()
6019 params->conn_min_interval = min; in hci_le_remote_conn_param_req_evt()
6020 params->conn_max_interval = max; in hci_le_remote_conn_param_req_evt()
6021 params->conn_latency = latency; in hci_le_remote_conn_param_req_evt()
6022 params->supervision_timeout = timeout; in hci_le_remote_conn_param_req_evt()
6030 mgmt_new_conn_param(hdev, &hcon->dst, hcon->dst_type, in hci_le_remote_conn_param_req_evt()
6034 cp.handle = ev->handle; in hci_le_remote_conn_param_req_evt()
6035 cp.interval_min = ev->interval_min; in hci_le_remote_conn_param_req_evt()
6036 cp.interval_max = ev->interval_max; in hci_le_remote_conn_param_req_evt()
6037 cp.latency = ev->latency; in hci_le_remote_conn_param_req_evt()
6038 cp.timeout = ev->timeout; in hci_le_remote_conn_param_req_evt()
6048 u8 num_reports = skb->data[0]; in hci_le_direct_adv_report_evt()
6049 struct hci_ev_le_direct_adv_info *ev = (void *)&skb->data[1]; in hci_le_direct_adv_report_evt()
6051 if (!num_reports || skb->len < num_reports * sizeof(*ev) + 1) in hci_le_direct_adv_report_evt()
6056 for (; num_reports; num_reports--, ev++) in hci_le_direct_adv_report_evt()
6057 process_adv_report(hdev, ev->evt_type, &ev->bdaddr, in hci_le_direct_adv_report_evt()
6058 ev->bdaddr_type, &ev->direct_addr, in hci_le_direct_adv_report_evt()
6059 ev->direct_addr_type, ev->rssi, NULL, 0, in hci_le_direct_adv_report_evt()
6067 struct hci_ev_le_phy_update_complete *ev = (void *) skb->data; in hci_le_phy_update_evt()
6070 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); in hci_le_phy_update_evt()
6072 if (ev->status) in hci_le_phy_update_evt()
6077 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); in hci_le_phy_update_evt()
6081 conn->le_tx_phy = ev->tx_phy; in hci_le_phy_update_evt()
6082 conn->le_rx_phy = ev->rx_phy; in hci_le_phy_update_evt()
6090 struct hci_ev_le_meta *le_ev = (void *) skb->data; in hci_le_meta_evt()
6094 switch (le_ev->subevent) { in hci_le_meta_evt()
6153 if (skb->len < sizeof(*hdr)) { in hci_get_cmd_complete()
6158 hdr = (void *) skb->data; in hci_get_cmd_complete()
6162 if (hdr->evt != event) in hci_get_cmd_complete()
6167 /* Check if request ended in Command Status - no way to retrieve in hci_get_cmd_complete()
6170 if (hdr->evt == HCI_EV_CMD_STATUS) in hci_get_cmd_complete()
6173 if (hdr->evt != HCI_EV_CMD_COMPLETE) { in hci_get_cmd_complete()
6174 bt_dev_err(hdev, "last event is not cmd complete (0x%2.2x)", in hci_get_cmd_complete()
6175 hdr->evt); in hci_get_cmd_complete()
6179 if (skb->len < sizeof(*ev)) { in hci_get_cmd_complete()
6184 ev = (void *) skb->data; in hci_get_cmd_complete()
6187 if (opcode != __le16_to_cpu(ev->opcode)) { in hci_get_cmd_complete()
6188 BT_DBG("opcode doesn't match (0x%2.2x != 0x%2.2x)", opcode, in hci_get_cmd_complete()
6189 __le16_to_cpu(ev->opcode)); in hci_get_cmd_complete()
6202 const struct hci_ev_conn_complete *conn_complete = (void *)skb->data; in hci_store_wake_reason()
6203 const struct hci_ev_conn_request *conn_request = (void *)skb->data; in hci_store_wake_reason()
6210 if (!hdev->suspended || hdev->wake_reason) in hci_store_wake_reason()
6216 hdev->wake_reason = MGMT_WAKE_REASON_REMOTE_WAKE; in hci_store_wake_reason()
6223 bacpy(&hdev->wake_addr, &conn_complete->bdaddr); in hci_store_wake_reason()
6224 hdev->wake_addr_type = BDADDR_BREDR; in hci_store_wake_reason()
6226 bacpy(&hdev->wake_addr, &conn_request->bdaddr); in hci_store_wake_reason()
6227 hdev->wake_addr_type = BDADDR_BREDR; in hci_store_wake_reason()
6229 struct hci_ev_le_meta *le_ev = (void *)skb->data; in hci_store_wake_reason()
6230 u8 subevent = le_ev->subevent; in hci_store_wake_reason()
6231 u8 *ptr = &skb->data[sizeof(*le_ev)]; in hci_store_wake_reason()
6244 bacpy(&hdev->wake_addr, &adv->bdaddr); in hci_store_wake_reason()
6245 hdev->wake_addr_type = adv->bdaddr_type; in hci_store_wake_reason()
6248 bacpy(&hdev->wake_addr, &direct_adv->bdaddr); in hci_store_wake_reason()
6249 hdev->wake_addr_type = direct_adv->bdaddr_type; in hci_store_wake_reason()
6252 bacpy(&hdev->wake_addr, &ext_adv->bdaddr); in hci_store_wake_reason()
6253 hdev->wake_addr_type = ext_adv->bdaddr_type; in hci_store_wake_reason()
6258 hdev->wake_reason = MGMT_WAKE_REASON_UNEXPECTED; in hci_store_wake_reason()
6267 struct hci_event_hdr *hdr = (void *) skb->data; in hci_event_packet()
6271 u8 status = 0, event = hdr->evt, req_evt = 0; in hci_event_packet()
6279 if (hdev->sent_cmd && bt_cb(hdev->sent_cmd)->hci.req_event == event) { in hci_event_packet()
6280 struct hci_command_hdr *cmd_hdr = (void *) hdev->sent_cmd->data; in hci_event_packet()
6281 opcode = __le16_to_cpu(cmd_hdr->opcode); in hci_event_packet()
6483 BT_DBG("%s event 0x%2.2x", hdev->name, event); in hci_event_packet()
6500 hdev->stat.evt_rx++; in hci_event_packet()