-
-
-/*
- * called by an interface when tx_rdy occurs.
- */
-int
-if_tx_rdy(struct ifnet *ifp)
-{
- struct dn_pipe *p;
- struct mbuf *head = NULL, *tail = NULL;
- int i;
-
- lck_mtx_lock(dn_mutex);
-
- for (i = 0; i < HASHSIZE; i++)
- SLIST_FOREACH(p, &pipehash[i], next)
- if (p->ifp == ifp)
- break ;
- if (p == NULL) {
- char buf[32];
- snprintf(buf, sizeof(buf), "%s", if_name(ifp));
- for (i = 0; i < HASHSIZE; i++)
- SLIST_FOREACH(p, &pipehash[i], next)
- if (!strcmp(p->if_name, buf) ) {
- p->ifp = ifp ;
- DPRINTF(("dummynet: ++ tx rdy from %s (now found)\n", buf));
- break ;
- }
- }
- if (p != NULL) {
- DPRINTF(("dummynet: ++ tx rdy from %s - qlen %d\n", if_name(ifp),
- IFCQ_LEN(&ifp->if_snd)));
- p->numbytes = 0 ; /* mark ready for I/O */
- ready_event_wfq(p, &head, &tail);
- }
-
- if (head != NULL) {
- serialize++;
- }
-
- lck_mtx_unlock(dn_mutex);
-
- /* Send out the de-queued list of ready-to-send packets */
- if (head != NULL) {
- dummynet_send(head);
- lck_mtx_lock(dn_mutex);
- serialize--;
- lck_mtx_unlock(dn_mutex);
- }
- return 0;
-}
-