Lines Matching refs:hcon

79 static inline u8 bdaddr_src_type(struct hci_conn *hcon)  in bdaddr_src_type()  argument
81 return bdaddr_type(hcon->type, hcon->src_type); in bdaddr_src_type()
84 static inline u8 bdaddr_dst_type(struct hci_conn *hcon) in bdaddr_dst_type() argument
86 return bdaddr_type(hcon->type, hcon->dst_type); in bdaddr_dst_type()
248 if (conn->hcon->type == LE_LINK) in l2cap_alloc_cid()
541 if (conn->hcon->type == ACL_LINK) in __l2cap_chan_add()
575 hci_conn_hold(conn->hcon); in __l2cap_chan_add()
599 struct amp_mgr *mgr = conn->hcon->amp_mgr; in l2cap_chan_del()
613 hci_conn_drop(conn->hcon); in l2cap_chan_del()
662 struct hci_conn *hcon = conn->hcon; in l2cap_conn_update_id_addr() local
669 bacpy(&chan->dst, &hcon->dst); in l2cap_conn_update_id_addr()
670 chan->dst_type = bdaddr_dst_type(hcon); in l2cap_conn_update_id_addr()
743 if (conn->hcon->type == ACL_LINK) in l2cap_chan_close()
745 else if (conn->hcon->type == LE_LINK) in l2cap_chan_close()
821 if (conn->hcon->type == LE_LINK) in l2cap_chan_check_security()
822 return smp_conn_security(conn->hcon, chan->sec_level); in l2cap_chan_check_security()
826 return hci_conn_security(conn->hcon, chan->sec_level, auth_type, in l2cap_chan_check_security()
865 if (lmp_no_flush_capable(conn->hcon->hdev) || in l2cap_send_cmd()
866 conn->hcon->type == LE_LINK) in l2cap_send_cmd()
885 struct hci_conn *hcon = chan->conn->hcon; in l2cap_do_send() local
904 if (hcon->type == LE_LINK || in l2cap_do_send()
906 lmp_no_flush_capable(hcon->hdev))) in l2cap_do_send()
1301 if (!smp_conn_security(conn->hcon, chan->sec_level)) in l2cap_le_start()
1318 } else if (chan->conn->hcon->type == LE_LINK) { in l2cap_start_connection()
1347 if (conn->hcon->type == LE_LINK) { in l2cap_do_start()
1488 struct hci_conn *hcon = conn->hcon; in l2cap_le_conn_ready() local
1489 struct hci_dev *hdev = hcon->hdev; in l2cap_le_conn_ready()
1496 if (hcon->out) in l2cap_le_conn_ready()
1497 smp_conn_security(hcon, hcon->pending_sec_level); in l2cap_le_conn_ready()
1504 if (hcon->role == HCI_ROLE_SLAVE && in l2cap_le_conn_ready()
1505 (hcon->le_conn_interval < hcon->le_conn_min_interval || in l2cap_le_conn_ready()
1506 hcon->le_conn_interval > hcon->le_conn_max_interval)) { in l2cap_le_conn_ready()
1509 req.min = cpu_to_le16(hcon->le_conn_min_interval); in l2cap_le_conn_ready()
1510 req.max = cpu_to_le16(hcon->le_conn_max_interval); in l2cap_le_conn_ready()
1511 req.latency = cpu_to_le16(hcon->le_conn_latency); in l2cap_le_conn_ready()
1512 req.to_multiplier = cpu_to_le16(hcon->le_supv_timeout); in l2cap_le_conn_ready()
1522 struct hci_conn *hcon = conn->hcon; in l2cap_conn_ready() local
1526 if (hcon->type == ACL_LINK) in l2cap_conn_ready()
1540 if (hcon->type == LE_LINK) { in l2cap_conn_ready()
1554 if (hcon->type == LE_LINK) in l2cap_conn_ready()
1557 queue_work(hcon->hdev->workqueue, &conn->pending_rx_work); in l2cap_conn_ready()
1603 struct hci_dev *hdev = conn->hcon->hdev; in l2cap_register_user()
1641 struct hci_dev *hdev = conn->hcon->hdev; in l2cap_unregister_user()
1667 static void l2cap_conn_del(struct hci_conn *hcon, int err) in l2cap_conn_del() argument
1669 struct l2cap_conn *conn = hcon->l2cap_data; in l2cap_conn_del()
1675 BT_DBG("hcon %p conn %p, err %d", hcon, conn, err); in l2cap_conn_del()
1694 hcon->disc_timeout = 0; in l2cap_conn_del()
1718 hcon->l2cap_data = NULL; in l2cap_conn_del()
1727 hci_conn_put(conn->hcon); in l2cap_conn_free()
2914 if (conn->hcon->type == LE_LINK) in l2cap_build_cmd()
3798 pchan = l2cap_global_chan_by_psm(BT_LISTEN, psm, &conn->hcon->src, in l2cap_connect()
3799 &conn->hcon->dst, ACL_LINK); in l2cap_connect()
3810 !hci_conn_check_link_mode(conn->hcon)) { in l2cap_connect()
3831 conn->hcon->disc_timeout = HCI_DISCONN_TIMEOUT; in l2cap_connect()
3833 bacpy(&chan->src, &conn->hcon->src); in l2cap_connect()
3834 bacpy(&chan->dst, &conn->hcon->dst); in l2cap_connect()
3835 chan->src_type = bdaddr_src_type(conn->hcon); in l2cap_connect()
3836 chan->dst_type = bdaddr_dst_type(conn->hcon); in l2cap_connect()
3921 struct hci_dev *hdev = conn->hcon->hdev; in l2cap_connect_req()
3922 struct hci_conn *hcon = conn->hcon; in l2cap_connect_req() local
3929 !test_and_set_bit(HCI_CONN_MGMT_CONNECTED, &hcon->flags)) in l2cap_connect_req()
3930 mgmt_device_connected(hdev, hcon, 0, NULL, 0); in l2cap_connect_req()
4511 struct amp_mgr *mgr = conn->hcon->amp_mgr; in l2cap_create_channel_req()
4515 &conn->hcon->dst); in l2cap_create_channel_req()
4960 bacmp(&conn->hcon->src, &conn->hcon->dst) > 0) { in l2cap_move_channel_req()
5217 struct hci_conn *hcon = conn->hcon; in l2cap_conn_param_update_req() local
5223 if (hcon->role != HCI_ROLE_MASTER) in l2cap_conn_param_update_req()
5252 store_hint = hci_le_conn_update(hcon, min, max, latency, in l2cap_conn_param_update_req()
5254 mgmt_new_conn_param(hcon->hdev, &hcon->dst, hcon->dst_type, in l2cap_conn_param_update_req()
5268 struct hci_conn *hcon = conn->hcon; in l2cap_le_connect_rsp() local
5322 if (hcon->sec_level > BT_SECURITY_MEDIUM) { in l2cap_le_connect_rsp()
5327 sec_level = hcon->sec_level + 1; in l2cap_le_connect_rsp()
5334 smp_conn_security(hcon, chan->sec_level); in l2cap_le_connect_rsp()
5458 pchan = l2cap_global_chan_by_psm(BT_LISTEN, psm, &conn->hcon->src, in l2cap_le_connect_req()
5459 &conn->hcon->dst, LE_LINK); in l2cap_le_connect_req()
5469 if (!smp_sufficient_security(conn->hcon, pchan->sec_level, in l2cap_le_connect_req()
5498 bacpy(&chan->src, &conn->hcon->src); in l2cap_le_connect_req()
5499 bacpy(&chan->dst, &conn->hcon->dst); in l2cap_le_connect_req()
5500 chan->src_type = bdaddr_src_type(conn->hcon); in l2cap_le_connect_req()
5501 chan->dst_type = bdaddr_dst_type(conn->hcon); in l2cap_le_connect_req()
5677 struct hci_conn *hcon = conn->hcon; in l2cap_le_sig_channel() local
5682 if (hcon->type != LE_LINK) in l2cap_le_sig_channel()
5718 struct hci_conn *hcon = conn->hcon; in l2cap_sig_channel() local
5726 if (hcon->type != ACL_LINK) in l2cap_sig_channel()
6441 chan->conn->mtu = chan->conn->hcon->hdev->acl_mtu; in l2cap_finish_move()
6512 chan->conn->mtu = chan->conn->hcon->hdev->acl_mtu; in l2cap_rx_state_wait_f()
6889 struct hci_conn *hcon = conn->hcon; in l2cap_conless_channel() local
6892 if (hcon->type != ACL_LINK) in l2cap_conless_channel()
6895 chan = l2cap_global_chan_by_psm(0, psm, &hcon->src, &hcon->dst, in l2cap_conless_channel()
6909 bacpy(&bt_cb(skb)->l2cap.bdaddr, &hcon->dst); in l2cap_conless_channel()
6926 struct hci_conn *hcon = conn->hcon; in l2cap_recv_frame() local
6930 if (hcon->state != BT_CONNECTED) { in l2cap_recv_frame()
6948 if (hcon->type == LE_LINK && in l2cap_recv_frame()
6949 hci_bdaddr_list_lookup(&hcon->hdev->blacklist, &hcon->dst, in l2cap_recv_frame()
6950 bdaddr_dst_type(hcon))) { in l2cap_recv_frame()
6990 static struct l2cap_conn *l2cap_conn_add(struct hci_conn *hcon) in l2cap_conn_add() argument
6992 struct l2cap_conn *conn = hcon->l2cap_data; in l2cap_conn_add()
6998 hchan = hci_chan_create(hcon); in l2cap_conn_add()
7009 hcon->l2cap_data = conn; in l2cap_conn_add()
7010 conn->hcon = hci_conn_get(hcon); in l2cap_conn_add()
7013 BT_DBG("hcon %p conn %p hchan %p", hcon, conn, hchan); in l2cap_conn_add()
7015 switch (hcon->type) { in l2cap_conn_add()
7017 if (hcon->hdev->le_mtu) { in l2cap_conn_add()
7018 conn->mtu = hcon->hdev->le_mtu; in l2cap_conn_add()
7023 conn->mtu = hcon->hdev->acl_mtu; in l2cap_conn_add()
7031 if (hcon->type == ACL_LINK && in l2cap_conn_add()
7032 hci_dev_test_flag(hcon->hdev, HCI_HS_ENABLED)) in l2cap_conn_add()
7035 if (hci_dev_test_flag(hcon->hdev, HCI_LE_ENABLED) && in l2cap_conn_add()
7036 (bredr_sc_enabled(hcon->hdev) || in l2cap_conn_add()
7037 hci_dev_test_flag(hcon->hdev, HCI_FORCE_BREDR_SMP))) in l2cap_conn_add()
7072 struct hci_conn *hcon; in l2cap_chan_connect() local
7156 hcon = hci_connect_le(hdev, dst, dst_type, in l2cap_chan_connect()
7161 hcon = hci_connect_le_scan(hdev, dst, dst_type, in l2cap_chan_connect()
7167 hcon = hci_connect_acl(hdev, dst, chan->sec_level, auth_type); in l2cap_chan_connect()
7170 if (IS_ERR(hcon)) { in l2cap_chan_connect()
7171 err = PTR_ERR(hcon); in l2cap_chan_connect()
7175 conn = l2cap_conn_add(hcon); in l2cap_chan_connect()
7177 hci_conn_drop(hcon); in l2cap_chan_connect()
7186 hci_conn_drop(hcon); in l2cap_chan_connect()
7192 bacpy(&chan->src, &hcon->src); in l2cap_chan_connect()
7193 chan->src_type = bdaddr_src_type(hcon); in l2cap_chan_connect()
7198 hci_conn_drop(hcon); in l2cap_chan_connect()
7210 if (hcon->state == BT_CONNECTED) { in l2cap_chan_connect()
7267 struct hci_conn *hcon) in l2cap_global_fixed_chan() argument
7269 u8 src_type = bdaddr_src_type(hcon); in l2cap_global_fixed_chan()
7283 if (bacmp(&c->src, &hcon->src) && bacmp(&c->src, BDADDR_ANY)) in l2cap_global_fixed_chan()
7298 static void l2cap_connect_cfm(struct hci_conn *hcon, u8 status) in l2cap_connect_cfm() argument
7300 struct hci_dev *hdev = hcon->hdev; in l2cap_connect_cfm()
7305 if (hcon->type != ACL_LINK && hcon->type != LE_LINK) in l2cap_connect_cfm()
7308 BT_DBG("hcon %p bdaddr %pMR status %d", hcon, &hcon->dst, status); in l2cap_connect_cfm()
7311 l2cap_conn_del(hcon, bt_to_errno(status)); in l2cap_connect_cfm()
7315 conn = l2cap_conn_add(hcon); in l2cap_connect_cfm()
7319 dst_type = bdaddr_dst_type(hcon); in l2cap_connect_cfm()
7322 if (hci_bdaddr_list_lookup(&hdev->blacklist, &hcon->dst, dst_type)) in l2cap_connect_cfm()
7330 pchan = l2cap_global_fixed_chan(NULL, hcon); in l2cap_connect_cfm()
7341 bacpy(&chan->src, &hcon->src); in l2cap_connect_cfm()
7342 bacpy(&chan->dst, &hcon->dst); in l2cap_connect_cfm()
7343 chan->src_type = bdaddr_src_type(hcon); in l2cap_connect_cfm()
7351 next = l2cap_global_fixed_chan(pchan, hcon); in l2cap_connect_cfm()
7359 int l2cap_disconn_ind(struct hci_conn *hcon) in l2cap_disconn_ind() argument
7361 struct l2cap_conn *conn = hcon->l2cap_data; in l2cap_disconn_ind()
7363 BT_DBG("hcon %p", hcon); in l2cap_disconn_ind()
7370 static void l2cap_disconn_cfm(struct hci_conn *hcon, u8 reason) in l2cap_disconn_cfm() argument
7372 if (hcon->type != ACL_LINK && hcon->type != LE_LINK) in l2cap_disconn_cfm()
7375 BT_DBG("hcon %p reason %d", hcon, reason); in l2cap_disconn_cfm()
7377 l2cap_conn_del(hcon, bt_to_errno(reason)); in l2cap_disconn_cfm()
7397 static void l2cap_security_cfm(struct hci_conn *hcon, u8 status, u8 encrypt) in l2cap_security_cfm() argument
7399 struct l2cap_conn *conn = hcon->l2cap_data; in l2cap_security_cfm()
7421 chan->sec_level = hcon->sec_level; in l2cap_security_cfm()
7488 void l2cap_recv_acldata(struct hci_conn *hcon, struct sk_buff *skb, u16 flags) in l2cap_recv_acldata() argument
7490 struct l2cap_conn *conn = hcon->l2cap_data; in l2cap_recv_acldata()
7495 if (!conn && hcon->hdev->dev_type != HCI_PRIMARY) in l2cap_recv_acldata()
7499 conn = l2cap_conn_add(hcon); in l2cap_recv_acldata()