Add memory barrier to r281764.
While race at this point may cause only a single packet delay and so was not really reproduced, it is better to not have it at all. MFC after: 1 week
This commit is contained in:
parent
8b2e525f52
commit
79f1cdb4fb
@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include <sys/select.h>
|
#include <sys/select.h>
|
||||||
#include <sys/uio.h>
|
#include <sys/uio.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
|
#include <machine/atomic.h>
|
||||||
#include <net/ethernet.h>
|
#include <net/ethernet.h>
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
@ -453,7 +454,7 @@ pci_vtnet_tx_thread(void *param)
|
|||||||
{
|
{
|
||||||
struct pci_vtnet_softc *sc = param;
|
struct pci_vtnet_softc *sc = param;
|
||||||
struct vqueue_info *vq;
|
struct vqueue_info *vq;
|
||||||
int have_work, error;
|
int error;
|
||||||
|
|
||||||
vq = &sc->vsc_queues[VTNET_TXQ];
|
vq = &sc->vsc_queues[VTNET_TXQ];
|
||||||
|
|
||||||
@ -467,20 +468,16 @@ pci_vtnet_tx_thread(void *param)
|
|||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
/* note - tx mutex is locked here */
|
/* note - tx mutex is locked here */
|
||||||
do {
|
while (sc->resetting || !vq_has_descs(vq)) {
|
||||||
vq->vq_used->vu_flags &= ~VRING_USED_F_NO_NOTIFY;
|
vq->vq_used->vu_flags &= ~VRING_USED_F_NO_NOTIFY;
|
||||||
if (sc->resetting)
|
mb();
|
||||||
have_work = 0;
|
if (!sc->resetting && vq_has_descs(vq))
|
||||||
else
|
break;
|
||||||
have_work = vq_has_descs(vq);
|
|
||||||
|
|
||||||
if (!have_work) {
|
sc->tx_in_progress = 0;
|
||||||
sc->tx_in_progress = 0;
|
error = pthread_cond_wait(&sc->tx_cond, &sc->tx_mtx);
|
||||||
error = pthread_cond_wait(&sc->tx_cond,
|
assert(error == 0);
|
||||||
&sc->tx_mtx);
|
}
|
||||||
assert(error == 0);
|
|
||||||
}
|
|
||||||
} while (!have_work);
|
|
||||||
vq->vq_used->vu_flags |= VRING_USED_F_NO_NOTIFY;
|
vq->vq_used->vu_flags |= VRING_USED_F_NO_NOTIFY;
|
||||||
sc->tx_in_progress = 1;
|
sc->tx_in_progress = 1;
|
||||||
pthread_mutex_unlock(&sc->tx_mtx);
|
pthread_mutex_unlock(&sc->tx_mtx);
|
||||||
|
Loading…
Reference in New Issue
Block a user