sc = dev->si_drv1;
devstat_start_transaction(&sc->stats);
- cothread_lock(sc->cotd);
+ cothread_lock(sc->cotd, 0);
TAILQ_INSERT_TAIL(&sc->cotd_queue, bio, bio_act);
cothread_signal(sc->cotd);
- cothread_unlock(sc->cotd);
+ cothread_unlock(sc->cotd, 0);
return(0);
}
sc = cotd->arg;
- cothread_lock(cotd);
+ cothread_lock(cotd, 0);
while (!TAILQ_EMPTY(&sc->cotd_done)) {
bio = TAILQ_FIRST(&sc->cotd_done);
TAILQ_REMOVE(&sc->cotd_done, bio, bio_act);
devstat_end_transaction_buf(&sc->stats, bio->bio_buf);
biodone(bio);
}
- cothread_unlock(sc->cotd);
+ cothread_unlock(sc->cotd, 0);
}
/*
struct vkd_softc *sc = cotd->arg;
int count;
- cothread_lock(cotd);
+ cothread_lock(cotd, 1);
for (;;) {
count = 0;
while ((bio = TAILQ_FIRST(&sc->cotd_queue)) != NULL) {
TAILQ_REMOVE(&sc->cotd_queue, bio, bio_act);
- cothread_unlock(cotd);
+ cothread_unlock(cotd, 1);
vkd_doio(sc, bio);
- cothread_lock(cotd);
+ cothread_lock(cotd, 1);
TAILQ_INSERT_TAIL(&sc->cotd_done, bio, bio_act);
if (++count == 8) {
cothread_intr(cotd);
cothread_wait(cotd); /* interlocks cothread lock */
}
/* NOT REACHED */
- cothread_unlock(cotd);
+ cothread_unlock(cotd, 1);
}
static
if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING)
return;
- cothread_lock(cotd);
+ cothread_lock(cotd, 0);
count = 0;
while ((m = ifq_dequeue(&ifp->if_snd, NULL)) != NULL) {
cothread_signal(cotd);
}
- cothread_unlock(cotd);
+ cothread_unlock(cotd, 0);
}
static int
if (sc) {
if (sc->cotd_tx) {
- cothread_lock(sc->cotd_tx);
+ cothread_lock(sc->cotd_tx, 0);
if (sc->cotd_tx_exit == VKE_COTD_RUN)
sc->cotd_tx_exit = VKE_COTD_EXIT;
cothread_signal(sc->cotd_tx);
- cothread_unlock(sc->cotd_tx);
+ cothread_unlock(sc->cotd_tx, 0);
cothread_delete(&sc->cotd_tx);
}
if (sc->cotd_rx) {
- cothread_lock(sc->cotd_rx);
+ cothread_lock(sc->cotd_rx, 0);
if (sc->cotd_rx_exit == VKE_COTD_RUN)
sc->cotd_rx_exit = VKE_COTD_EXIT;
cothread_signal(sc->cotd_rx);
- cothread_unlock(sc->cotd_rx);
+ cothread_unlock(sc->cotd_rx, 0);
cothread_delete(&sc->cotd_rx);
}
static int count = 0;
ifnet_serialize_all(ifp);
- cothread_lock(cotd);
+ cothread_lock(cotd, 0);
if (sc->cotd_rx_exit != VKE_COTD_RUN) {
- cothread_unlock(cotd);
+ cothread_unlock(cotd, 0);
ifnet_deserialize_all(ifp);
return;
}
if (count)
cothread_signal(cotd);
- cothread_unlock(cotd);
+ cothread_unlock(cotd, 0);
ifnet_deserialize_all(ifp);
}
struct mbuf *m;
ifnet_serialize_all(ifp);
- cothread_lock(cotd);
+ cothread_lock(cotd, 0);
if (sc->cotd_tx_exit != VKE_COTD_RUN) {
- cothread_unlock(cotd);
+ cothread_unlock(cotd, 0);
ifnet_deserialize_all(ifp);
return;
}
m_freem(m);
}
- cothread_unlock(cotd);
+ cothread_unlock(cotd, 0);
ifnet_deserialize_all(ifp);
}
FD_ZERO(&fdset);
- cothread_lock(cotd);
+ cothread_lock(cotd, 1);
for (;;) {
int n;
if ((m = fifo->array[NETFIFOINDEX(fifo->windex)]) !=
NULL) {
- cothread_unlock(cotd);
+ cothread_unlock(cotd, 1);
n = read(sc->sc_fd, mtod(m, void *), MCLBYTES);
- cothread_lock(cotd);
+ cothread_lock(cotd, 1);
if (n <= 0)
break;
ifp->if_ipackets++;
if (sc->cotd_rx_exit != VKE_COTD_RUN)
break;
- cothread_unlock(cotd);
+ cothread_unlock(cotd, 1);
/* Set up data for select() call */
FD_SET(sc->sc_fd, &fdset);
if (select(sc->sc_fd + 1, &fdset, NULL, NULL, &tv) == -1)
kprintf(VKE_DEVNAME "%d: select failed for TAP device\n", sc->sc_unit);
- cothread_lock(cotd);
+ cothread_lock(cotd, 1);
}
sc->cotd_rx_exit = VKE_COTD_DEAD;
- cothread_unlock(cotd);
+ cothread_unlock(cotd, 1);
}
/*
struct ifnet *ifp = &sc->arpcom.ac_if;
int count = 0;
- cothread_lock(cotd);
+ cothread_lock(cotd, 1);
while (sc->cotd_tx_exit == VKE_COTD_RUN) {
/* Write outgoing packets to the TAP interface */
if (m->m_pkthdr.len <= MCLBYTES) {
m_copydata(m, 0, m->m_pkthdr.len, sc->sc_txbuf);
sc->sc_txbuf_len = m->m_pkthdr.len;
- cothread_unlock(cotd);
+ cothread_unlock(cotd, 1);
if (write(sc->sc_fd, sc->sc_txbuf, sc->sc_txbuf_len) < 0) {
- cothread_lock(cotd);
+ cothread_lock(cotd, 1);
ifp->if_oerrors++;
} else {
- cothread_lock(cotd);
+ cothread_lock(cotd, 1);
vke_txfifo_done_enqueue(sc, m);
ifp->if_opackets++;
if (count++ == VKE_CHUNK) {
}
/* NOT REACHED */
sc->cotd_tx_exit = VKE_COTD_DEAD;
- cothread_unlock(cotd);
+ cothread_unlock(cotd, 1);
}
static int