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()
599 if (conn->hcon->type == ACL_LINK) in __l2cap_chan_add()
633 hci_conn_hold(conn->hcon); in __l2cap_chan_add()
671 hci_conn_drop(conn->hcon); in l2cap_chan_del()
742 struct hci_conn *hcon = conn->hcon; in l2cap_conn_update_id_addr() local
749 bacpy(&chan->dst, &hcon->dst); in l2cap_conn_update_id_addr()
750 chan->dst_type = bdaddr_dst_type(hcon); in l2cap_conn_update_id_addr()
830 if (conn->hcon->type == ACL_LINK) in l2cap_chan_close()
832 else if (conn->hcon->type == LE_LINK) { in l2cap_chan_close()
917 if (conn->hcon->type == LE_LINK) in l2cap_chan_check_security()
918 return smp_conn_security(conn->hcon, chan->sec_level); in l2cap_chan_check_security()
922 return hci_conn_security(conn->hcon, chan->sec_level, auth_type, in l2cap_chan_check_security()
952 if (hci_conn_valid(conn->hcon->hdev, conn->hcon)) in l2cap_send_acl()
971 if (lmp_no_flush_capable(conn->hcon->hdev) || in l2cap_send_cmd()
972 conn->hcon->type == LE_LINK) in l2cap_send_cmd()
985 struct hci_conn *hcon = chan->conn->hcon; in l2cap_do_send() local
995 if (hcon->type == LE_LINK || in l2cap_do_send()
997 lmp_no_flush_capable(hcon->hdev))) in l2cap_do_send()
1371 if (!smp_conn_security(conn->hcon, chan->sec_level)) in l2cap_le_start()
1389 if (chan->conn->hcon->type == LE_LINK) { in l2cap_start_connection()
1414 static bool l2cap_check_enc_key_size(struct hci_conn *hcon, in l2cap_check_enc_key_size() argument
1426 int min_key_size = hcon->hdev->min_enc_key_size; in l2cap_check_enc_key_size()
1432 return (!test_bit(HCI_CONN_ENCRYPT, &hcon->flags) || in l2cap_check_enc_key_size()
1433 hcon->enc_key_size >= min_key_size); in l2cap_check_enc_key_size()
1440 if (conn->hcon->type == LE_LINK) { in l2cap_do_start()
1457 if (l2cap_check_enc_key_size(conn->hcon, chan)) in l2cap_do_start()
1532 if (l2cap_check_enc_key_size(conn->hcon, chan)) in l2cap_conn_start()
1580 struct hci_conn *hcon = conn->hcon; in l2cap_le_conn_ready() local
1581 struct hci_dev *hdev = hcon->hdev; in l2cap_le_conn_ready()
1588 if (hcon->out) in l2cap_le_conn_ready()
1589 smp_conn_security(hcon, hcon->pending_sec_level); in l2cap_le_conn_ready()
1596 if (hcon->role == HCI_ROLE_SLAVE && in l2cap_le_conn_ready()
1597 (hcon->le_conn_interval < hcon->le_conn_min_interval || in l2cap_le_conn_ready()
1598 hcon->le_conn_interval > hcon->le_conn_max_interval)) { in l2cap_le_conn_ready()
1601 req.min = cpu_to_le16(hcon->le_conn_min_interval); in l2cap_le_conn_ready()
1602 req.max = cpu_to_le16(hcon->le_conn_max_interval); in l2cap_le_conn_ready()
1603 req.latency = cpu_to_le16(hcon->le_conn_latency); in l2cap_le_conn_ready()
1604 req.to_multiplier = cpu_to_le16(hcon->le_supv_timeout); in l2cap_le_conn_ready()
1614 struct hci_conn *hcon = conn->hcon; in l2cap_conn_ready() local
1618 if (hcon->type == ACL_LINK) in l2cap_conn_ready()
1627 if (hcon->type == LE_LINK) { in l2cap_conn_ready()
1641 if (hcon->type == LE_LINK) in l2cap_conn_ready()
1644 queue_work(hcon->hdev->workqueue, &conn->pending_rx_work); in l2cap_conn_ready()
1688 struct hci_dev *hdev = conn->hcon->hdev; in l2cap_register_user()
1726 struct hci_dev *hdev = conn->hcon->hdev; in l2cap_unregister_user()
1752 static void l2cap_conn_del(struct hci_conn *hcon, int err) in l2cap_conn_del() argument
1754 struct l2cap_conn *conn = hcon->l2cap_data; in l2cap_conn_del()
1760 BT_DBG("hcon %p conn %p, err %d", hcon, conn, err); in l2cap_conn_del()
1780 hcon->disc_timeout = 0; in l2cap_conn_del()
1801 hcon->l2cap_data = NULL; in l2cap_conn_del()
1810 hci_conn_put(conn->hcon); in l2cap_conn_free()
2996 if (conn->hcon->type == LE_LINK) in l2cap_build_cmd()
3239 struct hci_conn *conn = chan->conn->hcon; in l2cap_mtu_auto()
3984 pchan = l2cap_global_chan_by_psm(BT_LISTEN, psm, &conn->hcon->src, in l2cap_connect()
3985 &conn->hcon->dst, ACL_LINK); in l2cap_connect()
3995 (!hci_conn_check_link_mode(conn->hcon) || in l2cap_connect()
3996 !l2cap_check_enc_key_size(conn->hcon, pchan))) { in l2cap_connect()
4025 conn->hcon->disc_timeout = HCI_DISCONN_TIMEOUT; in l2cap_connect()
4027 bacpy(&chan->src, &conn->hcon->src); in l2cap_connect()
4028 bacpy(&chan->dst, &conn->hcon->dst); in l2cap_connect()
4029 chan->src_type = bdaddr_src_type(conn->hcon); in l2cap_connect()
4030 chan->dst_type = bdaddr_dst_type(conn->hcon); in l2cap_connect()
4635 struct hci_conn *hcon = conn->hcon; in l2cap_conn_param_update_req() local
4641 if (hcon->role != HCI_ROLE_MASTER) in l2cap_conn_param_update_req()
4670 store_hint = hci_le_conn_update(hcon, min, max, latency, in l2cap_conn_param_update_req()
4672 mgmt_new_conn_param(hcon->hdev, &hcon->dst, hcon->dst_type, in l2cap_conn_param_update_req()
4686 struct hci_conn *hcon = conn->hcon; in l2cap_le_connect_rsp() local
4736 if (hcon->sec_level > BT_SECURITY_MEDIUM) { in l2cap_le_connect_rsp()
4741 sec_level = hcon->sec_level + 1; in l2cap_le_connect_rsp()
4748 smp_conn_security(hcon, chan->sec_level); in l2cap_le_connect_rsp()
4861 pchan = l2cap_global_chan_by_psm(BT_LISTEN, psm, &conn->hcon->src, in l2cap_le_connect_req()
4862 &conn->hcon->dst, LE_LINK); in l2cap_le_connect_req()
4871 if (!smp_sufficient_security(conn->hcon, pchan->sec_level, in l2cap_le_connect_req()
4898 bacpy(&chan->src, &conn->hcon->src); in l2cap_le_connect_req()
4899 bacpy(&chan->dst, &conn->hcon->dst); in l2cap_le_connect_req()
4900 chan->src_type = bdaddr_src_type(conn->hcon); in l2cap_le_connect_req()
4901 chan->dst_type = bdaddr_dst_type(conn->hcon); in l2cap_le_connect_req()
5060 pchan = l2cap_global_chan_by_psm(BT_LISTEN, psm, &conn->hcon->src, in l2cap_ecred_conn_req()
5061 &conn->hcon->dst, LE_LINK); in l2cap_ecred_conn_req()
5069 if (!smp_sufficient_security(conn->hcon, pchan->sec_level, in l2cap_ecred_conn_req()
5103 bacpy(&chan->src, &conn->hcon->src); in l2cap_ecred_conn_req()
5104 bacpy(&chan->dst, &conn->hcon->dst); in l2cap_ecred_conn_req()
5105 chan->src_type = bdaddr_src_type(conn->hcon); in l2cap_ecred_conn_req()
5106 chan->dst_type = bdaddr_dst_type(conn->hcon); in l2cap_ecred_conn_req()
5160 struct hci_conn *hcon = conn->hcon; in l2cap_ecred_conn_rsp() local
5224 if (hcon->sec_level > BT_SECURITY_MEDIUM) { in l2cap_ecred_conn_rsp()
5229 sec_level = hcon->sec_level + 1; in l2cap_ecred_conn_rsp()
5236 smp_conn_security(hcon, chan->sec_level); in l2cap_ecred_conn_rsp()
5457 struct hci_conn *hcon = conn->hcon; in l2cap_le_sig_channel() local
5462 if (hcon->type != LE_LINK) in l2cap_le_sig_channel()
5506 struct hci_conn *hcon = conn->hcon; in l2cap_sig_channel() local
5512 if (hcon->type != ACL_LINK) in l2cap_sig_channel()
6242 chan->conn->mtu = chan->conn->hcon->mtu; in l2cap_finish_move()
6309 chan->conn->mtu = chan->conn->hcon->mtu; in l2cap_rx_state_wait_f()
6741 struct hci_conn *hcon = conn->hcon; in l2cap_conless_channel() local
6744 if (hcon->type != ACL_LINK) in l2cap_conless_channel()
6747 chan = l2cap_global_chan_by_psm(0, psm, &hcon->src, &hcon->dst, in l2cap_conless_channel()
6763 bacpy(&bt_cb(skb)->l2cap.bdaddr, &hcon->dst); in l2cap_conless_channel()
6782 struct hci_conn *hcon = conn->hcon; in l2cap_recv_frame() local
6786 if (hcon->state != BT_CONNECTED) { in l2cap_recv_frame()
6804 if (hcon->type == LE_LINK && in l2cap_recv_frame()
6805 hci_bdaddr_list_lookup(&hcon->hdev->reject_list, &hcon->dst, in l2cap_recv_frame()
6806 bdaddr_dst_type(hcon))) { in l2cap_recv_frame()
6850 static struct l2cap_conn *l2cap_conn_add(struct hci_conn *hcon) in l2cap_conn_add() argument
6852 struct l2cap_conn *conn = hcon->l2cap_data; in l2cap_conn_add()
6858 hchan = hci_chan_create(hcon); in l2cap_conn_add()
6869 hcon->l2cap_data = conn; in l2cap_conn_add()
6870 conn->hcon = hci_conn_get(hcon); in l2cap_conn_add()
6873 BT_DBG("hcon %p conn %p hchan %p", hcon, conn, hchan); in l2cap_conn_add()
6875 conn->mtu = hcon->mtu; in l2cap_conn_add()
6880 if (hci_dev_test_flag(hcon->hdev, HCI_LE_ENABLED) && in l2cap_conn_add()
6881 (bredr_sc_enabled(hcon->hdev) || in l2cap_conn_add()
6882 hci_dev_test_flag(hcon->hdev, HCI_FORCE_BREDR_SMP))) in l2cap_conn_add()
6945 struct hci_conn *hcon; in l2cap_chan_connect() local
7034 hcon = hci_connect_le(hdev, dst, dst_type, false, in l2cap_chan_connect()
7038 hcon = hci_connect_le_scan(hdev, dst, dst_type, in l2cap_chan_connect()
7044 hcon = hci_connect_acl(hdev, dst, chan->sec_level, auth_type, in l2cap_chan_connect()
7048 if (IS_ERR(hcon)) { in l2cap_chan_connect()
7049 err = PTR_ERR(hcon); in l2cap_chan_connect()
7053 conn = l2cap_conn_add(hcon); in l2cap_chan_connect()
7055 hci_conn_drop(hcon); in l2cap_chan_connect()
7071 hci_conn_drop(hcon); in l2cap_chan_connect()
7081 hci_conn_drop(hcon); in l2cap_chan_connect()
7087 bacpy(&chan->src, &hcon->src); in l2cap_chan_connect()
7088 chan->src_type = bdaddr_src_type(hcon); in l2cap_chan_connect()
7093 hci_conn_drop(hcon); in l2cap_chan_connect()
7105 if (hcon->state == BT_CONNECTED) { in l2cap_chan_connect()
7191 struct hci_conn *hcon) in l2cap_global_fixed_chan() argument
7193 u8 src_type = bdaddr_src_type(hcon); in l2cap_global_fixed_chan()
7207 if (bacmp(&c->src, &hcon->src) && bacmp(&c->src, BDADDR_ANY)) in l2cap_global_fixed_chan()
7222 static void l2cap_connect_cfm(struct hci_conn *hcon, u8 status) in l2cap_connect_cfm() argument
7224 struct hci_dev *hdev = hcon->hdev; in l2cap_connect_cfm()
7229 if (hcon->type != ACL_LINK && hcon->type != LE_LINK) in l2cap_connect_cfm()
7232 BT_DBG("hcon %p bdaddr %pMR status %d", hcon, &hcon->dst, status); in l2cap_connect_cfm()
7235 l2cap_conn_del(hcon, bt_to_errno(status)); in l2cap_connect_cfm()
7239 conn = l2cap_conn_add(hcon); in l2cap_connect_cfm()
7243 dst_type = bdaddr_dst_type(hcon); in l2cap_connect_cfm()
7246 if (hci_bdaddr_list_lookup(&hdev->reject_list, &hcon->dst, dst_type)) in l2cap_connect_cfm()
7254 pchan = l2cap_global_fixed_chan(NULL, hcon); in l2cap_connect_cfm()
7265 bacpy(&chan->src, &hcon->src); in l2cap_connect_cfm()
7266 bacpy(&chan->dst, &hcon->dst); in l2cap_connect_cfm()
7267 chan->src_type = bdaddr_src_type(hcon); in l2cap_connect_cfm()
7275 next = l2cap_global_fixed_chan(pchan, hcon); in l2cap_connect_cfm()
7283 int l2cap_disconn_ind(struct hci_conn *hcon) in l2cap_disconn_ind() argument
7285 struct l2cap_conn *conn = hcon->l2cap_data; in l2cap_disconn_ind()
7287 BT_DBG("hcon %p", hcon); in l2cap_disconn_ind()
7294 static void l2cap_disconn_cfm(struct hci_conn *hcon, u8 reason) in l2cap_disconn_cfm() argument
7296 if (hcon->type != ACL_LINK && hcon->type != LE_LINK) in l2cap_disconn_cfm()
7299 BT_DBG("hcon %p reason %d", hcon, reason); in l2cap_disconn_cfm()
7301 l2cap_conn_del(hcon, bt_to_errno(reason)); in l2cap_disconn_cfm()
7321 static void l2cap_security_cfm(struct hci_conn *hcon, u8 status, u8 encrypt) in l2cap_security_cfm() argument
7323 struct l2cap_conn *conn = hcon->l2cap_data; in l2cap_security_cfm()
7340 chan->sec_level = hcon->sec_level; in l2cap_security_cfm()
7356 if (!status && l2cap_check_enc_key_size(hcon, chan)) in l2cap_security_cfm()
7366 if (!status && l2cap_check_enc_key_size(hcon, chan)) { in l2cap_security_cfm()
7488 void l2cap_recv_acldata(struct hci_conn *hcon, struct sk_buff *skb, u16 flags) in l2cap_recv_acldata() argument
7494 hci_dev_lock(hcon->hdev); in l2cap_recv_acldata()
7496 conn = hcon->l2cap_data; in l2cap_recv_acldata()
7499 conn = l2cap_conn_add(hcon); in l2cap_recv_acldata()
7503 hci_dev_unlock(hcon->hdev); in l2cap_recv_acldata()