Lines Matching defs:conn
3134 struct hci_conn *conn;
3136 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &b->bdaddr);
3137 if (!conn)
3140 if (conn->state != BT_CONNECTED && conn->state != BT_CONFIG)
4934 if (p->conn) {
4935 hci_conn_drop(p->conn);
4936 hci_conn_put(p->conn);
4937 p->conn = NULL;
5249 static int hci_disconnect_sync(struct hci_dev *hdev, struct hci_conn *conn,
5254 if (conn->type == AMP_LINK)
5255 return hci_disconnect_phy_link_sync(hdev, conn->handle, reason);
5258 cp.handle = cpu_to_le16(conn->handle);
5277 struct hci_conn *conn, u8 reason)
5282 if (test_bit(HCI_CONN_SCANNING, &conn->flags))
5285 if (conn->role == HCI_ROLE_SLAVE ||
5286 test_and_set_bit(HCI_CONN_CANCEL, &conn->flags))
5293 static int hci_connect_cancel_sync(struct hci_dev *hdev, struct hci_conn *conn,
5296 if (conn->type == LE_LINK)
5297 return hci_le_connect_cancel_sync(hdev, conn, reason);
5299 if (conn->type == ISO_LINK) {
5308 if (test_bit(HCI_CONN_CREATE_CIS, &conn->flags))
5309 return hci_disconnect_sync(hdev, conn, reason);
5312 if (bacmp(&conn->dst, BDADDR_ANY))
5331 6, &conn->dst,
5336 6, &conn->dst, HCI_CMD_TIMEOUT);
5339 static int hci_reject_sco_sync(struct hci_dev *hdev, struct hci_conn *conn,
5345 bacpy(&cp.bdaddr, &conn->dst);
5358 static int hci_le_reject_cis_sync(struct hci_dev *hdev, struct hci_conn *conn,
5364 cp.handle = cpu_to_le16(conn->handle);
5371 static int hci_reject_conn_sync(struct hci_dev *hdev, struct hci_conn *conn,
5376 if (conn->type == ISO_LINK)
5377 return hci_le_reject_cis_sync(hdev, conn, reason);
5379 if (conn->type == SCO_LINK || conn->type == ESCO_LINK)
5380 return hci_reject_sco_sync(hdev, conn, reason);
5383 bacpy(&cp.bdaddr, &conn->dst);
5390 int hci_abort_conn_sync(struct hci_dev *hdev, struct hci_conn *conn, u8 reason)
5393 u16 handle = conn->handle;
5397 switch (conn->state) {
5400 err = hci_disconnect_sync(hdev, conn, reason);
5403 err = hci_connect_cancel_sync(hdev, conn, reason);
5406 err = hci_reject_conn_sync(hdev, conn, reason);
5412 if (test_and_clear_bit(HCI_CONN_BIG_SYNC_FAILED, &conn->flags) ||
5413 test_and_clear_bit(HCI_CONN_PA_SYNC_FAILED, &conn->flags)) {
5414 hci_conn_failed(conn, reason);
5415 } else if (test_bit(HCI_CONN_PA_SYNC, &conn->flags) ||
5416 test_bit(HCI_CONN_BIG_SYNC, &conn->flags)) {
5417 conn->state = BT_CLOSED;
5418 hci_disconn_cfm(conn, reason);
5419 hci_conn_del(conn);
5435 if (!c || c != conn) {
5446 conn->state = BT_CLOSED;
5447 hci_disconn_cfm(conn, reason);
5448 hci_conn_del(conn);
5450 hci_conn_failed(conn, reason);
5461 struct hci_conn *conn;
5464 while ((conn = list_first_or_null_rcu(head, struct hci_conn, list))) {
5466 conn = hci_conn_get(conn);
5473 hci_abort_conn_sync(hdev, conn, reason);
5474 hci_conn_put(conn);
6080 static bool conn_use_rpa(struct hci_conn *conn)
6082 struct hci_dev *hdev = conn->hdev;
6088 struct hci_conn *conn)
6095 err = hci_update_random_address_sync(hdev, false, conn_use_rpa(conn),
6103 err = hci_get_random_address(hdev, false, conn_use_rpa(conn), NULL,
6117 cp.peer_addr_type = conn->dst_type;
6118 bacpy(&cp.peer_addr, &conn->dst);
6151 struct hci_conn *conn)
6159 return hci_le_ext_directed_advertising_sync(hdev, conn);
6171 status = hci_update_random_address_sync(hdev, false, conn_use_rpa(conn),
6187 cp.direct_addr_type = conn->dst_type;
6188 bacpy(&cp.direct_addr, &conn->dst);
6202 static void set_ext_conn_params(struct hci_conn *conn,
6205 struct hci_dev *hdev = conn->hdev;
6211 p->conn_interval_min = cpu_to_le16(conn->le_conn_min_interval);
6212 p->conn_interval_max = cpu_to_le16(conn->le_conn_max_interval);
6213 p->conn_latency = cpu_to_le16(conn->le_conn_latency);
6214 p->supervision_timeout = cpu_to_le16(conn->le_supv_timeout);
6220 struct hci_conn *conn, u8 own_addr_type)
6232 bacpy(&cp->peer_addr, &conn->dst);
6233 cp->peer_addr_type = conn->dst_type;
6240 set_ext_conn_params(conn, p);
6248 set_ext_conn_params(conn, p);
6256 set_ext_conn_params(conn, p);
6264 conn->conn_timeout, NULL);
6267 int hci_le_create_conn_sync(struct hci_dev *hdev, struct hci_conn *conn)
6275 if (conn->role == HCI_ROLE_SLAVE) {
6282 hci_conn_del(conn);
6289 err = hci_le_directed_advertising_sync(hdev, conn);
6297 params = hci_conn_params_lookup(hdev, &conn->dst, conn->dst_type);
6299 conn->le_conn_min_interval = params->conn_min_interval;
6300 conn->le_conn_max_interval = params->conn_max_interval;
6301 conn->le_conn_latency = params->conn_latency;
6302 conn->le_supv_timeout = params->supervision_timeout;
6304 conn->le_conn_min_interval = hdev->le_conn_min_interval;
6305 conn->le_conn_max_interval = hdev->le_conn_max_interval;
6306 conn->le_conn_latency = hdev->le_conn_latency;
6307 conn->le_supv_timeout = hdev->le_supv_timeout;
6324 err = hci_update_random_address_sync(hdev, false, conn_use_rpa(conn),
6330 err = hci_le_ext_create_conn_sync(hdev, conn, own_addr_type);
6339 bacpy(&cp.peer_addr, &conn->dst);
6340 cp.peer_addr_type = conn->dst_type;
6342 cp.conn_interval_min = cpu_to_le16(conn->le_conn_min_interval);
6343 cp.conn_interval_max = cpu_to_le16(conn->le_conn_max_interval);
6344 cp.conn_latency = cpu_to_le16(conn->le_conn_latency);
6345 cp.supervision_timeout = cpu_to_le16(conn->le_supv_timeout);
6360 conn->conn_timeout, NULL);
6364 hci_le_connect_cancel_sync(hdev, conn, 0x00);
6377 struct hci_conn *conn;
6410 list_for_each_entry_rcu(conn, &hdev->conn_hash.list, list) {
6411 if (test_bit(HCI_CONN_CREATE_CIS, &conn->flags))
6416 list_for_each_entry_rcu(conn, &hdev->conn_hash.list, list) {
6419 if (hci_conn_check_create_cis(conn))
6422 cig = conn->iso_qos.ucast.cig;
6440 list_for_each_entry_rcu(conn, &hdev->conn_hash.list, list) {
6443 if (hci_conn_check_create_cis(conn) ||
6444 conn->iso_qos.ucast.cig != cig)
6447 set_bit(HCI_CONN_CREATE_CIS, &conn->flags);
6448 cis->acl_handle = cpu_to_le16(conn->parent->handle);
6449 cis->cis_handle = cpu_to_le16(conn->handle);
6469 conn->conn_timeout, NULL);