Lines Matching refs:hcon
77 static inline u8 bdaddr_src_type(struct hci_conn *hcon) in bdaddr_src_type() argument
79 return bdaddr_type(hcon->type, hcon->src_type); in bdaddr_src_type()
82 static inline u8 bdaddr_dst_type(struct hci_conn *hcon) in bdaddr_dst_type() argument
84 return bdaddr_type(hcon->type, hcon->dst_type); in bdaddr_dst_type()
254 if (conn->hcon->type == LE_LINK) in l2cap_alloc_cid()
567 if (conn->hcon->type == ACL_LINK) in __l2cap_chan_add()
601 hci_conn_hold(conn->hcon); in __l2cap_chan_add()
625 struct amp_mgr *mgr = conn->hcon->amp_mgr; in l2cap_chan_del()
639 hci_conn_drop(conn->hcon); in l2cap_chan_del()
709 struct hci_conn *hcon = conn->hcon; in l2cap_conn_update_id_addr() local
716 bacpy(&chan->dst, &hcon->dst); in l2cap_conn_update_id_addr()
717 chan->dst_type = bdaddr_dst_type(hcon); in l2cap_conn_update_id_addr()
811 if (conn->hcon->type == ACL_LINK) in l2cap_chan_close()
813 else if (conn->hcon->type == LE_LINK) { in l2cap_chan_close()
898 if (conn->hcon->type == LE_LINK) in l2cap_chan_check_security()
899 return smp_conn_security(conn->hcon, chan->sec_level); in l2cap_chan_check_security()
903 return hci_conn_security(conn->hcon, chan->sec_level, auth_type, in l2cap_chan_check_security()
942 if (lmp_no_flush_capable(conn->hcon->hdev) || in l2cap_send_cmd()
943 conn->hcon->type == LE_LINK) in l2cap_send_cmd()
962 struct hci_conn *hcon = chan->conn->hcon; in l2cap_do_send() local
981 if (hcon->type == LE_LINK || in l2cap_do_send()
983 lmp_no_flush_capable(hcon->hdev))) in l2cap_do_send()
1463 if (!smp_conn_security(conn->hcon, chan->sec_level)) in l2cap_le_start()
1484 } else if (chan->conn->hcon->type == LE_LINK) { in l2cap_start_connection()
1509 static bool l2cap_check_enc_key_size(struct hci_conn *hcon) in l2cap_check_enc_key_size() argument
1520 int min_key_size = hcon->hdev->min_enc_key_size; in l2cap_check_enc_key_size()
1523 if (hcon->sec_level == BT_SECURITY_FIPS) in l2cap_check_enc_key_size()
1526 return (!test_bit(HCI_CONN_ENCRYPT, &hcon->flags) || in l2cap_check_enc_key_size()
1527 hcon->enc_key_size >= min_key_size); in l2cap_check_enc_key_size()
1534 if (conn->hcon->type == LE_LINK) { in l2cap_do_start()
1551 if (l2cap_check_enc_key_size(conn->hcon)) in l2cap_do_start()
1633 if (l2cap_check_enc_key_size(conn->hcon)) in l2cap_conn_start()
1683 struct hci_conn *hcon = conn->hcon; in l2cap_le_conn_ready() local
1684 struct hci_dev *hdev = hcon->hdev; in l2cap_le_conn_ready()
1691 if (hcon->out) in l2cap_le_conn_ready()
1692 smp_conn_security(hcon, hcon->pending_sec_level); in l2cap_le_conn_ready()
1699 if (hcon->role == HCI_ROLE_SLAVE && in l2cap_le_conn_ready()
1700 (hcon->le_conn_interval < hcon->le_conn_min_interval || in l2cap_le_conn_ready()
1701 hcon->le_conn_interval > hcon->le_conn_max_interval)) { in l2cap_le_conn_ready()
1704 req.min = cpu_to_le16(hcon->le_conn_min_interval); in l2cap_le_conn_ready()
1705 req.max = cpu_to_le16(hcon->le_conn_max_interval); in l2cap_le_conn_ready()
1706 req.latency = cpu_to_le16(hcon->le_conn_latency); in l2cap_le_conn_ready()
1707 req.to_multiplier = cpu_to_le16(hcon->le_supv_timeout); in l2cap_le_conn_ready()
1717 struct hci_conn *hcon = conn->hcon; in l2cap_conn_ready() local
1721 if (hcon->type == ACL_LINK) in l2cap_conn_ready()
1735 if (hcon->type == LE_LINK) { in l2cap_conn_ready()
1749 if (hcon->type == LE_LINK) in l2cap_conn_ready()
1752 queue_work(hcon->hdev->workqueue, &conn->pending_rx_work); in l2cap_conn_ready()
1798 struct hci_dev *hdev = conn->hcon->hdev; in l2cap_register_user()
1836 struct hci_dev *hdev = conn->hcon->hdev; in l2cap_unregister_user()
1862 static void l2cap_conn_del(struct hci_conn *hcon, int err) in l2cap_conn_del() argument
1864 struct l2cap_conn *conn = hcon->l2cap_data; in l2cap_conn_del()
1870 BT_DBG("hcon %p conn %p, err %d", hcon, conn, err); in l2cap_conn_del()
1889 hcon->disc_timeout = 0; in l2cap_conn_del()
1913 hcon->l2cap_data = NULL; in l2cap_conn_del()
1922 hci_conn_put(conn->hcon); in l2cap_conn_free()
3109 if (conn->hcon->type == LE_LINK) in l2cap_build_cmd()
3394 struct hci_conn *conn = chan->conn->hcon; in l2cap_mtu_auto()
4100 pchan = l2cap_global_chan_by_psm(BT_LISTEN, psm, &conn->hcon->src, in l2cap_connect()
4101 &conn->hcon->dst, ACL_LINK); in l2cap_connect()
4112 !hci_conn_check_link_mode(conn->hcon)) { in l2cap_connect()
4141 conn->hcon->disc_timeout = HCI_DISCONN_TIMEOUT; in l2cap_connect()
4143 bacpy(&chan->src, &conn->hcon->src); in l2cap_connect()
4144 bacpy(&chan->dst, &conn->hcon->dst); in l2cap_connect()
4145 chan->src_type = bdaddr_src_type(conn->hcon); in l2cap_connect()
4146 chan->dst_type = bdaddr_dst_type(conn->hcon); in l2cap_connect()
4231 struct hci_dev *hdev = conn->hcon->hdev; in l2cap_connect_req()
4232 struct hci_conn *hcon = conn->hcon; in l2cap_connect_req() local
4239 !test_and_set_bit(HCI_CONN_MGMT_CONNECTED, &hcon->flags)) in l2cap_connect_req()
4240 mgmt_device_connected(hdev, hcon, NULL, 0); in l2cap_connect_req()
4831 struct amp_mgr *mgr = conn->hcon->amp_mgr; in l2cap_create_channel_req()
4835 &conn->hcon->dst); in l2cap_create_channel_req()
5278 bacmp(&conn->hcon->src, &conn->hcon->dst) > 0) { in l2cap_move_channel_req()
5534 struct hci_conn *hcon = conn->hcon; in l2cap_conn_param_update_req() local
5540 if (hcon->role != HCI_ROLE_MASTER) in l2cap_conn_param_update_req()
5569 store_hint = hci_le_conn_update(hcon, min, max, latency, in l2cap_conn_param_update_req()
5571 mgmt_new_conn_param(hcon->hdev, &hcon->dst, hcon->dst_type, in l2cap_conn_param_update_req()
5585 struct hci_conn *hcon = conn->hcon; in l2cap_le_connect_rsp() local
5639 if (hcon->sec_level > BT_SECURITY_MEDIUM) { in l2cap_le_connect_rsp()
5644 sec_level = hcon->sec_level + 1; in l2cap_le_connect_rsp()
5651 smp_conn_security(hcon, chan->sec_level); in l2cap_le_connect_rsp()
5775 pchan = l2cap_global_chan_by_psm(BT_LISTEN, psm, &conn->hcon->src, in l2cap_le_connect_req()
5776 &conn->hcon->dst, LE_LINK); in l2cap_le_connect_req()
5786 if (!smp_sufficient_security(conn->hcon, pchan->sec_level, in l2cap_le_connect_req()
5813 bacpy(&chan->src, &conn->hcon->src); in l2cap_le_connect_req()
5814 bacpy(&chan->dst, &conn->hcon->dst); in l2cap_le_connect_req()
5815 chan->src_type = bdaddr_src_type(conn->hcon); in l2cap_le_connect_req()
5816 chan->dst_type = bdaddr_dst_type(conn->hcon); in l2cap_le_connect_req()
5966 pchan = l2cap_global_chan_by_psm(BT_LISTEN, psm, &conn->hcon->src, in l2cap_ecred_conn_req()
5967 &conn->hcon->dst, LE_LINK); in l2cap_ecred_conn_req()
5976 if (!smp_sufficient_security(conn->hcon, pchan->sec_level, in l2cap_ecred_conn_req()
6010 bacpy(&chan->src, &conn->hcon->src); in l2cap_ecred_conn_req()
6011 bacpy(&chan->dst, &conn->hcon->dst); in l2cap_ecred_conn_req()
6012 chan->src_type = bdaddr_src_type(conn->hcon); in l2cap_ecred_conn_req()
6013 chan->dst_type = bdaddr_dst_type(conn->hcon); in l2cap_ecred_conn_req()
6067 struct hci_conn *hcon = conn->hcon; in l2cap_ecred_conn_rsp() local
6133 if (hcon->sec_level > BT_SECURITY_MEDIUM) { in l2cap_ecred_conn_rsp()
6138 sec_level = hcon->sec_level + 1; in l2cap_ecred_conn_rsp()
6145 smp_conn_security(hcon, chan->sec_level); in l2cap_ecred_conn_rsp()
6366 struct hci_conn *hcon = conn->hcon; in l2cap_le_sig_channel() local
6371 if (hcon->type != LE_LINK) in l2cap_le_sig_channel()
6407 struct hci_conn *hcon = conn->hcon; in l2cap_sig_channel() local
6413 if (hcon->type != ACL_LINK) in l2cap_sig_channel()
7127 chan->conn->mtu = chan->conn->hcon->hdev->acl_mtu; in l2cap_finish_move()
7198 chan->conn->mtu = chan->conn->hcon->hdev->acl_mtu; in l2cap_rx_state_wait_f()
7605 struct hci_conn *hcon = conn->hcon; in l2cap_conless_channel() local
7608 if (hcon->type != ACL_LINK) in l2cap_conless_channel()
7611 chan = l2cap_global_chan_by_psm(0, psm, &hcon->src, &hcon->dst, in l2cap_conless_channel()
7625 bacpy(&bt_cb(skb)->l2cap.bdaddr, &hcon->dst); in l2cap_conless_channel()
7642 struct hci_conn *hcon = conn->hcon; in l2cap_recv_frame() local
7646 if (hcon->state != BT_CONNECTED) { in l2cap_recv_frame()
7664 if (hcon->type == LE_LINK && in l2cap_recv_frame()
7665 hci_bdaddr_list_lookup(&hcon->hdev->reject_list, &hcon->dst, in l2cap_recv_frame()
7666 bdaddr_dst_type(hcon))) { in l2cap_recv_frame()
7706 static struct l2cap_conn *l2cap_conn_add(struct hci_conn *hcon) in l2cap_conn_add() argument
7708 struct l2cap_conn *conn = hcon->l2cap_data; in l2cap_conn_add()
7714 hchan = hci_chan_create(hcon); in l2cap_conn_add()
7725 hcon->l2cap_data = conn; in l2cap_conn_add()
7726 conn->hcon = hci_conn_get(hcon); in l2cap_conn_add()
7729 BT_DBG("hcon %p conn %p hchan %p", hcon, conn, hchan); in l2cap_conn_add()
7731 switch (hcon->type) { in l2cap_conn_add()
7733 if (hcon->hdev->le_mtu) { in l2cap_conn_add()
7734 conn->mtu = hcon->hdev->le_mtu; in l2cap_conn_add()
7739 conn->mtu = hcon->hdev->acl_mtu; in l2cap_conn_add()
7747 if (hcon->type == ACL_LINK && in l2cap_conn_add()
7748 hci_dev_test_flag(hcon->hdev, HCI_HS_ENABLED)) in l2cap_conn_add()
7751 if (hci_dev_test_flag(hcon->hdev, HCI_LE_ENABLED) && in l2cap_conn_add()
7752 (bredr_sc_enabled(hcon->hdev) || in l2cap_conn_add()
7753 hci_dev_test_flag(hcon->hdev, HCI_FORCE_BREDR_SMP))) in l2cap_conn_add()
7816 struct hci_conn *hcon; in l2cap_chan_connect() local
7905 hcon = hci_connect_le(hdev, dst, dst_type, in l2cap_chan_connect()
7910 hcon = hci_connect_le_scan(hdev, dst, dst_type, in l2cap_chan_connect()
7917 hcon = hci_connect_acl(hdev, dst, chan->sec_level, auth_type, in l2cap_chan_connect()
7921 if (IS_ERR(hcon)) { in l2cap_chan_connect()
7922 err = PTR_ERR(hcon); in l2cap_chan_connect()
7926 conn = l2cap_conn_add(hcon); in l2cap_chan_connect()
7928 hci_conn_drop(hcon); in l2cap_chan_connect()
7944 hci_conn_drop(hcon); in l2cap_chan_connect()
7954 hci_conn_drop(hcon); in l2cap_chan_connect()
7960 bacpy(&chan->src, &hcon->src); in l2cap_chan_connect()
7961 chan->src_type = bdaddr_src_type(hcon); in l2cap_chan_connect()
7966 hci_conn_drop(hcon); in l2cap_chan_connect()
7978 if (hcon->state == BT_CONNECTED) { in l2cap_chan_connect()
8067 struct hci_conn *hcon) in l2cap_global_fixed_chan() argument
8069 u8 src_type = bdaddr_src_type(hcon); in l2cap_global_fixed_chan()
8083 if (bacmp(&c->src, &hcon->src) && bacmp(&c->src, BDADDR_ANY)) in l2cap_global_fixed_chan()
8098 static void l2cap_connect_cfm(struct hci_conn *hcon, u8 status) in l2cap_connect_cfm() argument
8100 struct hci_dev *hdev = hcon->hdev; in l2cap_connect_cfm()
8105 if (hcon->type != ACL_LINK && hcon->type != LE_LINK) in l2cap_connect_cfm()
8108 BT_DBG("hcon %p bdaddr %pMR status %d", hcon, &hcon->dst, status); in l2cap_connect_cfm()
8111 l2cap_conn_del(hcon, bt_to_errno(status)); in l2cap_connect_cfm()
8115 conn = l2cap_conn_add(hcon); in l2cap_connect_cfm()
8119 dst_type = bdaddr_dst_type(hcon); in l2cap_connect_cfm()
8122 if (hci_bdaddr_list_lookup(&hdev->reject_list, &hcon->dst, dst_type)) in l2cap_connect_cfm()
8130 pchan = l2cap_global_fixed_chan(NULL, hcon); in l2cap_connect_cfm()
8141 bacpy(&chan->src, &hcon->src); in l2cap_connect_cfm()
8142 bacpy(&chan->dst, &hcon->dst); in l2cap_connect_cfm()
8143 chan->src_type = bdaddr_src_type(hcon); in l2cap_connect_cfm()
8151 next = l2cap_global_fixed_chan(pchan, hcon); in l2cap_connect_cfm()
8159 int l2cap_disconn_ind(struct hci_conn *hcon) in l2cap_disconn_ind() argument
8161 struct l2cap_conn *conn = hcon->l2cap_data; in l2cap_disconn_ind()
8163 BT_DBG("hcon %p", hcon); in l2cap_disconn_ind()
8170 static void l2cap_disconn_cfm(struct hci_conn *hcon, u8 reason) in l2cap_disconn_cfm() argument
8172 if (hcon->type != ACL_LINK && hcon->type != LE_LINK) in l2cap_disconn_cfm()
8175 BT_DBG("hcon %p reason %d", hcon, reason); in l2cap_disconn_cfm()
8177 l2cap_conn_del(hcon, bt_to_errno(reason)); in l2cap_disconn_cfm()
8197 static void l2cap_security_cfm(struct hci_conn *hcon, u8 status, u8 encrypt) in l2cap_security_cfm() argument
8199 struct l2cap_conn *conn = hcon->l2cap_data; in l2cap_security_cfm()
8221 chan->sec_level = hcon->sec_level; in l2cap_security_cfm()
8237 if (!status && l2cap_check_enc_key_size(hcon)) in l2cap_security_cfm()
8247 if (!status && l2cap_check_enc_key_size(hcon)) { in l2cap_security_cfm()
8353 void l2cap_recv_acldata(struct hci_conn *hcon, struct sk_buff *skb, u16 flags) in l2cap_recv_acldata() argument
8355 struct l2cap_conn *conn = hcon->l2cap_data; in l2cap_recv_acldata()
8359 if (!conn && hcon->hdev->dev_type != HCI_PRIMARY) in l2cap_recv_acldata()
8363 conn = l2cap_conn_add(hcon); in l2cap_recv_acldata()