From d3ab0d02cf03775ff3bfc8a2652b449b9ee2fd7a Mon Sep 17 00:00:00 2001 From: Bill Paul Date: Thu, 16 Aug 2001 20:15:16 +0000 Subject: [PATCH] After one more day of testing, make what I hope are the final tweaks to prevent/workaround TX lockups in this driver. The secret seems to be to not let the TX DMA queue become too full. If we have too many packets in the queue, we should wait for them to drain a bit before trying to queue more. This should prevent the lockup from occurring, and if it does occur, there is special code in sf_start() to kick the NIC in the head and get it going again. Special thanks to Glen Neff for helping me test this fix. --- sys/dev/sf/if_sf.c | 8 +++++--- sys/pci/if_sf.c | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/sys/dev/sf/if_sf.c b/sys/dev/sf/if_sf.c index 8f5fec3c075..c0c05d5300a 100644 --- a/sys/dev/sf/if_sf.c +++ b/sys/dev/sf/if_sf.c @@ -1348,9 +1348,6 @@ static void sf_start(ifp) return; } - if (sc->sf_tx_cnt) - sf_txeof(sc); - txprod = csr_read_4(sc, SF_TXDQ_PRODIDX); i = SF_IDX_HI(txprod) >> 4; @@ -1388,6 +1385,11 @@ static void sf_start(ifp) SF_INC(i, SF_TX_DLIST_CNT); sc->sf_tx_cnt++; + /* + * Don't get the TX DMA queue get too full. + */ + if (sc->sf_tx_cnt > 64) + break; } if (cur_tx == NULL) { diff --git a/sys/pci/if_sf.c b/sys/pci/if_sf.c index 8f5fec3c075..c0c05d5300a 100644 --- a/sys/pci/if_sf.c +++ b/sys/pci/if_sf.c @@ -1348,9 +1348,6 @@ static void sf_start(ifp) return; } - if (sc->sf_tx_cnt) - sf_txeof(sc); - txprod = csr_read_4(sc, SF_TXDQ_PRODIDX); i = SF_IDX_HI(txprod) >> 4; @@ -1388,6 +1385,11 @@ static void sf_start(ifp) SF_INC(i, SF_TX_DLIST_CNT); sc->sf_tx_cnt++; + /* + * Don't get the TX DMA queue get too full. + */ + if (sc->sf_tx_cnt > 64) + break; } if (cur_tx == NULL) {