Silence irritating watchdog timeout messages: if we call

ndis_send_packets() but there's no link yet, we get an immediate
callback to ndis_txeof(), which clears if_timer. But ndis_start()
sets if_timer right after the call to ndis_send_packets(). Set
if_timer before calling ndis_send_packets().

Also fix mutex locking to prevent ndis_txeof() from running in
the middle of ndis_start().
This commit is contained in:
Bill Paul 2003-12-14 22:47:01 +00:00
parent 232d6b73a0
commit a417109f1f

View File

@ -523,6 +523,8 @@ ndis_txeof(adapter, packet, status)
if (packet->np_rsvd[1] == NULL)
panic("NDIS driver corrupted reserved packet fields");
NDIS_LOCK(sc);
m = (struct mbuf *)packet->np_rsvd[1];
idx = (int)packet->np_rsvd[0];
ifp->if_opackets++;
@ -537,6 +539,8 @@ ndis_txeof(adapter, packet, status)
ifp->if_timer = 0;
ifp->if_flags &= ~IFF_OACTIVE;
NDIS_UNLOCK(sc);
if (ifp->if_snd.ifq_head != NULL)
ndis_start(ifp);
@ -653,6 +657,8 @@ ndis_start(ifp)
sc = ifp->if_softc;
NDIS_LOCK(sc);
p0 = &sc->ndis_txarray[sc->ndis_txidx];
while(sc->ndis_txpending) {
@ -660,7 +666,6 @@ ndis_start(ifp)
if (m == NULL)
break;
NDIS_LOCK(sc);
sc->ndis_txarray[sc->ndis_txidx] = NULL;
if (ndis_mtop(m, &sc->ndis_txarray[sc->ndis_txidx])) {
@ -694,7 +699,6 @@ ndis_start(ifp)
NDIS_INC(sc);
sc->ndis_txpending--;
NDIS_UNLOCK(sc);
pcnt++;
@ -720,13 +724,15 @@ ndis_start(ifp)
if (sc->ndis_txpending == 0)
ifp->if_flags |= IFF_OACTIVE;
ndis_send_packets(sc, p0, pcnt);
/*
* Set a timeout in case the chip goes out to lunch.
*/
ifp->if_timer = 5;
NDIS_UNLOCK(sc);
ndis_send_packets(sc, p0, pcnt);
return;
}