diff options
author | dg <dg@FreeBSD.org> | 1996-09-19 09:15:20 +0000 |
---|---|---|
committer | dg <dg@FreeBSD.org> | 1996-09-19 09:15:20 +0000 |
commit | 421d9828c9a2e9cb663c417c4d0dd5721678937a (patch) | |
tree | d3637fe3ef984d3eeb8065e484efe25298189664 | |
parent | 0c5fd5b5a08483af87aaf200b399018c948aa13b (diff) | |
download | FreeBSD-src-421d9828c9a2e9cb663c417c4d0dd5721678937a.zip FreeBSD-src-421d9828c9a2e9cb663c417c4d0dd5721678937a.tar.gz |
Implemented a better, dynamic, mechanism for adjusting the transmit
threshold.
-rw-r--r-- | sys/dev/fxp/if_fxp.c | 21 | ||||
-rw-r--r-- | sys/pci/if_fxp.c | 21 |
2 files changed, 38 insertions, 4 deletions
diff --git a/sys/dev/fxp/if_fxp.c b/sys/dev/fxp/if_fxp.c index 52d4253..7e72bec 100644 --- a/sys/dev/fxp/if_fxp.c +++ b/sys/dev/fxp/if_fxp.c @@ -24,7 +24,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: if_fxp.c,v 1.14 1996/09/06 23:08:52 phk Exp $ + * $Id: if_fxp.c,v 1.15 1996/09/18 16:18:05 davidg Exp $ */ /* @@ -152,6 +152,13 @@ static struct pci_device fxp_device = { DATA_SET(pcidevice_set, fxp_device); /* + * Set initial transmit threshold at 64 (512 bytes). This is + * increased by 64 (512 bytes) at a time, to maximum of 192 + * (1536 bytes), if an underrun occurs. + */ +static int tx_threshold = 64; + +/* * Number of transmit control blocks. This determines the number * of transmit buffers that can be chained in the CB list. * This must be a power of two. @@ -491,7 +498,7 @@ tbdinit: txp->cb_status = 0; txp->cb_command = FXP_CB_COMMAND_XMIT | FXP_CB_COMMAND_SF | FXP_CB_COMMAND_S; - txp->tx_threshold = 128; /* bytes*8 = 1024 */ + txp->tx_threshold = tx_threshold; txp->mb_head = mb_head; /* @@ -678,6 +685,15 @@ fxp_stats_update(arg) sp->rx_overrun_errors + sp->rx_shortframes; /* + * If any transmit underruns occured, bump up the transmit + * threshold by another 512 bytes (64 * 8). + */ + if (sp->tx_underruns) { + ifp->if_oerrors += sp->tx_underruns; + if (tx_threshold < 192) + tx_threshold += 64; + } + /* * If there is no pending command, start another stats * dump. Otherwise punt for now. */ @@ -696,6 +712,7 @@ fxp_stats_update(arg) * next timer event to update them. */ sp->tx_good = 0; + sp->tx_underruns = 0; sp->tx_total_collisions = 0; sp->rx_good = 0; diff --git a/sys/pci/if_fxp.c b/sys/pci/if_fxp.c index 52d4253..7e72bec 100644 --- a/sys/pci/if_fxp.c +++ b/sys/pci/if_fxp.c @@ -24,7 +24,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: if_fxp.c,v 1.14 1996/09/06 23:08:52 phk Exp $ + * $Id: if_fxp.c,v 1.15 1996/09/18 16:18:05 davidg Exp $ */ /* @@ -152,6 +152,13 @@ static struct pci_device fxp_device = { DATA_SET(pcidevice_set, fxp_device); /* + * Set initial transmit threshold at 64 (512 bytes). This is + * increased by 64 (512 bytes) at a time, to maximum of 192 + * (1536 bytes), if an underrun occurs. + */ +static int tx_threshold = 64; + +/* * Number of transmit control blocks. This determines the number * of transmit buffers that can be chained in the CB list. * This must be a power of two. @@ -491,7 +498,7 @@ tbdinit: txp->cb_status = 0; txp->cb_command = FXP_CB_COMMAND_XMIT | FXP_CB_COMMAND_SF | FXP_CB_COMMAND_S; - txp->tx_threshold = 128; /* bytes*8 = 1024 */ + txp->tx_threshold = tx_threshold; txp->mb_head = mb_head; /* @@ -678,6 +685,15 @@ fxp_stats_update(arg) sp->rx_overrun_errors + sp->rx_shortframes; /* + * If any transmit underruns occured, bump up the transmit + * threshold by another 512 bytes (64 * 8). + */ + if (sp->tx_underruns) { + ifp->if_oerrors += sp->tx_underruns; + if (tx_threshold < 192) + tx_threshold += 64; + } + /* * If there is no pending command, start another stats * dump. Otherwise punt for now. */ @@ -696,6 +712,7 @@ fxp_stats_update(arg) * next timer event to update them. */ sp->tx_good = 0; + sp->tx_underruns = 0; sp->tx_total_collisions = 0; sp->rx_good = 0; |