summaryrefslogtreecommitdiffstats
path: root/sys/pci/if_ste.c
diff options
context:
space:
mode:
authorru <ru@FreeBSD.org>2004-04-06 07:58:32 +0000
committerru <ru@FreeBSD.org>2004-04-06 07:58:32 +0000
commit98d9fd07bb5e57f6a66d22479ead515743049923 (patch)
treeead8d2327d2836379c3ef48df57b8fd9ca05acc5 /sys/pci/if_ste.c
parent728ea9afc21bf876dc79cb1a03479a112317abee (diff)
downloadFreeBSD-src-98d9fd07bb5e57f6a66d22479ead515743049923.zip
FreeBSD-src-98d9fd07bb5e57f6a66d22479ead515743049923.tar.gz
- Improved the TX performance with polling(4) by only checking the
status registers for error conditions and updating statistics when there are cycles left (inspired by the nge(4) driver). - Removed the TX list counter and the producer/consumer gap; it's enough to just ensure we don't reuse the last (free) descriptor, as the chip may not have read its next pointer yet. If we reuse it, the TX may stall under a heavy TX load with polling enabled. - Dropped code to recharge the watchdog timer, it's pointless; the watchdog routine will re-init the chip and both RX and TX lists.
Diffstat (limited to 'sys/pci/if_ste.c')
-rw-r--r--sys/pci/if_ste.c26
1 files changed, 11 insertions, 15 deletions
diff --git a/sys/pci/if_ste.c b/sys/pci/if_ste.c
index 9c375f8..1062aed 100644
--- a/sys/pci/if_ste.c
+++ b/sys/pci/if_ste.c
@@ -651,7 +651,7 @@ ste_poll(struct ifnet *ifp, enum poll_cmd cmd, int count)
if (ifp->if_snd.ifq_head != NULL)
ste_start(ifp);
- if (cmd == POLL_AND_CHECK_STATUS) { /* also check status register */
+ if (sc->rxcycles > 0 && cmd == POLL_AND_CHECK_STATUS) {
u_int16_t status;
status = CSR_READ_2(sc, STE_ISR_ACK);
@@ -923,21 +923,15 @@ ste_txeof(sc)
m_freem(cur_tx->ste_mbuf);
cur_tx->ste_mbuf = NULL;
-
+ ifp->if_flags &= ~IFF_OACTIVE;
ifp->if_opackets++;
- sc->ste_cdata.ste_tx_cnt--;
STE_INC(idx, STE_TX_LIST_CNT);
}
- if (idx != sc->ste_cdata.ste_tx_cons) {
- sc->ste_cdata.ste_tx_cons = idx;
- ifp->if_flags &= ~IFF_OACTIVE;
- if (idx == sc->ste_cdata.ste_tx_prod)
- ifp->if_timer = 0;
- else if (ifp->if_timer == 0)
- ifp->if_timer = 5;
- }
+ sc->ste_cdata.ste_tx_cons = idx;
+ if (idx == sc->ste_cdata.ste_tx_prod)
+ ifp->if_timer = 0;
}
static void
@@ -1302,7 +1296,6 @@ ste_init_tx_list(sc)
cd->ste_tx_prod = 0;
cd->ste_tx_cons = 0;
- cd->ste_tx_cnt = 0;
return;
}
@@ -1637,8 +1630,12 @@ ste_start(ifp)
idx = sc->ste_cdata.ste_tx_prod;
while(sc->ste_cdata.ste_tx_chain[idx].ste_mbuf == NULL) {
-
- if ((STE_TX_LIST_CNT - sc->ste_cdata.ste_tx_cnt) < 3) {
+ /*
+ * We cannot re-use the last (free) descriptor;
+ * the chip may not have read its ste_next yet.
+ */
+ if (STE_NEXT(idx, STE_TX_LIST_CNT) ==
+ sc->ste_cdata.ste_tx_cons) {
ifp->if_flags |= IFF_OACTIVE;
break;
}
@@ -1683,7 +1680,6 @@ ste_start(ifp)
BPF_MTAP(ifp, cur_tx->ste_mbuf);
STE_INC(idx, STE_TX_LIST_CNT);
- sc->ste_cdata.ste_tx_cnt++;
ifp->if_timer = 5;
}
sc->ste_cdata.ste_tx_prod = idx;
OpenPOWER on IntegriCloud