Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/ic Assert that I'm DMA-syncing a non-negative number...



details:   https://anonhg.NetBSD.org/src/rev/9f7e1ae174e2
branches:  trunk
changeset: 572111:9f7e1ae174e2
user:      dyoung <dyoung%NetBSD.org@localhost>
date:      Mon Dec 20 00:16:21 2004 +0000

description:
Assert that I'm DMA-syncing a non-negative number of transmit
descriptors.

As I free dirty transmit buffers, move them to the free list, not
back to the dirty list!

Add a 5-second transmit timeout.

diffstat:

 sys/dev/ic/rtw.c |  13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diffs (55 lines):

diff -r 21066bfe5ffc -r 9f7e1ae174e2 sys/dev/ic/rtw.c
--- a/sys/dev/ic/rtw.c  Sun Dec 19 14:42:19 2004 +0000
+++ b/sys/dev/ic/rtw.c  Mon Dec 20 00:16:21 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rtw.c,v 1.5 2004/12/19 08:19:25 dyoung Exp $ */
+/* $NetBSD: rtw.c,v 1.6 2004/12/20 00:16:21 dyoung Exp $ */
 /*-
  * Copyright (c) 2004, 2005 David Young.  All rights reserved.
  *
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rtw.c,v 1.5 2004/12/19 08:19:25 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtw.c,v 1.6 2004/12/20 00:16:21 dyoung Exp $");
 
 #include "bpfilter.h"
 
@@ -1386,7 +1386,7 @@
        while ((stx = SIMPLEQ_FIRST(&stc->stc_dirtyq)) != NULL) {
                rtw_txbuf_release(dmat, ic, stx);
                SIMPLEQ_REMOVE_HEAD(&stc->stc_dirtyq, stx_q);
-               SIMPLEQ_INSERT_HEAD(&stc->stc_dirtyq, stx, stx_q);
+               SIMPLEQ_INSERT_TAIL(&stc->stc_freeq, stx, stx_q);
        }
 }
 
@@ -1437,6 +1437,8 @@
                if (stx->stx_last < stx->stx_first)
                        ndesc += htc->htc_ndesc;
 
+               KASSERT(ndesc > 0);
+
                rtw_txdescs_sync(sc->sc_dmat, sc->sc_desc_dmamap, htc,
                    stx->stx_first, ndesc,
                    BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE);
@@ -1447,7 +1449,7 @@
 
                rtw_collect_txpkt(sc, htc, stx, ndesc);
                SIMPLEQ_REMOVE_HEAD(&stc->stc_dirtyq, stx_q);
-               SIMPLEQ_INSERT_HEAD(&stc->stc_freeq, stx, stx_q);
+               SIMPLEQ_INSERT_TAIL(&stc->stc_freeq, stx, stx_q);
                sc->sc_if.if_flags &= ~IFF_OACTIVE;
        }
        if (stx == NULL)
@@ -2478,6 +2480,9 @@
                SIMPLEQ_REMOVE_HEAD(&stc->stc_freeq, stx_q);
                SIMPLEQ_INSERT_TAIL(&stc->stc_dirtyq, stx, stx_q);
 
+               stc->stc_tx_timer = 5;
+               ifp->if_timer = 1;
+
                /* TBD poke just one txmtr? */
                RTW_WRITE8(&sc->sc_regs, RTW_TPPOLL,
                    RTW_TPPOLL_NPQ | RTW_TPPOLL_LPQ | RTW_TPPOLL_HPQ |



Home | Main Index | Thread Index | Old Index