Date: Sat, 8 Dec 2007 05:19:51 GMT From: Kip Macy <kmacy@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 130459 for review Message-ID: <200712080519.lB85Jp5B046004@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=130459 Change 130459 by kmacy@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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200712080519.lB85Jp5B046004>