Lines Matching refs:hdev
45 static void hci_cc_inquiry_cancel(struct hci_dev *hdev, struct sk_buff *skb, in hci_cc_inquiry_cancel() argument
50 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_inquiry_cancel()
59 if (status == 0x0c && !test_bit(HCI_INQUIRY, &hdev->flags)) { in hci_cc_inquiry_cancel()
60 bt_dev_warn(hdev, "Ignoring error of Inquiry Cancel command"); in hci_cc_inquiry_cancel()
69 clear_bit(HCI_INQUIRY, &hdev->flags); in hci_cc_inquiry_cancel()
71 wake_up_bit(&hdev->flags, HCI_INQUIRY); in hci_cc_inquiry_cancel()
73 hci_dev_lock(hdev); in hci_cc_inquiry_cancel()
77 if (!hci_dev_test_flag(hdev, HCI_LE_SCAN) || in hci_cc_inquiry_cancel()
78 hdev->le_scan_type != LE_SCAN_ACTIVE) in hci_cc_inquiry_cancel()
79 hci_discovery_set_state(hdev, DISCOVERY_STOPPED); in hci_cc_inquiry_cancel()
80 hci_dev_unlock(hdev); in hci_cc_inquiry_cancel()
82 hci_conn_check_pending(hdev); in hci_cc_inquiry_cancel()
85 static void hci_cc_periodic_inq(struct hci_dev *hdev, struct sk_buff *skb) in hci_cc_periodic_inq() argument
89 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_periodic_inq()
94 hci_dev_set_flag(hdev, HCI_PERIODIC_INQ); in hci_cc_periodic_inq()
97 static void hci_cc_exit_periodic_inq(struct hci_dev *hdev, struct sk_buff *skb) in hci_cc_exit_periodic_inq() argument
101 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_exit_periodic_inq()
106 hci_dev_clear_flag(hdev, HCI_PERIODIC_INQ); in hci_cc_exit_periodic_inq()
108 hci_conn_check_pending(hdev); in hci_cc_exit_periodic_inq()
111 static void hci_cc_remote_name_req_cancel(struct hci_dev *hdev, in hci_cc_remote_name_req_cancel() argument
114 BT_DBG("%s", hdev->name); in hci_cc_remote_name_req_cancel()
117 static void hci_cc_role_discovery(struct hci_dev *hdev, struct sk_buff *skb) in hci_cc_role_discovery() argument
122 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_role_discovery()
127 hci_dev_lock(hdev); in hci_cc_role_discovery()
129 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(rp->handle)); in hci_cc_role_discovery()
133 hci_dev_unlock(hdev); in hci_cc_role_discovery()
136 static void hci_cc_read_link_policy(struct hci_dev *hdev, struct sk_buff *skb) in hci_cc_read_link_policy() argument
141 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_read_link_policy()
146 hci_dev_lock(hdev); in hci_cc_read_link_policy()
148 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(rp->handle)); in hci_cc_read_link_policy()
152 hci_dev_unlock(hdev); in hci_cc_read_link_policy()
155 static void hci_cc_write_link_policy(struct hci_dev *hdev, struct sk_buff *skb) in hci_cc_write_link_policy() argument
161 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_write_link_policy()
166 sent = hci_sent_cmd_data(hdev, HCI_OP_WRITE_LINK_POLICY); in hci_cc_write_link_policy()
170 hci_dev_lock(hdev); in hci_cc_write_link_policy()
172 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(rp->handle)); in hci_cc_write_link_policy()
176 hci_dev_unlock(hdev); in hci_cc_write_link_policy()
179 static void hci_cc_read_def_link_policy(struct hci_dev *hdev, in hci_cc_read_def_link_policy() argument
184 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_read_def_link_policy()
189 hdev->link_policy = __le16_to_cpu(rp->policy); in hci_cc_read_def_link_policy()
192 static void hci_cc_write_def_link_policy(struct hci_dev *hdev, in hci_cc_write_def_link_policy() argument
198 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_write_def_link_policy()
203 sent = hci_sent_cmd_data(hdev, HCI_OP_WRITE_DEF_LINK_POLICY); in hci_cc_write_def_link_policy()
207 hdev->link_policy = get_unaligned_le16(sent); in hci_cc_write_def_link_policy()
210 static void hci_cc_reset(struct hci_dev *hdev, struct sk_buff *skb) in hci_cc_reset() argument
214 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_reset()
216 clear_bit(HCI_RESET, &hdev->flags); in hci_cc_reset()
222 hci_dev_clear_volatile_flags(hdev); in hci_cc_reset()
224 hci_discovery_set_state(hdev, DISCOVERY_STOPPED); in hci_cc_reset()
226 hdev->inq_tx_power = HCI_TX_POWER_INVALID; in hci_cc_reset()
227 hdev->adv_tx_power = HCI_TX_POWER_INVALID; in hci_cc_reset()
229 memset(hdev->adv_data, 0, sizeof(hdev->adv_data)); in hci_cc_reset()
230 hdev->adv_data_len = 0; in hci_cc_reset()
232 memset(hdev->scan_rsp_data, 0, sizeof(hdev->scan_rsp_data)); in hci_cc_reset()
233 hdev->scan_rsp_data_len = 0; in hci_cc_reset()
235 hdev->le_scan_type = LE_SCAN_PASSIVE; in hci_cc_reset()
237 hdev->ssp_debug_mode = 0; in hci_cc_reset()
239 hci_bdaddr_list_clear(&hdev->le_white_list); in hci_cc_reset()
240 hci_bdaddr_list_clear(&hdev->le_resolv_list); in hci_cc_reset()
243 static void hci_cc_read_stored_link_key(struct hci_dev *hdev, in hci_cc_read_stored_link_key() argument
249 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_read_stored_link_key()
251 sent = hci_sent_cmd_data(hdev, HCI_OP_READ_STORED_LINK_KEY); in hci_cc_read_stored_link_key()
256 hdev->stored_max_keys = rp->max_keys; in hci_cc_read_stored_link_key()
257 hdev->stored_num_keys = rp->num_keys; in hci_cc_read_stored_link_key()
261 static void hci_cc_delete_stored_link_key(struct hci_dev *hdev, in hci_cc_delete_stored_link_key() argument
266 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_delete_stored_link_key()
271 if (rp->num_keys <= hdev->stored_num_keys) in hci_cc_delete_stored_link_key()
272 hdev->stored_num_keys -= rp->num_keys; in hci_cc_delete_stored_link_key()
274 hdev->stored_num_keys = 0; in hci_cc_delete_stored_link_key()
277 static void hci_cc_write_local_name(struct hci_dev *hdev, struct sk_buff *skb) in hci_cc_write_local_name() argument
282 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_write_local_name()
284 sent = hci_sent_cmd_data(hdev, HCI_OP_WRITE_LOCAL_NAME); in hci_cc_write_local_name()
288 hci_dev_lock(hdev); in hci_cc_write_local_name()
290 if (hci_dev_test_flag(hdev, HCI_MGMT)) in hci_cc_write_local_name()
291 mgmt_set_local_name_complete(hdev, sent, status); in hci_cc_write_local_name()
293 memcpy(hdev->dev_name, sent, HCI_MAX_NAME_LENGTH); in hci_cc_write_local_name()
295 hci_dev_unlock(hdev); in hci_cc_write_local_name()
298 static void hci_cc_read_local_name(struct hci_dev *hdev, struct sk_buff *skb) in hci_cc_read_local_name() argument
302 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_read_local_name()
307 if (hci_dev_test_flag(hdev, HCI_SETUP) || in hci_cc_read_local_name()
308 hci_dev_test_flag(hdev, HCI_CONFIG)) in hci_cc_read_local_name()
309 memcpy(hdev->dev_name, rp->name, HCI_MAX_NAME_LENGTH); in hci_cc_read_local_name()
312 static void hci_cc_write_auth_enable(struct hci_dev *hdev, struct sk_buff *skb) in hci_cc_write_auth_enable() argument
317 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_write_auth_enable()
319 sent = hci_sent_cmd_data(hdev, HCI_OP_WRITE_AUTH_ENABLE); in hci_cc_write_auth_enable()
323 hci_dev_lock(hdev); in hci_cc_write_auth_enable()
329 set_bit(HCI_AUTH, &hdev->flags); in hci_cc_write_auth_enable()
331 clear_bit(HCI_AUTH, &hdev->flags); in hci_cc_write_auth_enable()
334 if (hci_dev_test_flag(hdev, HCI_MGMT)) in hci_cc_write_auth_enable()
335 mgmt_auth_enable_complete(hdev, status); in hci_cc_write_auth_enable()
337 hci_dev_unlock(hdev); in hci_cc_write_auth_enable()
340 static void hci_cc_write_encrypt_mode(struct hci_dev *hdev, struct sk_buff *skb) in hci_cc_write_encrypt_mode() argument
346 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_write_encrypt_mode()
351 sent = hci_sent_cmd_data(hdev, HCI_OP_WRITE_ENCRYPT_MODE); in hci_cc_write_encrypt_mode()
358 set_bit(HCI_ENCRYPT, &hdev->flags); in hci_cc_write_encrypt_mode()
360 clear_bit(HCI_ENCRYPT, &hdev->flags); in hci_cc_write_encrypt_mode()
363 static void hci_cc_write_scan_enable(struct hci_dev *hdev, struct sk_buff *skb) in hci_cc_write_scan_enable() argument
369 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_write_scan_enable()
371 sent = hci_sent_cmd_data(hdev, HCI_OP_WRITE_SCAN_ENABLE); in hci_cc_write_scan_enable()
377 hci_dev_lock(hdev); in hci_cc_write_scan_enable()
380 hdev->discov_timeout = 0; in hci_cc_write_scan_enable()
385 set_bit(HCI_ISCAN, &hdev->flags); in hci_cc_write_scan_enable()
387 clear_bit(HCI_ISCAN, &hdev->flags); in hci_cc_write_scan_enable()
390 set_bit(HCI_PSCAN, &hdev->flags); in hci_cc_write_scan_enable()
392 clear_bit(HCI_PSCAN, &hdev->flags); in hci_cc_write_scan_enable()
395 hci_dev_unlock(hdev); in hci_cc_write_scan_enable()
398 static void hci_cc_read_class_of_dev(struct hci_dev *hdev, struct sk_buff *skb) in hci_cc_read_class_of_dev() argument
402 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_read_class_of_dev()
407 memcpy(hdev->dev_class, rp->dev_class, 3); in hci_cc_read_class_of_dev()
409 BT_DBG("%s class 0x%.2x%.2x%.2x", hdev->name, in hci_cc_read_class_of_dev()
410 hdev->dev_class[2], hdev->dev_class[1], hdev->dev_class[0]); in hci_cc_read_class_of_dev()
413 static void hci_cc_write_class_of_dev(struct hci_dev *hdev, struct sk_buff *skb) in hci_cc_write_class_of_dev() argument
418 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_write_class_of_dev()
420 sent = hci_sent_cmd_data(hdev, HCI_OP_WRITE_CLASS_OF_DEV); in hci_cc_write_class_of_dev()
424 hci_dev_lock(hdev); in hci_cc_write_class_of_dev()
427 memcpy(hdev->dev_class, sent, 3); in hci_cc_write_class_of_dev()
429 if (hci_dev_test_flag(hdev, HCI_MGMT)) in hci_cc_write_class_of_dev()
430 mgmt_set_class_of_dev_complete(hdev, sent, status); in hci_cc_write_class_of_dev()
432 hci_dev_unlock(hdev); in hci_cc_write_class_of_dev()
435 static void hci_cc_read_voice_setting(struct hci_dev *hdev, struct sk_buff *skb) in hci_cc_read_voice_setting() argument
440 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_read_voice_setting()
447 if (hdev->voice_setting == setting) in hci_cc_read_voice_setting()
450 hdev->voice_setting = setting; in hci_cc_read_voice_setting()
452 BT_DBG("%s voice setting 0x%4.4x", hdev->name, setting); in hci_cc_read_voice_setting()
454 if (hdev->notify) in hci_cc_read_voice_setting()
455 hdev->notify(hdev, HCI_NOTIFY_VOICE_SETTING); in hci_cc_read_voice_setting()
458 static void hci_cc_write_voice_setting(struct hci_dev *hdev, in hci_cc_write_voice_setting() argument
465 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_write_voice_setting()
470 sent = hci_sent_cmd_data(hdev, HCI_OP_WRITE_VOICE_SETTING); in hci_cc_write_voice_setting()
476 if (hdev->voice_setting == setting) in hci_cc_write_voice_setting()
479 hdev->voice_setting = setting; in hci_cc_write_voice_setting()
481 BT_DBG("%s voice setting 0x%4.4x", hdev->name, setting); in hci_cc_write_voice_setting()
483 if (hdev->notify) in hci_cc_write_voice_setting()
484 hdev->notify(hdev, HCI_NOTIFY_VOICE_SETTING); in hci_cc_write_voice_setting()
487 static void hci_cc_read_num_supported_iac(struct hci_dev *hdev, in hci_cc_read_num_supported_iac() argument
492 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_read_num_supported_iac()
497 hdev->num_iac = rp->num_iac; in hci_cc_read_num_supported_iac()
499 BT_DBG("%s num iac %d", hdev->name, hdev->num_iac); in hci_cc_read_num_supported_iac()
502 static void hci_cc_write_ssp_mode(struct hci_dev *hdev, struct sk_buff *skb) in hci_cc_write_ssp_mode() argument
507 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_write_ssp_mode()
509 sent = hci_sent_cmd_data(hdev, HCI_OP_WRITE_SSP_MODE); in hci_cc_write_ssp_mode()
513 hci_dev_lock(hdev); in hci_cc_write_ssp_mode()
517 hdev->features[1][0] |= LMP_HOST_SSP; in hci_cc_write_ssp_mode()
519 hdev->features[1][0] &= ~LMP_HOST_SSP; in hci_cc_write_ssp_mode()
522 if (hci_dev_test_flag(hdev, HCI_MGMT)) in hci_cc_write_ssp_mode()
523 mgmt_ssp_enable_complete(hdev, sent->mode, status); in hci_cc_write_ssp_mode()
526 hci_dev_set_flag(hdev, HCI_SSP_ENABLED); in hci_cc_write_ssp_mode()
528 hci_dev_clear_flag(hdev, HCI_SSP_ENABLED); in hci_cc_write_ssp_mode()
531 hci_dev_unlock(hdev); in hci_cc_write_ssp_mode()
534 static void hci_cc_write_sc_support(struct hci_dev *hdev, struct sk_buff *skb) in hci_cc_write_sc_support() argument
539 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_write_sc_support()
541 sent = hci_sent_cmd_data(hdev, HCI_OP_WRITE_SC_SUPPORT); in hci_cc_write_sc_support()
545 hci_dev_lock(hdev); in hci_cc_write_sc_support()
549 hdev->features[1][0] |= LMP_HOST_SC; in hci_cc_write_sc_support()
551 hdev->features[1][0] &= ~LMP_HOST_SC; in hci_cc_write_sc_support()
554 if (!hci_dev_test_flag(hdev, HCI_MGMT) && !status) { in hci_cc_write_sc_support()
556 hci_dev_set_flag(hdev, HCI_SC_ENABLED); in hci_cc_write_sc_support()
558 hci_dev_clear_flag(hdev, HCI_SC_ENABLED); in hci_cc_write_sc_support()
561 hci_dev_unlock(hdev); in hci_cc_write_sc_support()
564 static void hci_cc_read_local_version(struct hci_dev *hdev, struct sk_buff *skb) in hci_cc_read_local_version() argument
568 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_read_local_version()
573 if (hci_dev_test_flag(hdev, HCI_SETUP) || in hci_cc_read_local_version()
574 hci_dev_test_flag(hdev, HCI_CONFIG)) { in hci_cc_read_local_version()
575 hdev->hci_ver = rp->hci_ver; in hci_cc_read_local_version()
576 hdev->hci_rev = __le16_to_cpu(rp->hci_rev); in hci_cc_read_local_version()
577 hdev->lmp_ver = rp->lmp_ver; in hci_cc_read_local_version()
578 hdev->manufacturer = __le16_to_cpu(rp->manufacturer); in hci_cc_read_local_version()
579 hdev->lmp_subver = __le16_to_cpu(rp->lmp_subver); in hci_cc_read_local_version()
583 static void hci_cc_read_local_commands(struct hci_dev *hdev, in hci_cc_read_local_commands() argument
588 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_read_local_commands()
593 if (hci_dev_test_flag(hdev, HCI_SETUP) || in hci_cc_read_local_commands()
594 hci_dev_test_flag(hdev, HCI_CONFIG)) in hci_cc_read_local_commands()
595 memcpy(hdev->commands, rp->commands, sizeof(hdev->commands)); in hci_cc_read_local_commands()
598 static void hci_cc_read_auth_payload_timeout(struct hci_dev *hdev, in hci_cc_read_auth_payload_timeout() argument
604 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_read_auth_payload_timeout()
609 hci_dev_lock(hdev); in hci_cc_read_auth_payload_timeout()
611 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(rp->handle)); in hci_cc_read_auth_payload_timeout()
615 hci_dev_unlock(hdev); in hci_cc_read_auth_payload_timeout()
618 static void hci_cc_write_auth_payload_timeout(struct hci_dev *hdev, in hci_cc_write_auth_payload_timeout() argument
625 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_write_auth_payload_timeout()
630 sent = hci_sent_cmd_data(hdev, HCI_OP_WRITE_AUTH_PAYLOAD_TO); in hci_cc_write_auth_payload_timeout()
634 hci_dev_lock(hdev); in hci_cc_write_auth_payload_timeout()
636 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(rp->handle)); in hci_cc_write_auth_payload_timeout()
640 hci_dev_unlock(hdev); in hci_cc_write_auth_payload_timeout()
643 static void hci_cc_read_local_features(struct hci_dev *hdev, in hci_cc_read_local_features() argument
648 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_read_local_features()
653 memcpy(hdev->features, rp->features, 8); in hci_cc_read_local_features()
658 if (hdev->features[0][0] & LMP_3SLOT) in hci_cc_read_local_features()
659 hdev->pkt_type |= (HCI_DM3 | HCI_DH3); in hci_cc_read_local_features()
661 if (hdev->features[0][0] & LMP_5SLOT) in hci_cc_read_local_features()
662 hdev->pkt_type |= (HCI_DM5 | HCI_DH5); in hci_cc_read_local_features()
664 if (hdev->features[0][1] & LMP_HV2) { in hci_cc_read_local_features()
665 hdev->pkt_type |= (HCI_HV2); in hci_cc_read_local_features()
666 hdev->esco_type |= (ESCO_HV2); in hci_cc_read_local_features()
669 if (hdev->features[0][1] & LMP_HV3) { in hci_cc_read_local_features()
670 hdev->pkt_type |= (HCI_HV3); in hci_cc_read_local_features()
671 hdev->esco_type |= (ESCO_HV3); in hci_cc_read_local_features()
674 if (lmp_esco_capable(hdev)) in hci_cc_read_local_features()
675 hdev->esco_type |= (ESCO_EV3); in hci_cc_read_local_features()
677 if (hdev->features[0][4] & LMP_EV4) in hci_cc_read_local_features()
678 hdev->esco_type |= (ESCO_EV4); in hci_cc_read_local_features()
680 if (hdev->features[0][4] & LMP_EV5) in hci_cc_read_local_features()
681 hdev->esco_type |= (ESCO_EV5); in hci_cc_read_local_features()
683 if (hdev->features[0][5] & LMP_EDR_ESCO_2M) in hci_cc_read_local_features()
684 hdev->esco_type |= (ESCO_2EV3); in hci_cc_read_local_features()
686 if (hdev->features[0][5] & LMP_EDR_ESCO_3M) in hci_cc_read_local_features()
687 hdev->esco_type |= (ESCO_3EV3); in hci_cc_read_local_features()
689 if (hdev->features[0][5] & LMP_EDR_3S_ESCO) in hci_cc_read_local_features()
690 hdev->esco_type |= (ESCO_2EV5 | ESCO_3EV5); in hci_cc_read_local_features()
693 static void hci_cc_read_local_ext_features(struct hci_dev *hdev, in hci_cc_read_local_ext_features() argument
698 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_read_local_ext_features()
703 if (hdev->max_page < rp->max_page) in hci_cc_read_local_ext_features()
704 hdev->max_page = rp->max_page; in hci_cc_read_local_ext_features()
707 memcpy(hdev->features[rp->page], rp->features, 8); in hci_cc_read_local_ext_features()
710 static void hci_cc_read_flow_control_mode(struct hci_dev *hdev, in hci_cc_read_flow_control_mode() argument
715 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_read_flow_control_mode()
720 hdev->flow_ctl_mode = rp->mode; in hci_cc_read_flow_control_mode()
723 static void hci_cc_read_buffer_size(struct hci_dev *hdev, struct sk_buff *skb) in hci_cc_read_buffer_size() argument
727 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_read_buffer_size()
732 hdev->acl_mtu = __le16_to_cpu(rp->acl_mtu); in hci_cc_read_buffer_size()
733 hdev->sco_mtu = rp->sco_mtu; in hci_cc_read_buffer_size()
734 hdev->acl_pkts = __le16_to_cpu(rp->acl_max_pkt); in hci_cc_read_buffer_size()
735 hdev->sco_pkts = __le16_to_cpu(rp->sco_max_pkt); in hci_cc_read_buffer_size()
737 if (test_bit(HCI_QUIRK_FIXUP_BUFFER_SIZE, &hdev->quirks)) { in hci_cc_read_buffer_size()
738 hdev->sco_mtu = 64; in hci_cc_read_buffer_size()
739 hdev->sco_pkts = 8; in hci_cc_read_buffer_size()
742 hdev->acl_cnt = hdev->acl_pkts; in hci_cc_read_buffer_size()
743 hdev->sco_cnt = hdev->sco_pkts; in hci_cc_read_buffer_size()
745 BT_DBG("%s acl mtu %d:%d sco mtu %d:%d", hdev->name, hdev->acl_mtu, in hci_cc_read_buffer_size()
746 hdev->acl_pkts, hdev->sco_mtu, hdev->sco_pkts); in hci_cc_read_buffer_size()
749 static void hci_cc_read_bd_addr(struct hci_dev *hdev, struct sk_buff *skb) in hci_cc_read_bd_addr() argument
753 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_read_bd_addr()
758 if (test_bit(HCI_INIT, &hdev->flags)) in hci_cc_read_bd_addr()
759 bacpy(&hdev->bdaddr, &rp->bdaddr); in hci_cc_read_bd_addr()
761 if (hci_dev_test_flag(hdev, HCI_SETUP)) in hci_cc_read_bd_addr()
762 bacpy(&hdev->setup_addr, &rp->bdaddr); in hci_cc_read_bd_addr()
765 static void hci_cc_read_local_pairing_opts(struct hci_dev *hdev, in hci_cc_read_local_pairing_opts() argument
770 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_read_local_pairing_opts()
775 if (hci_dev_test_flag(hdev, HCI_SETUP) || in hci_cc_read_local_pairing_opts()
776 hci_dev_test_flag(hdev, HCI_CONFIG)) { in hci_cc_read_local_pairing_opts()
777 hdev->pairing_opts = rp->pairing_opts; in hci_cc_read_local_pairing_opts()
778 hdev->max_enc_key_size = rp->max_key_size; in hci_cc_read_local_pairing_opts()
782 static void hci_cc_read_page_scan_activity(struct hci_dev *hdev, in hci_cc_read_page_scan_activity() argument
787 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_read_page_scan_activity()
792 if (test_bit(HCI_INIT, &hdev->flags)) { in hci_cc_read_page_scan_activity()
793 hdev->page_scan_interval = __le16_to_cpu(rp->interval); in hci_cc_read_page_scan_activity()
794 hdev->page_scan_window = __le16_to_cpu(rp->window); in hci_cc_read_page_scan_activity()
798 static void hci_cc_write_page_scan_activity(struct hci_dev *hdev, in hci_cc_write_page_scan_activity() argument
804 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_write_page_scan_activity()
809 sent = hci_sent_cmd_data(hdev, HCI_OP_WRITE_PAGE_SCAN_ACTIVITY); in hci_cc_write_page_scan_activity()
813 hdev->page_scan_interval = __le16_to_cpu(sent->interval); in hci_cc_write_page_scan_activity()
814 hdev->page_scan_window = __le16_to_cpu(sent->window); in hci_cc_write_page_scan_activity()
817 static void hci_cc_read_page_scan_type(struct hci_dev *hdev, in hci_cc_read_page_scan_type() argument
822 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_read_page_scan_type()
827 if (test_bit(HCI_INIT, &hdev->flags)) in hci_cc_read_page_scan_type()
828 hdev->page_scan_type = rp->type; in hci_cc_read_page_scan_type()
831 static void hci_cc_write_page_scan_type(struct hci_dev *hdev, in hci_cc_write_page_scan_type() argument
837 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_write_page_scan_type()
842 type = hci_sent_cmd_data(hdev, HCI_OP_WRITE_PAGE_SCAN_TYPE); in hci_cc_write_page_scan_type()
844 hdev->page_scan_type = *type; in hci_cc_write_page_scan_type()
847 static void hci_cc_read_data_block_size(struct hci_dev *hdev, in hci_cc_read_data_block_size() argument
852 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_read_data_block_size()
857 hdev->block_mtu = __le16_to_cpu(rp->max_acl_len); in hci_cc_read_data_block_size()
858 hdev->block_len = __le16_to_cpu(rp->block_len); in hci_cc_read_data_block_size()
859 hdev->num_blocks = __le16_to_cpu(rp->num_blocks); in hci_cc_read_data_block_size()
861 hdev->block_cnt = hdev->num_blocks; in hci_cc_read_data_block_size()
863 BT_DBG("%s blk mtu %d cnt %d len %d", hdev->name, hdev->block_mtu, in hci_cc_read_data_block_size()
864 hdev->block_cnt, hdev->block_len); in hci_cc_read_data_block_size()
867 static void hci_cc_read_clock(struct hci_dev *hdev, struct sk_buff *skb) in hci_cc_read_clock() argument
873 BT_DBG("%s", hdev->name); in hci_cc_read_clock()
881 hci_dev_lock(hdev); in hci_cc_read_clock()
883 cp = hci_sent_cmd_data(hdev, HCI_OP_READ_CLOCK); in hci_cc_read_clock()
888 hdev->clock = le32_to_cpu(rp->clock); in hci_cc_read_clock()
892 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(rp->handle)); in hci_cc_read_clock()
899 hci_dev_unlock(hdev); in hci_cc_read_clock()
902 static void hci_cc_read_local_amp_info(struct hci_dev *hdev, in hci_cc_read_local_amp_info() argument
907 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_read_local_amp_info()
912 hdev->amp_status = rp->amp_status; in hci_cc_read_local_amp_info()
913 hdev->amp_total_bw = __le32_to_cpu(rp->total_bw); in hci_cc_read_local_amp_info()
914 hdev->amp_max_bw = __le32_to_cpu(rp->max_bw); in hci_cc_read_local_amp_info()
915 hdev->amp_min_latency = __le32_to_cpu(rp->min_latency); in hci_cc_read_local_amp_info()
916 hdev->amp_max_pdu = __le32_to_cpu(rp->max_pdu); in hci_cc_read_local_amp_info()
917 hdev->amp_type = rp->amp_type; in hci_cc_read_local_amp_info()
918 hdev->amp_pal_cap = __le16_to_cpu(rp->pal_cap); in hci_cc_read_local_amp_info()
919 hdev->amp_assoc_size = __le16_to_cpu(rp->max_assoc_size); in hci_cc_read_local_amp_info()
920 hdev->amp_be_flush_to = __le32_to_cpu(rp->be_flush_to); in hci_cc_read_local_amp_info()
921 hdev->amp_max_flush_to = __le32_to_cpu(rp->max_flush_to); in hci_cc_read_local_amp_info()
924 static void hci_cc_read_inq_rsp_tx_power(struct hci_dev *hdev, in hci_cc_read_inq_rsp_tx_power() argument
929 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_read_inq_rsp_tx_power()
934 hdev->inq_tx_power = rp->tx_power; in hci_cc_read_inq_rsp_tx_power()
937 static void hci_cc_read_def_err_data_reporting(struct hci_dev *hdev, in hci_cc_read_def_err_data_reporting() argument
942 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_read_def_err_data_reporting()
947 hdev->err_data_reporting = rp->err_data_reporting; in hci_cc_read_def_err_data_reporting()
950 static void hci_cc_write_def_err_data_reporting(struct hci_dev *hdev, in hci_cc_write_def_err_data_reporting() argument
956 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_write_def_err_data_reporting()
961 cp = hci_sent_cmd_data(hdev, HCI_OP_WRITE_DEF_ERR_DATA_REPORTING); in hci_cc_write_def_err_data_reporting()
965 hdev->err_data_reporting = cp->err_data_reporting; in hci_cc_write_def_err_data_reporting()
968 static void hci_cc_pin_code_reply(struct hci_dev *hdev, struct sk_buff *skb) in hci_cc_pin_code_reply() argument
974 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_pin_code_reply()
976 hci_dev_lock(hdev); in hci_cc_pin_code_reply()
978 if (hci_dev_test_flag(hdev, HCI_MGMT)) in hci_cc_pin_code_reply()
979 mgmt_pin_code_reply_complete(hdev, &rp->bdaddr, rp->status); in hci_cc_pin_code_reply()
984 cp = hci_sent_cmd_data(hdev, HCI_OP_PIN_CODE_REPLY); in hci_cc_pin_code_reply()
988 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &cp->bdaddr); in hci_cc_pin_code_reply()
993 hci_dev_unlock(hdev); in hci_cc_pin_code_reply()
996 static void hci_cc_pin_code_neg_reply(struct hci_dev *hdev, struct sk_buff *skb) in hci_cc_pin_code_neg_reply() argument
1000 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_pin_code_neg_reply()
1002 hci_dev_lock(hdev); in hci_cc_pin_code_neg_reply()
1004 if (hci_dev_test_flag(hdev, HCI_MGMT)) in hci_cc_pin_code_neg_reply()
1005 mgmt_pin_code_neg_reply_complete(hdev, &rp->bdaddr, in hci_cc_pin_code_neg_reply()
1008 hci_dev_unlock(hdev); in hci_cc_pin_code_neg_reply()
1011 static void hci_cc_le_read_buffer_size(struct hci_dev *hdev, in hci_cc_le_read_buffer_size() argument
1016 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_le_read_buffer_size()
1021 hdev->le_mtu = __le16_to_cpu(rp->le_mtu); in hci_cc_le_read_buffer_size()
1022 hdev->le_pkts = rp->le_max_pkt; in hci_cc_le_read_buffer_size()
1024 hdev->le_cnt = hdev->le_pkts; in hci_cc_le_read_buffer_size()
1026 BT_DBG("%s le mtu %d:%d", hdev->name, hdev->le_mtu, hdev->le_pkts); in hci_cc_le_read_buffer_size()
1029 static void hci_cc_le_read_local_features(struct hci_dev *hdev, in hci_cc_le_read_local_features() argument
1034 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_le_read_local_features()
1039 memcpy(hdev->le_features, rp->features, 8); in hci_cc_le_read_local_features()
1042 static void hci_cc_le_read_adv_tx_power(struct hci_dev *hdev, in hci_cc_le_read_adv_tx_power() argument
1047 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_le_read_adv_tx_power()
1052 hdev->adv_tx_power = rp->tx_power; in hci_cc_le_read_adv_tx_power()
1055 static void hci_cc_user_confirm_reply(struct hci_dev *hdev, struct sk_buff *skb) in hci_cc_user_confirm_reply() argument
1059 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_user_confirm_reply()
1061 hci_dev_lock(hdev); in hci_cc_user_confirm_reply()
1063 if (hci_dev_test_flag(hdev, HCI_MGMT)) in hci_cc_user_confirm_reply()
1064 mgmt_user_confirm_reply_complete(hdev, &rp->bdaddr, ACL_LINK, 0, in hci_cc_user_confirm_reply()
1067 hci_dev_unlock(hdev); in hci_cc_user_confirm_reply()
1070 static void hci_cc_user_confirm_neg_reply(struct hci_dev *hdev, in hci_cc_user_confirm_neg_reply() argument
1075 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_user_confirm_neg_reply()
1077 hci_dev_lock(hdev); in hci_cc_user_confirm_neg_reply()
1079 if (hci_dev_test_flag(hdev, HCI_MGMT)) in hci_cc_user_confirm_neg_reply()
1080 mgmt_user_confirm_neg_reply_complete(hdev, &rp->bdaddr, in hci_cc_user_confirm_neg_reply()
1083 hci_dev_unlock(hdev); in hci_cc_user_confirm_neg_reply()
1086 static void hci_cc_user_passkey_reply(struct hci_dev *hdev, struct sk_buff *skb) in hci_cc_user_passkey_reply() argument
1090 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_user_passkey_reply()
1092 hci_dev_lock(hdev); in hci_cc_user_passkey_reply()
1094 if (hci_dev_test_flag(hdev, HCI_MGMT)) in hci_cc_user_passkey_reply()
1095 mgmt_user_passkey_reply_complete(hdev, &rp->bdaddr, ACL_LINK, in hci_cc_user_passkey_reply()
1098 hci_dev_unlock(hdev); in hci_cc_user_passkey_reply()
1101 static void hci_cc_user_passkey_neg_reply(struct hci_dev *hdev, in hci_cc_user_passkey_neg_reply() argument
1106 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_user_passkey_neg_reply()
1108 hci_dev_lock(hdev); in hci_cc_user_passkey_neg_reply()
1110 if (hci_dev_test_flag(hdev, HCI_MGMT)) in hci_cc_user_passkey_neg_reply()
1111 mgmt_user_passkey_neg_reply_complete(hdev, &rp->bdaddr, in hci_cc_user_passkey_neg_reply()
1114 hci_dev_unlock(hdev); in hci_cc_user_passkey_neg_reply()
1117 static void hci_cc_read_local_oob_data(struct hci_dev *hdev, in hci_cc_read_local_oob_data() argument
1122 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_read_local_oob_data()
1125 static void hci_cc_read_local_oob_ext_data(struct hci_dev *hdev, in hci_cc_read_local_oob_ext_data() argument
1130 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_read_local_oob_ext_data()
1133 static void hci_cc_le_set_random_addr(struct hci_dev *hdev, struct sk_buff *skb) in hci_cc_le_set_random_addr() argument
1138 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_le_set_random_addr()
1143 sent = hci_sent_cmd_data(hdev, HCI_OP_LE_SET_RANDOM_ADDR); in hci_cc_le_set_random_addr()
1147 hci_dev_lock(hdev); in hci_cc_le_set_random_addr()
1149 bacpy(&hdev->random_addr, sent); in hci_cc_le_set_random_addr()
1151 hci_dev_unlock(hdev); in hci_cc_le_set_random_addr()
1154 static void hci_cc_le_set_default_phy(struct hci_dev *hdev, struct sk_buff *skb) in hci_cc_le_set_default_phy() argument
1159 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_le_set_default_phy()
1164 cp = hci_sent_cmd_data(hdev, HCI_OP_LE_SET_DEFAULT_PHY); in hci_cc_le_set_default_phy()
1168 hci_dev_lock(hdev); in hci_cc_le_set_default_phy()
1170 hdev->le_tx_def_phys = cp->tx_phys; in hci_cc_le_set_default_phy()
1171 hdev->le_rx_def_phys = cp->rx_phys; in hci_cc_le_set_default_phy()
1173 hci_dev_unlock(hdev); in hci_cc_le_set_default_phy()
1176 static void hci_cc_le_set_adv_set_random_addr(struct hci_dev *hdev, in hci_cc_le_set_adv_set_random_addr() argument
1186 cp = hci_sent_cmd_data(hdev, HCI_OP_LE_SET_ADV_SET_RAND_ADDR); in hci_cc_le_set_adv_set_random_addr()
1190 hci_dev_lock(hdev); in hci_cc_le_set_adv_set_random_addr()
1192 if (!hdev->cur_adv_instance) { in hci_cc_le_set_adv_set_random_addr()
1194 bacpy(&hdev->random_addr, &cp->bdaddr); in hci_cc_le_set_adv_set_random_addr()
1196 adv_instance = hci_find_adv_instance(hdev, in hci_cc_le_set_adv_set_random_addr()
1197 hdev->cur_adv_instance); in hci_cc_le_set_adv_set_random_addr()
1202 hci_dev_unlock(hdev); in hci_cc_le_set_adv_set_random_addr()
1205 static void hci_cc_le_set_adv_enable(struct hci_dev *hdev, struct sk_buff *skb) in hci_cc_le_set_adv_enable() argument
1209 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_le_set_adv_enable()
1214 sent = hci_sent_cmd_data(hdev, HCI_OP_LE_SET_ADV_ENABLE); in hci_cc_le_set_adv_enable()
1218 hci_dev_lock(hdev); in hci_cc_le_set_adv_enable()
1226 hci_dev_set_flag(hdev, HCI_LE_ADV); in hci_cc_le_set_adv_enable()
1228 conn = hci_lookup_le_connect(hdev); in hci_cc_le_set_adv_enable()
1230 queue_delayed_work(hdev->workqueue, in hci_cc_le_set_adv_enable()
1234 hci_dev_clear_flag(hdev, HCI_LE_ADV); in hci_cc_le_set_adv_enable()
1237 hci_dev_unlock(hdev); in hci_cc_le_set_adv_enable()
1240 static void hci_cc_le_set_ext_adv_enable(struct hci_dev *hdev, in hci_cc_le_set_ext_adv_enable() argument
1246 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_le_set_ext_adv_enable()
1251 cp = hci_sent_cmd_data(hdev, HCI_OP_LE_SET_EXT_ADV_ENABLE); in hci_cc_le_set_ext_adv_enable()
1255 hci_dev_lock(hdev); in hci_cc_le_set_ext_adv_enable()
1260 hci_dev_set_flag(hdev, HCI_LE_ADV); in hci_cc_le_set_ext_adv_enable()
1262 conn = hci_lookup_le_connect(hdev); in hci_cc_le_set_ext_adv_enable()
1264 queue_delayed_work(hdev->workqueue, in hci_cc_le_set_ext_adv_enable()
1268 hci_dev_clear_flag(hdev, HCI_LE_ADV); in hci_cc_le_set_ext_adv_enable()
1271 hci_dev_unlock(hdev); in hci_cc_le_set_ext_adv_enable()
1274 static void hci_cc_le_set_scan_param(struct hci_dev *hdev, struct sk_buff *skb) in hci_cc_le_set_scan_param() argument
1279 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_le_set_scan_param()
1284 cp = hci_sent_cmd_data(hdev, HCI_OP_LE_SET_SCAN_PARAM); in hci_cc_le_set_scan_param()
1288 hci_dev_lock(hdev); in hci_cc_le_set_scan_param()
1290 hdev->le_scan_type = cp->type; in hci_cc_le_set_scan_param()
1292 hci_dev_unlock(hdev); in hci_cc_le_set_scan_param()
1295 static void hci_cc_le_set_ext_scan_param(struct hci_dev *hdev, in hci_cc_le_set_ext_scan_param() argument
1302 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_le_set_ext_scan_param()
1307 cp = hci_sent_cmd_data(hdev, HCI_OP_LE_SET_EXT_SCAN_PARAMS); in hci_cc_le_set_ext_scan_param()
1313 hci_dev_lock(hdev); in hci_cc_le_set_ext_scan_param()
1315 hdev->le_scan_type = phy_param->type; in hci_cc_le_set_ext_scan_param()
1317 hci_dev_unlock(hdev); in hci_cc_le_set_ext_scan_param()
1320 static bool has_pending_adv_report(struct hci_dev *hdev) in has_pending_adv_report() argument
1322 struct discovery_state *d = &hdev->discovery; in has_pending_adv_report()
1327 static void clear_pending_adv_report(struct hci_dev *hdev) in clear_pending_adv_report() argument
1329 struct discovery_state *d = &hdev->discovery; in clear_pending_adv_report()
1335 static void store_pending_adv_report(struct hci_dev *hdev, bdaddr_t *bdaddr, in store_pending_adv_report() argument
1339 struct discovery_state *d = &hdev->discovery; in store_pending_adv_report()
1352 static void le_set_scan_enable_complete(struct hci_dev *hdev, u8 enable) in le_set_scan_enable_complete() argument
1354 hci_dev_lock(hdev); in le_set_scan_enable_complete()
1358 hci_dev_set_flag(hdev, HCI_LE_SCAN); in le_set_scan_enable_complete()
1359 if (hdev->le_scan_type == LE_SCAN_ACTIVE) in le_set_scan_enable_complete()
1360 clear_pending_adv_report(hdev); in le_set_scan_enable_complete()
1368 if (has_pending_adv_report(hdev)) { in le_set_scan_enable_complete()
1369 struct discovery_state *d = &hdev->discovery; in le_set_scan_enable_complete()
1371 mgmt_device_found(hdev, &d->last_adv_addr, LE_LINK, in le_set_scan_enable_complete()
1381 cancel_delayed_work(&hdev->le_scan_disable); in le_set_scan_enable_complete()
1383 hci_dev_clear_flag(hdev, HCI_LE_SCAN); in le_set_scan_enable_complete()
1392 if (hci_dev_test_and_clear_flag(hdev, HCI_LE_SCAN_INTERRUPTED)) in le_set_scan_enable_complete()
1393 hci_discovery_set_state(hdev, DISCOVERY_STOPPED); in le_set_scan_enable_complete()
1394 else if (!hci_dev_test_flag(hdev, HCI_LE_ADV) && in le_set_scan_enable_complete()
1395 hdev->discovery.state == DISCOVERY_FINDING) in le_set_scan_enable_complete()
1396 hci_req_reenable_advertising(hdev); in le_set_scan_enable_complete()
1401 bt_dev_err(hdev, "use of reserved LE_Scan_Enable param %d", in le_set_scan_enable_complete()
1406 hci_dev_unlock(hdev); in le_set_scan_enable_complete()
1409 static void hci_cc_le_set_scan_enable(struct hci_dev *hdev, in hci_cc_le_set_scan_enable() argument
1415 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_le_set_scan_enable()
1420 cp = hci_sent_cmd_data(hdev, HCI_OP_LE_SET_SCAN_ENABLE); in hci_cc_le_set_scan_enable()
1424 le_set_scan_enable_complete(hdev, cp->enable); in hci_cc_le_set_scan_enable()
1427 static void hci_cc_le_set_ext_scan_enable(struct hci_dev *hdev, in hci_cc_le_set_ext_scan_enable() argument
1433 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_le_set_ext_scan_enable()
1438 cp = hci_sent_cmd_data(hdev, HCI_OP_LE_SET_EXT_SCAN_ENABLE); in hci_cc_le_set_ext_scan_enable()
1442 le_set_scan_enable_complete(hdev, cp->enable); in hci_cc_le_set_ext_scan_enable()
1445 static void hci_cc_le_read_num_adv_sets(struct hci_dev *hdev, in hci_cc_le_read_num_adv_sets() argument
1450 BT_DBG("%s status 0x%2.2x No of Adv sets %u", hdev->name, rp->status, in hci_cc_le_read_num_adv_sets()
1456 hdev->le_num_of_adv_sets = rp->num_of_sets; in hci_cc_le_read_num_adv_sets()
1459 static void hci_cc_le_read_white_list_size(struct hci_dev *hdev, in hci_cc_le_read_white_list_size() argument
1464 BT_DBG("%s status 0x%2.2x size %u", hdev->name, rp->status, rp->size); in hci_cc_le_read_white_list_size()
1469 hdev->le_white_list_size = rp->size; in hci_cc_le_read_white_list_size()
1472 static void hci_cc_le_clear_white_list(struct hci_dev *hdev, in hci_cc_le_clear_white_list() argument
1477 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_le_clear_white_list()
1482 hci_bdaddr_list_clear(&hdev->le_white_list); in hci_cc_le_clear_white_list()
1485 static void hci_cc_le_add_to_white_list(struct hci_dev *hdev, in hci_cc_le_add_to_white_list() argument
1491 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_le_add_to_white_list()
1496 sent = hci_sent_cmd_data(hdev, HCI_OP_LE_ADD_TO_WHITE_LIST); in hci_cc_le_add_to_white_list()
1500 hci_bdaddr_list_add(&hdev->le_white_list, &sent->bdaddr, in hci_cc_le_add_to_white_list()
1504 static void hci_cc_le_del_from_white_list(struct hci_dev *hdev, in hci_cc_le_del_from_white_list() argument
1510 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_le_del_from_white_list()
1515 sent = hci_sent_cmd_data(hdev, HCI_OP_LE_DEL_FROM_WHITE_LIST); in hci_cc_le_del_from_white_list()
1519 hci_bdaddr_list_del(&hdev->le_white_list, &sent->bdaddr, in hci_cc_le_del_from_white_list()
1523 static void hci_cc_le_read_supported_states(struct hci_dev *hdev, in hci_cc_le_read_supported_states() argument
1528 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_le_read_supported_states()
1533 memcpy(hdev->le_states, rp->le_states, 8); in hci_cc_le_read_supported_states()
1536 static void hci_cc_le_read_def_data_len(struct hci_dev *hdev, in hci_cc_le_read_def_data_len() argument
1541 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_le_read_def_data_len()
1546 hdev->le_def_tx_len = le16_to_cpu(rp->tx_len); in hci_cc_le_read_def_data_len()
1547 hdev->le_def_tx_time = le16_to_cpu(rp->tx_time); in hci_cc_le_read_def_data_len()
1550 static void hci_cc_le_write_def_data_len(struct hci_dev *hdev, in hci_cc_le_write_def_data_len() argument
1556 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_le_write_def_data_len()
1561 sent = hci_sent_cmd_data(hdev, HCI_OP_LE_WRITE_DEF_DATA_LEN); in hci_cc_le_write_def_data_len()
1565 hdev->le_def_tx_len = le16_to_cpu(sent->tx_len); in hci_cc_le_write_def_data_len()
1566 hdev->le_def_tx_time = le16_to_cpu(sent->tx_time); in hci_cc_le_write_def_data_len()
1569 static void hci_cc_le_add_to_resolv_list(struct hci_dev *hdev, in hci_cc_le_add_to_resolv_list() argument
1575 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_le_add_to_resolv_list()
1580 sent = hci_sent_cmd_data(hdev, HCI_OP_LE_ADD_TO_RESOLV_LIST); in hci_cc_le_add_to_resolv_list()
1584 hci_bdaddr_list_add_with_irk(&hdev->le_resolv_list, &sent->bdaddr, in hci_cc_le_add_to_resolv_list()
1589 static void hci_cc_le_del_from_resolv_list(struct hci_dev *hdev, in hci_cc_le_del_from_resolv_list() argument
1595 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_le_del_from_resolv_list()
1600 sent = hci_sent_cmd_data(hdev, HCI_OP_LE_DEL_FROM_RESOLV_LIST); in hci_cc_le_del_from_resolv_list()
1604 hci_bdaddr_list_del_with_irk(&hdev->le_resolv_list, &sent->bdaddr, in hci_cc_le_del_from_resolv_list()
1608 static void hci_cc_le_clear_resolv_list(struct hci_dev *hdev, in hci_cc_le_clear_resolv_list() argument
1613 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_le_clear_resolv_list()
1618 hci_bdaddr_list_clear(&hdev->le_resolv_list); in hci_cc_le_clear_resolv_list()
1621 static void hci_cc_le_read_resolv_list_size(struct hci_dev *hdev, in hci_cc_le_read_resolv_list_size() argument
1626 BT_DBG("%s status 0x%2.2x size %u", hdev->name, rp->status, rp->size); in hci_cc_le_read_resolv_list_size()
1631 hdev->le_resolv_list_size = rp->size; in hci_cc_le_read_resolv_list_size()
1634 static void hci_cc_le_set_addr_resolution_enable(struct hci_dev *hdev, in hci_cc_le_set_addr_resolution_enable() argument
1639 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_le_set_addr_resolution_enable()
1644 sent = hci_sent_cmd_data(hdev, HCI_OP_LE_SET_ADDR_RESOLV_ENABLE); in hci_cc_le_set_addr_resolution_enable()
1648 hci_dev_lock(hdev); in hci_cc_le_set_addr_resolution_enable()
1651 hci_dev_set_flag(hdev, HCI_LL_RPA_RESOLUTION); in hci_cc_le_set_addr_resolution_enable()
1653 hci_dev_clear_flag(hdev, HCI_LL_RPA_RESOLUTION); in hci_cc_le_set_addr_resolution_enable()
1655 hci_dev_unlock(hdev); in hci_cc_le_set_addr_resolution_enable()
1658 static void hci_cc_le_read_max_data_len(struct hci_dev *hdev, in hci_cc_le_read_max_data_len() argument
1663 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_le_read_max_data_len()
1668 hdev->le_max_tx_len = le16_to_cpu(rp->tx_len); in hci_cc_le_read_max_data_len()
1669 hdev->le_max_tx_time = le16_to_cpu(rp->tx_time); in hci_cc_le_read_max_data_len()
1670 hdev->le_max_rx_len = le16_to_cpu(rp->rx_len); in hci_cc_le_read_max_data_len()
1671 hdev->le_max_rx_time = le16_to_cpu(rp->rx_time); in hci_cc_le_read_max_data_len()
1674 static void hci_cc_write_le_host_supported(struct hci_dev *hdev, in hci_cc_write_le_host_supported() argument
1680 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_write_le_host_supported()
1685 sent = hci_sent_cmd_data(hdev, HCI_OP_WRITE_LE_HOST_SUPPORTED); in hci_cc_write_le_host_supported()
1689 hci_dev_lock(hdev); in hci_cc_write_le_host_supported()
1692 hdev->features[1][0] |= LMP_HOST_LE; in hci_cc_write_le_host_supported()
1693 hci_dev_set_flag(hdev, HCI_LE_ENABLED); in hci_cc_write_le_host_supported()
1695 hdev->features[1][0] &= ~LMP_HOST_LE; in hci_cc_write_le_host_supported()
1696 hci_dev_clear_flag(hdev, HCI_LE_ENABLED); in hci_cc_write_le_host_supported()
1697 hci_dev_clear_flag(hdev, HCI_ADVERTISING); in hci_cc_write_le_host_supported()
1701 hdev->features[1][0] |= LMP_HOST_LE_BREDR; in hci_cc_write_le_host_supported()
1703 hdev->features[1][0] &= ~LMP_HOST_LE_BREDR; in hci_cc_write_le_host_supported()
1705 hci_dev_unlock(hdev); in hci_cc_write_le_host_supported()
1708 static void hci_cc_set_adv_param(struct hci_dev *hdev, struct sk_buff *skb) in hci_cc_set_adv_param() argument
1713 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_set_adv_param()
1718 cp = hci_sent_cmd_data(hdev, HCI_OP_LE_SET_ADV_PARAM); in hci_cc_set_adv_param()
1722 hci_dev_lock(hdev); in hci_cc_set_adv_param()
1723 hdev->adv_addr_type = cp->own_address_type; in hci_cc_set_adv_param()
1724 hci_dev_unlock(hdev); in hci_cc_set_adv_param()
1727 static void hci_cc_set_ext_adv_param(struct hci_dev *hdev, struct sk_buff *skb) in hci_cc_set_ext_adv_param() argument
1733 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_set_ext_adv_param()
1738 cp = hci_sent_cmd_data(hdev, HCI_OP_LE_SET_EXT_ADV_PARAMS); in hci_cc_set_ext_adv_param()
1742 hci_dev_lock(hdev); in hci_cc_set_ext_adv_param()
1743 hdev->adv_addr_type = cp->own_addr_type; in hci_cc_set_ext_adv_param()
1744 if (!hdev->cur_adv_instance) { in hci_cc_set_ext_adv_param()
1746 hdev->adv_tx_power = rp->tx_power; in hci_cc_set_ext_adv_param()
1748 adv_instance = hci_find_adv_instance(hdev, in hci_cc_set_ext_adv_param()
1749 hdev->cur_adv_instance); in hci_cc_set_ext_adv_param()
1754 hci_req_update_adv_data(hdev, hdev->cur_adv_instance); in hci_cc_set_ext_adv_param()
1755 hci_dev_unlock(hdev); in hci_cc_set_ext_adv_param()
1758 static void hci_cc_read_rssi(struct hci_dev *hdev, struct sk_buff *skb) in hci_cc_read_rssi() argument
1763 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_read_rssi()
1768 hci_dev_lock(hdev); in hci_cc_read_rssi()
1770 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(rp->handle)); in hci_cc_read_rssi()
1774 hci_dev_unlock(hdev); in hci_cc_read_rssi()
1777 static void hci_cc_read_tx_power(struct hci_dev *hdev, struct sk_buff *skb) in hci_cc_read_tx_power() argument
1783 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); in hci_cc_read_tx_power()
1788 sent = hci_sent_cmd_data(hdev, HCI_OP_READ_TX_POWER); in hci_cc_read_tx_power()
1792 hci_dev_lock(hdev); in hci_cc_read_tx_power()
1794 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(rp->handle)); in hci_cc_read_tx_power()
1808 hci_dev_unlock(hdev); in hci_cc_read_tx_power()
1811 static void hci_cc_write_ssp_debug_mode(struct hci_dev *hdev, struct sk_buff *skb) in hci_cc_write_ssp_debug_mode() argument
1816 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cc_write_ssp_debug_mode()
1821 mode = hci_sent_cmd_data(hdev, HCI_OP_WRITE_SSP_DEBUG_MODE); in hci_cc_write_ssp_debug_mode()
1823 hdev->ssp_debug_mode = *mode; in hci_cc_write_ssp_debug_mode()
1826 static void hci_cs_inquiry(struct hci_dev *hdev, __u8 status) in hci_cs_inquiry() argument
1828 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cs_inquiry()
1831 hci_conn_check_pending(hdev); in hci_cs_inquiry()
1835 set_bit(HCI_INQUIRY, &hdev->flags); in hci_cs_inquiry()
1838 static void hci_cs_create_conn(struct hci_dev *hdev, __u8 status) in hci_cs_create_conn() argument
1843 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cs_create_conn()
1845 cp = hci_sent_cmd_data(hdev, HCI_OP_CREATE_CONN); in hci_cs_create_conn()
1849 hci_dev_lock(hdev); in hci_cs_create_conn()
1851 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &cp->bdaddr); in hci_cs_create_conn()
1853 BT_DBG("%s bdaddr %pMR hcon %p", hdev->name, &cp->bdaddr, conn); in hci_cs_create_conn()
1866 conn = hci_conn_add(hdev, ACL_LINK, &cp->bdaddr, in hci_cs_create_conn()
1869 bt_dev_err(hdev, "no memory for new connection"); in hci_cs_create_conn()
1873 hci_dev_unlock(hdev); in hci_cs_create_conn()
1876 static void hci_cs_add_sco(struct hci_dev *hdev, __u8 status) in hci_cs_add_sco() argument
1882 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cs_add_sco()
1887 cp = hci_sent_cmd_data(hdev, HCI_OP_ADD_SCO); in hci_cs_add_sco()
1893 BT_DBG("%s handle 0x%4.4x", hdev->name, handle); in hci_cs_add_sco()
1895 hci_dev_lock(hdev); in hci_cs_add_sco()
1897 acl = hci_conn_hash_lookup_handle(hdev, handle); in hci_cs_add_sco()
1908 hci_dev_unlock(hdev); in hci_cs_add_sco()
1911 static void hci_cs_auth_requested(struct hci_dev *hdev, __u8 status) in hci_cs_auth_requested() argument
1916 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cs_auth_requested()
1921 cp = hci_sent_cmd_data(hdev, HCI_OP_AUTH_REQUESTED); in hci_cs_auth_requested()
1925 hci_dev_lock(hdev); in hci_cs_auth_requested()
1927 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(cp->handle)); in hci_cs_auth_requested()
1935 hci_dev_unlock(hdev); in hci_cs_auth_requested()
1938 static void hci_cs_set_conn_encrypt(struct hci_dev *hdev, __u8 status) in hci_cs_set_conn_encrypt() argument
1943 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cs_set_conn_encrypt()
1948 cp = hci_sent_cmd_data(hdev, HCI_OP_SET_CONN_ENCRYPT); in hci_cs_set_conn_encrypt()
1952 hci_dev_lock(hdev); in hci_cs_set_conn_encrypt()
1954 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(cp->handle)); in hci_cs_set_conn_encrypt()
1962 hci_dev_unlock(hdev); in hci_cs_set_conn_encrypt()
1965 static int hci_outgoing_auth_needed(struct hci_dev *hdev, in hci_outgoing_auth_needed() argument
1987 static int hci_resolve_name(struct hci_dev *hdev, in hci_resolve_name() argument
1999 return hci_send_cmd(hdev, HCI_OP_REMOTE_NAME_REQ, sizeof(cp), &cp); in hci_resolve_name()
2002 static bool hci_resolve_next_name(struct hci_dev *hdev) in hci_resolve_next_name() argument
2004 struct discovery_state *discov = &hdev->discovery; in hci_resolve_next_name()
2010 e = hci_inquiry_cache_lookup_resolve(hdev, BDADDR_ANY, NAME_NEEDED); in hci_resolve_next_name()
2014 if (hci_resolve_name(hdev, e) == 0) { in hci_resolve_next_name()
2022 static void hci_check_pending_name(struct hci_dev *hdev, struct hci_conn *conn, in hci_check_pending_name() argument
2025 struct discovery_state *discov = &hdev->discovery; in hci_check_pending_name()
2036 mgmt_device_connected(hdev, conn, 0, name, name_len); in hci_check_pending_name()
2047 e = hci_inquiry_cache_lookup_resolve(hdev, bdaddr, NAME_PENDING); in hci_check_pending_name()
2058 mgmt_remote_name(hdev, bdaddr, ACL_LINK, 0x00, in hci_check_pending_name()
2064 if (hci_resolve_next_name(hdev)) in hci_check_pending_name()
2068 hci_discovery_set_state(hdev, DISCOVERY_STOPPED); in hci_check_pending_name()
2071 static void hci_cs_remote_name_req(struct hci_dev *hdev, __u8 status) in hci_cs_remote_name_req() argument
2076 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cs_remote_name_req()
2083 cp = hci_sent_cmd_data(hdev, HCI_OP_REMOTE_NAME_REQ); in hci_cs_remote_name_req()
2087 hci_dev_lock(hdev); in hci_cs_remote_name_req()
2089 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &cp->bdaddr); in hci_cs_remote_name_req()
2091 if (hci_dev_test_flag(hdev, HCI_MGMT)) in hci_cs_remote_name_req()
2092 hci_check_pending_name(hdev, conn, &cp->bdaddr, NULL, 0); in hci_cs_remote_name_req()
2097 if (!hci_outgoing_auth_needed(hdev, conn)) in hci_cs_remote_name_req()
2106 hci_send_cmd(hdev, HCI_OP_AUTH_REQUESTED, in hci_cs_remote_name_req()
2111 hci_dev_unlock(hdev); in hci_cs_remote_name_req()
2114 static void hci_cs_read_remote_features(struct hci_dev *hdev, __u8 status) in hci_cs_read_remote_features() argument
2119 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cs_read_remote_features()
2124 cp = hci_sent_cmd_data(hdev, HCI_OP_READ_REMOTE_FEATURES); in hci_cs_read_remote_features()
2128 hci_dev_lock(hdev); in hci_cs_read_remote_features()
2130 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(cp->handle)); in hci_cs_read_remote_features()
2138 hci_dev_unlock(hdev); in hci_cs_read_remote_features()
2141 static void hci_cs_read_remote_ext_features(struct hci_dev *hdev, __u8 status) in hci_cs_read_remote_ext_features() argument
2146 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cs_read_remote_ext_features()
2151 cp = hci_sent_cmd_data(hdev, HCI_OP_READ_REMOTE_EXT_FEATURES); in hci_cs_read_remote_ext_features()
2155 hci_dev_lock(hdev); in hci_cs_read_remote_ext_features()
2157 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(cp->handle)); in hci_cs_read_remote_ext_features()
2165 hci_dev_unlock(hdev); in hci_cs_read_remote_ext_features()
2168 static void hci_cs_setup_sync_conn(struct hci_dev *hdev, __u8 status) in hci_cs_setup_sync_conn() argument
2174 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cs_setup_sync_conn()
2179 cp = hci_sent_cmd_data(hdev, HCI_OP_SETUP_SYNC_CONN); in hci_cs_setup_sync_conn()
2185 BT_DBG("%s handle 0x%4.4x", hdev->name, handle); in hci_cs_setup_sync_conn()
2187 hci_dev_lock(hdev); in hci_cs_setup_sync_conn()
2189 acl = hci_conn_hash_lookup_handle(hdev, handle); in hci_cs_setup_sync_conn()
2200 hci_dev_unlock(hdev); in hci_cs_setup_sync_conn()
2203 static void hci_cs_sniff_mode(struct hci_dev *hdev, __u8 status) in hci_cs_sniff_mode() argument
2208 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cs_sniff_mode()
2213 cp = hci_sent_cmd_data(hdev, HCI_OP_SNIFF_MODE); in hci_cs_sniff_mode()
2217 hci_dev_lock(hdev); in hci_cs_sniff_mode()
2219 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(cp->handle)); in hci_cs_sniff_mode()
2227 hci_dev_unlock(hdev); in hci_cs_sniff_mode()
2230 static void hci_cs_exit_sniff_mode(struct hci_dev *hdev, __u8 status) in hci_cs_exit_sniff_mode() argument
2235 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cs_exit_sniff_mode()
2240 cp = hci_sent_cmd_data(hdev, HCI_OP_EXIT_SNIFF_MODE); in hci_cs_exit_sniff_mode()
2244 hci_dev_lock(hdev); in hci_cs_exit_sniff_mode()
2246 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(cp->handle)); in hci_cs_exit_sniff_mode()
2254 hci_dev_unlock(hdev); in hci_cs_exit_sniff_mode()
2257 static void hci_cs_disconnect(struct hci_dev *hdev, u8 status) in hci_cs_disconnect() argument
2265 cp = hci_sent_cmd_data(hdev, HCI_OP_DISCONNECT); in hci_cs_disconnect()
2269 hci_dev_lock(hdev); in hci_cs_disconnect()
2271 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(cp->handle)); in hci_cs_disconnect()
2275 mgmt_disconnect_failed(hdev, &conn->dst, conn->type, in hci_cs_disconnect()
2285 hci_req_reenable_advertising(hdev); in hci_cs_disconnect()
2288 hci_dev_unlock(hdev); in hci_cs_disconnect()
2291 static void cs_le_create_conn(struct hci_dev *hdev, bdaddr_t *peer_addr, in cs_le_create_conn() argument
2297 conn = hci_conn_hash_lookup_le(hdev, peer_addr, in cs_le_create_conn()
2306 if (use_ll_privacy(hdev) && in cs_le_create_conn()
2307 hci_dev_test_flag(hdev, HCI_LL_RPA_RESOLUTION)) { in cs_le_create_conn()
2324 bacpy(&conn->init_addr, &hdev->random_addr); in cs_le_create_conn()
2326 bacpy(&conn->init_addr, &hdev->bdaddr); in cs_le_create_conn()
2337 queue_delayed_work(conn->hdev->workqueue, in cs_le_create_conn()
2342 static void hci_cs_le_create_conn(struct hci_dev *hdev, u8 status) in hci_cs_le_create_conn() argument
2346 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cs_le_create_conn()
2355 cp = hci_sent_cmd_data(hdev, HCI_OP_LE_CREATE_CONN); in hci_cs_le_create_conn()
2359 hci_dev_lock(hdev); in hci_cs_le_create_conn()
2361 cs_le_create_conn(hdev, &cp->peer_addr, cp->peer_addr_type, in hci_cs_le_create_conn()
2364 hci_dev_unlock(hdev); in hci_cs_le_create_conn()
2367 static void hci_cs_le_ext_create_conn(struct hci_dev *hdev, u8 status) in hci_cs_le_ext_create_conn() argument
2371 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cs_le_ext_create_conn()
2380 cp = hci_sent_cmd_data(hdev, HCI_OP_LE_EXT_CREATE_CONN); in hci_cs_le_ext_create_conn()
2384 hci_dev_lock(hdev); in hci_cs_le_ext_create_conn()
2386 cs_le_create_conn(hdev, &cp->peer_addr, cp->peer_addr_type, in hci_cs_le_ext_create_conn()
2389 hci_dev_unlock(hdev); in hci_cs_le_ext_create_conn()
2392 static void hci_cs_le_read_remote_features(struct hci_dev *hdev, u8 status) in hci_cs_le_read_remote_features() argument
2397 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cs_le_read_remote_features()
2402 cp = hci_sent_cmd_data(hdev, HCI_OP_LE_READ_REMOTE_FEATURES); in hci_cs_le_read_remote_features()
2406 hci_dev_lock(hdev); in hci_cs_le_read_remote_features()
2408 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(cp->handle)); in hci_cs_le_read_remote_features()
2416 hci_dev_unlock(hdev); in hci_cs_le_read_remote_features()
2419 static void hci_cs_le_start_enc(struct hci_dev *hdev, u8 status) in hci_cs_le_start_enc() argument
2424 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cs_le_start_enc()
2429 hci_dev_lock(hdev); in hci_cs_le_start_enc()
2431 cp = hci_sent_cmd_data(hdev, HCI_OP_LE_START_ENC); in hci_cs_le_start_enc()
2435 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(cp->handle)); in hci_cs_le_start_enc()
2446 hci_dev_unlock(hdev); in hci_cs_le_start_enc()
2449 static void hci_cs_switch_role(struct hci_dev *hdev, u8 status) in hci_cs_switch_role() argument
2454 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_cs_switch_role()
2459 cp = hci_sent_cmd_data(hdev, HCI_OP_SWITCH_ROLE); in hci_cs_switch_role()
2463 hci_dev_lock(hdev); in hci_cs_switch_role()
2465 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &cp->bdaddr); in hci_cs_switch_role()
2469 hci_dev_unlock(hdev); in hci_cs_switch_role()
2472 static void hci_inquiry_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) in hci_inquiry_complete_evt() argument
2475 struct discovery_state *discov = &hdev->discovery; in hci_inquiry_complete_evt()
2478 BT_DBG("%s status 0x%2.2x", hdev->name, status); in hci_inquiry_complete_evt()
2480 hci_conn_check_pending(hdev); in hci_inquiry_complete_evt()
2482 if (!test_and_clear_bit(HCI_INQUIRY, &hdev->flags)) in hci_inquiry_complete_evt()
2486 wake_up_bit(&hdev->flags, HCI_INQUIRY); in hci_inquiry_complete_evt()
2488 if (!hci_dev_test_flag(hdev, HCI_MGMT)) in hci_inquiry_complete_evt()
2491 hci_dev_lock(hdev); in hci_inquiry_complete_evt()
2504 if (!hci_dev_test_flag(hdev, HCI_LE_SCAN) || in hci_inquiry_complete_evt()
2505 !test_bit(HCI_QUIRK_SIMULTANEOUS_DISCOVERY, &hdev->quirks)) in hci_inquiry_complete_evt()
2506 hci_discovery_set_state(hdev, DISCOVERY_STOPPED); in hci_inquiry_complete_evt()
2510 e = hci_inquiry_cache_lookup_resolve(hdev, BDADDR_ANY, NAME_NEEDED); in hci_inquiry_complete_evt()
2511 if (e && hci_resolve_name(hdev, e) == 0) { in hci_inquiry_complete_evt()
2513 hci_discovery_set_state(hdev, DISCOVERY_RESOLVING); in hci_inquiry_complete_evt()
2522 if (!hci_dev_test_flag(hdev, HCI_LE_SCAN) || in hci_inquiry_complete_evt()
2523 !test_bit(HCI_QUIRK_SIMULTANEOUS_DISCOVERY, &hdev->quirks)) in hci_inquiry_complete_evt()
2524 hci_discovery_set_state(hdev, DISCOVERY_STOPPED); in hci_inquiry_complete_evt()
2528 hci_dev_unlock(hdev); in hci_inquiry_complete_evt()
2531 static void hci_inquiry_result_evt(struct hci_dev *hdev, struct sk_buff *skb) in hci_inquiry_result_evt() argument
2537 BT_DBG("%s num_rsp %d", hdev->name, num_rsp); in hci_inquiry_result_evt()
2542 if (hci_dev_test_flag(hdev, HCI_PERIODIC_INQ)) in hci_inquiry_result_evt()
2545 hci_dev_lock(hdev); in hci_inquiry_result_evt()
2559 flags = hci_inquiry_cache_update(hdev, &data, false); in hci_inquiry_result_evt()
2561 mgmt_device_found(hdev, &info->bdaddr, ACL_LINK, 0x00, in hci_inquiry_result_evt()
2566 hci_dev_unlock(hdev); in hci_inquiry_result_evt()
2569 static void hci_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) in hci_conn_complete_evt() argument
2574 BT_DBG("%s", hdev->name); in hci_conn_complete_evt()
2576 hci_dev_lock(hdev); in hci_conn_complete_evt()
2578 conn = hci_conn_hash_lookup_ba(hdev, ev->link_type, &ev->bdaddr); in hci_conn_complete_evt()
2590 hci_bdaddr_list_lookup_with_flags(&hdev->whitelist, in hci_conn_complete_evt()
2593 conn = hci_conn_add(hdev, ev->link_type, &ev->bdaddr, in hci_conn_complete_evt()
2596 bt_dev_err(hdev, "no memory for new conn"); in hci_conn_complete_evt()
2603 conn = hci_conn_hash_lookup_ba(hdev, ESCO_LINK, in hci_conn_complete_evt()
2620 !hci_find_link_key(hdev, &ev->bdaddr)) in hci_conn_complete_evt()
2630 if (test_bit(HCI_AUTH, &hdev->flags)) in hci_conn_complete_evt()
2633 if (test_bit(HCI_ENCRYPT, &hdev->flags)) in hci_conn_complete_evt()
2640 hci_send_cmd(hdev, HCI_OP_READ_REMOTE_FEATURES, in hci_conn_complete_evt()
2643 hci_req_update_scan(hdev); in hci_conn_complete_evt()
2647 if (!conn->out && hdev->hci_ver < BLUETOOTH_VER_2_0) { in hci_conn_complete_evt()
2651 hci_send_cmd(hdev, HCI_OP_CHANGE_CONN_PTYPE, sizeof(cp), in hci_conn_complete_evt()
2657 mgmt_connect_failed(hdev, &conn->dst, conn->type, in hci_conn_complete_evt()
2670 if (hdev->notify) in hci_conn_complete_evt()
2671 hdev->notify(hdev, HCI_NOTIFY_ENABLE_SCO_CVSD); in hci_conn_complete_evt()
2679 hci_dev_unlock(hdev); in hci_conn_complete_evt()
2681 hci_conn_check_pending(hdev); in hci_conn_complete_evt()
2684 static void hci_reject_conn(struct hci_dev *hdev, bdaddr_t *bdaddr) in hci_reject_conn() argument
2690 hci_send_cmd(hdev, HCI_OP_REJECT_CONN_REQ, sizeof(cp), &cp); in hci_reject_conn()
2693 static void hci_conn_request_evt(struct hci_dev *hdev, struct sk_buff *skb) in hci_conn_request_evt() argument
2696 int mask = hdev->link_mode; in hci_conn_request_evt()
2701 BT_DBG("%s bdaddr %pMR type 0x%x", hdev->name, &ev->bdaddr, in hci_conn_request_evt()
2704 mask |= hci_proto_connect_ind(hdev, &ev->bdaddr, ev->link_type, in hci_conn_request_evt()
2708 hci_reject_conn(hdev, &ev->bdaddr); in hci_conn_request_evt()
2712 if (hci_bdaddr_list_lookup(&hdev->blacklist, &ev->bdaddr, in hci_conn_request_evt()
2714 hci_reject_conn(hdev, &ev->bdaddr); in hci_conn_request_evt()
2722 if (hci_dev_test_flag(hdev, HCI_MGMT) && in hci_conn_request_evt()
2723 !hci_dev_test_flag(hdev, HCI_CONNECTABLE) && in hci_conn_request_evt()
2724 !hci_bdaddr_list_lookup_with_flags(&hdev->whitelist, &ev->bdaddr, in hci_conn_request_evt()
2726 hci_reject_conn(hdev, &ev->bdaddr); in hci_conn_request_evt()
2732 hci_dev_lock(hdev); in hci_conn_request_evt()
2734 ie = hci_inquiry_cache_lookup(hdev, &ev->bdaddr); in hci_conn_request_evt()
2738 conn = hci_conn_hash_lookup_ba(hdev, ev->link_type, in hci_conn_request_evt()
2741 conn = hci_conn_add(hdev, ev->link_type, &ev->bdaddr, in hci_conn_request_evt()
2744 bt_dev_err(hdev, "no memory for new connection"); in hci_conn_request_evt()
2745 hci_dev_unlock(hdev); in hci_conn_request_evt()
2752 hci_dev_unlock(hdev); in hci_conn_request_evt()
2755 (!(flags & HCI_PROTO_DEFER) && !lmp_esco_capable(hdev))) { in hci_conn_request_evt()
2761 if (lmp_rswitch_capable(hdev) && (mask & HCI_LM_MASTER)) in hci_conn_request_evt()
2766 hci_send_cmd(hdev, HCI_OP_ACCEPT_CONN_REQ, sizeof(cp), &cp); in hci_conn_request_evt()
2777 cp.content_format = cpu_to_le16(hdev->voice_setting); in hci_conn_request_evt()
2780 hci_send_cmd(hdev, HCI_OP_ACCEPT_SYNC_CONN_REQ, sizeof(cp), in hci_conn_request_evt()
2804 static void hci_disconn_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) in hci_disconn_complete_evt() argument
2813 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); in hci_disconn_complete_evt()
2815 hci_dev_lock(hdev); in hci_disconn_complete_evt()
2817 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); in hci_disconn_complete_evt()
2822 mgmt_disconnect_failed(hdev, &conn->dst, conn->type, in hci_disconn_complete_evt()
2836 mgmt_device_disconnected(hdev, &conn->dst, conn->type, conn->dst_type, in hci_disconn_complete_evt()
2841 hci_remove_link_key(hdev, &conn->dst); in hci_disconn_complete_evt()
2843 hci_req_update_scan(hdev); in hci_disconn_complete_evt()
2846 params = hci_conn_params_lookup(hdev, &conn->dst, conn->dst_type); in hci_disconn_complete_evt()
2857 list_add(¶ms->action, &hdev->pend_le_conns); in hci_disconn_complete_evt()
2858 hci_update_background_scan(hdev); in hci_disconn_complete_evt()
2874 if (list_empty(&hdev->conn_hash.list) && in hci_disconn_complete_evt()
2875 test_and_clear_bit(SUSPEND_DISCONNECTING, hdev->suspend_tasks)) { in hci_disconn_complete_evt()
2876 wake_up(&hdev->suspend_wait_q); in hci_disconn_complete_evt()
2890 hci_req_reenable_advertising(hdev); in hci_disconn_complete_evt()
2893 hci_dev_unlock(hdev); in hci_disconn_complete_evt()
2896 static void hci_auth_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) in hci_auth_complete_evt() argument
2901 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); in hci_auth_complete_evt()
2903 hci_dev_lock(hdev); in hci_auth_complete_evt()
2905 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); in hci_auth_complete_evt()
2914 bt_dev_info(hdev, "re-auth of legacy device is not possible."); in hci_auth_complete_evt()
2934 hci_send_cmd(hdev, HCI_OP_SET_CONN_ENCRYPT, sizeof(cp), in hci_auth_complete_evt()
2954 hci_send_cmd(hdev, HCI_OP_SET_CONN_ENCRYPT, sizeof(cp), in hci_auth_complete_evt()
2963 hci_dev_unlock(hdev); in hci_auth_complete_evt()
2966 static void hci_remote_name_evt(struct hci_dev *hdev, struct sk_buff *skb) in hci_remote_name_evt() argument
2971 BT_DBG("%s", hdev->name); in hci_remote_name_evt()
2973 hci_conn_check_pending(hdev); in hci_remote_name_evt()
2975 hci_dev_lock(hdev); in hci_remote_name_evt()
2977 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); in hci_remote_name_evt()
2979 if (!hci_dev_test_flag(hdev, HCI_MGMT)) in hci_remote_name_evt()
2983 hci_check_pending_name(hdev, conn, &ev->bdaddr, ev->name, in hci_remote_name_evt()
2986 hci_check_pending_name(hdev, conn, &ev->bdaddr, NULL, 0); in hci_remote_name_evt()
2992 if (!hci_outgoing_auth_needed(hdev, conn)) in hci_remote_name_evt()
3001 hci_send_cmd(hdev, HCI_OP_AUTH_REQUESTED, sizeof(cp), &cp); in hci_remote_name_evt()
3005 hci_dev_unlock(hdev); in hci_remote_name_evt()
3008 static void read_enc_key_size_complete(struct hci_dev *hdev, u8 status, in read_enc_key_size_complete() argument
3015 BT_DBG("%s status 0x%02x", hdev->name, status); in read_enc_key_size_complete()
3018 bt_dev_err(hdev, "invalid read key size response"); in read_enc_key_size_complete()
3025 hci_dev_lock(hdev); in read_enc_key_size_complete()
3027 conn = hci_conn_hash_lookup_handle(hdev, handle); in read_enc_key_size_complete()
3036 bt_dev_err(hdev, "failed to read key size for handle %u", in read_enc_key_size_complete()
3046 hci_dev_unlock(hdev); in read_enc_key_size_complete()
3049 static void hci_encrypt_change_evt(struct hci_dev *hdev, struct sk_buff *skb) in hci_encrypt_change_evt() argument
3054 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); in hci_encrypt_change_evt()
3056 hci_dev_lock(hdev); in hci_encrypt_change_evt()
3058 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); in hci_encrypt_change_evt()
3086 hci_dev_set_flag(hdev, HCI_RPA_EXPIRED); in hci_encrypt_change_evt()
3087 hci_adv_instances_set_rpa_expired(hdev, true); in hci_encrypt_change_evt()
3118 if (!(hdev->commands[20] & 0x10)) { in hci_encrypt_change_evt()
3123 hci_req_init(&req, hdev); in hci_encrypt_change_evt()
3129 bt_dev_err(hdev, "sending read key size failed"); in hci_encrypt_change_evt()
3146 ((conn->type == ACL_LINK && lmp_ping_capable(hdev)) || in hci_encrypt_change_evt()
3147 (conn->type == LE_LINK && (hdev->le_features[0] & HCI_LE_PING)))) { in hci_encrypt_change_evt()
3151 cp.timeout = cpu_to_le16(hdev->auth_payload_timeout); in hci_encrypt_change_evt()
3152 hci_send_cmd(conn->hdev, HCI_OP_WRITE_AUTH_PAYLOAD_TO, in hci_encrypt_change_evt()
3160 hci_dev_unlock(hdev); in hci_encrypt_change_evt()
3163 static void hci_change_link_key_complete_evt(struct hci_dev *hdev, in hci_change_link_key_complete_evt() argument
3169 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); in hci_change_link_key_complete_evt()
3171 hci_dev_lock(hdev); in hci_change_link_key_complete_evt()
3173 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); in hci_change_link_key_complete_evt()
3183 hci_dev_unlock(hdev); in hci_change_link_key_complete_evt()
3186 static void hci_remote_features_evt(struct hci_dev *hdev, in hci_remote_features_evt() argument
3192 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); in hci_remote_features_evt()
3194 hci_dev_lock(hdev); in hci_remote_features_evt()
3196 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); in hci_remote_features_evt()
3206 if (!ev->status && lmp_ext_feat_capable(hdev) && in hci_remote_features_evt()
3211 hci_send_cmd(hdev, HCI_OP_READ_REMOTE_EXT_FEATURES, in hci_remote_features_evt()
3221 hci_send_cmd(hdev, HCI_OP_REMOTE_NAME_REQ, sizeof(cp), &cp); in hci_remote_features_evt()
3223 mgmt_device_connected(hdev, conn, 0, NULL, 0); in hci_remote_features_evt()
3225 if (!hci_outgoing_auth_needed(hdev, conn)) { in hci_remote_features_evt()
3232 hci_dev_unlock(hdev); in hci_remote_features_evt()
3235 static void hci_cmd_complete_evt(struct hci_dev *hdev, struct sk_buff *skb, in hci_cmd_complete_evt() argument
3249 hci_cc_inquiry_cancel(hdev, skb, status); in hci_cmd_complete_evt()
3253 hci_cc_periodic_inq(hdev, skb); in hci_cmd_complete_evt()
3257 hci_cc_exit_periodic_inq(hdev, skb); in hci_cmd_complete_evt()
3261 hci_cc_remote_name_req_cancel(hdev, skb); in hci_cmd_complete_evt()
3265 hci_cc_role_discovery(hdev, skb); in hci_cmd_complete_evt()
3269 hci_cc_read_link_policy(hdev, skb); in hci_cmd_complete_evt()
3273 hci_cc_write_link_policy(hdev, skb); in hci_cmd_complete_evt()
3277 hci_cc_read_def_link_policy(hdev, skb); in hci_cmd_complete_evt()
3281 hci_cc_write_def_link_policy(hdev, skb); in hci_cmd_complete_evt()
3285 hci_cc_reset(hdev, skb); in hci_cmd_complete_evt()
3289 hci_cc_read_stored_link_key(hdev, skb); in hci_cmd_complete_evt()
3293 hci_cc_delete_stored_link_key(hdev, skb); in hci_cmd_complete_evt()
3297 hci_cc_write_local_name(hdev, skb); in hci_cmd_complete_evt()
3301 hci_cc_read_local_name(hdev, skb); in hci_cmd_complete_evt()
3305 hci_cc_write_auth_enable(hdev, skb); in hci_cmd_complete_evt()
3309 hci_cc_write_encrypt_mode(hdev, skb); in hci_cmd_complete_evt()
3313 hci_cc_write_scan_enable(hdev, skb); in hci_cmd_complete_evt()
3317 hci_cc_read_class_of_dev(hdev, skb); in hci_cmd_complete_evt()
3321 hci_cc_write_class_of_dev(hdev, skb); in hci_cmd_complete_evt()
3325 hci_cc_read_voice_setting(hdev, skb); in hci_cmd_complete_evt()
3329 hci_cc_write_voice_setting(hdev, skb); in hci_cmd_complete_evt()
3333 hci_cc_read_num_supported_iac(hdev, skb); in hci_cmd_complete_evt()
3337 hci_cc_write_ssp_mode(hdev, skb); in hci_cmd_complete_evt()
3341 hci_cc_write_sc_support(hdev, skb); in hci_cmd_complete_evt()
3345 hci_cc_read_auth_payload_timeout(hdev, skb); in hci_cmd_complete_evt()
3349 hci_cc_write_auth_payload_timeout(hdev, skb); in hci_cmd_complete_evt()
3353 hci_cc_read_local_version(hdev, skb); in hci_cmd_complete_evt()
3357 hci_cc_read_local_commands(hdev, skb); in hci_cmd_complete_evt()
3361 hci_cc_read_local_features(hdev, skb); in hci_cmd_complete_evt()
3365 hci_cc_read_local_ext_features(hdev, skb); in hci_cmd_complete_evt()
3369 hci_cc_read_buffer_size(hdev, skb); in hci_cmd_complete_evt()
3373 hci_cc_read_bd_addr(hdev, skb); in hci_cmd_complete_evt()
3377 hci_cc_read_local_pairing_opts(hdev, skb); in hci_cmd_complete_evt()
3381 hci_cc_read_page_scan_activity(hdev, skb); in hci_cmd_complete_evt()
3385 hci_cc_write_page_scan_activity(hdev, skb); in hci_cmd_complete_evt()
3389 hci_cc_read_page_scan_type(hdev, skb); in hci_cmd_complete_evt()
3393 hci_cc_write_page_scan_type(hdev, skb); in hci_cmd_complete_evt()
3397 hci_cc_read_data_block_size(hdev, skb); in hci_cmd_complete_evt()
3401 hci_cc_read_flow_control_mode(hdev, skb); in hci_cmd_complete_evt()
3405 hci_cc_read_local_amp_info(hdev, skb); in hci_cmd_complete_evt()
3409 hci_cc_read_clock(hdev, skb); in hci_cmd_complete_evt()
3413 hci_cc_read_inq_rsp_tx_power(hdev, skb); in hci_cmd_complete_evt()
3417 hci_cc_read_def_err_data_reporting(hdev, skb); in hci_cmd_complete_evt()
3421 hci_cc_write_def_err_data_reporting(hdev, skb); in hci_cmd_complete_evt()
3425 hci_cc_pin_code_reply(hdev, skb); in hci_cmd_complete_evt()
3429 hci_cc_pin_code_neg_reply(hdev, skb); in hci_cmd_complete_evt()
3433 hci_cc_read_local_oob_data(hdev, skb); in hci_cmd_complete_evt()
3437 hci_cc_read_local_oob_ext_data(hdev, skb); in hci_cmd_complete_evt()
3441 hci_cc_le_read_buffer_size(hdev, skb); in hci_cmd_complete_evt()
3445 hci_cc_le_read_local_features(hdev, skb); in hci_cmd_complete_evt()
3449 hci_cc_le_read_adv_tx_power(hdev, skb); in hci_cmd_complete_evt()
3453 hci_cc_user_confirm_reply(hdev, skb); in hci_cmd_complete_evt()
3457 hci_cc_user_confirm_neg_reply(hdev, skb); in hci_cmd_complete_evt()
3461 hci_cc_user_passkey_reply(hdev, skb); in hci_cmd_complete_evt()
3465 hci_cc_user_passkey_neg_reply(hdev, skb); in hci_cmd_complete_evt()
3469 hci_cc_le_set_random_addr(hdev, skb); in hci_cmd_complete_evt()
3473 hci_cc_le_set_adv_enable(hdev, skb); in hci_cmd_complete_evt()
3477 hci_cc_le_set_scan_param(hdev, skb); in hci_cmd_complete_evt()
3481 hci_cc_le_set_scan_enable(hdev, skb); in hci_cmd_complete_evt()
3485 hci_cc_le_read_white_list_size(hdev, skb); in hci_cmd_complete_evt()
3489 hci_cc_le_clear_white_list(hdev, skb); in hci_cmd_complete_evt()
3493 hci_cc_le_add_to_white_list(hdev, skb); in hci_cmd_complete_evt()
3497 hci_cc_le_del_from_white_list(hdev, skb); in hci_cmd_complete_evt()
3501 hci_cc_le_read_supported_states(hdev, skb); in hci_cmd_complete_evt()
3505 hci_cc_le_read_def_data_len(hdev, skb); in hci_cmd_complete_evt()
3509 hci_cc_le_write_def_data_len(hdev, skb); in hci_cmd_complete_evt()
3513 hci_cc_le_add_to_resolv_list(hdev, skb); in hci_cmd_complete_evt()
3517 hci_cc_le_del_from_resolv_list(hdev, skb); in hci_cmd_complete_evt()
3521 hci_cc_le_clear_resolv_list(hdev, skb); in hci_cmd_complete_evt()
3525 hci_cc_le_read_resolv_list_size(hdev, skb); in hci_cmd_complete_evt()
3529 hci_cc_le_set_addr_resolution_enable(hdev, skb); in hci_cmd_complete_evt()
3533 hci_cc_le_read_max_data_len(hdev, skb); in hci_cmd_complete_evt()
3537 hci_cc_write_le_host_supported(hdev, skb); in hci_cmd_complete_evt()
3541 hci_cc_set_adv_param(hdev, skb); in hci_cmd_complete_evt()
3545 hci_cc_read_rssi(hdev, skb); in hci_cmd_complete_evt()
3549 hci_cc_read_tx_power(hdev, skb); in hci_cmd_complete_evt()
3553 hci_cc_write_ssp_debug_mode(hdev, skb); in hci_cmd_complete_evt()
3557 hci_cc_le_set_ext_scan_param(hdev, skb); in hci_cmd_complete_evt()
3561 hci_cc_le_set_ext_scan_enable(hdev, skb); in hci_cmd_complete_evt()
3565 hci_cc_le_set_default_phy(hdev, skb); in hci_cmd_complete_evt()
3569 hci_cc_le_read_num_adv_sets(hdev, skb); in hci_cmd_complete_evt()
3573 hci_cc_set_ext_adv_param(hdev, skb); in hci_cmd_complete_evt()
3577 hci_cc_le_set_ext_adv_enable(hdev, skb); in hci_cmd_complete_evt()
3581 hci_cc_le_set_adv_set_random_addr(hdev, skb); in hci_cmd_complete_evt()
3585 BT_DBG("%s opcode 0x%4.4x", hdev->name, *opcode); in hci_cmd_complete_evt()
3590 cancel_delayed_work(&hdev->cmd_timer); in hci_cmd_complete_evt()
3592 if (ev->ncmd && !test_bit(HCI_RESET, &hdev->flags)) in hci_cmd_complete_evt()
3593 atomic_set(&hdev->cmd_cnt, 1); in hci_cmd_complete_evt()
3595 hci_req_cmd_complete(hdev, *opcode, *status, req_complete, in hci_cmd_complete_evt()
3598 if (hci_dev_test_flag(hdev, HCI_CMD_PENDING)) { in hci_cmd_complete_evt()
3599 bt_dev_err(hdev, in hci_cmd_complete_evt()
3604 if (atomic_read(&hdev->cmd_cnt) && !skb_queue_empty(&hdev->cmd_q)) in hci_cmd_complete_evt()
3605 queue_work(hdev->workqueue, &hdev->cmd_work); in hci_cmd_complete_evt()
3608 static void hci_cmd_status_evt(struct hci_dev *hdev, struct sk_buff *skb, in hci_cmd_status_evt() argument
3622 hci_cs_inquiry(hdev, ev->status); in hci_cmd_status_evt()
3626 hci_cs_create_conn(hdev, ev->status); in hci_cmd_status_evt()
3630 hci_cs_disconnect(hdev, ev->status); in hci_cmd_status_evt()
3634 hci_cs_add_sco(hdev, ev->status); in hci_cmd_status_evt()
3638 hci_cs_auth_requested(hdev, ev->status); in hci_cmd_status_evt()
3642 hci_cs_set_conn_encrypt(hdev, ev->status); in hci_cmd_status_evt()
3646 hci_cs_remote_name_req(hdev, ev->status); in hci_cmd_status_evt()
3650 hci_cs_read_remote_features(hdev, ev->status); in hci_cmd_status_evt()
3654 hci_cs_read_remote_ext_features(hdev, ev->status); in hci_cmd_status_evt()
3658 hci_cs_setup_sync_conn(hdev, ev->status); in hci_cmd_status_evt()
3662 hci_cs_sniff_mode(hdev, ev->status); in hci_cmd_status_evt()
3666 hci_cs_exit_sniff_mode(hdev, ev->status); in hci_cmd_status_evt()
3670 hci_cs_switch_role(hdev, ev->status); in hci_cmd_status_evt()
3674 hci_cs_le_create_conn(hdev, ev->status); in hci_cmd_status_evt()
3678 hci_cs_le_read_remote_features(hdev, ev->status); in hci_cmd_status_evt()
3682 hci_cs_le_start_enc(hdev, ev->status); in hci_cmd_status_evt()
3686 hci_cs_le_ext_create_conn(hdev, ev->status); in hci_cmd_status_evt()
3690 BT_DBG("%s opcode 0x%4.4x", hdev->name, *opcode); in hci_cmd_status_evt()
3695 cancel_delayed_work(&hdev->cmd_timer); in hci_cmd_status_evt()
3697 if (ev->ncmd && !test_bit(HCI_RESET, &hdev->flags)) in hci_cmd_status_evt()
3698 atomic_set(&hdev->cmd_cnt, 1); in hci_cmd_status_evt()
3707 (hdev->sent_cmd && !bt_cb(hdev->sent_cmd)->hci.req_event)) in hci_cmd_status_evt()
3708 hci_req_cmd_complete(hdev, *opcode, ev->status, req_complete, in hci_cmd_status_evt()
3711 if (hci_dev_test_flag(hdev, HCI_CMD_PENDING)) { in hci_cmd_status_evt()
3712 bt_dev_err(hdev, in hci_cmd_status_evt()
3717 if (atomic_read(&hdev->cmd_cnt) && !skb_queue_empty(&hdev->cmd_q)) in hci_cmd_status_evt()
3718 queue_work(hdev->workqueue, &hdev->cmd_work); in hci_cmd_status_evt()
3721 static void hci_hardware_error_evt(struct hci_dev *hdev, struct sk_buff *skb) in hci_hardware_error_evt() argument
3725 hdev->hw_error_code = ev->code; in hci_hardware_error_evt()
3727 queue_work(hdev->req_workqueue, &hdev->error_reset); in hci_hardware_error_evt()
3730 static void hci_role_change_evt(struct hci_dev *hdev, struct sk_buff *skb) in hci_role_change_evt() argument
3735 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); in hci_role_change_evt()
3737 hci_dev_lock(hdev); in hci_role_change_evt()
3739 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); in hci_role_change_evt()
3749 hci_dev_unlock(hdev); in hci_role_change_evt()
3752 static void hci_num_comp_pkts_evt(struct hci_dev *hdev, struct sk_buff *skb) in hci_num_comp_pkts_evt() argument
3757 if (hdev->flow_ctl_mode != HCI_FLOW_CTL_MODE_PACKET_BASED) { in hci_num_comp_pkts_evt()
3758 bt_dev_err(hdev, "wrong event for mode %d", hdev->flow_ctl_mode); in hci_num_comp_pkts_evt()
3764 BT_DBG("%s bad parameters", hdev->name); in hci_num_comp_pkts_evt()
3768 BT_DBG("%s num_hndl %d", hdev->name, ev->num_hndl); in hci_num_comp_pkts_evt()
3778 conn = hci_conn_hash_lookup_handle(hdev, handle); in hci_num_comp_pkts_evt()
3786 hdev->acl_cnt += count; in hci_num_comp_pkts_evt()
3787 if (hdev->acl_cnt > hdev->acl_pkts) in hci_num_comp_pkts_evt()
3788 hdev->acl_cnt = hdev->acl_pkts; in hci_num_comp_pkts_evt()
3792 if (hdev->le_pkts) { in hci_num_comp_pkts_evt()
3793 hdev->le_cnt += count; in hci_num_comp_pkts_evt()
3794 if (hdev->le_cnt > hdev->le_pkts) in hci_num_comp_pkts_evt()
3795 hdev->le_cnt = hdev->le_pkts; in hci_num_comp_pkts_evt()
3797 hdev->acl_cnt += count; in hci_num_comp_pkts_evt()
3798 if (hdev->acl_cnt > hdev->acl_pkts) in hci_num_comp_pkts_evt()
3799 hdev->acl_cnt = hdev->acl_pkts; in hci_num_comp_pkts_evt()
3804 hdev->sco_cnt += count; in hci_num_comp_pkts_evt()
3805 if (hdev->sco_cnt > hdev->sco_pkts) in hci_num_comp_pkts_evt()
3806 hdev->sco_cnt = hdev->sco_pkts; in hci_num_comp_pkts_evt()
3810 bt_dev_err(hdev, "unknown type %d conn %p", in hci_num_comp_pkts_evt()
3816 queue_work(hdev->workqueue, &hdev->tx_work); in hci_num_comp_pkts_evt()
3819 static struct hci_conn *__hci_conn_lookup_handle(struct hci_dev *hdev, in __hci_conn_lookup_handle() argument
3824 switch (hdev->dev_type) { in __hci_conn_lookup_handle()
3826 return hci_conn_hash_lookup_handle(hdev, handle); in __hci_conn_lookup_handle()
3828 chan = hci_chan_lookup_handle(hdev, handle); in __hci_conn_lookup_handle()
3833 bt_dev_err(hdev, "unknown dev_type %d", hdev->dev_type); in __hci_conn_lookup_handle()
3840 static void hci_num_comp_blocks_evt(struct hci_dev *hdev, struct sk_buff *skb) in hci_num_comp_blocks_evt() argument
3845 if (hdev->flow_ctl_mode != HCI_FLOW_CTL_MODE_BLOCK_BASED) { in hci_num_comp_blocks_evt()
3846 bt_dev_err(hdev, "wrong event for mode %d", hdev->flow_ctl_mode); in hci_num_comp_blocks_evt()
3852 BT_DBG("%s bad parameters", hdev->name); in hci_num_comp_blocks_evt()
3856 BT_DBG("%s num_blocks %d num_hndl %d", hdev->name, ev->num_blocks, in hci_num_comp_blocks_evt()
3867 conn = __hci_conn_lookup_handle(hdev, handle); in hci_num_comp_blocks_evt()
3876 hdev->block_cnt += block_count; in hci_num_comp_blocks_evt()
3877 if (hdev->block_cnt > hdev->num_blocks) in hci_num_comp_blocks_evt()
3878 hdev->block_cnt = hdev->num_blocks; in hci_num_comp_blocks_evt()
3882 bt_dev_err(hdev, "unknown type %d conn %p", in hci_num_comp_blocks_evt()
3888 queue_work(hdev->workqueue, &hdev->tx_work); in hci_num_comp_blocks_evt()
3891 static void hci_mode_change_evt(struct hci_dev *hdev, struct sk_buff *skb) in hci_mode_change_evt() argument
3896 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); in hci_mode_change_evt()
3898 hci_dev_lock(hdev); in hci_mode_change_evt()
3900 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); in hci_mode_change_evt()
3916 hci_dev_unlock(hdev); in hci_mode_change_evt()
3919 static void hci_pin_code_request_evt(struct hci_dev *hdev, struct sk_buff *skb) in hci_pin_code_request_evt() argument
3924 BT_DBG("%s", hdev->name); in hci_pin_code_request_evt()
3926 hci_dev_lock(hdev); in hci_pin_code_request_evt()
3928 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); in hci_pin_code_request_evt()
3938 if (!hci_dev_test_flag(hdev, HCI_BONDABLE) && in hci_pin_code_request_evt()
3940 hci_send_cmd(hdev, HCI_OP_PIN_CODE_NEG_REPLY, in hci_pin_code_request_evt()
3942 } else if (hci_dev_test_flag(hdev, HCI_MGMT)) { in hci_pin_code_request_evt()
3950 mgmt_pin_code_request(hdev, &ev->bdaddr, secure); in hci_pin_code_request_evt()
3954 hci_dev_unlock(hdev); in hci_pin_code_request_evt()
3989 static void hci_link_key_request_evt(struct hci_dev *hdev, struct sk_buff *skb) in hci_link_key_request_evt() argument
3996 BT_DBG("%s", hdev->name); in hci_link_key_request_evt()
3998 if (!hci_dev_test_flag(hdev, HCI_MGMT)) in hci_link_key_request_evt()
4001 hci_dev_lock(hdev); in hci_link_key_request_evt()
4003 key = hci_find_link_key(hdev, &ev->bdaddr); in hci_link_key_request_evt()
4005 BT_DBG("%s link key not found for %pMR", hdev->name, in hci_link_key_request_evt()
4010 BT_DBG("%s found key type %u for %pMR", hdev->name, key->type, in hci_link_key_request_evt()
4013 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); in hci_link_key_request_evt()
4020 BT_DBG("%s ignoring unauthenticated key", hdev->name); in hci_link_key_request_evt()
4028 hdev->name); in hci_link_key_request_evt()
4038 hci_send_cmd(hdev, HCI_OP_LINK_KEY_REPLY, sizeof(cp), &cp); in hci_link_key_request_evt()
4040 hci_dev_unlock(hdev); in hci_link_key_request_evt()
4045 hci_send_cmd(hdev, HCI_OP_LINK_KEY_NEG_REPLY, 6, &ev->bdaddr); in hci_link_key_request_evt()
4046 hci_dev_unlock(hdev); in hci_link_key_request_evt()
4049 static void hci_link_key_notify_evt(struct hci_dev *hdev, struct sk_buff *skb) in hci_link_key_notify_evt() argument
4057 BT_DBG("%s", hdev->name); in hci_link_key_notify_evt()
4059 hci_dev_lock(hdev); in hci_link_key_notify_evt()
4061 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); in hci_link_key_notify_evt()
4072 if (!hci_dev_test_flag(hdev, HCI_MGMT)) in hci_link_key_notify_evt()
4075 key = hci_add_link_key(hdev, conn, &ev->bdaddr, ev->link_key, in hci_link_key_notify_evt()
4086 mgmt_new_link_key(hdev, key, persistent); in hci_link_key_notify_evt()
4094 !hci_dev_test_flag(hdev, HCI_KEEP_DEBUG_KEYS)) { in hci_link_key_notify_evt()
4106 hci_dev_unlock(hdev); in hci_link_key_notify_evt()
4109 static void hci_clock_offset_evt(struct hci_dev *hdev, struct sk_buff *skb) in hci_clock_offset_evt() argument
4114 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); in hci_clock_offset_evt()
4116 hci_dev_lock(hdev); in hci_clock_offset_evt()
4118 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); in hci_clock_offset_evt()
4122 ie = hci_inquiry_cache_lookup(hdev, &conn->dst); in hci_clock_offset_evt()
4129 hci_dev_unlock(hdev); in hci_clock_offset_evt()
4132 static void hci_pkt_type_change_evt(struct hci_dev *hdev, struct sk_buff *skb) in hci_pkt_type_change_evt() argument
4137 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); in hci_pkt_type_change_evt()
4139 hci_dev_lock(hdev); in hci_pkt_type_change_evt()
4141 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); in hci_pkt_type_change_evt()
4145 hci_dev_unlock(hdev); in hci_pkt_type_change_evt()
4148 static void hci_pscan_rep_mode_evt(struct hci_dev *hdev, struct sk_buff *skb) in hci_pscan_rep_mode_evt() argument
4153 BT_DBG("%s", hdev->name); in hci_pscan_rep_mode_evt()
4155 hci_dev_lock(hdev); in hci_pscan_rep_mode_evt()
4157 ie = hci_inquiry_cache_lookup(hdev, &ev->bdaddr); in hci_pscan_rep_mode_evt()
4163 hci_dev_unlock(hdev); in hci_pscan_rep_mode_evt()
4166 static void hci_inquiry_result_with_rssi_evt(struct hci_dev *hdev, in hci_inquiry_result_with_rssi_evt() argument
4172 BT_DBG("%s num_rsp %d", hdev->name, num_rsp); in hci_inquiry_result_with_rssi_evt()
4177 if (hci_dev_test_flag(hdev, HCI_PERIODIC_INQ)) in hci_inquiry_result_with_rssi_evt()
4180 hci_dev_lock(hdev); in hci_inquiry_result_with_rssi_evt()
4201 flags = hci_inquiry_cache_update(hdev, &data, false); in hci_inquiry_result_with_rssi_evt()
4203 mgmt_device_found(hdev, &info->bdaddr, ACL_LINK, 0x00, in hci_inquiry_result_with_rssi_evt()
4225 flags = hci_inquiry_cache_update(hdev, &data, false); in hci_inquiry_result_with_rssi_evt()
4227 mgmt_device_found(hdev, &info->bdaddr, ACL_LINK, 0x00, in hci_inquiry_result_with_rssi_evt()
4234 hci_dev_unlock(hdev); in hci_inquiry_result_with_rssi_evt()
4237 static void hci_remote_ext_features_evt(struct hci_dev *hdev, in hci_remote_ext_features_evt() argument
4243 BT_DBG("%s", hdev->name); in hci_remote_ext_features_evt()
4245 hci_dev_lock(hdev); in hci_remote_ext_features_evt()
4247 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); in hci_remote_ext_features_evt()
4257 ie = hci_inquiry_cache_lookup(hdev, &conn->dst); in hci_remote_ext_features_evt()
4287 hci_send_cmd(hdev, HCI_OP_REMOTE_NAME_REQ, sizeof(cp), &cp); in hci_remote_ext_features_evt()
4289 mgmt_device_connected(hdev, conn, 0, NULL, 0); in hci_remote_ext_features_evt()
4291 if (!hci_outgoing_auth_needed(hdev, conn)) { in hci_remote_ext_features_evt()
4298 hci_dev_unlock(hdev); in hci_remote_ext_features_evt()
4301 static void hci_sync_conn_complete_evt(struct hci_dev *hdev, in hci_sync_conn_complete_evt() argument
4307 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); in hci_sync_conn_complete_evt()
4309 hci_dev_lock(hdev); in hci_sync_conn_complete_evt()
4311 conn = hci_conn_hash_lookup_ba(hdev, ev->link_type, &ev->bdaddr); in hci_sync_conn_complete_evt()
4325 conn = hci_conn_hash_lookup_ba(hdev, ESCO_LINK, &ev->bdaddr); in hci_sync_conn_complete_evt()
4343 bt_dev_err(hdev, "Ignoring connect complete event for existing connection"); in hci_sync_conn_complete_evt()
4364 conn->pkt_type = (hdev->esco_type & SCO_ESCO_MASK) | in hci_sync_conn_complete_evt()
4365 (hdev->esco_type & EDR_ESCO_MASK); in hci_sync_conn_complete_evt()
4376 bt_dev_dbg(hdev, "SCO connected with air mode: %02x", ev->air_mode); in hci_sync_conn_complete_evt()
4380 if (hdev->notify) in hci_sync_conn_complete_evt()
4381 hdev->notify(hdev, HCI_NOTIFY_ENABLE_SCO_CVSD); in hci_sync_conn_complete_evt()
4384 if (hdev->notify) in hci_sync_conn_complete_evt()
4385 hdev->notify(hdev, HCI_NOTIFY_ENABLE_SCO_TRANSP); in hci_sync_conn_complete_evt()
4394 hci_dev_unlock(hdev); in hci_sync_conn_complete_evt()
4414 static void hci_extended_inquiry_result_evt(struct hci_dev *hdev, in hci_extended_inquiry_result_evt() argument
4422 BT_DBG("%s num_rsp %d", hdev->name, num_rsp); in hci_extended_inquiry_result_evt()
4427 if (hci_dev_test_flag(hdev, HCI_PERIODIC_INQ)) in hci_extended_inquiry_result_evt()
4430 hci_dev_lock(hdev); in hci_extended_inquiry_result_evt()
4445 if (hci_dev_test_flag(hdev, HCI_MGMT)) in hci_extended_inquiry_result_evt()
4452 flags = hci_inquiry_cache_update(hdev, &data, name_known); in hci_extended_inquiry_result_evt()
4456 mgmt_device_found(hdev, &info->bdaddr, ACL_LINK, 0x00, in hci_extended_inquiry_result_evt()
4461 hci_dev_unlock(hdev); in hci_extended_inquiry_result_evt()
4464 static void hci_key_refresh_complete_evt(struct hci_dev *hdev, in hci_key_refresh_complete_evt() argument
4470 BT_DBG("%s status 0x%2.2x handle 0x%4.4x", hdev->name, ev->status, in hci_key_refresh_complete_evt()
4473 hci_dev_lock(hdev); in hci_key_refresh_complete_evt()
4475 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); in hci_key_refresh_complete_evt()
4511 hci_dev_unlock(hdev); in hci_key_refresh_complete_evt()
4534 struct hci_dev *hdev = conn->hdev; in bredr_oob_data_present() local
4537 data = hci_find_remote_oob_data(hdev, &conn->dst, BDADDR_BREDR); in bredr_oob_data_present()
4541 if (bredr_sc_enabled(hdev)) { in bredr_oob_data_present()
4548 if (!hci_dev_test_flag(hdev, HCI_SC_ONLY)) in bredr_oob_data_present()
4574 static void hci_io_capa_request_evt(struct hci_dev *hdev, struct sk_buff *skb) in hci_io_capa_request_evt() argument
4579 BT_DBG("%s", hdev->name); in hci_io_capa_request_evt()
4581 hci_dev_lock(hdev); in hci_io_capa_request_evt()
4583 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); in hci_io_capa_request_evt()
4589 if (!hci_dev_test_flag(hdev, HCI_MGMT)) in hci_io_capa_request_evt()
4595 if (hci_dev_test_flag(hdev, HCI_BONDABLE) || in hci_io_capa_request_evt()
4621 if (!hci_dev_test_flag(hdev, HCI_BONDABLE)) in hci_io_capa_request_evt()
4627 hci_send_cmd(hdev, HCI_OP_IO_CAPABILITY_REPLY, in hci_io_capa_request_evt()
4635 hci_send_cmd(hdev, HCI_OP_IO_CAPABILITY_NEG_REPLY, in hci_io_capa_request_evt()
4640 hci_dev_unlock(hdev); in hci_io_capa_request_evt()
4643 static void hci_io_capa_reply_evt(struct hci_dev *hdev, struct sk_buff *skb) in hci_io_capa_reply_evt() argument
4648 BT_DBG("%s", hdev->name); in hci_io_capa_reply_evt()
4650 hci_dev_lock(hdev); in hci_io_capa_reply_evt()
4652 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); in hci_io_capa_reply_evt()
4660 hci_dev_unlock(hdev); in hci_io_capa_reply_evt()
4663 static void hci_user_confirm_request_evt(struct hci_dev *hdev, in hci_user_confirm_request_evt() argument
4670 BT_DBG("%s", hdev->name); in hci_user_confirm_request_evt()
4672 hci_dev_lock(hdev); in hci_user_confirm_request_evt()
4674 if (!hci_dev_test_flag(hdev, HCI_MGMT)) in hci_user_confirm_request_evt()
4677 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); in hci_user_confirm_request_evt()
4692 hci_send_cmd(hdev, HCI_OP_USER_CONFIRM_NEG_REPLY, in hci_user_confirm_request_evt()
4719 if (hci_find_link_key(hdev, &ev->bdaddr)) { in hci_user_confirm_request_evt()
4720 bt_dev_dbg(hdev, "Local host already has link key"); in hci_user_confirm_request_evt()
4726 hdev->auto_accept_delay); in hci_user_confirm_request_evt()
4728 if (hdev->auto_accept_delay > 0) { in hci_user_confirm_request_evt()
4729 int delay = msecs_to_jiffies(hdev->auto_accept_delay); in hci_user_confirm_request_evt()
4730 queue_delayed_work(conn->hdev->workqueue, in hci_user_confirm_request_evt()
4735 hci_send_cmd(hdev, HCI_OP_USER_CONFIRM_REPLY, in hci_user_confirm_request_evt()
4741 mgmt_user_confirm_request(hdev, &ev->bdaddr, ACL_LINK, 0, in hci_user_confirm_request_evt()
4745 hci_dev_unlock(hdev); in hci_user_confirm_request_evt()
4748 static void hci_user_passkey_request_evt(struct hci_dev *hdev, in hci_user_passkey_request_evt() argument
4753 BT_DBG("%s", hdev->name); in hci_user_passkey_request_evt()
4755 if (hci_dev_test_flag(hdev, HCI_MGMT)) in hci_user_passkey_request_evt()
4756 mgmt_user_passkey_request(hdev, &ev->bdaddr, ACL_LINK, 0); in hci_user_passkey_request_evt()
4759 static void hci_user_passkey_notify_evt(struct hci_dev *hdev, in hci_user_passkey_notify_evt() argument
4765 BT_DBG("%s", hdev->name); in hci_user_passkey_notify_evt()
4767 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); in hci_user_passkey_notify_evt()
4774 if (hci_dev_test_flag(hdev, HCI_MGMT)) in hci_user_passkey_notify_evt()
4775 mgmt_user_passkey_notify(hdev, &conn->dst, conn->type, in hci_user_passkey_notify_evt()
4780 static void hci_keypress_notify_evt(struct hci_dev *hdev, struct sk_buff *skb) in hci_keypress_notify_evt() argument
4785 BT_DBG("%s", hdev->name); in hci_keypress_notify_evt()
4787 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); in hci_keypress_notify_evt()
4812 if (hci_dev_test_flag(hdev, HCI_MGMT)) in hci_keypress_notify_evt()
4813 mgmt_user_passkey_notify(hdev, &conn->dst, conn->type, in hci_keypress_notify_evt()
4818 static void hci_simple_pair_complete_evt(struct hci_dev *hdev, in hci_simple_pair_complete_evt() argument
4824 BT_DBG("%s", hdev->name); in hci_simple_pair_complete_evt()
4826 hci_dev_lock(hdev); in hci_simple_pair_complete_evt()
4828 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); in hci_simple_pair_complete_evt()
4846 hci_dev_unlock(hdev); in hci_simple_pair_complete_evt()
4849 static void hci_remote_host_features_evt(struct hci_dev *hdev, in hci_remote_host_features_evt() argument
4856 BT_DBG("%s", hdev->name); in hci_remote_host_features_evt()
4858 hci_dev_lock(hdev); in hci_remote_host_features_evt()
4860 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); in hci_remote_host_features_evt()
4864 ie = hci_inquiry_cache_lookup(hdev, &ev->bdaddr); in hci_remote_host_features_evt()
4868 hci_dev_unlock(hdev); in hci_remote_host_features_evt()
4871 static void hci_remote_oob_data_request_evt(struct hci_dev *hdev, in hci_remote_oob_data_request_evt() argument
4877 BT_DBG("%s", hdev->name); in hci_remote_oob_data_request_evt()
4879 hci_dev_lock(hdev); in hci_remote_oob_data_request_evt()
4881 if (!hci_dev_test_flag(hdev, HCI_MGMT)) in hci_remote_oob_data_request_evt()
4884 data = hci_find_remote_oob_data(hdev, &ev->bdaddr, BDADDR_BREDR); in hci_remote_oob_data_request_evt()
4889 hci_send_cmd(hdev, HCI_OP_REMOTE_OOB_DATA_NEG_REPLY, in hci_remote_oob_data_request_evt()
4894 if (bredr_sc_enabled(hdev)) { in hci_remote_oob_data_request_evt()
4898 if (hci_dev_test_flag(hdev, HCI_SC_ONLY)) { in hci_remote_oob_data_request_evt()
4908 hci_send_cmd(hdev, HCI_OP_REMOTE_OOB_EXT_DATA_REPLY, in hci_remote_oob_data_request_evt()
4917 hci_send_cmd(hdev, HCI_OP_REMOTE_OOB_DATA_REPLY, in hci_remote_oob_data_request_evt()
4922 hci_dev_unlock(hdev); in hci_remote_oob_data_request_evt()
4926 static void hci_chan_selected_evt(struct hci_dev *hdev, struct sk_buff *skb) in hci_chan_selected_evt() argument
4931 BT_DBG("%s handle 0x%2.2x", hdev->name, ev->phy_handle); in hci_chan_selected_evt()
4935 hcon = hci_conn_hash_lookup_handle(hdev, ev->phy_handle); in hci_chan_selected_evt()
4939 amp_read_loc_assoc_final_data(hdev, hcon); in hci_chan_selected_evt()
4942 static void hci_phy_link_complete_evt(struct hci_dev *hdev, in hci_phy_link_complete_evt() argument
4948 BT_DBG("%s handle 0x%2.2x status 0x%2.2x", hdev->name, ev->phy_handle, in hci_phy_link_complete_evt()
4951 hci_dev_lock(hdev); in hci_phy_link_complete_evt()
4953 hcon = hci_conn_hash_lookup_handle(hdev, ev->phy_handle); in hci_phy_link_complete_evt()
4955 hci_dev_unlock(hdev); in hci_phy_link_complete_evt()
4960 hci_dev_unlock(hdev); in hci_phy_link_complete_evt()
4966 hci_dev_unlock(hdev); in hci_phy_link_complete_evt()
4984 hci_dev_unlock(hdev); in hci_phy_link_complete_evt()
4987 static void hci_loglink_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) in hci_loglink_complete_evt() argument
4995 hdev->name, le16_to_cpu(ev->handle), ev->phy_handle, in hci_loglink_complete_evt()
4998 hcon = hci_conn_hash_lookup_handle(hdev, ev->phy_handle); in hci_loglink_complete_evt()
5018 bredr_chan->conn->mtu = hdev->block_mtu; in hci_loglink_complete_evt()
5026 static void hci_disconn_loglink_complete_evt(struct hci_dev *hdev, in hci_disconn_loglink_complete_evt() argument
5032 BT_DBG("%s log handle 0x%4.4x status 0x%2.2x", hdev->name, in hci_disconn_loglink_complete_evt()
5038 hci_dev_lock(hdev); in hci_disconn_loglink_complete_evt()
5040 hchan = hci_chan_lookup_handle(hdev, le16_to_cpu(ev->handle)); in hci_disconn_loglink_complete_evt()
5047 hci_dev_unlock(hdev); in hci_disconn_loglink_complete_evt()
5050 static void hci_disconn_phylink_complete_evt(struct hci_dev *hdev, in hci_disconn_phylink_complete_evt() argument
5056 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); in hci_disconn_phylink_complete_evt()
5061 hci_dev_lock(hdev); in hci_disconn_phylink_complete_evt()
5063 hcon = hci_conn_hash_lookup_handle(hdev, ev->phy_handle); in hci_disconn_phylink_complete_evt()
5070 hci_dev_unlock(hdev); in hci_disconn_phylink_complete_evt()
5088 } else if (hci_dev_test_flag(conn->hdev, HCI_PRIVACY)) { in le_conn_update_addr()
5090 bacpy(&conn->init_addr, &conn->hdev->rpa); in le_conn_update_addr()
5092 hci_copy_identity_address(conn->hdev, &conn->init_addr, in le_conn_update_addr()
5096 conn->resp_addr_type = conn->hdev->adv_addr_type; in le_conn_update_addr()
5103 } else if (conn->hdev->adv_addr_type == ADDR_LE_DEV_RANDOM) { in le_conn_update_addr()
5107 if (!ext_adv_capable(conn->hdev)) in le_conn_update_addr()
5109 &conn->hdev->random_addr); in le_conn_update_addr()
5111 bacpy(&conn->resp_addr, &conn->hdev->bdaddr); in le_conn_update_addr()
5122 conn->le_conn_min_interval = conn->hdev->le_conn_min_interval; in le_conn_update_addr()
5123 conn->le_conn_max_interval = conn->hdev->le_conn_max_interval; in le_conn_update_addr()
5127 static void le_conn_complete_evt(struct hci_dev *hdev, u8 status, in le_conn_complete_evt() argument
5138 hci_dev_lock(hdev); in le_conn_complete_evt()
5143 hci_dev_clear_flag(hdev, HCI_LE_ADV); in le_conn_complete_evt()
5145 conn = hci_lookup_le_connect(hdev); in le_conn_complete_evt()
5147 conn = hci_conn_add(hdev, LE_LINK, bdaddr, role); in le_conn_complete_evt()
5149 bt_dev_err(hdev, "no memory for new connection"); in le_conn_complete_evt()
5166 if (hci_dev_test_flag(hdev, HCI_PRIVACY)) { in le_conn_complete_evt()
5168 bacpy(&conn->init_addr, &hdev->rpa); in le_conn_complete_evt()
5170 hci_copy_identity_address(hdev, in le_conn_complete_evt()
5190 irk = hci_get_irk(hdev, &conn->dst, conn->dst_type); in le_conn_complete_evt()
5207 if (hci_bdaddr_list_lookup(&hdev->blacklist, &conn->dst, addr_type)) { in le_conn_complete_evt()
5213 mgmt_device_connected(hdev, conn, 0, NULL, 0); in le_conn_complete_evt()
5236 (hdev->le_features[0] & HCI_LE_SLAVE_FEATURES)) { in le_conn_complete_evt()
5241 hci_send_cmd(hdev, HCI_OP_LE_READ_REMOTE_FEATURES, in le_conn_complete_evt()
5250 params = hci_pend_le_action_lookup(&hdev->pend_le_conns, &conn->dst, in le_conn_complete_evt()
5262 hci_update_background_scan(hdev); in le_conn_complete_evt()
5263 hci_dev_unlock(hdev); in le_conn_complete_evt()
5266 static void hci_le_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) in hci_le_conn_complete_evt() argument
5270 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); in hci_le_conn_complete_evt()
5272 le_conn_complete_evt(hdev, ev->status, &ev->bdaddr, ev->bdaddr_type, in hci_le_conn_complete_evt()
5279 static void hci_le_enh_conn_complete_evt(struct hci_dev *hdev, in hci_le_enh_conn_complete_evt() argument
5284 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); in hci_le_enh_conn_complete_evt()
5286 le_conn_complete_evt(hdev, ev->status, &ev->bdaddr, ev->bdaddr_type, in hci_le_enh_conn_complete_evt()
5292 if (use_ll_privacy(hdev) && in hci_le_enh_conn_complete_evt()
5293 hci_dev_test_flag(hdev, HCI_ENABLE_LL_PRIVACY) && in hci_le_enh_conn_complete_evt()
5294 hci_dev_test_flag(hdev, HCI_LL_RPA_RESOLUTION)) in hci_le_enh_conn_complete_evt()
5295 hci_req_disable_address_resolution(hdev); in hci_le_enh_conn_complete_evt()
5298 static void hci_le_ext_adv_term_evt(struct hci_dev *hdev, struct sk_buff *skb) in hci_le_ext_adv_term_evt() argument
5303 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); in hci_le_ext_adv_term_evt()
5308 adv = hci_find_adv_instance(hdev, ev->handle); in hci_le_ext_adv_term_evt()
5313 hci_remove_adv_instance(hdev, ev->handle); in hci_le_ext_adv_term_evt()
5314 mgmt_advertising_removed(NULL, hdev, ev->handle); in hci_le_ext_adv_term_evt()
5319 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->conn_handle)); in hci_le_ext_adv_term_evt()
5323 if (hdev->adv_addr_type != ADDR_LE_DEV_RANDOM || in hci_le_ext_adv_term_evt()
5327 if (!hdev->cur_adv_instance) { in hci_le_ext_adv_term_evt()
5328 bacpy(&conn->resp_addr, &hdev->random_addr); in hci_le_ext_adv_term_evt()
5332 adv_instance = hci_find_adv_instance(hdev, hdev->cur_adv_instance); in hci_le_ext_adv_term_evt()
5338 static void hci_le_conn_update_complete_evt(struct hci_dev *hdev, in hci_le_conn_update_complete_evt() argument
5344 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); in hci_le_conn_update_complete_evt()
5349 hci_dev_lock(hdev); in hci_le_conn_update_complete_evt()
5351 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); in hci_le_conn_update_complete_evt()
5358 hci_dev_unlock(hdev); in hci_le_conn_update_complete_evt()
5362 static struct hci_conn *check_pending_le_conn(struct hci_dev *hdev, in check_pending_le_conn() argument
5375 if (hci_bdaddr_list_lookup(&hdev->blacklist, addr, addr_type)) in check_pending_le_conn()
5381 if (hdev->conn_hash.le_num_slave > 0 && in check_pending_le_conn()
5382 (!test_bit(HCI_QUIRK_VALID_LE_STATES, &hdev->quirks) || in check_pending_le_conn()
5383 !(hdev->le_states[3] & 0x10))) in check_pending_le_conn()
5389 params = hci_pend_le_action_lookup(&hdev->pend_le_conns, addr, in check_pending_le_conn()
5417 conn = hci_connect_le(hdev, addr, addr_type, BT_SECURITY_LOW, in check_pending_le_conn()
5418 hdev->def_le_autoconnect_timeout, HCI_ROLE_MASTER, in check_pending_le_conn()
5452 static void process_adv_report(struct hci_dev *hdev, u8 type, bdaddr_t *bdaddr, in process_adv_report() argument
5457 struct discovery_state *d = &hdev->discovery; in process_adv_report()
5472 bt_dev_err_ratelimited(hdev, "unknown advertising packet " in process_adv_report()
5478 bt_dev_err_ratelimited(hdev, "legacy adv larger than 31 bytes"); in process_adv_report()
5513 if (!hci_dev_test_flag(hdev, HCI_PRIVACY)) in process_adv_report()
5520 if (!smp_irk_matches(hdev, hdev->irk, direct_addr)) in process_adv_report()
5525 irk = hci_get_irk(hdev, bdaddr, bdaddr_type); in process_adv_report()
5536 conn = check_pending_le_conn(hdev, bdaddr, bdaddr_type, type, in process_adv_report()
5550 if (hdev->le_scan_type == LE_SCAN_PASSIVE) { in process_adv_report()
5554 if (!hci_pend_le_action_lookup(&hdev->pend_le_reports, in process_adv_report()
5556 idr_is_empty(&hdev->adv_monitors_idr)) in process_adv_report()
5563 mgmt_device_found(hdev, bdaddr, LE_LINK, bdaddr_type, NULL, in process_adv_report()
5593 if (!ext_adv && !has_pending_adv_report(hdev)) { in process_adv_report()
5598 store_pending_adv_report(hdev, bdaddr, bdaddr_type, in process_adv_report()
5603 mgmt_device_found(hdev, bdaddr, LE_LINK, bdaddr_type, NULL, in process_adv_report()
5619 mgmt_device_found(hdev, &d->last_adv_addr, LE_LINK, in process_adv_report()
5630 store_pending_adv_report(hdev, bdaddr, bdaddr_type, in process_adv_report()
5638 clear_pending_adv_report(hdev); in process_adv_report()
5639 mgmt_device_found(hdev, bdaddr, LE_LINK, bdaddr_type, NULL, in process_adv_report()
5648 mgmt_device_found(hdev, &d->last_adv_addr, LE_LINK, in process_adv_report()
5651 clear_pending_adv_report(hdev); in process_adv_report()
5654 static void hci_le_adv_report_evt(struct hci_dev *hdev, struct sk_buff *skb) in hci_le_adv_report_evt() argument
5659 hci_dev_lock(hdev); in hci_le_adv_report_evt()
5666 bt_dev_err(hdev, "Malicious advertising data."); in hci_le_adv_report_evt()
5673 process_adv_report(hdev, ev->evt_type, &ev->bdaddr, in hci_le_adv_report_evt()
5677 bt_dev_err(hdev, "Dropping invalid advertising data"); in hci_le_adv_report_evt()
5683 hci_dev_unlock(hdev); in hci_le_adv_report_evt()
5686 static u8 ext_evt_type_to_legacy(struct hci_dev *hdev, u16 evt_type) in ext_evt_type_to_legacy() argument
5724 bt_dev_err_ratelimited(hdev, "Unknown advertising packet type: 0x%02x", in ext_evt_type_to_legacy()
5730 static void hci_le_ext_adv_report_evt(struct hci_dev *hdev, struct sk_buff *skb) in hci_le_ext_adv_report_evt() argument
5735 hci_dev_lock(hdev); in hci_le_ext_adv_report_evt()
5743 legacy_evt_type = ext_evt_type_to_legacy(hdev, evt_type); in hci_le_ext_adv_report_evt()
5745 process_adv_report(hdev, legacy_evt_type, &ev->bdaddr, in hci_le_ext_adv_report_evt()
5754 hci_dev_unlock(hdev); in hci_le_ext_adv_report_evt()
5757 static void hci_le_remote_feat_complete_evt(struct hci_dev *hdev, in hci_le_remote_feat_complete_evt() argument
5763 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); in hci_le_remote_feat_complete_evt()
5765 hci_dev_lock(hdev); in hci_le_remote_feat_complete_evt()
5767 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); in hci_le_remote_feat_complete_evt()
5784 if ((hdev->le_features[0] & HCI_LE_SLAVE_FEATURES) && in hci_le_remote_feat_complete_evt()
5796 hci_dev_unlock(hdev); in hci_le_remote_feat_complete_evt()
5799 static void hci_le_ltk_request_evt(struct hci_dev *hdev, struct sk_buff *skb) in hci_le_ltk_request_evt() argument
5807 BT_DBG("%s handle 0x%4.4x", hdev->name, __le16_to_cpu(ev->handle)); in hci_le_ltk_request_evt()
5809 hci_dev_lock(hdev); in hci_le_ltk_request_evt()
5811 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); in hci_le_ltk_request_evt()
5815 ltk = hci_find_ltk(hdev, &conn->dst, conn->dst_type, conn->role); in hci_le_ltk_request_evt()
5837 hci_send_cmd(hdev, HCI_OP_LE_LTK_REPLY, sizeof(cp), &cp); in hci_le_ltk_request_evt()
5853 hci_dev_unlock(hdev); in hci_le_ltk_request_evt()
5859 hci_send_cmd(hdev, HCI_OP_LE_LTK_NEG_REPLY, sizeof(neg), &neg); in hci_le_ltk_request_evt()
5860 hci_dev_unlock(hdev); in hci_le_ltk_request_evt()
5863 static void send_conn_param_neg_reply(struct hci_dev *hdev, u16 handle, in send_conn_param_neg_reply() argument
5871 hci_send_cmd(hdev, HCI_OP_LE_CONN_PARAM_REQ_NEG_REPLY, sizeof(cp), in send_conn_param_neg_reply()
5875 static void hci_le_remote_conn_param_req_evt(struct hci_dev *hdev, in hci_le_remote_conn_param_req_evt() argument
5889 hcon = hci_conn_hash_lookup_handle(hdev, handle); in hci_le_remote_conn_param_req_evt()
5891 return send_conn_param_neg_reply(hdev, handle, in hci_le_remote_conn_param_req_evt()
5895 return send_conn_param_neg_reply(hdev, handle, in hci_le_remote_conn_param_req_evt()
5902 hci_dev_lock(hdev); in hci_le_remote_conn_param_req_evt()
5904 params = hci_conn_params_lookup(hdev, &hcon->dst, in hci_le_remote_conn_param_req_evt()
5916 hci_dev_unlock(hdev); in hci_le_remote_conn_param_req_evt()
5918 mgmt_new_conn_param(hdev, &hcon->dst, hcon->dst_type, in hci_le_remote_conn_param_req_evt()
5930 hci_send_cmd(hdev, HCI_OP_LE_CONN_PARAM_REQ_REPLY, sizeof(cp), &cp); in hci_le_remote_conn_param_req_evt()
5933 static void hci_le_direct_adv_report_evt(struct hci_dev *hdev, in hci_le_direct_adv_report_evt() argument
5942 hci_dev_lock(hdev); in hci_le_direct_adv_report_evt()
5945 process_adv_report(hdev, ev->evt_type, &ev->bdaddr, in hci_le_direct_adv_report_evt()
5950 hci_dev_unlock(hdev); in hci_le_direct_adv_report_evt()
5953 static void hci_le_phy_update_evt(struct hci_dev *hdev, struct sk_buff *skb) in hci_le_phy_update_evt() argument
5958 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); in hci_le_phy_update_evt()
5963 hci_dev_lock(hdev); in hci_le_phy_update_evt()
5965 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); in hci_le_phy_update_evt()
5973 hci_dev_unlock(hdev); in hci_le_phy_update_evt()
5976 static void hci_le_meta_evt(struct hci_dev *hdev, struct sk_buff *skb) in hci_le_meta_evt() argument
5984 hci_le_conn_complete_evt(hdev, skb); in hci_le_meta_evt()
5988 hci_le_conn_update_complete_evt(hdev, skb); in hci_le_meta_evt()
5992 hci_le_adv_report_evt(hdev, skb); in hci_le_meta_evt()
5996 hci_le_remote_feat_complete_evt(hdev, skb); in hci_le_meta_evt()
6000 hci_le_ltk_request_evt(hdev, skb); in hci_le_meta_evt()
6004 hci_le_remote_conn_param_req_evt(hdev, skb); in hci_le_meta_evt()
6008 hci_le_direct_adv_report_evt(hdev, skb); in hci_le_meta_evt()
6012 hci_le_phy_update_evt(hdev, skb); in hci_le_meta_evt()
6016 hci_le_ext_adv_report_evt(hdev, skb); in hci_le_meta_evt()
6020 hci_le_enh_conn_complete_evt(hdev, skb); in hci_le_meta_evt()
6024 hci_le_ext_adv_term_evt(hdev, skb); in hci_le_meta_evt()
6032 static bool hci_get_cmd_complete(struct hci_dev *hdev, u16 opcode, in hci_get_cmd_complete() argument
6042 bt_dev_err(hdev, "too short HCI event"); in hci_get_cmd_complete()
6062 bt_dev_err(hdev, "last event is not cmd complete (0x%2.2x)", in hci_get_cmd_complete()
6068 bt_dev_err(hdev, "too short cmd_complete event"); in hci_get_cmd_complete()
6084 static void hci_store_wake_reason(struct hci_dev *hdev, u8 event, in hci_store_wake_reason() argument
6093 hci_dev_lock(hdev); in hci_store_wake_reason()
6098 if (!hdev->suspended || hdev->wake_reason) in hci_store_wake_reason()
6104 hdev->wake_reason = MGMT_WAKE_REASON_REMOTE_WAKE; in hci_store_wake_reason()
6111 bacpy(&hdev->wake_addr, &conn_complete->bdaddr); in hci_store_wake_reason()
6112 hdev->wake_addr_type = BDADDR_BREDR; in hci_store_wake_reason()
6114 bacpy(&hdev->wake_addr, &conn_request->bdaddr); in hci_store_wake_reason()
6115 hdev->wake_addr_type = BDADDR_BREDR; in hci_store_wake_reason()
6132 bacpy(&hdev->wake_addr, &adv->bdaddr); in hci_store_wake_reason()
6133 hdev->wake_addr_type = adv->bdaddr_type; in hci_store_wake_reason()
6136 bacpy(&hdev->wake_addr, &direct_adv->bdaddr); in hci_store_wake_reason()
6137 hdev->wake_addr_type = direct_adv->bdaddr_type; in hci_store_wake_reason()
6140 bacpy(&hdev->wake_addr, &ext_adv->bdaddr); in hci_store_wake_reason()
6141 hdev->wake_addr_type = ext_adv->bdaddr_type; in hci_store_wake_reason()
6146 hdev->wake_reason = MGMT_WAKE_REASON_UNEXPECTED; in hci_store_wake_reason()
6150 hci_dev_unlock(hdev); in hci_store_wake_reason()
6153 void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb) in hci_event_packet() argument
6163 bt_dev_warn(hdev, "Received unexpected HCI Event 00000000"); in hci_event_packet()
6167 if (hdev->sent_cmd && bt_cb(hdev->sent_cmd)->hci.req_event == event) { in hci_event_packet()
6168 struct hci_command_hdr *cmd_hdr = (void *) hdev->sent_cmd->data; in hci_event_packet()
6170 hci_req_cmd_complete(hdev, opcode, status, &req_complete, in hci_event_packet()
6187 hci_store_wake_reason(hdev, event, skb); in hci_event_packet()
6191 hci_inquiry_complete_evt(hdev, skb); in hci_event_packet()
6195 hci_inquiry_result_evt(hdev, skb); in hci_event_packet()
6199 hci_conn_complete_evt(hdev, skb); in hci_event_packet()
6203 hci_conn_request_evt(hdev, skb); in hci_event_packet()
6207 hci_disconn_complete_evt(hdev, skb); in hci_event_packet()
6211 hci_auth_complete_evt(hdev, skb); in hci_event_packet()
6215 hci_remote_name_evt(hdev, skb); in hci_event_packet()
6219 hci_encrypt_change_evt(hdev, skb); in hci_event_packet()
6223 hci_change_link_key_complete_evt(hdev, skb); in hci_event_packet()
6227 hci_remote_features_evt(hdev, skb); in hci_event_packet()
6231 hci_cmd_complete_evt(hdev, skb, &opcode, &status, in hci_event_packet()
6236 hci_cmd_status_evt(hdev, skb, &opcode, &status, &req_complete, in hci_event_packet()
6241 hci_hardware_error_evt(hdev, skb); in hci_event_packet()
6245 hci_role_change_evt(hdev, skb); in hci_event_packet()
6249 hci_num_comp_pkts_evt(hdev, skb); in hci_event_packet()
6253 hci_mode_change_evt(hdev, skb); in hci_event_packet()
6257 hci_pin_code_request_evt(hdev, skb); in hci_event_packet()
6261 hci_link_key_request_evt(hdev, skb); in hci_event_packet()
6265 hci_link_key_notify_evt(hdev, skb); in hci_event_packet()
6269 hci_clock_offset_evt(hdev, skb); in hci_event_packet()
6273 hci_pkt_type_change_evt(hdev, skb); in hci_event_packet()
6277 hci_pscan_rep_mode_evt(hdev, skb); in hci_event_packet()
6281 hci_inquiry_result_with_rssi_evt(hdev, skb); in hci_event_packet()
6285 hci_remote_ext_features_evt(hdev, skb); in hci_event_packet()
6289 hci_sync_conn_complete_evt(hdev, skb); in hci_event_packet()
6293 hci_extended_inquiry_result_evt(hdev, skb); in hci_event_packet()
6297 hci_key_refresh_complete_evt(hdev, skb); in hci_event_packet()
6301 hci_io_capa_request_evt(hdev, skb); in hci_event_packet()
6305 hci_io_capa_reply_evt(hdev, skb); in hci_event_packet()
6309 hci_user_confirm_request_evt(hdev, skb); in hci_event_packet()
6313 hci_user_passkey_request_evt(hdev, skb); in hci_event_packet()
6317 hci_user_passkey_notify_evt(hdev, skb); in hci_event_packet()
6321 hci_keypress_notify_evt(hdev, skb); in hci_event_packet()
6325 hci_simple_pair_complete_evt(hdev, skb); in hci_event_packet()
6329 hci_remote_host_features_evt(hdev, skb); in hci_event_packet()
6333 hci_le_meta_evt(hdev, skb); in hci_event_packet()
6337 hci_remote_oob_data_request_evt(hdev, skb); in hci_event_packet()
6342 hci_chan_selected_evt(hdev, skb); in hci_event_packet()
6346 hci_phy_link_complete_evt(hdev, skb); in hci_event_packet()
6350 hci_loglink_complete_evt(hdev, skb); in hci_event_packet()
6354 hci_disconn_loglink_complete_evt(hdev, skb); in hci_event_packet()
6358 hci_disconn_phylink_complete_evt(hdev, skb); in hci_event_packet()
6363 hci_num_comp_blocks_evt(hdev, skb); in hci_event_packet()
6367 msft_vendor_evt(hdev, skb); in hci_event_packet()
6371 BT_DBG("%s event 0x%2.2x", hdev->name, event); in hci_event_packet()
6376 req_complete(hdev, status, opcode); in hci_event_packet()
6378 if (!hci_get_cmd_complete(hdev, opcode, req_evt, orig_skb)) { in hci_event_packet()
6382 req_complete_skb(hdev, status, opcode, orig_skb); in hci_event_packet()
6388 hdev->stat.evt_rx++; in hci_event_packet()