Lines Matching refs:conn
99 struct hci_conn *conn; in hci_cc_role_discovery() local
108 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(rp->handle)); in hci_cc_role_discovery()
109 if (conn) in hci_cc_role_discovery()
110 conn->role = rp->role; in hci_cc_role_discovery()
118 struct hci_conn *conn; in hci_cc_read_link_policy() local
127 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(rp->handle)); in hci_cc_read_link_policy()
128 if (conn) in hci_cc_read_link_policy()
129 conn->link_policy = __le16_to_cpu(rp->policy); in hci_cc_read_link_policy()
137 struct hci_conn *conn; in hci_cc_write_link_policy() local
151 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(rp->handle)); in hci_cc_write_link_policy()
152 if (conn) in hci_cc_write_link_policy()
153 conn->link_policy = get_unaligned_le16(sent + 2); in hci_cc_write_link_policy()
787 struct hci_conn *conn; in hci_cc_read_clock() local
808 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(rp->handle)); in hci_cc_read_clock()
809 if (conn) { in hci_cc_read_clock()
810 conn->clock = le32_to_cpu(rp->clock); in hci_cc_read_clock()
811 conn->clock_accuracy = le16_to_cpu(rp->accuracy); in hci_cc_read_clock()
897 struct hci_conn *conn; in hci_cc_pin_code_reply() local
913 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &cp->bdaddr); in hci_cc_pin_code_reply()
914 if (conn) in hci_cc_pin_code_reply()
915 conn->pin_length = cp->pin_len; in hci_cc_pin_code_reply()
1098 struct hci_conn *conn; in hci_cc_le_set_adv_enable() local
1102 conn = hci_conn_hash_lookup_state(hdev, LE_LINK, BT_CONNECT); in hci_cc_le_set_adv_enable()
1103 if (conn) in hci_cc_le_set_adv_enable()
1105 &conn->le_conn_timeout, in hci_cc_le_set_adv_enable()
1106 conn->conn_timeout); in hci_cc_le_set_adv_enable()
1429 struct hci_conn *conn; in hci_cc_read_rssi() local
1438 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(rp->handle)); in hci_cc_read_rssi()
1439 if (conn) in hci_cc_read_rssi()
1440 conn->rssi = rp->rssi; in hci_cc_read_rssi()
1449 struct hci_conn *conn; in hci_cc_read_tx_power() local
1462 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(rp->handle)); in hci_cc_read_tx_power()
1463 if (!conn) in hci_cc_read_tx_power()
1468 conn->tx_power = rp->tx_power; in hci_cc_read_tx_power()
1471 conn->max_tx_power = rp->tx_power; in hci_cc_read_tx_power()
1509 struct hci_conn *conn; in hci_cs_create_conn() local
1519 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &cp->bdaddr); in hci_cs_create_conn()
1521 BT_DBG("%s bdaddr %pMR hcon %p", hdev->name, &cp->bdaddr, conn); in hci_cs_create_conn()
1524 if (conn && conn->state == BT_CONNECT) { in hci_cs_create_conn()
1525 if (status != 0x0c || conn->attempt > 2) { in hci_cs_create_conn()
1526 conn->state = BT_CLOSED; in hci_cs_create_conn()
1527 hci_connect_cfm(conn, status); in hci_cs_create_conn()
1528 hci_conn_del(conn); in hci_cs_create_conn()
1530 conn->state = BT_CONNECT2; in hci_cs_create_conn()
1533 if (!conn) { in hci_cs_create_conn()
1534 conn = hci_conn_add(hdev, ACL_LINK, &cp->bdaddr, in hci_cs_create_conn()
1536 if (!conn) in hci_cs_create_conn()
1582 struct hci_conn *conn; in hci_cs_auth_requested() local
1595 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(cp->handle)); in hci_cs_auth_requested()
1596 if (conn) { in hci_cs_auth_requested()
1597 if (conn->state == BT_CONFIG) { in hci_cs_auth_requested()
1598 hci_connect_cfm(conn, status); in hci_cs_auth_requested()
1599 hci_conn_drop(conn); in hci_cs_auth_requested()
1609 struct hci_conn *conn; in hci_cs_set_conn_encrypt() local
1622 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(cp->handle)); in hci_cs_set_conn_encrypt()
1623 if (conn) { in hci_cs_set_conn_encrypt()
1624 if (conn->state == BT_CONFIG) { in hci_cs_set_conn_encrypt()
1625 hci_connect_cfm(conn, status); in hci_cs_set_conn_encrypt()
1626 hci_conn_drop(conn); in hci_cs_set_conn_encrypt()
1634 struct hci_conn *conn) in hci_outgoing_auth_needed() argument
1636 if (conn->state != BT_CONFIG || !conn->out) in hci_outgoing_auth_needed()
1639 if (conn->pending_sec_level == BT_SECURITY_SDP) in hci_outgoing_auth_needed()
1646 if (!hci_conn_ssp_enabled(conn) && !(conn->auth_type & 0x01) && in hci_outgoing_auth_needed()
1647 conn->pending_sec_level != BT_SECURITY_FIPS && in hci_outgoing_auth_needed()
1648 conn->pending_sec_level != BT_SECURITY_HIGH && in hci_outgoing_auth_needed()
1649 conn->pending_sec_level != BT_SECURITY_MEDIUM) in hci_outgoing_auth_needed()
1690 static void hci_check_pending_name(struct hci_dev *hdev, struct hci_conn *conn, in hci_check_pending_name() argument
1701 if (conn && in hci_check_pending_name()
1702 (conn->state == BT_CONFIG || conn->state == BT_CONNECTED) && in hci_check_pending_name()
1703 !test_and_set_bit(HCI_CONN_MGMT_CONNECTED, &conn->flags)) in hci_check_pending_name()
1704 mgmt_device_connected(hdev, conn, 0, name, name_len); in hci_check_pending_name()
1742 struct hci_conn *conn; in hci_cs_remote_name_req() local
1757 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &cp->bdaddr); in hci_cs_remote_name_req()
1760 hci_check_pending_name(hdev, conn, &cp->bdaddr, NULL, 0); in hci_cs_remote_name_req()
1762 if (!conn) in hci_cs_remote_name_req()
1765 if (!hci_outgoing_auth_needed(hdev, conn)) in hci_cs_remote_name_req()
1768 if (!test_and_set_bit(HCI_CONN_AUTH_PEND, &conn->flags)) { in hci_cs_remote_name_req()
1771 set_bit(HCI_CONN_AUTH_INITIATOR, &conn->flags); in hci_cs_remote_name_req()
1773 auth_cp.handle = __cpu_to_le16(conn->handle); in hci_cs_remote_name_req()
1785 struct hci_conn *conn; in hci_cs_read_remote_features() local
1798 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(cp->handle)); in hci_cs_read_remote_features()
1799 if (conn) { in hci_cs_read_remote_features()
1800 if (conn->state == BT_CONFIG) { in hci_cs_read_remote_features()
1801 hci_connect_cfm(conn, status); in hci_cs_read_remote_features()
1802 hci_conn_drop(conn); in hci_cs_read_remote_features()
1812 struct hci_conn *conn; in hci_cs_read_remote_ext_features() local
1825 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(cp->handle)); in hci_cs_read_remote_ext_features()
1826 if (conn) { in hci_cs_read_remote_ext_features()
1827 if (conn->state == BT_CONFIG) { in hci_cs_read_remote_ext_features()
1828 hci_connect_cfm(conn, status); in hci_cs_read_remote_ext_features()
1829 hci_conn_drop(conn); in hci_cs_read_remote_ext_features()
1874 struct hci_conn *conn; in hci_cs_sniff_mode() local
1887 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(cp->handle)); in hci_cs_sniff_mode()
1888 if (conn) { in hci_cs_sniff_mode()
1889 clear_bit(HCI_CONN_MODE_CHANGE_PEND, &conn->flags); in hci_cs_sniff_mode()
1891 if (test_and_clear_bit(HCI_CONN_SCO_SETUP_PEND, &conn->flags)) in hci_cs_sniff_mode()
1892 hci_sco_setup(conn, status); in hci_cs_sniff_mode()
1901 struct hci_conn *conn; in hci_cs_exit_sniff_mode() local
1914 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(cp->handle)); in hci_cs_exit_sniff_mode()
1915 if (conn) { in hci_cs_exit_sniff_mode()
1916 clear_bit(HCI_CONN_MODE_CHANGE_PEND, &conn->flags); in hci_cs_exit_sniff_mode()
1918 if (test_and_clear_bit(HCI_CONN_SCO_SETUP_PEND, &conn->flags)) in hci_cs_exit_sniff_mode()
1919 hci_sco_setup(conn, status); in hci_cs_exit_sniff_mode()
1928 struct hci_conn *conn; in hci_cs_disconnect() local
1939 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(cp->handle)); in hci_cs_disconnect()
1940 if (conn) in hci_cs_disconnect()
1941 mgmt_disconnect_failed(hdev, &conn->dst, conn->type, in hci_cs_disconnect()
1942 conn->dst_type, status); in hci_cs_disconnect()
1991 struct hci_conn *conn; in hci_cs_le_create_conn() local
2008 conn = hci_conn_hash_lookup_ba(hdev, LE_LINK, &cp->peer_addr); in hci_cs_le_create_conn()
2009 if (!conn) in hci_cs_le_create_conn()
2016 conn->init_addr_type = cp->own_address_type; in hci_cs_le_create_conn()
2018 bacpy(&conn->init_addr, &hdev->random_addr); in hci_cs_le_create_conn()
2020 bacpy(&conn->init_addr, &hdev->bdaddr); in hci_cs_le_create_conn()
2022 conn->resp_addr_type = cp->peer_addr_type; in hci_cs_le_create_conn()
2023 bacpy(&conn->resp_addr, &cp->peer_addr); in hci_cs_le_create_conn()
2031 queue_delayed_work(conn->hdev->workqueue, in hci_cs_le_create_conn()
2032 &conn->le_conn_timeout, in hci_cs_le_create_conn()
2033 conn->conn_timeout); in hci_cs_le_create_conn()
2042 struct hci_conn *conn; in hci_cs_le_read_remote_features() local
2055 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(cp->handle)); in hci_cs_le_read_remote_features()
2056 if (conn) { in hci_cs_le_read_remote_features()
2057 if (conn->state == BT_CONFIG) { in hci_cs_le_read_remote_features()
2058 hci_connect_cfm(conn, status); in hci_cs_le_read_remote_features()
2059 hci_conn_drop(conn); in hci_cs_le_read_remote_features()
2069 struct hci_conn *conn; in hci_cs_le_start_enc() local
2082 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(cp->handle)); in hci_cs_le_start_enc()
2083 if (!conn) in hci_cs_le_start_enc()
2086 if (conn->state != BT_CONNECTED) in hci_cs_le_start_enc()
2089 hci_disconnect(conn, HCI_ERROR_AUTH_FAILURE); in hci_cs_le_start_enc()
2090 hci_conn_drop(conn); in hci_cs_le_start_enc()
2099 struct hci_conn *conn; in hci_cs_switch_role() local
2112 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &cp->bdaddr); in hci_cs_switch_role()
2113 if (conn) in hci_cs_switch_role()
2114 clear_bit(HCI_CONN_RSWITCH_PEND, &conn->flags); in hci_cs_switch_role()
2219 struct hci_conn *conn; in hci_conn_complete_evt() local
2225 conn = hci_conn_hash_lookup_ba(hdev, ev->link_type, &ev->bdaddr); in hci_conn_complete_evt()
2226 if (!conn) { in hci_conn_complete_evt()
2230 conn = hci_conn_hash_lookup_ba(hdev, ESCO_LINK, &ev->bdaddr); in hci_conn_complete_evt()
2231 if (!conn) in hci_conn_complete_evt()
2234 conn->type = SCO_LINK; in hci_conn_complete_evt()
2238 conn->handle = __le16_to_cpu(ev->handle); in hci_conn_complete_evt()
2240 if (conn->type == ACL_LINK) { in hci_conn_complete_evt()
2241 conn->state = BT_CONFIG; in hci_conn_complete_evt()
2242 hci_conn_hold(conn); in hci_conn_complete_evt()
2244 if (!conn->out && !hci_conn_ssp_enabled(conn) && in hci_conn_complete_evt()
2246 conn->disc_timeout = HCI_PAIRING_TIMEOUT; in hci_conn_complete_evt()
2248 conn->disc_timeout = HCI_DISCONN_TIMEOUT; in hci_conn_complete_evt()
2250 conn->state = BT_CONNECTED; in hci_conn_complete_evt()
2252 hci_debugfs_create_conn(conn); in hci_conn_complete_evt()
2253 hci_conn_add_sysfs(conn); in hci_conn_complete_evt()
2256 set_bit(HCI_CONN_AUTH, &conn->flags); in hci_conn_complete_evt()
2259 set_bit(HCI_CONN_ENCRYPT, &conn->flags); in hci_conn_complete_evt()
2262 if (conn->type == ACL_LINK) { in hci_conn_complete_evt()
2272 if (!conn->out && hdev->hci_ver < BLUETOOTH_VER_2_0) { in hci_conn_complete_evt()
2275 cp.pkt_type = cpu_to_le16(conn->pkt_type); in hci_conn_complete_evt()
2280 conn->state = BT_CLOSED; in hci_conn_complete_evt()
2281 if (conn->type == ACL_LINK) in hci_conn_complete_evt()
2282 mgmt_connect_failed(hdev, &conn->dst, conn->type, in hci_conn_complete_evt()
2283 conn->dst_type, ev->status); in hci_conn_complete_evt()
2286 if (conn->type == ACL_LINK) in hci_conn_complete_evt()
2287 hci_sco_setup(conn, ev->status); in hci_conn_complete_evt()
2290 hci_connect_cfm(conn, ev->status); in hci_conn_complete_evt()
2291 hci_conn_del(conn); in hci_conn_complete_evt()
2293 hci_connect_cfm(conn, ev->status); in hci_conn_complete_evt()
2315 struct hci_conn *conn; in hci_conn_request_evt() local
2355 conn = hci_conn_hash_lookup_ba(hdev, ev->link_type, in hci_conn_request_evt()
2357 if (!conn) { in hci_conn_request_evt()
2358 conn = hci_conn_add(hdev, ev->link_type, &ev->bdaddr, in hci_conn_request_evt()
2360 if (!conn) { in hci_conn_request_evt()
2367 memcpy(conn->dev_class, ev->dev_class, 3); in hci_conn_request_evt()
2374 conn->state = BT_CONNECT; in hci_conn_request_evt()
2386 conn->state = BT_CONNECT; in hci_conn_request_evt()
2389 cp.pkt_type = cpu_to_le16(conn->pkt_type); in hci_conn_request_evt()
2400 conn->state = BT_CONNECT2; in hci_conn_request_evt()
2401 hci_connect_cfm(conn, 0); in hci_conn_request_evt()
2426 struct hci_conn *conn; in hci_disconn_complete_evt() local
2434 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); in hci_disconn_complete_evt()
2435 if (!conn) in hci_disconn_complete_evt()
2439 mgmt_disconnect_failed(hdev, &conn->dst, conn->type, in hci_disconn_complete_evt()
2440 conn->dst_type, ev->status); in hci_disconn_complete_evt()
2444 conn->state = BT_CLOSED; in hci_disconn_complete_evt()
2446 mgmt_connected = test_and_clear_bit(HCI_CONN_MGMT_CONNECTED, &conn->flags); in hci_disconn_complete_evt()
2447 mgmt_device_disconnected(hdev, &conn->dst, conn->type, conn->dst_type, in hci_disconn_complete_evt()
2450 if (conn->type == ACL_LINK) { in hci_disconn_complete_evt()
2451 if (test_bit(HCI_CONN_FLUSH_KEY, &conn->flags)) in hci_disconn_complete_evt()
2452 hci_remove_link_key(hdev, &conn->dst); in hci_disconn_complete_evt()
2457 params = hci_conn_params_lookup(hdev, &conn->dst, conn->dst_type); in hci_disconn_complete_evt()
2477 type = conn->type; in hci_disconn_complete_evt()
2479 hci_disconn_cfm(conn, ev->reason); in hci_disconn_complete_evt()
2480 hci_conn_del(conn); in hci_disconn_complete_evt()
2502 struct hci_conn *conn; in hci_auth_complete_evt() local
2508 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); in hci_auth_complete_evt()
2509 if (!conn) in hci_auth_complete_evt()
2513 if (!hci_conn_ssp_enabled(conn) && in hci_auth_complete_evt()
2514 test_bit(HCI_CONN_REAUTH_PEND, &conn->flags)) { in hci_auth_complete_evt()
2517 set_bit(HCI_CONN_AUTH, &conn->flags); in hci_auth_complete_evt()
2518 conn->sec_level = conn->pending_sec_level; in hci_auth_complete_evt()
2521 mgmt_auth_failed(conn, ev->status); in hci_auth_complete_evt()
2524 clear_bit(HCI_CONN_AUTH_PEND, &conn->flags); in hci_auth_complete_evt()
2525 clear_bit(HCI_CONN_REAUTH_PEND, &conn->flags); in hci_auth_complete_evt()
2527 if (conn->state == BT_CONFIG) { in hci_auth_complete_evt()
2528 if (!ev->status && hci_conn_ssp_enabled(conn)) { in hci_auth_complete_evt()
2535 conn->state = BT_CONNECTED; in hci_auth_complete_evt()
2536 hci_connect_cfm(conn, ev->status); in hci_auth_complete_evt()
2537 hci_conn_drop(conn); in hci_auth_complete_evt()
2540 hci_auth_cfm(conn, ev->status); in hci_auth_complete_evt()
2542 hci_conn_hold(conn); in hci_auth_complete_evt()
2543 conn->disc_timeout = HCI_DISCONN_TIMEOUT; in hci_auth_complete_evt()
2544 hci_conn_drop(conn); in hci_auth_complete_evt()
2547 if (test_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags)) { in hci_auth_complete_evt()
2555 clear_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags); in hci_auth_complete_evt()
2556 hci_encrypt_cfm(conn, ev->status, 0x00); in hci_auth_complete_evt()
2567 struct hci_conn *conn; in hci_remote_name_evt() local
2575 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); in hci_remote_name_evt()
2581 hci_check_pending_name(hdev, conn, &ev->bdaddr, ev->name, in hci_remote_name_evt()
2584 hci_check_pending_name(hdev, conn, &ev->bdaddr, NULL, 0); in hci_remote_name_evt()
2587 if (!conn) in hci_remote_name_evt()
2590 if (!hci_outgoing_auth_needed(hdev, conn)) in hci_remote_name_evt()
2593 if (!test_and_set_bit(HCI_CONN_AUTH_PEND, &conn->flags)) { in hci_remote_name_evt()
2596 set_bit(HCI_CONN_AUTH_INITIATOR, &conn->flags); in hci_remote_name_evt()
2598 cp.handle = __cpu_to_le16(conn->handle); in hci_remote_name_evt()
2609 struct hci_conn *conn; in hci_encrypt_change_evt() local
2615 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); in hci_encrypt_change_evt()
2616 if (!conn) in hci_encrypt_change_evt()
2622 set_bit(HCI_CONN_AUTH, &conn->flags); in hci_encrypt_change_evt()
2623 set_bit(HCI_CONN_ENCRYPT, &conn->flags); in hci_encrypt_change_evt()
2624 conn->sec_level = conn->pending_sec_level; in hci_encrypt_change_evt()
2627 if (conn->key_type == HCI_LK_AUTH_COMBINATION_P256) in hci_encrypt_change_evt()
2628 set_bit(HCI_CONN_FIPS, &conn->flags); in hci_encrypt_change_evt()
2630 if ((conn->type == ACL_LINK && ev->encrypt == 0x02) || in hci_encrypt_change_evt()
2631 conn->type == LE_LINK) in hci_encrypt_change_evt()
2632 set_bit(HCI_CONN_AES_CCM, &conn->flags); in hci_encrypt_change_evt()
2634 clear_bit(HCI_CONN_ENCRYPT, &conn->flags); in hci_encrypt_change_evt()
2635 clear_bit(HCI_CONN_AES_CCM, &conn->flags); in hci_encrypt_change_evt()
2642 if (ev->status && conn->type == LE_LINK) in hci_encrypt_change_evt()
2645 clear_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags); in hci_encrypt_change_evt()
2647 if (ev->status && conn->state == BT_CONNECTED) { in hci_encrypt_change_evt()
2648 hci_disconnect(conn, HCI_ERROR_AUTH_FAILURE); in hci_encrypt_change_evt()
2649 hci_conn_drop(conn); in hci_encrypt_change_evt()
2653 if (conn->state == BT_CONFIG) { in hci_encrypt_change_evt()
2655 conn->state = BT_CONNECTED; in hci_encrypt_change_evt()
2662 (!test_bit(HCI_CONN_AES_CCM, &conn->flags) || in hci_encrypt_change_evt()
2663 conn->key_type != HCI_LK_AUTH_COMBINATION_P256)) { in hci_encrypt_change_evt()
2664 hci_connect_cfm(conn, HCI_ERROR_AUTH_FAILURE); in hci_encrypt_change_evt()
2665 hci_conn_drop(conn); in hci_encrypt_change_evt()
2669 hci_connect_cfm(conn, ev->status); in hci_encrypt_change_evt()
2670 hci_conn_drop(conn); in hci_encrypt_change_evt()
2672 hci_encrypt_cfm(conn, ev->status, ev->encrypt); in hci_encrypt_change_evt()
2682 struct hci_conn *conn; in hci_change_link_key_complete_evt() local
2688 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); in hci_change_link_key_complete_evt()
2689 if (conn) { in hci_change_link_key_complete_evt()
2691 set_bit(HCI_CONN_SECURE, &conn->flags); in hci_change_link_key_complete_evt()
2693 clear_bit(HCI_CONN_AUTH_PEND, &conn->flags); in hci_change_link_key_complete_evt()
2695 hci_key_change_cfm(conn, ev->status); in hci_change_link_key_complete_evt()
2705 struct hci_conn *conn; in hci_remote_features_evt() local
2711 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); in hci_remote_features_evt()
2712 if (!conn) in hci_remote_features_evt()
2716 memcpy(conn->features[0], ev->features, 8); in hci_remote_features_evt()
2718 if (conn->state != BT_CONFIG) in hci_remote_features_evt()
2722 lmp_ext_feat_capable(conn)) { in hci_remote_features_evt()
2731 if (!ev->status && !test_bit(HCI_CONN_MGMT_CONNECTED, &conn->flags)) { in hci_remote_features_evt()
2734 bacpy(&cp.bdaddr, &conn->dst); in hci_remote_features_evt()
2737 } else if (!test_and_set_bit(HCI_CONN_MGMT_CONNECTED, &conn->flags)) in hci_remote_features_evt()
2738 mgmt_device_connected(hdev, conn, 0, NULL, 0); in hci_remote_features_evt()
2740 if (!hci_outgoing_auth_needed(hdev, conn)) { in hci_remote_features_evt()
2741 conn->state = BT_CONNECTED; in hci_remote_features_evt()
2742 hci_connect_cfm(conn, ev->status); in hci_remote_features_evt()
2743 hci_conn_drop(conn); in hci_remote_features_evt()
3180 struct hci_conn *conn; in hci_role_change_evt() local
3186 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); in hci_role_change_evt()
3187 if (conn) { in hci_role_change_evt()
3189 conn->role = ev->role; in hci_role_change_evt()
3191 clear_bit(HCI_CONN_RSWITCH_PEND, &conn->flags); in hci_role_change_evt()
3193 hci_role_switch_cfm(conn, ev->status, ev->role); in hci_role_change_evt()
3219 struct hci_conn *conn; in hci_num_comp_pkts_evt() local
3225 conn = hci_conn_hash_lookup_handle(hdev, handle); in hci_num_comp_pkts_evt()
3226 if (!conn) in hci_num_comp_pkts_evt()
3229 conn->sent -= count; in hci_num_comp_pkts_evt()
3231 switch (conn->type) { in hci_num_comp_pkts_evt()
3257 BT_ERR("Unknown type %d conn %p", conn->type, conn); in hci_num_comp_pkts_evt()
3276 return chan->conn; in __hci_conn_lookup_handle()
3307 struct hci_conn *conn = NULL; in hci_num_comp_blocks_evt() local
3313 conn = __hci_conn_lookup_handle(hdev, handle); in hci_num_comp_blocks_evt()
3314 if (!conn) in hci_num_comp_blocks_evt()
3317 conn->sent -= block_count; in hci_num_comp_blocks_evt()
3319 switch (conn->type) { in hci_num_comp_blocks_evt()
3328 BT_ERR("Unknown type %d conn %p", conn->type, conn); in hci_num_comp_blocks_evt()
3339 struct hci_conn *conn; in hci_mode_change_evt() local
3345 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); in hci_mode_change_evt()
3346 if (conn) { in hci_mode_change_evt()
3347 conn->mode = ev->mode; in hci_mode_change_evt()
3350 &conn->flags)) { in hci_mode_change_evt()
3351 if (conn->mode == HCI_CM_ACTIVE) in hci_mode_change_evt()
3352 set_bit(HCI_CONN_POWER_SAVE, &conn->flags); in hci_mode_change_evt()
3354 clear_bit(HCI_CONN_POWER_SAVE, &conn->flags); in hci_mode_change_evt()
3357 if (test_and_clear_bit(HCI_CONN_SCO_SETUP_PEND, &conn->flags)) in hci_mode_change_evt()
3358 hci_sco_setup(conn, ev->status); in hci_mode_change_evt()
3367 struct hci_conn *conn; in hci_pin_code_request_evt() local
3373 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); in hci_pin_code_request_evt()
3374 if (!conn) in hci_pin_code_request_evt()
3377 if (conn->state == BT_CONNECTED) { in hci_pin_code_request_evt()
3378 hci_conn_hold(conn); in hci_pin_code_request_evt()
3379 conn->disc_timeout = HCI_PAIRING_TIMEOUT; in hci_pin_code_request_evt()
3380 hci_conn_drop(conn); in hci_pin_code_request_evt()
3384 !test_bit(HCI_CONN_AUTH_INITIATOR, &conn->flags)) { in hci_pin_code_request_evt()
3390 if (conn->pending_sec_level == BT_SECURITY_HIGH) in hci_pin_code_request_evt()
3402 static void conn_set_key(struct hci_conn *conn, u8 key_type, u8 pin_len) in conn_set_key() argument
3407 conn->pin_length = pin_len; in conn_set_key()
3408 conn->key_type = key_type; in conn_set_key()
3417 conn->pending_sec_level = BT_SECURITY_HIGH; in conn_set_key()
3419 conn->pending_sec_level = BT_SECURITY_MEDIUM; in conn_set_key()
3423 conn->pending_sec_level = BT_SECURITY_MEDIUM; in conn_set_key()
3426 conn->pending_sec_level = BT_SECURITY_HIGH; in conn_set_key()
3429 conn->pending_sec_level = BT_SECURITY_FIPS; in conn_set_key()
3438 struct hci_conn *conn; in hci_link_key_request_evt() local
3458 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); in hci_link_key_request_evt()
3459 if (conn) { in hci_link_key_request_evt()
3460 clear_bit(HCI_CONN_NEW_LINK_KEY, &conn->flags); in hci_link_key_request_evt()
3464 conn->auth_type != 0xff && (conn->auth_type & 0x01)) { in hci_link_key_request_evt()
3470 (conn->pending_sec_level == BT_SECURITY_HIGH || in hci_link_key_request_evt()
3471 conn->pending_sec_level == BT_SECURITY_FIPS)) { in hci_link_key_request_evt()
3477 conn_set_key(conn, key->type, key->pin_len); in hci_link_key_request_evt()
3497 struct hci_conn *conn; in hci_link_key_notify_evt() local
3506 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); in hci_link_key_notify_evt()
3507 if (!conn) in hci_link_key_notify_evt()
3510 hci_conn_hold(conn); in hci_link_key_notify_evt()
3511 conn->disc_timeout = HCI_DISCONN_TIMEOUT; in hci_link_key_notify_evt()
3512 hci_conn_drop(conn); in hci_link_key_notify_evt()
3514 set_bit(HCI_CONN_NEW_LINK_KEY, &conn->flags); in hci_link_key_notify_evt()
3515 conn_set_key(conn, ev->key_type, conn->pin_length); in hci_link_key_notify_evt()
3520 key = hci_add_link_key(hdev, conn, &ev->bdaddr, ev->link_key, in hci_link_key_notify_evt()
3529 conn_set_key(conn, key->type, key->pin_len); in hci_link_key_notify_evt()
3546 clear_bit(HCI_CONN_FLUSH_KEY, &conn->flags); in hci_link_key_notify_evt()
3548 set_bit(HCI_CONN_FLUSH_KEY, &conn->flags); in hci_link_key_notify_evt()
3557 struct hci_conn *conn; in hci_clock_offset_evt() local
3563 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); in hci_clock_offset_evt()
3564 if (conn && !ev->status) { in hci_clock_offset_evt()
3567 ie = hci_inquiry_cache_lookup(hdev, &conn->dst); in hci_clock_offset_evt()
3580 struct hci_conn *conn; in hci_pkt_type_change_evt() local
3586 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); in hci_pkt_type_change_evt()
3587 if (conn && !ev->status) in hci_pkt_type_change_evt()
3588 conn->pkt_type = __le16_to_cpu(ev->pkt_type); in hci_pkt_type_change_evt()
3679 struct hci_conn *conn; in hci_remote_ext_features_evt() local
3685 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); in hci_remote_ext_features_evt()
3686 if (!conn) in hci_remote_ext_features_evt()
3690 memcpy(conn->features[ev->page], ev->features, 8); in hci_remote_ext_features_evt()
3695 ie = hci_inquiry_cache_lookup(hdev, &conn->dst); in hci_remote_ext_features_evt()
3700 set_bit(HCI_CONN_SSP_ENABLED, &conn->flags); in hci_remote_ext_features_evt()
3710 clear_bit(HCI_CONN_SSP_ENABLED, &conn->flags); in hci_remote_ext_features_evt()
3714 set_bit(HCI_CONN_SC_ENABLED, &conn->flags); in hci_remote_ext_features_evt()
3717 if (conn->state != BT_CONFIG) in hci_remote_ext_features_evt()
3720 if (!ev->status && !test_bit(HCI_CONN_MGMT_CONNECTED, &conn->flags)) { in hci_remote_ext_features_evt()
3723 bacpy(&cp.bdaddr, &conn->dst); in hci_remote_ext_features_evt()
3726 } else if (!test_and_set_bit(HCI_CONN_MGMT_CONNECTED, &conn->flags)) in hci_remote_ext_features_evt()
3727 mgmt_device_connected(hdev, conn, 0, NULL, 0); in hci_remote_ext_features_evt()
3729 if (!hci_outgoing_auth_needed(hdev, conn)) { in hci_remote_ext_features_evt()
3730 conn->state = BT_CONNECTED; in hci_remote_ext_features_evt()
3731 hci_connect_cfm(conn, ev->status); in hci_remote_ext_features_evt()
3732 hci_conn_drop(conn); in hci_remote_ext_features_evt()
3743 struct hci_conn *conn; in hci_sync_conn_complete_evt() local
3749 conn = hci_conn_hash_lookup_ba(hdev, ev->link_type, &ev->bdaddr); in hci_sync_conn_complete_evt()
3750 if (!conn) { in hci_sync_conn_complete_evt()
3754 conn = hci_conn_hash_lookup_ba(hdev, ESCO_LINK, &ev->bdaddr); in hci_sync_conn_complete_evt()
3755 if (!conn) in hci_sync_conn_complete_evt()
3758 conn->type = SCO_LINK; in hci_sync_conn_complete_evt()
3763 conn->handle = __le16_to_cpu(ev->handle); in hci_sync_conn_complete_evt()
3764 conn->state = BT_CONNECTED; in hci_sync_conn_complete_evt()
3766 hci_debugfs_create_conn(conn); in hci_sync_conn_complete_evt()
3767 hci_conn_add_sysfs(conn); in hci_sync_conn_complete_evt()
3777 if (conn->out) { in hci_sync_conn_complete_evt()
3778 conn->pkt_type = (hdev->esco_type & SCO_ESCO_MASK) | in hci_sync_conn_complete_evt()
3780 if (hci_setup_sync(conn, conn->link->handle)) in hci_sync_conn_complete_evt()
3786 conn->state = BT_CLOSED; in hci_sync_conn_complete_evt()
3790 hci_connect_cfm(conn, ev->status); in hci_sync_conn_complete_evt()
3792 hci_conn_del(conn); in hci_sync_conn_complete_evt()
3869 struct hci_conn *conn; in hci_key_refresh_complete_evt() local
3876 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); in hci_key_refresh_complete_evt()
3877 if (!conn) in hci_key_refresh_complete_evt()
3883 if (conn->type != LE_LINK) in hci_key_refresh_complete_evt()
3887 conn->sec_level = conn->pending_sec_level; in hci_key_refresh_complete_evt()
3889 clear_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags); in hci_key_refresh_complete_evt()
3891 if (ev->status && conn->state == BT_CONNECTED) { in hci_key_refresh_complete_evt()
3892 hci_disconnect(conn, HCI_ERROR_AUTH_FAILURE); in hci_key_refresh_complete_evt()
3893 hci_conn_drop(conn); in hci_key_refresh_complete_evt()
3897 if (conn->state == BT_CONFIG) { in hci_key_refresh_complete_evt()
3899 conn->state = BT_CONNECTED; in hci_key_refresh_complete_evt()
3901 hci_connect_cfm(conn, ev->status); in hci_key_refresh_complete_evt()
3902 hci_conn_drop(conn); in hci_key_refresh_complete_evt()
3904 hci_auth_cfm(conn, ev->status); in hci_key_refresh_complete_evt()
3906 hci_conn_hold(conn); in hci_key_refresh_complete_evt()
3907 conn->disc_timeout = HCI_DISCONN_TIMEOUT; in hci_key_refresh_complete_evt()
3908 hci_conn_drop(conn); in hci_key_refresh_complete_evt()
3915 static u8 hci_get_auth_req(struct hci_conn *conn) in hci_get_auth_req() argument
3918 if (conn->remote_auth == HCI_AT_NO_BONDING || in hci_get_auth_req()
3919 conn->remote_auth == HCI_AT_NO_BONDING_MITM) in hci_get_auth_req()
3920 return conn->remote_auth | (conn->auth_type & 0x01); in hci_get_auth_req()
3925 if (conn->remote_cap != HCI_IO_NO_INPUT_OUTPUT && in hci_get_auth_req()
3926 conn->io_capability != HCI_IO_NO_INPUT_OUTPUT) in hci_get_auth_req()
3927 return conn->remote_auth | 0x01; in hci_get_auth_req()
3930 return (conn->remote_auth & ~0x01) | (conn->auth_type & 0x01); in hci_get_auth_req()
3933 static u8 bredr_oob_data_present(struct hci_conn *conn) in bredr_oob_data_present() argument
3935 struct hci_dev *hdev = conn->hdev; in bredr_oob_data_present()
3938 data = hci_find_remote_oob_data(hdev, &conn->dst, BDADDR_BREDR); in bredr_oob_data_present()
3978 struct hci_conn *conn; in hci_io_capa_request_evt() local
3984 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); in hci_io_capa_request_evt()
3985 if (!conn) in hci_io_capa_request_evt()
3988 hci_conn_hold(conn); in hci_io_capa_request_evt()
3997 test_bit(HCI_CONN_AUTH_INITIATOR, &conn->flags) || in hci_io_capa_request_evt()
3998 (conn->remote_auth & ~0x01) == HCI_AT_NO_BONDING) { in hci_io_capa_request_evt()
4004 cp.capability = (conn->io_capability == 0x04) ? in hci_io_capa_request_evt()
4005 HCI_IO_DISPLAY_YESNO : conn->io_capability; in hci_io_capa_request_evt()
4008 if (conn->remote_auth == 0xff) { in hci_io_capa_request_evt()
4012 if (conn->io_capability != HCI_IO_NO_INPUT_OUTPUT && in hci_io_capa_request_evt()
4013 conn->auth_type != HCI_AT_NO_BONDING) in hci_io_capa_request_evt()
4014 conn->auth_type |= 0x01; in hci_io_capa_request_evt()
4016 conn->auth_type = hci_get_auth_req(conn); in hci_io_capa_request_evt()
4023 conn->auth_type &= HCI_AT_NO_BONDING_MITM; in hci_io_capa_request_evt()
4025 cp.authentication = conn->auth_type; in hci_io_capa_request_evt()
4026 cp.oob_data = bredr_oob_data_present(conn); in hci_io_capa_request_evt()
4047 struct hci_conn *conn; in hci_io_capa_reply_evt() local
4053 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); in hci_io_capa_reply_evt()
4054 if (!conn) in hci_io_capa_reply_evt()
4057 conn->remote_cap = ev->capability; in hci_io_capa_reply_evt()
4058 conn->remote_auth = ev->authentication; in hci_io_capa_reply_evt()
4069 struct hci_conn *conn; in hci_user_confirm_request_evt() local
4078 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); in hci_user_confirm_request_evt()
4079 if (!conn) in hci_user_confirm_request_evt()
4082 loc_mitm = (conn->auth_type & 0x01); in hci_user_confirm_request_evt()
4083 rem_mitm = (conn->remote_auth & 0x01); in hci_user_confirm_request_evt()
4090 if (conn->pending_sec_level > BT_SECURITY_MEDIUM && in hci_user_confirm_request_evt()
4091 conn->remote_cap == HCI_IO_NO_INPUT_OUTPUT) { in hci_user_confirm_request_evt()
4099 if ((!loc_mitm || conn->remote_cap == HCI_IO_NO_INPUT_OUTPUT) && in hci_user_confirm_request_evt()
4100 (!rem_mitm || conn->io_capability == HCI_IO_NO_INPUT_OUTPUT)) { in hci_user_confirm_request_evt()
4108 if (!test_bit(HCI_CONN_AUTH_PEND, &conn->flags) && in hci_user_confirm_request_evt()
4109 conn->io_capability != HCI_IO_NO_INPUT_OUTPUT && in hci_user_confirm_request_evt()
4121 queue_delayed_work(conn->hdev->workqueue, in hci_user_confirm_request_evt()
4122 &conn->auto_accept_work, delay); in hci_user_confirm_request_evt()
4154 struct hci_conn *conn; in hci_user_passkey_notify_evt() local
4158 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); in hci_user_passkey_notify_evt()
4159 if (!conn) in hci_user_passkey_notify_evt()
4162 conn->passkey_notify = __le32_to_cpu(ev->passkey); in hci_user_passkey_notify_evt()
4163 conn->passkey_entered = 0; in hci_user_passkey_notify_evt()
4166 mgmt_user_passkey_notify(hdev, &conn->dst, conn->type, in hci_user_passkey_notify_evt()
4167 conn->dst_type, conn->passkey_notify, in hci_user_passkey_notify_evt()
4168 conn->passkey_entered); in hci_user_passkey_notify_evt()
4174 struct hci_conn *conn; in hci_keypress_notify_evt() local
4178 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); in hci_keypress_notify_evt()
4179 if (!conn) in hci_keypress_notify_evt()
4184 conn->passkey_entered = 0; in hci_keypress_notify_evt()
4188 conn->passkey_entered++; in hci_keypress_notify_evt()
4192 conn->passkey_entered--; in hci_keypress_notify_evt()
4196 conn->passkey_entered = 0; in hci_keypress_notify_evt()
4204 mgmt_user_passkey_notify(hdev, &conn->dst, conn->type, in hci_keypress_notify_evt()
4205 conn->dst_type, conn->passkey_notify, in hci_keypress_notify_evt()
4206 conn->passkey_entered); in hci_keypress_notify_evt()
4213 struct hci_conn *conn; in hci_simple_pair_complete_evt() local
4219 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); in hci_simple_pair_complete_evt()
4220 if (!conn) in hci_simple_pair_complete_evt()
4224 conn->remote_auth = 0xff; in hci_simple_pair_complete_evt()
4231 if (!test_bit(HCI_CONN_AUTH_PEND, &conn->flags) && ev->status) in hci_simple_pair_complete_evt()
4232 mgmt_auth_failed(conn, ev->status); in hci_simple_pair_complete_evt()
4234 hci_conn_drop(conn); in hci_simple_pair_complete_evt()
4245 struct hci_conn *conn; in hci_remote_host_features_evt() local
4251 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); in hci_remote_host_features_evt()
4252 if (conn) in hci_remote_host_features_evt()
4253 memcpy(conn->features[1], ev->features, 8); in hci_remote_host_features_evt()
4386 bredr_chan->conn->mtu = hdev->block_mtu; in hci_loglink_complete_evt()
4444 struct hci_conn *conn; in hci_le_conn_complete_evt() local
4457 conn = hci_conn_hash_lookup_state(hdev, LE_LINK, BT_CONNECT); in hci_le_conn_complete_evt()
4458 if (!conn) { in hci_le_conn_complete_evt()
4459 conn = hci_conn_add(hdev, LE_LINK, &ev->bdaddr, ev->role); in hci_le_conn_complete_evt()
4460 if (!conn) { in hci_le_conn_complete_evt()
4465 conn->dst_type = ev->bdaddr_type; in hci_le_conn_complete_evt()
4475 if (conn->out) { in hci_le_conn_complete_evt()
4476 conn->resp_addr_type = ev->bdaddr_type; in hci_le_conn_complete_evt()
4477 bacpy(&conn->resp_addr, &ev->bdaddr); in hci_le_conn_complete_evt()
4479 conn->init_addr_type = ADDR_LE_DEV_RANDOM; in hci_le_conn_complete_evt()
4480 bacpy(&conn->init_addr, &hdev->rpa); in hci_le_conn_complete_evt()
4483 &conn->init_addr, in hci_le_conn_complete_evt()
4484 &conn->init_addr_type); in hci_le_conn_complete_evt()
4488 cancel_delayed_work(&conn->le_conn_timeout); in hci_le_conn_complete_evt()
4491 if (!conn->out) { in hci_le_conn_complete_evt()
4495 conn->resp_addr_type = hdev->adv_addr_type; in hci_le_conn_complete_evt()
4497 bacpy(&conn->resp_addr, &hdev->random_addr); in hci_le_conn_complete_evt()
4499 bacpy(&conn->resp_addr, &hdev->bdaddr); in hci_le_conn_complete_evt()
4501 conn->init_addr_type = ev->bdaddr_type; in hci_le_conn_complete_evt()
4502 bacpy(&conn->init_addr, &ev->bdaddr); in hci_le_conn_complete_evt()
4509 conn->le_conn_min_interval = hdev->le_conn_min_interval; in hci_le_conn_complete_evt()
4510 conn->le_conn_max_interval = hdev->le_conn_max_interval; in hci_le_conn_complete_evt()
4522 irk = hci_get_irk(hdev, &conn->dst, conn->dst_type); in hci_le_conn_complete_evt()
4524 bacpy(&conn->dst, &irk->bdaddr); in hci_le_conn_complete_evt()
4525 conn->dst_type = irk->addr_type; in hci_le_conn_complete_evt()
4529 hci_le_conn_failed(conn, ev->status); in hci_le_conn_complete_evt()
4533 if (conn->dst_type == ADDR_LE_DEV_PUBLIC) in hci_le_conn_complete_evt()
4539 if (hci_bdaddr_list_lookup(&hdev->blacklist, &conn->dst, addr_type)) { in hci_le_conn_complete_evt()
4540 hci_conn_drop(conn); in hci_le_conn_complete_evt()
4544 if (!test_and_set_bit(HCI_CONN_MGMT_CONNECTED, &conn->flags)) in hci_le_conn_complete_evt()
4545 mgmt_device_connected(hdev, conn, 0, NULL, 0); in hci_le_conn_complete_evt()
4547 conn->sec_level = BT_SECURITY_LOW; in hci_le_conn_complete_evt()
4548 conn->handle = __le16_to_cpu(ev->handle); in hci_le_conn_complete_evt()
4549 conn->state = BT_CONFIG; in hci_le_conn_complete_evt()
4551 conn->le_conn_interval = le16_to_cpu(ev->interval); in hci_le_conn_complete_evt()
4552 conn->le_conn_latency = le16_to_cpu(ev->latency); in hci_le_conn_complete_evt()
4553 conn->le_supv_timeout = le16_to_cpu(ev->supervision_timeout); in hci_le_conn_complete_evt()
4555 hci_debugfs_create_conn(conn); in hci_le_conn_complete_evt()
4556 hci_conn_add_sysfs(conn); in hci_le_conn_complete_evt()
4568 if (conn->out || in hci_le_conn_complete_evt()
4572 cp.handle = __cpu_to_le16(conn->handle); in hci_le_conn_complete_evt()
4577 hci_conn_hold(conn); in hci_le_conn_complete_evt()
4579 conn->state = BT_CONNECTED; in hci_le_conn_complete_evt()
4580 hci_connect_cfm(conn, ev->status); in hci_le_conn_complete_evt()
4583 hci_connect_cfm(conn, ev->status); in hci_le_conn_complete_evt()
4586 params = hci_pend_le_action_lookup(&hdev->pend_le_conns, &conn->dst, in hci_le_conn_complete_evt()
4587 conn->dst_type); in hci_le_conn_complete_evt()
4590 if (params->conn) { in hci_le_conn_complete_evt()
4591 hci_conn_drop(params->conn); in hci_le_conn_complete_evt()
4592 hci_conn_put(params->conn); in hci_le_conn_complete_evt()
4593 params->conn = NULL; in hci_le_conn_complete_evt()
4606 struct hci_conn *conn; in hci_le_conn_update_complete_evt() local
4615 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); in hci_le_conn_update_complete_evt()
4616 if (conn) { in hci_le_conn_update_complete_evt()
4617 conn->le_conn_interval = le16_to_cpu(ev->interval); in hci_le_conn_update_complete_evt()
4618 conn->le_conn_latency = le16_to_cpu(ev->latency); in hci_le_conn_update_complete_evt()
4619 conn->le_supv_timeout = le16_to_cpu(ev->supervision_timeout); in hci_le_conn_update_complete_evt()
4630 struct hci_conn *conn; in check_pending_le_conn() local
4676 conn = hci_connect_le(hdev, addr, addr_type, BT_SECURITY_LOW, in check_pending_le_conn()
4678 if (!IS_ERR(conn)) { in check_pending_le_conn()
4685 params->conn = hci_conn_get(conn); in check_pending_le_conn()
4686 return conn; in check_pending_le_conn()
4689 switch (PTR_ERR(conn)) { in check_pending_le_conn()
4698 BT_DBG("Failed to connect: err %ld", PTR_ERR(conn)); in check_pending_le_conn()
4711 struct hci_conn *conn; in process_adv_report() local
4749 conn = check_pending_le_conn(hdev, bdaddr, bdaddr_type, type); in process_adv_report()
4750 if (conn && type == LE_ADV_IND) { in process_adv_report()
4754 memcpy(conn->le_adv_data, data, len); in process_adv_report()
4755 conn->le_adv_data_len = len; in process_adv_report()
4890 struct hci_conn *conn; in hci_le_remote_feat_complete_evt() local
4896 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); in hci_le_remote_feat_complete_evt()
4897 if (conn) { in hci_le_remote_feat_complete_evt()
4899 memcpy(conn->features[0], ev->features, 8); in hci_le_remote_feat_complete_evt()
4901 if (conn->state == BT_CONFIG) { in hci_le_remote_feat_complete_evt()
4914 !conn->out && ev->status == 0x1a) in hci_le_remote_feat_complete_evt()
4919 conn->state = BT_CONNECTED; in hci_le_remote_feat_complete_evt()
4920 hci_connect_cfm(conn, status); in hci_le_remote_feat_complete_evt()
4921 hci_conn_drop(conn); in hci_le_remote_feat_complete_evt()
4933 struct hci_conn *conn; in hci_le_ltk_request_evt() local
4940 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); in hci_le_ltk_request_evt()
4941 if (conn == NULL) in hci_le_ltk_request_evt()
4944 ltk = hci_find_ltk(hdev, &conn->dst, conn->dst_type, conn->role); in hci_le_ltk_request_evt()
4959 cp.handle = cpu_to_le16(conn->handle); in hci_le_ltk_request_evt()
4961 conn->pending_sec_level = smp_ltk_sec_level(ltk); in hci_le_ltk_request_evt()
4963 conn->enc_key_size = ltk->enc_size; in hci_le_ltk_request_evt()
4974 set_bit(HCI_CONN_STK_ENCRYPT, &conn->flags); in hci_le_ltk_request_evt()
4978 clear_bit(HCI_CONN_STK_ENCRYPT, &conn->flags); in hci_le_ltk_request_evt()