Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/ic Calling DELAY() during polling for command comple...
details: https://anonhg.NetBSD.org/src/rev/e057a06549bb
branches: trunk
changeset: 472062:e057a06549bb
user: jonathan <jonathan%NetBSD.org@localhost>
date: Tue Apr 20 04:40:24 1999 +0000
description:
Calling DELAY() during polling for command completion of the normal
per-packet discard of every received packet increases latency and
decrease throughput. INstead, Spin on S_COMMAND_IN_PROGESS for enough
iterations as the expected time to completion. Only do DELAY()/poll
loops (as suggested by Jason Thorpe) if spinning fails.
Take PCI as fastest case and compute worst-case estimate.
Shorten DELAY() in S_COMMAND_COMPLETE polling-loop up 10, loop-count
down. to speed up epreset() completion (m/c filter change, ifup/ipdown, etc).
diffstat:
sys/dev/ic/elink3.c | 27 ++++++++++++++++++++-------
1 files changed, 20 insertions(+), 7 deletions(-)
diffs (58 lines):
diff -r 9a75d0676cee -r e057a06549bb sys/dev/ic/elink3.c
--- a/sys/dev/ic/elink3.c Tue Apr 20 00:45:24 1999 +0000
+++ b/sys/dev/ic/elink3.c Tue Apr 20 04:40:24 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: elink3.c,v 1.56 1999/04/19 23:26:48 jonathan Exp $ */
+/* $NetBSD: elink3.c,v 1.57 1999/04/20 04:40:24 jonathan Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -277,12 +277,12 @@
bus_space_handle_t ioh;
{
- register int i;
+ int i;
- for (i = 0; i < 1000; i++) {
- if (bus_space_read_2(iot, ioh, ELINK_STATUS) & S_COMMAND_IN_PROGRESS)
- return;
- DELAY(100);
+ for (i = 0; i < 10000; i++) {
+ if ((bus_space_read_2(iot, ioh, ELINK_STATUS) & S_COMMAND_IN_PROGRESS) == 0)
+ break;
+ DELAY(10);
}
}
@@ -299,7 +299,6 @@
register bus_space_handle_t ioh = sc->sc_ioh;
bus_space_write_2(iot, ioh, cmd, arg);
-
ep_finish_reset(iot, ioh);
}
@@ -309,8 +308,22 @@
register bus_space_tag_t iot;
register bus_space_handle_t ioh;
{
+ int i;
bus_space_write_2(iot, ioh, ELINK_COMMAND, RX_DISCARD_TOP_PACK);
+
+ /*
+ * Spin for about 1 msec, to avoid forcing a DELAY() between
+ * every received packet (adding latency and limiting pkt-recv rate).
+ * On PCI, at 4 30-nsec PCI bus cycles for a read, 8000 iterations
+ * is about right.
+ */
+ for (i = 0; i < 8000; i++) {
+ if ((bus_space_read_2(iot, ioh, ELINK_STATUS) & S_COMMAND_IN_PROGRESS) == 0)
+ return;
+ }
+
+ /* Didn't complete in a hurry. Do DELAY()s. */
ep_finish_reset(iot, ioh);
}
Home |
Main Index |
Thread Index |
Old Index