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()
237 if (conn->hcon->type == LE_LINK) in l2cap_alloc_cid()
530 if (conn->hcon->type == ACL_LINK) in __l2cap_chan_add()
564 hci_conn_hold(conn->hcon); in __l2cap_chan_add()
588 struct amp_mgr *mgr = conn->hcon->amp_mgr; in l2cap_chan_del()
602 hci_conn_drop(conn->hcon); in l2cap_chan_del()
651 struct hci_conn *hcon = conn->hcon; in l2cap_conn_update_id_addr() local
658 bacpy(&chan->dst, &hcon->dst); in l2cap_conn_update_id_addr()
659 chan->dst_type = bdaddr_dst_type(hcon); in l2cap_conn_update_id_addr()
732 if (conn->hcon->type == ACL_LINK) in l2cap_chan_close()
734 else if (conn->hcon->type == LE_LINK) in l2cap_chan_close()
810 if (conn->hcon->type == LE_LINK) in l2cap_chan_check_security()
811 return smp_conn_security(conn->hcon, chan->sec_level); in l2cap_chan_check_security()
815 return hci_conn_security(conn->hcon, chan->sec_level, auth_type, in l2cap_chan_check_security()
854 if (lmp_no_flush_capable(conn->hcon->hdev) || in l2cap_send_cmd()
855 conn->hcon->type == LE_LINK) in l2cap_send_cmd()
874 struct hci_conn *hcon = chan->conn->hcon; in l2cap_do_send() local
893 if (hcon->type == LE_LINK || in l2cap_do_send()
895 lmp_no_flush_capable(hcon->hdev))) in l2cap_do_send()
1290 if (!smp_conn_security(conn->hcon, chan->sec_level)) in l2cap_le_start()
1307 } else if (chan->conn->hcon->type == LE_LINK) { in l2cap_start_connection()
1336 if (conn->hcon->type == LE_LINK) { in l2cap_do_start()
1477 struct hci_conn *hcon = conn->hcon; in l2cap_le_conn_ready() local
1478 struct hci_dev *hdev = hcon->hdev; in l2cap_le_conn_ready()
1485 if (hcon->out) in l2cap_le_conn_ready()
1486 smp_conn_security(hcon, hcon->pending_sec_level); in l2cap_le_conn_ready()
1493 if (hcon->role == HCI_ROLE_SLAVE && in l2cap_le_conn_ready()
1494 (hcon->le_conn_interval < hcon->le_conn_min_interval || in l2cap_le_conn_ready()
1495 hcon->le_conn_interval > hcon->le_conn_max_interval)) { in l2cap_le_conn_ready()
1498 req.min = cpu_to_le16(hcon->le_conn_min_interval); in l2cap_le_conn_ready()
1499 req.max = cpu_to_le16(hcon->le_conn_max_interval); in l2cap_le_conn_ready()
1500 req.latency = cpu_to_le16(hcon->le_conn_latency); in l2cap_le_conn_ready()
1501 req.to_multiplier = cpu_to_le16(hcon->le_supv_timeout); in l2cap_le_conn_ready()
1511 struct hci_conn *hcon = conn->hcon; in l2cap_conn_ready() local
1515 if (hcon->type == ACL_LINK) in l2cap_conn_ready()
1529 if (hcon->type == LE_LINK) { in l2cap_conn_ready()
1543 if (hcon->type == LE_LINK) in l2cap_conn_ready()
1546 queue_work(hcon->hdev->workqueue, &conn->pending_rx_work); in l2cap_conn_ready()
1592 struct hci_dev *hdev = conn->hcon->hdev; in l2cap_register_user()
1630 struct hci_dev *hdev = conn->hcon->hdev; in l2cap_unregister_user()
1660 static void l2cap_conn_del(struct hci_conn *hcon, int err) in l2cap_conn_del() argument
1662 struct l2cap_conn *conn = hcon->l2cap_data; in l2cap_conn_del()
1668 BT_DBG("hcon %p conn %p, err %d", hcon, conn, err); in l2cap_conn_del()
1687 hcon->disc_timeout = 0; in l2cap_conn_del()
1711 hcon->l2cap_data = NULL; in l2cap_conn_del()
1720 hci_conn_put(conn->hcon); in l2cap_conn_free()
2897 if (conn->hcon->type == LE_LINK) in l2cap_build_cmd()
3773 pchan = l2cap_global_chan_by_psm(BT_LISTEN, psm, &conn->hcon->src, in l2cap_connect()
3774 &conn->hcon->dst, ACL_LINK); in l2cap_connect()
3785 !hci_conn_check_link_mode(conn->hcon)) { in l2cap_connect()
3806 conn->hcon->disc_timeout = HCI_DISCONN_TIMEOUT; in l2cap_connect()
3808 bacpy(&chan->src, &conn->hcon->src); in l2cap_connect()
3809 bacpy(&chan->dst, &conn->hcon->dst); in l2cap_connect()
3810 chan->src_type = bdaddr_src_type(conn->hcon); in l2cap_connect()
3811 chan->dst_type = bdaddr_dst_type(conn->hcon); in l2cap_connect()
3896 struct hci_dev *hdev = conn->hcon->hdev; in l2cap_connect_req()
3897 struct hci_conn *hcon = conn->hcon; in l2cap_connect_req() local
3904 !test_and_set_bit(HCI_CONN_MGMT_CONNECTED, &hcon->flags)) in l2cap_connect_req()
3905 mgmt_device_connected(hdev, hcon, 0, NULL, 0); in l2cap_connect_req()
4486 struct amp_mgr *mgr = conn->hcon->amp_mgr; in l2cap_create_channel_req()
4490 &conn->hcon->dst); in l2cap_create_channel_req()
4935 bacmp(&conn->hcon->src, &conn->hcon->dst) > 0) { in l2cap_move_channel_req()
5192 struct hci_conn *hcon = conn->hcon; in l2cap_conn_param_update_req() local
5198 if (hcon->role != HCI_ROLE_MASTER) in l2cap_conn_param_update_req()
5227 store_hint = hci_le_conn_update(hcon, min, max, latency, in l2cap_conn_param_update_req()
5229 mgmt_new_conn_param(hcon->hdev, &hcon->dst, hcon->dst_type, in l2cap_conn_param_update_req()
5243 struct hci_conn *hcon = conn->hcon; in l2cap_le_connect_rsp() local
5290 if (hcon->sec_level > BT_SECURITY_MEDIUM) { in l2cap_le_connect_rsp()
5295 sec_level = hcon->sec_level + 1; in l2cap_le_connect_rsp()
5302 smp_conn_security(hcon, chan->sec_level); in l2cap_le_connect_rsp()
5426 pchan = l2cap_global_chan_by_psm(BT_LISTEN, psm, &conn->hcon->src, in l2cap_le_connect_req()
5427 &conn->hcon->dst, LE_LINK); in l2cap_le_connect_req()
5437 if (!smp_sufficient_security(conn->hcon, pchan->sec_level, in l2cap_le_connect_req()
5459 bacpy(&chan->src, &conn->hcon->src); in l2cap_le_connect_req()
5460 bacpy(&chan->dst, &conn->hcon->dst); in l2cap_le_connect_req()
5461 chan->src_type = bdaddr_src_type(conn->hcon); in l2cap_le_connect_req()
5462 chan->dst_type = bdaddr_dst_type(conn->hcon); in l2cap_le_connect_req()
5640 struct hci_conn *hcon = conn->hcon; in l2cap_le_sig_channel() local
5645 if (hcon->type != LE_LINK) in l2cap_le_sig_channel()
5681 struct hci_conn *hcon = conn->hcon; in l2cap_sig_channel() local
5689 if (hcon->type != ACL_LINK) in l2cap_sig_channel()
6401 chan->conn->mtu = chan->conn->hcon->hdev->acl_mtu; in l2cap_finish_move()
6472 chan->conn->mtu = chan->conn->hcon->hdev->acl_mtu; in l2cap_rx_state_wait_f()
6847 struct hci_conn *hcon = conn->hcon; in l2cap_conless_channel() local
6850 if (hcon->type != ACL_LINK) in l2cap_conless_channel()
6853 chan = l2cap_global_chan_by_psm(0, psm, &hcon->src, &hcon->dst, in l2cap_conless_channel()
6867 bacpy(&bt_cb(skb)->l2cap.bdaddr, &hcon->dst); in l2cap_conless_channel()
6884 struct hci_conn *hcon = conn->hcon; in l2cap_recv_frame() local
6888 if (hcon->state != BT_CONNECTED) { in l2cap_recv_frame()
6906 if (hcon->type == LE_LINK && in l2cap_recv_frame()
6907 hci_bdaddr_list_lookup(&hcon->hdev->blacklist, &hcon->dst, in l2cap_recv_frame()
6908 bdaddr_dst_type(hcon))) { in l2cap_recv_frame()
6948 static struct l2cap_conn *l2cap_conn_add(struct hci_conn *hcon) in l2cap_conn_add() argument
6950 struct l2cap_conn *conn = hcon->l2cap_data; in l2cap_conn_add()
6956 hchan = hci_chan_create(hcon); in l2cap_conn_add()
6967 hcon->l2cap_data = conn; in l2cap_conn_add()
6968 conn->hcon = hci_conn_get(hcon); in l2cap_conn_add()
6971 BT_DBG("hcon %p conn %p hchan %p", hcon, conn, hchan); in l2cap_conn_add()
6973 switch (hcon->type) { in l2cap_conn_add()
6975 if (hcon->hdev->le_mtu) { in l2cap_conn_add()
6976 conn->mtu = hcon->hdev->le_mtu; in l2cap_conn_add()
6981 conn->mtu = hcon->hdev->acl_mtu; in l2cap_conn_add()
6989 if (hcon->type == ACL_LINK && in l2cap_conn_add()
6990 hci_dev_test_flag(hcon->hdev, HCI_HS_ENABLED)) in l2cap_conn_add()
6993 if (hci_dev_test_flag(hcon->hdev, HCI_LE_ENABLED) && in l2cap_conn_add()
6994 (bredr_sc_enabled(hcon->hdev) || in l2cap_conn_add()
6995 hci_dev_test_flag(hcon->hdev, HCI_FORCE_BREDR_SMP))) in l2cap_conn_add()
7030 struct hci_conn *hcon; in l2cap_chan_connect() local
7120 hcon = hci_connect_le(hdev, dst, dst_type, chan->sec_level, in l2cap_chan_connect()
7124 hcon = hci_connect_acl(hdev, dst, chan->sec_level, auth_type); in l2cap_chan_connect()
7127 if (IS_ERR(hcon)) { in l2cap_chan_connect()
7128 err = PTR_ERR(hcon); in l2cap_chan_connect()
7132 conn = l2cap_conn_add(hcon); in l2cap_chan_connect()
7134 hci_conn_drop(hcon); in l2cap_chan_connect()
7143 hci_conn_drop(hcon); in l2cap_chan_connect()
7149 bacpy(&chan->src, &hcon->src); in l2cap_chan_connect()
7150 chan->src_type = bdaddr_src_type(hcon); in l2cap_chan_connect()
7155 hci_conn_drop(hcon); in l2cap_chan_connect()
7167 if (hcon->state == BT_CONNECTED) { in l2cap_chan_connect()
7224 struct hci_conn *hcon) in l2cap_global_fixed_chan() argument
7226 u8 src_type = bdaddr_src_type(hcon); in l2cap_global_fixed_chan()
7240 if (bacmp(&c->src, &hcon->src) && bacmp(&c->src, BDADDR_ANY)) in l2cap_global_fixed_chan()
7255 static void l2cap_connect_cfm(struct hci_conn *hcon, u8 status) in l2cap_connect_cfm() argument
7257 struct hci_dev *hdev = hcon->hdev; in l2cap_connect_cfm()
7262 if (hcon->type != ACL_LINK && hcon->type != LE_LINK) in l2cap_connect_cfm()
7265 BT_DBG("hcon %p bdaddr %pMR status %d", hcon, &hcon->dst, status); in l2cap_connect_cfm()
7268 l2cap_conn_del(hcon, bt_to_errno(status)); in l2cap_connect_cfm()
7272 conn = l2cap_conn_add(hcon); in l2cap_connect_cfm()
7276 dst_type = bdaddr_dst_type(hcon); in l2cap_connect_cfm()
7279 if (hci_bdaddr_list_lookup(&hdev->blacklist, &hcon->dst, dst_type)) in l2cap_connect_cfm()
7287 pchan = l2cap_global_fixed_chan(NULL, hcon); in l2cap_connect_cfm()
7298 bacpy(&chan->src, &hcon->src); in l2cap_connect_cfm()
7299 bacpy(&chan->dst, &hcon->dst); in l2cap_connect_cfm()
7300 chan->src_type = bdaddr_src_type(hcon); in l2cap_connect_cfm()
7308 next = l2cap_global_fixed_chan(pchan, hcon); in l2cap_connect_cfm()
7316 int l2cap_disconn_ind(struct hci_conn *hcon) in l2cap_disconn_ind() argument
7318 struct l2cap_conn *conn = hcon->l2cap_data; in l2cap_disconn_ind()
7320 BT_DBG("hcon %p", hcon); in l2cap_disconn_ind()
7327 static void l2cap_disconn_cfm(struct hci_conn *hcon, u8 reason) in l2cap_disconn_cfm() argument
7329 if (hcon->type != ACL_LINK && hcon->type != LE_LINK) in l2cap_disconn_cfm()
7332 BT_DBG("hcon %p reason %d", hcon, reason); in l2cap_disconn_cfm()
7334 l2cap_conn_del(hcon, bt_to_errno(reason)); in l2cap_disconn_cfm()
7354 static void l2cap_security_cfm(struct hci_conn *hcon, u8 status, u8 encrypt) in l2cap_security_cfm() argument
7356 struct l2cap_conn *conn = hcon->l2cap_data; in l2cap_security_cfm()
7378 chan->sec_level = hcon->sec_level; in l2cap_security_cfm()
7445 int l2cap_recv_acldata(struct hci_conn *hcon, struct sk_buff *skb, u16 flags) in l2cap_recv_acldata() argument
7447 struct l2cap_conn *conn = hcon->l2cap_data; in l2cap_recv_acldata()
7452 if (!conn && hcon->hdev->dev_type != HCI_BREDR) in l2cap_recv_acldata()
7456 conn = l2cap_conn_add(hcon); in l2cap_recv_acldata()