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()
749 struct hci_conn *hcon = conn->hcon; in l2cap_conn_update_id_addr() local
756 bacpy(&chan->dst, &hcon->dst); in l2cap_conn_update_id_addr()
757 chan->dst_type = bdaddr_dst_type(hcon); in l2cap_conn_update_id_addr()
837 if (conn->hcon->type == ACL_LINK) in l2cap_chan_close()
839 else if (conn->hcon->type == LE_LINK) { in l2cap_chan_close()
924 if (conn->hcon->type == LE_LINK) in l2cap_chan_check_security()
925 return smp_conn_security(conn->hcon, chan->sec_level); in l2cap_chan_check_security()
929 return hci_conn_security(conn->hcon, chan->sec_level, auth_type, in l2cap_chan_check_security()
968 if (lmp_no_flush_capable(conn->hcon->hdev) || in l2cap_send_cmd()
969 conn->hcon->type == LE_LINK) in l2cap_send_cmd()
988 struct hci_conn *hcon = chan->conn->hcon; in l2cap_do_send() local
1007 if (hcon->type == LE_LINK || in l2cap_do_send()
1009 lmp_no_flush_capable(hcon->hdev))) in l2cap_do_send()
1490 if (!smp_conn_security(conn->hcon, chan->sec_level)) in l2cap_le_start()
1511 } else if (chan->conn->hcon->type == LE_LINK) { in l2cap_start_connection()
1536 static bool l2cap_check_enc_key_size(struct hci_conn *hcon) in l2cap_check_enc_key_size() argument
1547 int min_key_size = hcon->hdev->min_enc_key_size; in l2cap_check_enc_key_size()
1550 if (hcon->sec_level == BT_SECURITY_FIPS) in l2cap_check_enc_key_size()
1553 return (!test_bit(HCI_CONN_ENCRYPT, &hcon->flags) || in l2cap_check_enc_key_size()
1554 hcon->enc_key_size >= min_key_size); in l2cap_check_enc_key_size()
1561 if (conn->hcon->type == LE_LINK) { in l2cap_do_start()
1578 if (l2cap_check_enc_key_size(conn->hcon)) in l2cap_do_start()
1660 if (l2cap_check_enc_key_size(conn->hcon)) in l2cap_conn_start()
1710 struct hci_conn *hcon = conn->hcon; in l2cap_le_conn_ready() local
1711 struct hci_dev *hdev = hcon->hdev; in l2cap_le_conn_ready()
1718 if (hcon->out) in l2cap_le_conn_ready()
1719 smp_conn_security(hcon, hcon->pending_sec_level); in l2cap_le_conn_ready()
1726 if (hcon->role == HCI_ROLE_SLAVE && in l2cap_le_conn_ready()
1727 (hcon->le_conn_interval < hcon->le_conn_min_interval || in l2cap_le_conn_ready()
1728 hcon->le_conn_interval > hcon->le_conn_max_interval)) { in l2cap_le_conn_ready()
1731 req.min = cpu_to_le16(hcon->le_conn_min_interval); in l2cap_le_conn_ready()
1732 req.max = cpu_to_le16(hcon->le_conn_max_interval); in l2cap_le_conn_ready()
1733 req.latency = cpu_to_le16(hcon->le_conn_latency); in l2cap_le_conn_ready()
1734 req.to_multiplier = cpu_to_le16(hcon->le_supv_timeout); in l2cap_le_conn_ready()
1744 struct hci_conn *hcon = conn->hcon; in l2cap_conn_ready() local
1748 if (hcon->type == ACL_LINK) in l2cap_conn_ready()
1762 if (hcon->type == LE_LINK) { in l2cap_conn_ready()
1776 if (hcon->type == LE_LINK) in l2cap_conn_ready()
1779 queue_work(hcon->hdev->workqueue, &conn->pending_rx_work); in l2cap_conn_ready()
1825 struct hci_dev *hdev = conn->hcon->hdev; in l2cap_register_user()
1863 struct hci_dev *hdev = conn->hcon->hdev; in l2cap_unregister_user()
1889 static void l2cap_conn_del(struct hci_conn *hcon, int err) in l2cap_conn_del() argument
1891 struct l2cap_conn *conn = hcon->l2cap_data; in l2cap_conn_del()
1897 BT_DBG("hcon %p conn %p, err %d", hcon, conn, err); in l2cap_conn_del()
1915 hcon->disc_timeout = 0; in l2cap_conn_del()
1939 hcon->l2cap_data = NULL; in l2cap_conn_del()
1948 hci_conn_put(conn->hcon); in l2cap_conn_free()
3113 if (conn->hcon->type == LE_LINK) in l2cap_build_cmd()
3394 struct hci_conn *conn = chan->conn->hcon; in l2cap_mtu_auto()
4144 pchan = l2cap_global_chan_by_psm(BT_LISTEN, psm, &conn->hcon->src, in l2cap_connect()
4145 &conn->hcon->dst, ACL_LINK); in l2cap_connect()
4156 !hci_conn_check_link_mode(conn->hcon)) { in l2cap_connect()
4185 conn->hcon->disc_timeout = HCI_DISCONN_TIMEOUT; in l2cap_connect()
4187 bacpy(&chan->src, &conn->hcon->src); in l2cap_connect()
4188 bacpy(&chan->dst, &conn->hcon->dst); in l2cap_connect()
4189 chan->src_type = bdaddr_src_type(conn->hcon); in l2cap_connect()
4190 chan->dst_type = bdaddr_dst_type(conn->hcon); in l2cap_connect()
4275 struct hci_dev *hdev = conn->hcon->hdev; in l2cap_connect_req()
4276 struct hci_conn *hcon = conn->hcon; in l2cap_connect_req() local
4283 !test_and_set_bit(HCI_CONN_MGMT_CONNECTED, &hcon->flags)) in l2cap_connect_req()
4284 mgmt_device_connected(hdev, hcon, NULL, 0); in l2cap_connect_req()
4885 struct amp_mgr *mgr = conn->hcon->amp_mgr; in l2cap_create_channel_req()
4889 &conn->hcon->dst); in l2cap_create_channel_req()
5332 bacmp(&conn->hcon->src, &conn->hcon->dst) > 0) { in l2cap_move_channel_req()
5593 struct hci_conn *hcon = conn->hcon; in l2cap_conn_param_update_req() local
5599 if (hcon->role != HCI_ROLE_MASTER) in l2cap_conn_param_update_req()
5628 store_hint = hci_le_conn_update(hcon, min, max, latency, in l2cap_conn_param_update_req()
5630 mgmt_new_conn_param(hcon->hdev, &hcon->dst, hcon->dst_type, in l2cap_conn_param_update_req()
5644 struct hci_conn *hcon = conn->hcon; in l2cap_le_connect_rsp() local
5698 if (hcon->sec_level > BT_SECURITY_MEDIUM) { in l2cap_le_connect_rsp()
5703 sec_level = hcon->sec_level + 1; in l2cap_le_connect_rsp()
5710 smp_conn_security(hcon, chan->sec_level); in l2cap_le_connect_rsp()
5847 pchan = l2cap_global_chan_by_psm(BT_LISTEN, psm, &conn->hcon->src, in l2cap_le_connect_req()
5848 &conn->hcon->dst, LE_LINK); in l2cap_le_connect_req()
5858 if (!smp_sufficient_security(conn->hcon, pchan->sec_level, in l2cap_le_connect_req()
5885 bacpy(&chan->src, &conn->hcon->src); in l2cap_le_connect_req()
5886 bacpy(&chan->dst, &conn->hcon->dst); in l2cap_le_connect_req()
5887 chan->src_type = bdaddr_src_type(conn->hcon); in l2cap_le_connect_req()
5888 chan->dst_type = bdaddr_dst_type(conn->hcon); in l2cap_le_connect_req()
6051 pchan = l2cap_global_chan_by_psm(BT_LISTEN, psm, &conn->hcon->src, in l2cap_ecred_conn_req()
6052 &conn->hcon->dst, LE_LINK); in l2cap_ecred_conn_req()
6061 if (!smp_sufficient_security(conn->hcon, pchan->sec_level, in l2cap_ecred_conn_req()
6095 bacpy(&chan->src, &conn->hcon->src); in l2cap_ecred_conn_req()
6096 bacpy(&chan->dst, &conn->hcon->dst); in l2cap_ecred_conn_req()
6097 chan->src_type = bdaddr_src_type(conn->hcon); in l2cap_ecred_conn_req()
6098 chan->dst_type = bdaddr_dst_type(conn->hcon); in l2cap_ecred_conn_req()
6153 struct hci_conn *hcon = conn->hcon; in l2cap_ecred_conn_rsp() local
6219 if (hcon->sec_level > BT_SECURITY_MEDIUM) { in l2cap_ecred_conn_rsp()
6224 sec_level = hcon->sec_level + 1; in l2cap_ecred_conn_rsp()
6231 smp_conn_security(hcon, chan->sec_level); in l2cap_ecred_conn_rsp()
6457 struct hci_conn *hcon = conn->hcon; in l2cap_le_sig_channel() local
6462 if (hcon->type != LE_LINK) in l2cap_le_sig_channel()
6498 struct hci_conn *hcon = conn->hcon; in l2cap_sig_channel() local
6504 if (hcon->type != ACL_LINK) in l2cap_sig_channel()
7236 chan->conn->mtu = chan->conn->hcon->hdev->acl_mtu; in l2cap_finish_move()
7307 chan->conn->mtu = chan->conn->hcon->hdev->acl_mtu; in l2cap_rx_state_wait_f()
7732 struct hci_conn *hcon = conn->hcon; in l2cap_conless_channel() local
7735 if (hcon->type != ACL_LINK) in l2cap_conless_channel()
7738 chan = l2cap_global_chan_by_psm(0, psm, &hcon->src, &hcon->dst, in l2cap_conless_channel()
7752 bacpy(&bt_cb(skb)->l2cap.bdaddr, &hcon->dst); in l2cap_conless_channel()
7769 struct hci_conn *hcon = conn->hcon; in l2cap_recv_frame() local
7773 if (hcon->state != BT_CONNECTED) { in l2cap_recv_frame()
7791 if (hcon->type == LE_LINK && in l2cap_recv_frame()
7792 hci_bdaddr_list_lookup(&hcon->hdev->reject_list, &hcon->dst, in l2cap_recv_frame()
7793 bdaddr_dst_type(hcon))) { in l2cap_recv_frame()
7833 static struct l2cap_conn *l2cap_conn_add(struct hci_conn *hcon) in l2cap_conn_add() argument
7835 struct l2cap_conn *conn = hcon->l2cap_data; in l2cap_conn_add()
7841 hchan = hci_chan_create(hcon); in l2cap_conn_add()
7852 hcon->l2cap_data = conn; in l2cap_conn_add()
7853 conn->hcon = hci_conn_get(hcon); in l2cap_conn_add()
7856 BT_DBG("hcon %p conn %p hchan %p", hcon, conn, hchan); in l2cap_conn_add()
7858 switch (hcon->type) { in l2cap_conn_add()
7860 if (hcon->hdev->le_mtu) { in l2cap_conn_add()
7861 conn->mtu = hcon->hdev->le_mtu; in l2cap_conn_add()
7866 conn->mtu = hcon->hdev->acl_mtu; in l2cap_conn_add()
7874 if (hcon->type == ACL_LINK && in l2cap_conn_add()
7875 hci_dev_test_flag(hcon->hdev, HCI_HS_ENABLED)) in l2cap_conn_add()
7878 if (hci_dev_test_flag(hcon->hdev, HCI_LE_ENABLED) && in l2cap_conn_add()
7879 (bredr_sc_enabled(hcon->hdev) || in l2cap_conn_add()
7880 hci_dev_test_flag(hcon->hdev, HCI_FORCE_BREDR_SMP))) in l2cap_conn_add()
7943 struct hci_conn *hcon; in l2cap_chan_connect() local
8032 hcon = hci_connect_le(hdev, dst, dst_type, false, in l2cap_chan_connect()
8037 hcon = hci_connect_le_scan(hdev, dst, dst_type, in l2cap_chan_connect()
8044 hcon = hci_connect_acl(hdev, dst, chan->sec_level, auth_type, in l2cap_chan_connect()
8048 if (IS_ERR(hcon)) { in l2cap_chan_connect()
8049 err = PTR_ERR(hcon); in l2cap_chan_connect()
8053 conn = l2cap_conn_add(hcon); in l2cap_chan_connect()
8055 hci_conn_drop(hcon); in l2cap_chan_connect()
8071 hci_conn_drop(hcon); in l2cap_chan_connect()
8081 hci_conn_drop(hcon); in l2cap_chan_connect()
8087 bacpy(&chan->src, &hcon->src); in l2cap_chan_connect()
8088 chan->src_type = bdaddr_src_type(hcon); in l2cap_chan_connect()
8093 hci_conn_drop(hcon); in l2cap_chan_connect()
8105 if (hcon->state == BT_CONNECTED) { in l2cap_chan_connect()
8194 struct hci_conn *hcon) in l2cap_global_fixed_chan() argument
8196 u8 src_type = bdaddr_src_type(hcon); in l2cap_global_fixed_chan()
8210 if (bacmp(&c->src, &hcon->src) && bacmp(&c->src, BDADDR_ANY)) in l2cap_global_fixed_chan()
8225 static void l2cap_connect_cfm(struct hci_conn *hcon, u8 status) in l2cap_connect_cfm() argument
8227 struct hci_dev *hdev = hcon->hdev; in l2cap_connect_cfm()
8232 if (hcon->type != ACL_LINK && hcon->type != LE_LINK) in l2cap_connect_cfm()
8235 BT_DBG("hcon %p bdaddr %pMR status %d", hcon, &hcon->dst, status); in l2cap_connect_cfm()
8238 l2cap_conn_del(hcon, bt_to_errno(status)); in l2cap_connect_cfm()
8242 conn = l2cap_conn_add(hcon); in l2cap_connect_cfm()
8246 dst_type = bdaddr_dst_type(hcon); in l2cap_connect_cfm()
8249 if (hci_bdaddr_list_lookup(&hdev->reject_list, &hcon->dst, dst_type)) in l2cap_connect_cfm()
8257 pchan = l2cap_global_fixed_chan(NULL, hcon); in l2cap_connect_cfm()
8268 bacpy(&chan->src, &hcon->src); in l2cap_connect_cfm()
8269 bacpy(&chan->dst, &hcon->dst); in l2cap_connect_cfm()
8270 chan->src_type = bdaddr_src_type(hcon); in l2cap_connect_cfm()
8278 next = l2cap_global_fixed_chan(pchan, hcon); in l2cap_connect_cfm()
8286 int l2cap_disconn_ind(struct hci_conn *hcon) in l2cap_disconn_ind() argument
8288 struct l2cap_conn *conn = hcon->l2cap_data; in l2cap_disconn_ind()
8290 BT_DBG("hcon %p", hcon); in l2cap_disconn_ind()
8297 static void l2cap_disconn_cfm(struct hci_conn *hcon, u8 reason) in l2cap_disconn_cfm() argument
8299 if (hcon->type != ACL_LINK && hcon->type != LE_LINK) in l2cap_disconn_cfm()
8302 BT_DBG("hcon %p reason %d", hcon, reason); in l2cap_disconn_cfm()
8304 l2cap_conn_del(hcon, bt_to_errno(reason)); in l2cap_disconn_cfm()
8324 static void l2cap_security_cfm(struct hci_conn *hcon, u8 status, u8 encrypt) in l2cap_security_cfm() argument
8326 struct l2cap_conn *conn = hcon->l2cap_data; in l2cap_security_cfm()
8348 chan->sec_level = hcon->sec_level; in l2cap_security_cfm()
8364 if (!status && l2cap_check_enc_key_size(hcon)) in l2cap_security_cfm()
8374 if (!status && l2cap_check_enc_key_size(hcon)) { in l2cap_security_cfm()
8480 void l2cap_recv_acldata(struct hci_conn *hcon, struct sk_buff *skb, u16 flags) in l2cap_recv_acldata() argument
8482 struct l2cap_conn *conn = hcon->l2cap_data; in l2cap_recv_acldata()
8486 if (!conn && hcon->hdev->dev_type != HCI_PRIMARY) in l2cap_recv_acldata()
8490 conn = l2cap_conn_add(hcon); in l2cap_recv_acldata()