Lines Matching refs:link

383 	struct hci_link *link, *next;  in hci_event_num_compl_pkts()  local
405 link = hci_link_lookup_handle(unit, handle); in hci_event_num_compl_pkts()
406 if (link) { in hci_event_num_compl_pkts()
407 if (link->hl_type == HCI_LINK_ACL) { in hci_event_num_compl_pkts()
409 hci_acl_complete(link, num); in hci_event_num_compl_pkts()
412 hci_sco_complete(link, num); in hci_event_num_compl_pkts()
433 link = TAILQ_FIRST(&unit->hci_links); in hci_event_num_compl_pkts()
434 while (link && (unit->hci_num_acl_pkts > 0 || unit->hci_num_sco_pkts > 0)) { in hci_event_num_compl_pkts()
435 next = TAILQ_NEXT(link, hl_next); in hci_event_num_compl_pkts()
437 if (link->hl_type == HCI_LINK_ACL) { in hci_event_num_compl_pkts()
438 if (unit->hci_num_acl_pkts > 0 && link->hl_txqlen > 0) in hci_event_num_compl_pkts()
439 hci_acl_start(link); in hci_event_num_compl_pkts()
441 if (unit->hci_num_sco_pkts > 0 && link->hl_txqlen > 0) in hci_event_num_compl_pkts()
442 hci_sco_start(link); in hci_event_num_compl_pkts()
445 link = next; in hci_event_num_compl_pkts()
576 struct hci_link *link; in hci_event_con_compl() local
593 link = hci_link_lookup_bdaddr(unit, &ep.bdaddr, ep.link_type); in hci_event_con_compl()
596 if (link != NULL) { in hci_event_con_compl()
615 hci_link_free(link, err); in hci_event_con_compl()
621 if (link == NULL) { in hci_event_con_compl()
637 link->hl_state = HCI_LINK_OPEN; in hci_event_con_compl()
638 link->hl_handle = HCI_CON_HANDLE(le16toh(ep.con_handle)); in hci_event_con_compl()
655 err = hci_acl_setmode(link); in hci_event_con_compl()
659 hci_acl_linkmode(link); in hci_event_con_compl()
661 (*link->hl_sco->sp_proto->connected)(link->hl_sco->sp_upper); in hci_event_con_compl()
675 struct hci_link *link; in hci_event_discon_compl() local
687 link = hci_link_lookup_handle(unit, HCI_CON_HANDLE(ep.con_handle)); in hci_event_discon_compl()
688 if (link) in hci_event_discon_compl()
689 hci_link_free(link, ENOLINK); in hci_event_discon_compl()
704 struct hci_link *link; in hci_event_con_req() local
720 link = hci_acl_newconn(unit, &ep.bdaddr); in hci_event_con_req()
722 link = hci_sco_newconn(unit, &ep.bdaddr); in hci_event_con_req()
724 if (link == NULL) { in hci_event_con_req()
752 struct hci_link *link; in hci_event_auth_compl() local
765 link = hci_link_lookup_handle(unit, ep.con_handle); in hci_event_auth_compl()
766 if (link == NULL || link->hl_type != HCI_LINK_ACL) in hci_event_auth_compl()
770 link->hl_flags |= HCI_LINK_AUTH; in hci_event_auth_compl()
772 if (link->hl_state == HCI_LINK_WAIT_AUTH) in hci_event_auth_compl()
773 link->hl_state = HCI_LINK_OPEN; in hci_event_auth_compl()
775 err = hci_acl_setmode(link); in hci_event_auth_compl()
780 hci_acl_linkmode(link); in hci_event_auth_compl()
794 struct hci_link *link; in hci_event_encryption_change() local
809 link = hci_link_lookup_handle(unit, con_handle); in hci_event_encryption_change()
810 if (link == NULL || link->hl_type != HCI_LINK_ACL) in hci_event_encryption_change()
815 link->hl_flags &= ~HCI_LINK_ENCRYPT; in hci_event_encryption_change()
823 link->hl_flags |= (HCI_LINK_AUTH | HCI_LINK_ENCRYPT); in hci_event_encryption_change()
825 if (link->hl_state == HCI_LINK_WAIT_ENCRYPT) in hci_event_encryption_change()
826 link->hl_state = HCI_LINK_OPEN; in hci_event_encryption_change()
828 err = hci_acl_setmode(link); in hci_event_encryption_change()
834 hci_acl_linkmode(link); in hci_event_encryption_change()
848 struct hci_link *link; in hci_event_change_con_link_key_compl() local
861 link = hci_link_lookup_handle(unit, ep.con_handle); in hci_event_change_con_link_key_compl()
862 if (link == NULL || link->hl_type != HCI_LINK_ACL) in hci_event_change_con_link_key_compl()
865 link->hl_flags &= ~HCI_LINK_SECURE_REQ; in hci_event_change_con_link_key_compl()
868 link->hl_flags |= (HCI_LINK_AUTH | HCI_LINK_SECURE); in hci_event_change_con_link_key_compl()
870 if (link->hl_state == HCI_LINK_WAIT_SECURE) in hci_event_change_con_link_key_compl()
871 link->hl_state = HCI_LINK_OPEN; in hci_event_change_con_link_key_compl()
873 err = hci_acl_setmode(link); in hci_event_change_con_link_key_compl()
878 hci_acl_linkmode(link); in hci_event_change_con_link_key_compl()
891 struct hci_link *link; in hci_event_read_clock_offset_compl() local
903 link = hci_link_lookup_handle(unit, ep.con_handle); in hci_event_read_clock_offset_compl()
904 if (link == NULL || link->hl_type != HCI_LINK_ACL) in hci_event_read_clock_offset_compl()
908 link->hl_clock = ep.clock_offset; in hci_event_read_clock_offset_compl()
1196 struct hci_link *link; in hci_cmd_read_encryption_key_size() local
1213 link = hci_link_lookup_handle(unit, rp.con_handle); in hci_cmd_read_encryption_key_size()
1214 if (link == NULL || link->hl_type != HCI_LINK_ACL) in hci_cmd_read_encryption_key_size()
1224 link->hl_flags &= ~HCI_LINK_ENCRYPT; in hci_cmd_read_encryption_key_size()
1226 link->hl_flags |= (HCI_LINK_AUTH | HCI_LINK_ENCRYPT); in hci_cmd_read_encryption_key_size()
1228 if (link->hl_state == HCI_LINK_WAIT_ENCRYPT) in hci_cmd_read_encryption_key_size()
1229 link->hl_state = HCI_LINK_OPEN; in hci_cmd_read_encryption_key_size()
1231 err = hci_acl_setmode(link); in hci_cmd_read_encryption_key_size()
1237 hci_acl_linkmode(link); in hci_cmd_read_encryption_key_size()
1250 struct hci_link *link, *next; in hci_cmd_reset() local
1268 while ((link = next) != NULL) { in hci_cmd_reset()
1269 next = TAILQ_NEXT(link, hl_next); in hci_cmd_reset()
1270 if (acl || link->hl_type != HCI_LINK_ACL) in hci_cmd_reset()
1271 hci_link_free(link, ECONNABORTED); in hci_cmd_reset()
1308 struct hci_link *link; in hci_cmd_create_con() local
1310 TAILQ_FOREACH(link, &unit->hci_links, hl_next) { in hci_cmd_create_con()
1311 if ((link->hl_flags & HCI_LINK_CREATE_CON) == 0) in hci_cmd_create_con()
1314 link->hl_flags &= ~HCI_LINK_CREATE_CON; in hci_cmd_create_con()
1321 hci_link_free(link, EBUSY); in hci_cmd_create_con()
1325 hci_link_free(link, EPROTO); in hci_cmd_create_con()