Lines Matching refs:hcon
78 static inline u8 bdaddr_src_type(struct hci_conn *hcon) in bdaddr_src_type() argument
80 return bdaddr_type(hcon->type, hcon->src_type); in bdaddr_src_type()
83 static inline u8 bdaddr_dst_type(struct hci_conn *hcon) in bdaddr_dst_type() argument
85 return bdaddr_type(hcon->type, hcon->dst_type); in bdaddr_dst_type()
246 if (conn->hcon->type == LE_LINK) in l2cap_alloc_cid()
600 if (conn->hcon->type == ACL_LINK) in __l2cap_chan_add()
634 hci_conn_hold(conn->hcon); in __l2cap_chan_add()
672 hci_conn_drop(conn->hcon); in l2cap_chan_del()
743 struct hci_conn *hcon = conn->hcon; in l2cap_conn_update_id_addr() local
750 bacpy(&chan->dst, &hcon->dst); in l2cap_conn_update_id_addr()
751 chan->dst_type = bdaddr_dst_type(hcon); in l2cap_conn_update_id_addr()
831 if (conn->hcon->type == ACL_LINK) in l2cap_chan_close()
833 else if (conn->hcon->type == LE_LINK) { in l2cap_chan_close()
918 if (conn->hcon->type == LE_LINK) in l2cap_chan_check_security()
919 return smp_conn_security(conn->hcon, chan->sec_level); in l2cap_chan_check_security()
923 return hci_conn_security(conn->hcon, chan->sec_level, auth_type, in l2cap_chan_check_security()
933 if (conn->hcon->type == LE_LINK) in l2cap_get_ident()
968 if (hci_conn_valid(conn->hcon->hdev, conn->hcon)) in l2cap_send_acl()
987 if (lmp_no_flush_capable(conn->hcon->hdev) || in l2cap_send_cmd()
988 conn->hcon->type == LE_LINK) in l2cap_send_cmd()
1001 struct hci_conn *hcon = chan->conn->hcon; in l2cap_do_send() local
1011 if (hcon->type == LE_LINK || in l2cap_do_send()
1013 lmp_no_flush_capable(hcon->hdev))) in l2cap_do_send()
1387 if (!smp_conn_security(conn->hcon, chan->sec_level)) in l2cap_le_start()
1405 if (chan->conn->hcon->type == LE_LINK) { in l2cap_start_connection()
1430 static bool l2cap_check_enc_key_size(struct hci_conn *hcon, in l2cap_check_enc_key_size() argument
1442 int min_key_size = hcon->hdev->min_enc_key_size; in l2cap_check_enc_key_size()
1448 return (!test_bit(HCI_CONN_ENCRYPT, &hcon->flags) || in l2cap_check_enc_key_size()
1449 hcon->enc_key_size >= min_key_size); in l2cap_check_enc_key_size()
1456 if (conn->hcon->type == LE_LINK) { in l2cap_do_start()
1473 if (l2cap_check_enc_key_size(conn->hcon, chan)) in l2cap_do_start()
1548 if (l2cap_check_enc_key_size(conn->hcon, chan)) in l2cap_conn_start()
1596 struct hci_conn *hcon = conn->hcon; in l2cap_le_conn_ready() local
1597 struct hci_dev *hdev = hcon->hdev; in l2cap_le_conn_ready()
1604 if (hcon->out) in l2cap_le_conn_ready()
1605 smp_conn_security(hcon, hcon->pending_sec_level); in l2cap_le_conn_ready()
1612 if (hcon->role == HCI_ROLE_SLAVE && in l2cap_le_conn_ready()
1613 (hcon->le_conn_interval < hcon->le_conn_min_interval || in l2cap_le_conn_ready()
1614 hcon->le_conn_interval > hcon->le_conn_max_interval)) { in l2cap_le_conn_ready()
1617 req.min = cpu_to_le16(hcon->le_conn_min_interval); in l2cap_le_conn_ready()
1618 req.max = cpu_to_le16(hcon->le_conn_max_interval); in l2cap_le_conn_ready()
1619 req.latency = cpu_to_le16(hcon->le_conn_latency); in l2cap_le_conn_ready()
1620 req.to_multiplier = cpu_to_le16(hcon->le_supv_timeout); in l2cap_le_conn_ready()
1630 struct hci_conn *hcon = conn->hcon; in l2cap_conn_ready() local
1634 if (hcon->type == ACL_LINK) in l2cap_conn_ready()
1643 if (hcon->type == LE_LINK) { in l2cap_conn_ready()
1657 if (hcon->type == LE_LINK) in l2cap_conn_ready()
1660 queue_work(hcon->hdev->workqueue, &conn->pending_rx_work); in l2cap_conn_ready()
1764 static void l2cap_conn_del(struct hci_conn *hcon, int err) in l2cap_conn_del() argument
1766 struct l2cap_conn *conn = hcon->l2cap_data; in l2cap_conn_del()
1772 BT_DBG("hcon %p conn %p, err %d", hcon, conn, err); in l2cap_conn_del()
1795 hcon->disc_timeout = 0; in l2cap_conn_del()
1813 hcon->l2cap_data = NULL; in l2cap_conn_del()
1822 hci_conn_put(conn->hcon); in l2cap_conn_free()
3011 if (conn->hcon->type == LE_LINK) in l2cap_build_cmd()
3254 struct hci_conn *conn = chan->conn->hcon; in l2cap_mtu_auto()
4022 pchan = l2cap_global_chan_by_psm(BT_LISTEN, psm, &conn->hcon->src, in l2cap_connect()
4023 &conn->hcon->dst, ACL_LINK); in l2cap_connect()
4033 (!hci_conn_check_link_mode(conn->hcon) || in l2cap_connect()
4034 !l2cap_check_enc_key_size(conn->hcon, pchan))) { in l2cap_connect()
4063 conn->hcon->disc_timeout = HCI_DISCONN_TIMEOUT; in l2cap_connect()
4065 bacpy(&chan->src, &conn->hcon->src); in l2cap_connect()
4066 bacpy(&chan->dst, &conn->hcon->dst); in l2cap_connect()
4067 chan->src_type = bdaddr_src_type(conn->hcon); in l2cap_connect()
4068 chan->dst_type = bdaddr_dst_type(conn->hcon); in l2cap_connect()
4677 struct hci_conn *hcon = conn->hcon; in l2cap_conn_param_update_req() local
4683 if (hcon->role != HCI_ROLE_MASTER) in l2cap_conn_param_update_req()
4712 store_hint = hci_le_conn_update(hcon, min, max, latency, in l2cap_conn_param_update_req()
4714 mgmt_new_conn_param(hcon->hdev, &hcon->dst, hcon->dst_type, in l2cap_conn_param_update_req()
4728 struct hci_conn *hcon = conn->hcon; in l2cap_le_connect_rsp() local
4778 if (hcon->sec_level > BT_SECURITY_MEDIUM) { in l2cap_le_connect_rsp()
4783 sec_level = hcon->sec_level + 1; in l2cap_le_connect_rsp()
4790 smp_conn_security(hcon, chan->sec_level); in l2cap_le_connect_rsp()
4925 pchan = l2cap_global_chan_by_psm(BT_LISTEN, psm, &conn->hcon->src, in l2cap_le_connect_req()
4926 &conn->hcon->dst, LE_LINK); in l2cap_le_connect_req()
4935 if (!smp_sufficient_security(conn->hcon, pchan->sec_level, in l2cap_le_connect_req()
4944 if (!l2cap_check_enc_key_size(conn->hcon, pchan)) { in l2cap_le_connect_req()
4970 bacpy(&chan->src, &conn->hcon->src); in l2cap_le_connect_req()
4971 bacpy(&chan->dst, &conn->hcon->dst); in l2cap_le_connect_req()
4972 chan->src_type = bdaddr_src_type(conn->hcon); in l2cap_le_connect_req()
4973 chan->dst_type = bdaddr_dst_type(conn->hcon); in l2cap_le_connect_req()
5143 pchan = l2cap_global_chan_by_psm(BT_LISTEN, psm, &conn->hcon->src, in l2cap_ecred_conn_req()
5144 &conn->hcon->dst, LE_LINK); in l2cap_ecred_conn_req()
5152 if (!smp_sufficient_security(conn->hcon, pchan->sec_level, in l2cap_ecred_conn_req()
5194 bacpy(&chan->src, &conn->hcon->src); in l2cap_ecred_conn_req()
5195 bacpy(&chan->dst, &conn->hcon->dst); in l2cap_ecred_conn_req()
5196 chan->src_type = bdaddr_src_type(conn->hcon); in l2cap_ecred_conn_req()
5197 chan->dst_type = bdaddr_dst_type(conn->hcon); in l2cap_ecred_conn_req()
5251 struct hci_conn *hcon = conn->hcon; in l2cap_ecred_conn_rsp() local
5315 if (hcon->sec_level > BT_SECURITY_MEDIUM) { in l2cap_ecred_conn_rsp()
5320 sec_level = hcon->sec_level + 1; in l2cap_ecred_conn_rsp()
5327 smp_conn_security(hcon, chan->sec_level); in l2cap_ecred_conn_rsp()
5577 struct hci_conn *hcon = conn->hcon; in l2cap_le_sig_channel() local
5582 if (hcon->type != LE_LINK) in l2cap_le_sig_channel()
5626 struct hci_conn *hcon = conn->hcon; in l2cap_sig_channel() local
5632 if (hcon->type != ACL_LINK) in l2cap_sig_channel()
6362 chan->conn->mtu = chan->conn->hcon->mtu; in l2cap_finish_move()
6429 chan->conn->mtu = chan->conn->hcon->mtu; in l2cap_rx_state_wait_f()
6875 struct hci_conn *hcon = conn->hcon; in l2cap_conless_channel() local
6878 if (hcon->type != ACL_LINK) in l2cap_conless_channel()
6881 chan = l2cap_global_chan_by_psm(0, psm, &hcon->src, &hcon->dst, in l2cap_conless_channel()
6897 bacpy(&bt_cb(skb)->l2cap.bdaddr, &hcon->dst); in l2cap_conless_channel()
6916 struct hci_conn *hcon = conn->hcon; in l2cap_recv_frame() local
6920 if (hcon->state != BT_CONNECTED) { in l2cap_recv_frame()
6938 if (hcon->type == LE_LINK && in l2cap_recv_frame()
6939 hci_bdaddr_list_lookup(&hcon->hdev->reject_list, &hcon->dst, in l2cap_recv_frame()
6940 bdaddr_dst_type(hcon))) { in l2cap_recv_frame()
6984 static struct l2cap_conn *l2cap_conn_add(struct hci_conn *hcon) in l2cap_conn_add() argument
6986 struct l2cap_conn *conn = hcon->l2cap_data; in l2cap_conn_add()
6992 hchan = hci_chan_create(hcon); in l2cap_conn_add()
7003 hcon->l2cap_data = conn; in l2cap_conn_add()
7004 conn->hcon = hci_conn_get(hcon); in l2cap_conn_add()
7007 BT_DBG("hcon %p conn %p hchan %p", hcon, conn, hchan); in l2cap_conn_add()
7009 conn->mtu = hcon->mtu; in l2cap_conn_add()
7014 if (hci_dev_test_flag(hcon->hdev, HCI_LE_ENABLED) && in l2cap_conn_add()
7015 (bredr_sc_enabled(hcon->hdev) || in l2cap_conn_add()
7016 hci_dev_test_flag(hcon->hdev, HCI_FORCE_BREDR_SMP))) in l2cap_conn_add()
7079 struct hci_conn *hcon; in l2cap_chan_connect() local
7168 hcon = hci_connect_le(hdev, dst, dst_type, false, in l2cap_chan_connect()
7172 hcon = hci_connect_le_scan(hdev, dst, dst_type, in l2cap_chan_connect()
7178 hcon = hci_connect_acl(hdev, dst, chan->sec_level, auth_type, in l2cap_chan_connect()
7182 if (IS_ERR(hcon)) { in l2cap_chan_connect()
7183 err = PTR_ERR(hcon); in l2cap_chan_connect()
7187 conn = l2cap_conn_add(hcon); in l2cap_chan_connect()
7189 hci_conn_drop(hcon); in l2cap_chan_connect()
7205 hci_conn_drop(hcon); in l2cap_chan_connect()
7215 hci_conn_drop(hcon); in l2cap_chan_connect()
7221 bacpy(&chan->src, &hcon->src); in l2cap_chan_connect()
7222 chan->src_type = bdaddr_src_type(hcon); in l2cap_chan_connect()
7227 hci_conn_drop(hcon); in l2cap_chan_connect()
7239 if (hcon->state == BT_CONNECTED) { in l2cap_chan_connect()
7325 struct hci_conn *hcon) in l2cap_global_fixed_chan() argument
7327 u8 src_type = bdaddr_src_type(hcon); in l2cap_global_fixed_chan()
7341 if (bacmp(&c->src, &hcon->src) && bacmp(&c->src, BDADDR_ANY)) in l2cap_global_fixed_chan()
7356 static void l2cap_connect_cfm(struct hci_conn *hcon, u8 status) in l2cap_connect_cfm() argument
7358 struct hci_dev *hdev = hcon->hdev; in l2cap_connect_cfm()
7363 if (hcon->type != ACL_LINK && hcon->type != LE_LINK) in l2cap_connect_cfm()
7366 BT_DBG("hcon %p bdaddr %pMR status %d", hcon, &hcon->dst, status); in l2cap_connect_cfm()
7369 l2cap_conn_del(hcon, bt_to_errno(status)); in l2cap_connect_cfm()
7373 conn = l2cap_conn_add(hcon); in l2cap_connect_cfm()
7377 dst_type = bdaddr_dst_type(hcon); in l2cap_connect_cfm()
7380 if (hci_bdaddr_list_lookup(&hdev->reject_list, &hcon->dst, dst_type)) in l2cap_connect_cfm()
7388 pchan = l2cap_global_fixed_chan(NULL, hcon); in l2cap_connect_cfm()
7399 bacpy(&chan->src, &hcon->src); in l2cap_connect_cfm()
7400 bacpy(&chan->dst, &hcon->dst); in l2cap_connect_cfm()
7401 chan->src_type = bdaddr_src_type(hcon); in l2cap_connect_cfm()
7409 next = l2cap_global_fixed_chan(pchan, hcon); in l2cap_connect_cfm()
7417 int l2cap_disconn_ind(struct hci_conn *hcon) in l2cap_disconn_ind() argument
7419 struct l2cap_conn *conn = hcon->l2cap_data; in l2cap_disconn_ind()
7421 BT_DBG("hcon %p", hcon); in l2cap_disconn_ind()
7428 static void l2cap_disconn_cfm(struct hci_conn *hcon, u8 reason) in l2cap_disconn_cfm() argument
7430 if (hcon->type != ACL_LINK && hcon->type != LE_LINK) in l2cap_disconn_cfm()
7433 BT_DBG("hcon %p reason %d", hcon, reason); in l2cap_disconn_cfm()
7435 l2cap_conn_del(hcon, bt_to_errno(reason)); in l2cap_disconn_cfm()
7455 static void l2cap_security_cfm(struct hci_conn *hcon, u8 status, u8 encrypt) in l2cap_security_cfm() argument
7457 struct l2cap_conn *conn = hcon->l2cap_data; in l2cap_security_cfm()
7474 chan->sec_level = hcon->sec_level; in l2cap_security_cfm()
7490 if (!status && l2cap_check_enc_key_size(hcon, chan)) in l2cap_security_cfm()
7500 if (!status && l2cap_check_enc_key_size(hcon, chan)) { in l2cap_security_cfm()
7625 struct hci_conn *hcon; in l2cap_recv_acldata() local
7632 hcon = hci_conn_hash_lookup_handle(hdev, handle); in l2cap_recv_acldata()
7633 if (!hcon) { in l2cap_recv_acldata()
7639 hci_conn_enter_active_mode(hcon, BT_POWER_FORCE_ACTIVE_OFF); in l2cap_recv_acldata()
7641 conn = hcon->l2cap_data; in l2cap_recv_acldata()
7644 conn = l2cap_conn_add(hcon); in l2cap_recv_acldata()
7647 hcon = NULL; in l2cap_recv_acldata()