Lines Matching refs:hcon
80 static inline u8 bdaddr_src_type(struct hci_conn *hcon) in bdaddr_src_type() argument
82 return bdaddr_type(hcon->type, hcon->src_type); in bdaddr_src_type()
85 static inline u8 bdaddr_dst_type(struct hci_conn *hcon) in bdaddr_dst_type() argument
87 return bdaddr_type(hcon->type, hcon->dst_type); in bdaddr_dst_type()
270 if (conn->hcon->type == LE_LINK) in l2cap_alloc_cid()
596 if (conn->hcon->type == ACL_LINK) in __l2cap_chan_add()
630 hci_conn_hold(conn->hcon); in __l2cap_chan_add()
654 struct amp_mgr *mgr = conn->hcon->amp_mgr; in l2cap_chan_del()
668 hci_conn_drop(conn->hcon); in l2cap_chan_del()
738 struct hci_conn *hcon = conn->hcon; in l2cap_conn_update_id_addr() local
745 bacpy(&chan->dst, &hcon->dst); in l2cap_conn_update_id_addr()
746 chan->dst_type = bdaddr_dst_type(hcon); in l2cap_conn_update_id_addr()
840 if (conn->hcon->type == ACL_LINK) in l2cap_chan_close()
842 else if (conn->hcon->type == LE_LINK) { in l2cap_chan_close()
927 if (conn->hcon->type == LE_LINK) in l2cap_chan_check_security()
928 return smp_conn_security(conn->hcon, chan->sec_level); in l2cap_chan_check_security()
932 return hci_conn_security(conn->hcon, chan->sec_level, auth_type, in l2cap_chan_check_security()
971 if (lmp_no_flush_capable(conn->hcon->hdev) || in l2cap_send_cmd()
972 conn->hcon->type == LE_LINK) in l2cap_send_cmd()
991 struct hci_conn *hcon = chan->conn->hcon; in l2cap_do_send() local
1010 if (hcon->type == LE_LINK || in l2cap_do_send()
1012 lmp_no_flush_capable(hcon->hdev))) in l2cap_do_send()
1493 if (!smp_conn_security(conn->hcon, chan->sec_level)) in l2cap_le_start()
1514 } else if (chan->conn->hcon->type == LE_LINK) { in l2cap_start_connection()
1539 static bool l2cap_check_enc_key_size(struct hci_conn *hcon) in l2cap_check_enc_key_size() argument
1550 int min_key_size = hcon->hdev->min_enc_key_size; in l2cap_check_enc_key_size()
1553 if (hcon->sec_level == BT_SECURITY_FIPS) in l2cap_check_enc_key_size()
1556 return (!test_bit(HCI_CONN_ENCRYPT, &hcon->flags) || in l2cap_check_enc_key_size()
1557 hcon->enc_key_size >= min_key_size); in l2cap_check_enc_key_size()
1564 if (conn->hcon->type == LE_LINK) { in l2cap_do_start()
1581 if (l2cap_check_enc_key_size(conn->hcon)) in l2cap_do_start()
1663 if (l2cap_check_enc_key_size(conn->hcon)) in l2cap_conn_start()
1713 struct hci_conn *hcon = conn->hcon; in l2cap_le_conn_ready() local
1714 struct hci_dev *hdev = hcon->hdev; in l2cap_le_conn_ready()
1721 if (hcon->out) in l2cap_le_conn_ready()
1722 smp_conn_security(hcon, hcon->pending_sec_level); in l2cap_le_conn_ready()
1729 if (hcon->role == HCI_ROLE_SLAVE && in l2cap_le_conn_ready()
1730 (hcon->le_conn_interval < hcon->le_conn_min_interval || in l2cap_le_conn_ready()
1731 hcon->le_conn_interval > hcon->le_conn_max_interval)) { in l2cap_le_conn_ready()
1734 req.min = cpu_to_le16(hcon->le_conn_min_interval); in l2cap_le_conn_ready()
1735 req.max = cpu_to_le16(hcon->le_conn_max_interval); in l2cap_le_conn_ready()
1736 req.latency = cpu_to_le16(hcon->le_conn_latency); in l2cap_le_conn_ready()
1737 req.to_multiplier = cpu_to_le16(hcon->le_supv_timeout); in l2cap_le_conn_ready()
1747 struct hci_conn *hcon = conn->hcon; in l2cap_conn_ready() local
1751 if (hcon->type == ACL_LINK) in l2cap_conn_ready()
1765 if (hcon->type == LE_LINK) { in l2cap_conn_ready()
1779 if (hcon->type == LE_LINK) in l2cap_conn_ready()
1782 queue_work(hcon->hdev->workqueue, &conn->pending_rx_work); in l2cap_conn_ready()
1828 struct hci_dev *hdev = conn->hcon->hdev; in l2cap_register_user()
1866 struct hci_dev *hdev = conn->hcon->hdev; in l2cap_unregister_user()
1892 static void l2cap_conn_del(struct hci_conn *hcon, int err) in l2cap_conn_del() argument
1894 struct l2cap_conn *conn = hcon->l2cap_data; in l2cap_conn_del()
1900 BT_DBG("hcon %p conn %p, err %d", hcon, conn, err); in l2cap_conn_del()
1919 hcon->disc_timeout = 0; in l2cap_conn_del()
1943 hcon->l2cap_data = NULL; in l2cap_conn_del()
1952 hci_conn_put(conn->hcon); in l2cap_conn_free()
3141 if (conn->hcon->type == LE_LINK) in l2cap_build_cmd()
3422 struct hci_conn *conn = chan->conn->hcon; in l2cap_mtu_auto()
4129 pchan = l2cap_global_chan_by_psm(BT_LISTEN, psm, &conn->hcon->src, in l2cap_connect()
4130 &conn->hcon->dst, ACL_LINK); in l2cap_connect()
4141 !hci_conn_check_link_mode(conn->hcon)) { in l2cap_connect()
4170 conn->hcon->disc_timeout = HCI_DISCONN_TIMEOUT; in l2cap_connect()
4172 bacpy(&chan->src, &conn->hcon->src); in l2cap_connect()
4173 bacpy(&chan->dst, &conn->hcon->dst); in l2cap_connect()
4174 chan->src_type = bdaddr_src_type(conn->hcon); in l2cap_connect()
4175 chan->dst_type = bdaddr_dst_type(conn->hcon); in l2cap_connect()
4260 struct hci_dev *hdev = conn->hcon->hdev; in l2cap_connect_req()
4261 struct hci_conn *hcon = conn->hcon; in l2cap_connect_req() local
4268 !test_and_set_bit(HCI_CONN_MGMT_CONNECTED, &hcon->flags)) in l2cap_connect_req()
4269 mgmt_device_connected(hdev, hcon, NULL, 0); in l2cap_connect_req()
4870 struct amp_mgr *mgr = conn->hcon->amp_mgr; in l2cap_create_channel_req()
4874 &conn->hcon->dst); in l2cap_create_channel_req()
5317 bacmp(&conn->hcon->src, &conn->hcon->dst) > 0) { in l2cap_move_channel_req()
5578 struct hci_conn *hcon = conn->hcon; in l2cap_conn_param_update_req() local
5584 if (hcon->role != HCI_ROLE_MASTER) in l2cap_conn_param_update_req()
5613 store_hint = hci_le_conn_update(hcon, min, max, latency, in l2cap_conn_param_update_req()
5615 mgmt_new_conn_param(hcon->hdev, &hcon->dst, hcon->dst_type, in l2cap_conn_param_update_req()
5629 struct hci_conn *hcon = conn->hcon; in l2cap_le_connect_rsp() local
5683 if (hcon->sec_level > BT_SECURITY_MEDIUM) { in l2cap_le_connect_rsp()
5688 sec_level = hcon->sec_level + 1; in l2cap_le_connect_rsp()
5695 smp_conn_security(hcon, chan->sec_level); in l2cap_le_connect_rsp()
5832 pchan = l2cap_global_chan_by_psm(BT_LISTEN, psm, &conn->hcon->src, in l2cap_le_connect_req()
5833 &conn->hcon->dst, LE_LINK); in l2cap_le_connect_req()
5843 if (!smp_sufficient_security(conn->hcon, pchan->sec_level, in l2cap_le_connect_req()
5870 bacpy(&chan->src, &conn->hcon->src); in l2cap_le_connect_req()
5871 bacpy(&chan->dst, &conn->hcon->dst); in l2cap_le_connect_req()
5872 chan->src_type = bdaddr_src_type(conn->hcon); in l2cap_le_connect_req()
5873 chan->dst_type = bdaddr_dst_type(conn->hcon); in l2cap_le_connect_req()
6036 pchan = l2cap_global_chan_by_psm(BT_LISTEN, psm, &conn->hcon->src, in l2cap_ecred_conn_req()
6037 &conn->hcon->dst, LE_LINK); in l2cap_ecred_conn_req()
6046 if (!smp_sufficient_security(conn->hcon, pchan->sec_level, in l2cap_ecred_conn_req()
6080 bacpy(&chan->src, &conn->hcon->src); in l2cap_ecred_conn_req()
6081 bacpy(&chan->dst, &conn->hcon->dst); in l2cap_ecred_conn_req()
6082 chan->src_type = bdaddr_src_type(conn->hcon); in l2cap_ecred_conn_req()
6083 chan->dst_type = bdaddr_dst_type(conn->hcon); in l2cap_ecred_conn_req()
6137 struct hci_conn *hcon = conn->hcon; in l2cap_ecred_conn_rsp() local
6203 if (hcon->sec_level > BT_SECURITY_MEDIUM) { in l2cap_ecred_conn_rsp()
6208 sec_level = hcon->sec_level + 1; in l2cap_ecred_conn_rsp()
6215 smp_conn_security(hcon, chan->sec_level); in l2cap_ecred_conn_rsp()
6436 struct hci_conn *hcon = conn->hcon; in l2cap_le_sig_channel() local
6441 if (hcon->type != LE_LINK) in l2cap_le_sig_channel()
6477 struct hci_conn *hcon = conn->hcon; in l2cap_sig_channel() local
6483 if (hcon->type != ACL_LINK) in l2cap_sig_channel()
7215 chan->conn->mtu = chan->conn->hcon->hdev->acl_mtu; in l2cap_finish_move()
7286 chan->conn->mtu = chan->conn->hcon->hdev->acl_mtu; in l2cap_rx_state_wait_f()
7711 struct hci_conn *hcon = conn->hcon; in l2cap_conless_channel() local
7714 if (hcon->type != ACL_LINK) in l2cap_conless_channel()
7717 chan = l2cap_global_chan_by_psm(0, psm, &hcon->src, &hcon->dst, in l2cap_conless_channel()
7731 bacpy(&bt_cb(skb)->l2cap.bdaddr, &hcon->dst); in l2cap_conless_channel()
7748 struct hci_conn *hcon = conn->hcon; in l2cap_recv_frame() local
7752 if (hcon->state != BT_CONNECTED) { in l2cap_recv_frame()
7770 if (hcon->type == LE_LINK && in l2cap_recv_frame()
7771 hci_bdaddr_list_lookup(&hcon->hdev->reject_list, &hcon->dst, in l2cap_recv_frame()
7772 bdaddr_dst_type(hcon))) { in l2cap_recv_frame()
7812 static struct l2cap_conn *l2cap_conn_add(struct hci_conn *hcon) in l2cap_conn_add() argument
7814 struct l2cap_conn *conn = hcon->l2cap_data; in l2cap_conn_add()
7820 hchan = hci_chan_create(hcon); in l2cap_conn_add()
7831 hcon->l2cap_data = conn; in l2cap_conn_add()
7832 conn->hcon = hci_conn_get(hcon); in l2cap_conn_add()
7835 BT_DBG("hcon %p conn %p hchan %p", hcon, conn, hchan); in l2cap_conn_add()
7837 switch (hcon->type) { in l2cap_conn_add()
7839 if (hcon->hdev->le_mtu) { in l2cap_conn_add()
7840 conn->mtu = hcon->hdev->le_mtu; in l2cap_conn_add()
7845 conn->mtu = hcon->hdev->acl_mtu; in l2cap_conn_add()
7853 if (hcon->type == ACL_LINK && in l2cap_conn_add()
7854 hci_dev_test_flag(hcon->hdev, HCI_HS_ENABLED)) in l2cap_conn_add()
7857 if (hci_dev_test_flag(hcon->hdev, HCI_LE_ENABLED) && in l2cap_conn_add()
7858 (bredr_sc_enabled(hcon->hdev) || in l2cap_conn_add()
7859 hci_dev_test_flag(hcon->hdev, HCI_FORCE_BREDR_SMP))) in l2cap_conn_add()
7922 struct hci_conn *hcon; in l2cap_chan_connect() local
8011 hcon = hci_connect_le(hdev, dst, dst_type, false, in l2cap_chan_connect()
8016 hcon = hci_connect_le_scan(hdev, dst, dst_type, in l2cap_chan_connect()
8023 hcon = hci_connect_acl(hdev, dst, chan->sec_level, auth_type, in l2cap_chan_connect()
8027 if (IS_ERR(hcon)) { in l2cap_chan_connect()
8028 err = PTR_ERR(hcon); in l2cap_chan_connect()
8032 conn = l2cap_conn_add(hcon); in l2cap_chan_connect()
8034 hci_conn_drop(hcon); in l2cap_chan_connect()
8050 hci_conn_drop(hcon); in l2cap_chan_connect()
8060 hci_conn_drop(hcon); in l2cap_chan_connect()
8066 bacpy(&chan->src, &hcon->src); in l2cap_chan_connect()
8067 chan->src_type = bdaddr_src_type(hcon); in l2cap_chan_connect()
8072 hci_conn_drop(hcon); in l2cap_chan_connect()
8084 if (hcon->state == BT_CONNECTED) { in l2cap_chan_connect()
8173 struct hci_conn *hcon) in l2cap_global_fixed_chan() argument
8175 u8 src_type = bdaddr_src_type(hcon); in l2cap_global_fixed_chan()
8189 if (bacmp(&c->src, &hcon->src) && bacmp(&c->src, BDADDR_ANY)) in l2cap_global_fixed_chan()
8204 static void l2cap_connect_cfm(struct hci_conn *hcon, u8 status) in l2cap_connect_cfm() argument
8206 struct hci_dev *hdev = hcon->hdev; in l2cap_connect_cfm()
8211 if (hcon->type != ACL_LINK && hcon->type != LE_LINK) in l2cap_connect_cfm()
8214 BT_DBG("hcon %p bdaddr %pMR status %d", hcon, &hcon->dst, status); in l2cap_connect_cfm()
8217 l2cap_conn_del(hcon, bt_to_errno(status)); in l2cap_connect_cfm()
8221 conn = l2cap_conn_add(hcon); in l2cap_connect_cfm()
8225 dst_type = bdaddr_dst_type(hcon); in l2cap_connect_cfm()
8228 if (hci_bdaddr_list_lookup(&hdev->reject_list, &hcon->dst, dst_type)) in l2cap_connect_cfm()
8236 pchan = l2cap_global_fixed_chan(NULL, hcon); in l2cap_connect_cfm()
8247 bacpy(&chan->src, &hcon->src); in l2cap_connect_cfm()
8248 bacpy(&chan->dst, &hcon->dst); in l2cap_connect_cfm()
8249 chan->src_type = bdaddr_src_type(hcon); in l2cap_connect_cfm()
8257 next = l2cap_global_fixed_chan(pchan, hcon); in l2cap_connect_cfm()
8265 int l2cap_disconn_ind(struct hci_conn *hcon) in l2cap_disconn_ind() argument
8267 struct l2cap_conn *conn = hcon->l2cap_data; in l2cap_disconn_ind()
8269 BT_DBG("hcon %p", hcon); in l2cap_disconn_ind()
8276 static void l2cap_disconn_cfm(struct hci_conn *hcon, u8 reason) in l2cap_disconn_cfm() argument
8278 if (hcon->type != ACL_LINK && hcon->type != LE_LINK) in l2cap_disconn_cfm()
8281 BT_DBG("hcon %p reason %d", hcon, reason); in l2cap_disconn_cfm()
8283 l2cap_conn_del(hcon, bt_to_errno(reason)); in l2cap_disconn_cfm()
8303 static void l2cap_security_cfm(struct hci_conn *hcon, u8 status, u8 encrypt) in l2cap_security_cfm() argument
8305 struct l2cap_conn *conn = hcon->l2cap_data; in l2cap_security_cfm()
8327 chan->sec_level = hcon->sec_level; in l2cap_security_cfm()
8343 if (!status && l2cap_check_enc_key_size(hcon)) in l2cap_security_cfm()
8353 if (!status && l2cap_check_enc_key_size(hcon)) { in l2cap_security_cfm()
8459 void l2cap_recv_acldata(struct hci_conn *hcon, struct sk_buff *skb, u16 flags) in l2cap_recv_acldata() argument
8461 struct l2cap_conn *conn = hcon->l2cap_data; in l2cap_recv_acldata()
8465 if (!conn && hcon->hdev->dev_type != HCI_PRIMARY) in l2cap_recv_acldata()
8469 conn = l2cap_conn_add(hcon); in l2cap_recv_acldata()