PERFORCE change 130459 for review
Kip Macy
kmacy at FreeBSD.org
Fri Dec 7 21:19:52 PST 2007
http://perforce.freebsd.org/chv.cgi?CH=130459
Change 130459 by kmacy at kmacy:storage:toestack on 2007/12/08 05:19:26
use cv in place of tsleep
Affected files ...
.. //depot/projects/toestack/sys/dev/cxgb/cxgb_multiq.c#9 edit
Differences ...
==== //depot/projects/toestack/sys/dev/cxgb/cxgb_multiq.c#9 (text+ko) ====
@@ -141,8 +141,12 @@
err = ENOBUFS;
}
mtx_unlock(&mr->br_lock);
- if ((qs->txq[TXQ_ETH].flags & TXQ_TRANSMITTING) == 0)
- wakeup(qs);
+ if ((qs->txq[TXQ_ETH].flags & TXQ_TRANSMITTING) == 0) {
+ mtx_lock(&qs->qs_mtx);
+ cv_broadcastpri(&qs->qs_cv, 1);
+ mtx_unlock(&qs->qs_mtx);
+ }
+
if (err)
m_freem(m);
@@ -501,8 +505,11 @@
} else if (immpkt)
err = cxgb_pcpu_enqueue_packet_(qs, immpkt);
- if (resid && (txq->flags & TXQ_TRANSMITTING) == 0)
- wakeup(qs);
+ if (resid && (txq->flags & TXQ_TRANSMITTING) == 0) {
+ mtx_lock(&qs->qs_mtx);
+ cv_broadcastpri(&qs->qs_cv, 1);
+ mtx_unlock(&qs->qs_mtx);
+ }
return ((err == ENOSPC) ? 0 : err);
}
@@ -617,8 +624,10 @@
txq->txq_mr.br_prod);
continue;
}
- done:
- tsleep(qs, 1, "cxgbidle", sleep_ticks);
+ done:
+ mtx_lock(&qs->qs_mtx);
+ cv_timedwait(&qs->qs_cv, &qs->qs_mtx, sleep_ticks);
+ mtx_unlock(&qs->qs_mtx);
}
if (bootverbose)
@@ -661,6 +670,8 @@
qs = &sc->sge.qs[pi->first_qset + j];
qs->port = pi;
qs->qs_cpuid = ((pi->first_qset + j) % mp_ncpus);
+ cv_init(&qs->qs_cv, qs->namebuf);
+ mtx_init(&qs->qs_mtx, qs->namebuf, NULL, MTX_DEF);
device_printf(sc->dev, "starting thread for %d\n", qs->qs_cpuid);
kproc_create(cxgb_pcpu_start_proc, qs, &p,
@@ -683,7 +694,9 @@
struct sge_qset *qs = &sc->sge.qs[first + j];
qs->qs_flags |= QS_EXITING;
- wakeup(qs);
+ mtx_lock(&qs->qs_mtx);
+ cv_broadcastpri(&qs->qs_cv, 1);
+ mtx_unlock(&qs->qs_mtx);
tsleep(&sc, PRI_MIN_TIMESHARE, "cxgb unload 0", hz>>2);
while (qs->qs_flags & QS_RUNNING) {
qs->qs_flags |= QS_EXITING;
More information about the p4-projects
mailing list