Lines Matching refs:unit

62 ng_hci_mtap(ng_hci_unit_p unit, struct mbuf *m0)
67 if (unit->raw != NULL && NG_HOOK_IS_VALID(unit->raw)) {
70 NG_SEND_DATA_ONLY(error, unit->raw, m);
75 __func__, NG_NODE_NAME(unit->node), error);
86 ng_hci_unit_p unit = NULL;
95 unit = (ng_hci_unit_p) NG_NODE_PRIVATE(node);
96 if ((unit->state & NG_HCI_UNIT_READY) != NG_HCI_UNIT_READY)
99 if (hook != unit->acl && hook != unit->sco)
106 if (hook == unit->acl) {
107 NG_HCI_BUFF_ACL_SIZE(unit->buffer, ep->pkt_size);
108 NG_HCI_BUFF_ACL_TOTAL(unit->buffer, ep->num_pkts);
110 NG_HCI_BUFF_SCO_SIZE(unit->buffer, ep->pkt_size);
111 NG_HCI_BUFF_SCO_TOTAL(unit->buffer, ep->num_pkts);
114 bcopy(&unit->bdaddr, &ep->bdaddr, sizeof(ep->bdaddr));
123 __func__, NG_NODE_NAME(unit->node),
128 * Clean unit (helper)
132 ng_hci_unit_clean(ng_hci_unit_p unit, int reason)
137 if (unit->state & NG_HCI_UNIT_COMMAND_PENDING)
138 ng_hci_command_untimeout(unit);
140 NG_BT_MBUFQ_DRAIN(&unit->cmdq);
141 NG_HCI_BUFF_CMD_SET(unit->buffer, 1);
144 while (!LIST_EMPTY(&unit->con_list)) {
145 ng_hci_unit_con_p con = LIST_FIRST(&unit->con_list);
160 NG_HCI_BUFF_ACL_TOTAL(unit->buffer, size);
161 NG_HCI_BUFF_ACL_FREE(unit->buffer, size);
163 NG_HCI_BUFF_SCO_TOTAL(unit->buffer, size);
164 NG_HCI_BUFF_SCO_FREE(unit->buffer, size);
167 ng_hci_flush_neighbor_cache(unit);
171 * Allocate and link new unit neighbor cache entry
175 ng_hci_new_neighbor(ng_hci_unit_p unit)
183 LIST_INSERT_HEAD(&unit->neighbors, n, next);
190 * Free unit neighbor cache entry
206 ng_hci_flush_neighbor_cache(ng_hci_unit_p unit)
208 while (!LIST_EMPTY(&unit->neighbors))
209 ng_hci_free_neighbor(LIST_FIRST(&unit->neighbors));
213 * Lookup unit in neighbor cache
217 ng_hci_get_neighbor(ng_hci_unit_p unit, bdaddr_p bdaddr,int link_type)
221 for (n = LIST_FIRST(&unit->neighbors); n != NULL; ) {
256 ng_hci_new_con(ng_hci_unit_p unit, int link_type)
265 con->unit = unit;
289 NG_HCI_BUFF_ACL_TOTAL(unit->buffer, num_pkts);
291 NG_HCI_BUFF_SCO_TOTAL(unit->buffer, num_pkts);
297 LIST_INSERT_HEAD(&unit->con_list, con, next);
318 NG_HCI_BUFF_ACL_FREE(con->unit->buffer, con->pending);
320 NG_HCI_BUFF_SCO_FREE(con->unit->buffer, con->pending);
329 * Lookup connection for given unit and connection handle.
333 ng_hci_con_by_handle(ng_hci_unit_p unit, int con_handle)
337 LIST_FOREACH(con, &unit->con_list, next)
345 * Lookup connection for given unit, link type and remove unit address
349 ng_hci_con_by_bdaddr(ng_hci_unit_p unit, bdaddr_p bdaddr, int link_type)
353 LIST_FOREACH(con, &unit->con_list, next)
367 ng_hci_command_timeout(ng_hci_unit_p unit)
369 if (unit->state & NG_HCI_UNIT_COMMAND_PENDING)
371 "%s: %s - Duplicated command timeout!\n", __func__, NG_NODE_NAME(unit->node));
373 unit->state |= NG_HCI_UNIT_COMMAND_PENDING;
374 ng_callout(&unit->cmd_timo, unit->node, NULL,
386 ng_hci_command_untimeout(ng_hci_unit_p unit)
388 if (!(unit->state & NG_HCI_UNIT_COMMAND_PENDING))
390 "%s: %s - No command timeout!\n", __func__, NG_NODE_NAME(unit->node));
392 if (ng_uncallout(&unit->cmd_timo, unit->node) == 0)
395 unit->state &= ~NG_HCI_UNIT_COMMAND_PENDING;
411 __func__, NG_NODE_NAME(con->unit->node));
414 ng_callout(&con->con_timo, con->unit->node, NULL,
431 "%s: %s - No connection timeout!\n", __func__, NG_NODE_NAME(con->unit->node));
433 if (ng_uncallout(&con->con_timo, con->unit->node) == 0)
461 /* 0x0a */ "Max number of SCO connections to a unit",
466 /* 0x0f */ "Host rejected due to remote unit is a personal unit",
492 /* 0x29 */ "Pairing with unit key not supported",