Tweak the Macronix driver to hopefully make it more reliable:
- Change to the same transmit scheme as the PNIC driver. - Dynamically set the cache alignment, and set burst size the same as the PNIC driver in mx_init(). - Enable 'store and forward' mode by default. This is the slowest option and it does reduce 100Mbps performance somewhat, but it's the most reliable setting I can find. I'm more interested in having the driver work reliably than trying to squeeze the best performance out of it. The reason I'm doing this is that on *some* systems you may see a lot of transmit underruns (which I can't explain: these are *fast* test systems) and these errors seem to cause unusual and decidedly non-tulip-like behavior. In normal 10Mbps mode, performance is fine (you can easily saturate a 10Mbps link). Also tweak some of the other drivers: - Increase the size of the TX ring for the Winbond, ASIX, VIA Rhine and PNIC drivers. - Set a larger value for ifq_maxlen in the ThunderLAN driver. The setting of TL_TX_LIST_CNT - 1 is too low (the ThunderLAN driver only allocates 20 transmit descriptors, and I don't want to fiddle with that now because the ThunderLAN's descriptor structure is an oddball size compared to the others).
This commit is contained in:
parent
14f270d531
commit
8b3db0e822
@ -29,7 +29,7 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
* THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: if_vrreg.h,v 1.10 1999/02/23 06:47:52 wpaul Exp $
|
||||
* $Id: if_vrreg.h,v 1.3 1999/02/23 15:38:24 wpaul Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -335,7 +335,7 @@ struct vr_desc {
|
||||
|
||||
#define VR_MAXFRAGS 16
|
||||
#define VR_RX_LIST_CNT 64
|
||||
#define VR_TX_LIST_CNT 64
|
||||
#define VR_TX_LIST_CNT 128
|
||||
#define VR_MIN_FRAMELEN 60
|
||||
#define VR_FRAMELEN 1536
|
||||
#define VR_RXLEN 1520
|
||||
|
@ -29,7 +29,7 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
* THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: if_axreg.h,v 1.6 1999/04/08 03:57:57 wpaul Exp $
|
||||
* $Id: if_axreg.h,v 1.5 1999/04/08 17:42:47 wpaul Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -265,7 +265,7 @@ struct ax_desc {
|
||||
|
||||
#define AX_MAXFRAGS 16
|
||||
#define AX_RX_LIST_CNT 64
|
||||
#define AX_TX_LIST_CNT 64
|
||||
#define AX_TX_LIST_CNT 128
|
||||
#define AX_MIN_FRAMELEN 60
|
||||
|
||||
/*
|
||||
|
108
sys/pci/if_mx.c
108
sys/pci/if_mx.c
@ -29,7 +29,7 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
* THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: if_mx.c,v 1.14 1999/04/16 01:56:06 ghelmer Exp $
|
||||
* $Id: if_mx.c,v 1.41 1999/05/06 15:07:10 wpaul Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -76,11 +76,6 @@
|
||||
#include <net/bpf.h>
|
||||
#endif
|
||||
|
||||
#include "opt_bdg.h"
|
||||
#ifdef BRIDGE
|
||||
#include <net/bridge.h>
|
||||
#endif
|
||||
|
||||
#include <vm/vm.h> /* for vtophys */
|
||||
#include <vm/pmap.h> /* for vtophys */
|
||||
#include <machine/clock.h> /* for DELAY */
|
||||
@ -99,7 +94,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"$Id: if_mx.c,v 1.14 1999/04/16 01:56:06 ghelmer Exp $";
|
||||
"$Id: if_mx.c,v 1.41 1999/05/06 15:07:10 wpaul Exp $";
|
||||
#endif
|
||||
|
||||
/*
|
||||
@ -1406,6 +1401,9 @@ mx_attach(config_id, unit)
|
||||
else
|
||||
sc->mx_type = MX_TYPE_987x5;
|
||||
|
||||
/* Save the cache line size. */
|
||||
sc->mx_cachesize = pci_conf_read(config_id, MX_PCI_CACHELEN) & 0xFF;
|
||||
|
||||
/* Reset the adapter. */
|
||||
mx_reset(sc);
|
||||
|
||||
@ -1754,44 +1752,21 @@ static void mx_rxeof(sc)
|
||||
|
||||
#if NBPFILTER > 0
|
||||
/*
|
||||
* Handle BPF listeners. Let the BPF user see the packet.
|
||||
*/
|
||||
if (ifp->if_bpf)
|
||||
bpf_mtap(ifp, m);
|
||||
#endif
|
||||
#ifdef BRIDGE
|
||||
if (do_bridge) {
|
||||
struct ifnet *bdg_ifp ;
|
||||
bdg_ifp = bridge_in(m);
|
||||
if (bdg_ifp == BDG_DROP)
|
||||
goto dropit ;
|
||||
if (bdg_ifp != BDG_LOCAL)
|
||||
bdg_forward(&m, bdg_ifp);
|
||||
if (bdg_ifp != BDG_LOCAL &&
|
||||
bdg_ifp != BDG_BCAST &&
|
||||
bdg_ifp != BDG_MCAST)
|
||||
goto dropit ;
|
||||
goto getit ;
|
||||
}
|
||||
#endif
|
||||
/*
|
||||
* Don't pass packet up to the ether_input() layer unless it's
|
||||
* Handle BPF listeners. Let the BPF user see the packet, but
|
||||
* don't pass it up to the ether_input() layer unless it's
|
||||
* a broadcast packet, multicast packet, matches our ethernet
|
||||
* address or the interface is in promiscuous mode.
|
||||
*/
|
||||
if (ifp->if_flags & IFF_PROMISC &&
|
||||
(bcmp(eh->ether_dhost, sc->arpcom.ac_enaddr,
|
||||
ETHER_ADDR_LEN) &&
|
||||
(eh->ether_dhost[0] & 1) == 0)) {
|
||||
#ifdef BRIDGE
|
||||
dropit:
|
||||
#endif
|
||||
if (m)
|
||||
if (ifp->if_bpf) {
|
||||
bpf_mtap(ifp, m);
|
||||
if (ifp->if_flags & IFF_PROMISC &&
|
||||
(bcmp(eh->ether_dhost, sc->arpcom.ac_enaddr,
|
||||
ETHER_ADDR_LEN) &&
|
||||
(eh->ether_dhost[0] & 1) == 0)) {
|
||||
m_freem(m);
|
||||
continue;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
#ifdef BRIDGE
|
||||
getit:
|
||||
#endif
|
||||
/* Remove header from mbuf and pass it on. */
|
||||
m_adj(m, sizeof(struct ether_header));
|
||||
@ -1843,7 +1818,7 @@ static void mx_txeof(sc)
|
||||
cur_tx = sc->mx_cdata.mx_tx_head;
|
||||
txstat = MX_TXSTATUS(cur_tx);
|
||||
|
||||
if ((txstat & MX_TXSTAT_OWN) || MX_TXOWN(cur_tx) == MX_UNSENT)
|
||||
if (txstat & MX_TXSTAT_OWN)
|
||||
break;
|
||||
|
||||
if (txstat & MX_TXSTAT_ERRSUM) {
|
||||
@ -1894,12 +1869,6 @@ static void mx_txeoc(sc)
|
||||
else
|
||||
mx_autoneg(sc, MX_FLAG_DELAYTIMEO, 1);
|
||||
}
|
||||
} else {
|
||||
if (MX_TXOWN(sc->mx_cdata.mx_tx_head) == MX_UNSENT) {
|
||||
MX_TXOWN(sc->mx_cdata.mx_tx_head) = MX_TXSTAT_OWN;
|
||||
ifp->if_timer = 5;
|
||||
CSR_WRITE_4(sc, MX_TXSTART, 0xFFFFFFFF);
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
@ -2068,7 +2037,7 @@ static int mx_encap(sc, c, m_head)
|
||||
|
||||
c->mx_mbuf = m_head;
|
||||
c->mx_lastdesc = frag - 1;
|
||||
MX_TXCTL(c) |= MX_TXCTL_LASTFRAG;
|
||||
MX_TXCTL(c) |= MX_TXCTL_LASTFRAG|MX_TXCTL_FINT;
|
||||
MX_TXNEXT(c) = vtophys(&c->mx_nextdesc->mx_ptr->mx_frag[0]);
|
||||
return(0);
|
||||
}
|
||||
@ -2094,6 +2063,9 @@ static void mx_start(ifp)
|
||||
return;
|
||||
}
|
||||
|
||||
if (ifp->if_flags & IFF_OACTIVE)
|
||||
return;
|
||||
|
||||
/*
|
||||
* Check for an available queue slot. If there are none,
|
||||
* punt.
|
||||
@ -2127,6 +2099,9 @@ static void mx_start(ifp)
|
||||
if (ifp->if_bpf)
|
||||
bpf_mtap(ifp, cur_tx->mx_mbuf);
|
||||
#endif
|
||||
MX_TXOWN(cur_tx) = MX_TXSTAT_OWN;
|
||||
CSR_WRITE_4(sc, MX_TXSTART, 0xFFFFFFFF);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@ -2135,23 +2110,10 @@ static void mx_start(ifp)
|
||||
if (cur_tx == NULL)
|
||||
return;
|
||||
|
||||
/*
|
||||
* Place the request for the upload interrupt
|
||||
* in the last descriptor in the chain. This way, if
|
||||
* we're chaining several packets at once, we'll only
|
||||
* get an interupt once for the whole chain rather than
|
||||
* once for each packet.
|
||||
*/
|
||||
MX_TXCTL(cur_tx) |= MX_TXCTL_FINT;
|
||||
sc->mx_cdata.mx_tx_tail = cur_tx;
|
||||
|
||||
if (sc->mx_cdata.mx_tx_head == NULL) {
|
||||
if (sc->mx_cdata.mx_tx_head == NULL)
|
||||
sc->mx_cdata.mx_tx_head = start_tx;
|
||||
MX_TXOWN(start_tx) = MX_TXSTAT_OWN;
|
||||
CSR_WRITE_4(sc, MX_TXSTART, 0xFFFFFFFF);
|
||||
} else {
|
||||
MX_TXOWN(start_tx) = MX_UNSENT;
|
||||
}
|
||||
|
||||
/*
|
||||
* Set a timeout in case the chip goes out to lunch.
|
||||
@ -2186,11 +2148,27 @@ static void mx_init(xsc)
|
||||
/*
|
||||
* Set cache alignment and burst length.
|
||||
*/
|
||||
CSR_WRITE_4(sc, MX_BUSCTL, MX_BUSCTL_CONFIG);
|
||||
CSR_WRITE_4(sc, MX_BUSCTL, MX_BUSCTL_MUSTBEONE|MX_BUSCTL_ARBITRATION);
|
||||
MX_SETBIT(sc, MX_BUSCTL, MX_BURSTLEN_16LONG);
|
||||
switch(sc->mx_cachesize) {
|
||||
case 32:
|
||||
MX_SETBIT(sc, MX_BUSCTL, MX_CACHEALIGN_32LONG);
|
||||
break;
|
||||
case 16:
|
||||
MX_SETBIT(sc, MX_BUSCTL, MX_CACHEALIGN_16LONG);
|
||||
break;
|
||||
case 8:
|
||||
MX_SETBIT(sc, MX_BUSCTL, MX_CACHEALIGN_8LONG);
|
||||
break;
|
||||
case 0:
|
||||
default:
|
||||
MX_SETBIT(sc, MX_BUSCTL, MX_CACHEALIGN_NONE);
|
||||
break;
|
||||
}
|
||||
|
||||
MX_SETBIT(sc, MX_NETCFG, MX_NETCFG_NO_RXCRC);
|
||||
MX_CLRBIT(sc, MX_NETCFG, MX_NETCFG_HEARTBEAT);
|
||||
MX_CLRBIT(sc, MX_NETCFG, MX_NETCFG_STORENFWD);
|
||||
MX_SETBIT(sc, MX_NETCFG, MX_NETCFG_STORENFWD);
|
||||
MX_CLRBIT(sc, MX_NETCFG, MX_NETCFG_TX_BACKOFF);
|
||||
|
||||
/*
|
||||
@ -2214,7 +2192,7 @@ static void mx_init(xsc)
|
||||
mx_setmode(sc, sc->ifmedia.ifm_media, 0);
|
||||
|
||||
MX_CLRBIT(sc, MX_NETCFG, MX_NETCFG_TX_THRESH);
|
||||
MX_CLRBIT(sc, MX_NETCFG, MX_NETCFG_SPEEDSEL);
|
||||
/*MX_CLRBIT(sc, MX_NETCFG, MX_NETCFG_SPEEDSEL);*/
|
||||
|
||||
if (IFM_SUBTYPE(sc->ifmedia.ifm_media) == IFM_10_T)
|
||||
MX_SETBIT(sc, MX_NETCFG, MX_TXTHRESH_160BYTES);
|
||||
|
@ -29,7 +29,7 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
* THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: if_mxreg.h,v 1.16 1999/04/08 17:35:38 wpaul Exp $
|
||||
* $Id: if_mxreg.h,v 1.17 1999/05/06 15:04:00 wpaul Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -93,7 +93,8 @@
|
||||
#define MX_BUSCTL_BUF_BIGENDIAN 0x00000080
|
||||
#define MX_BUSCTL_BURSTLEN 0x00003F00
|
||||
#define MX_BUSCTL_CACHEALIGN 0x0000C000
|
||||
#define MX_BUSCTL_XMITPOLL 0x00060000
|
||||
#define MX_BUSCTL_TXPOLL 0x000E0000
|
||||
#define MX_BUSCTL_MUSTBEONE 0x04000000
|
||||
|
||||
#define MX_SKIPLEN_1LONG 0x00000004
|
||||
#define MX_SKIPLEN_2LONG 0x00000008
|
||||
@ -101,6 +102,7 @@
|
||||
#define MX_SKIPLEN_4LONG 0x00000020
|
||||
#define MX_SKIPLEN_5LONG 0x00000040
|
||||
|
||||
#define MX_CACHEALIGN_NONE 0x00000000
|
||||
#define MX_CACHEALIGN_8LONG 0x00004000
|
||||
#define MX_CACHEALIGN_16LONG 0x00008000
|
||||
#define MX_CACHEALIGN_32LONG 0x0000C000
|
||||
@ -398,7 +400,7 @@ struct mx_desc {
|
||||
|
||||
#define MX_MAXFRAGS 16
|
||||
#define MX_RX_LIST_CNT 64
|
||||
#define MX_TX_LIST_CNT 64
|
||||
#define MX_TX_LIST_CNT 128
|
||||
#define MX_MIN_FRAMELEN 60
|
||||
|
||||
/*
|
||||
@ -416,8 +418,6 @@ struct mx_txdesc {
|
||||
|
||||
#define MX_TXOWN(x) x->mx_ptr->mx_frag[0].mx_status
|
||||
|
||||
#define MX_UNSENT 0x12341234
|
||||
|
||||
struct mx_list_data {
|
||||
struct mx_desc mx_rx_list[MX_RX_LIST_CNT];
|
||||
struct mx_txdesc mx_tx_list[MX_TX_LIST_CNT];
|
||||
@ -490,7 +490,7 @@ struct mx_softc {
|
||||
u_int8_t mx_tx_pend; /* TX pending */
|
||||
u_int8_t mx_want_auto;
|
||||
u_int8_t mx_autoneg;
|
||||
u_int8_t mx_singlebuf;
|
||||
u_int8_t mx_cachesize;
|
||||
caddr_t mx_ldata_ptr;
|
||||
struct mx_list_data *mx_ldata;
|
||||
struct mx_chain_data mx_cdata;
|
||||
@ -581,6 +581,7 @@ struct mx_softc {
|
||||
#define MX_PCI_STATUS 0x06
|
||||
#define MX_PCI_REVID 0x08
|
||||
#define MX_PCI_CLASSCODE 0x09
|
||||
#define MX_PCI_CACHELEN 0x0C
|
||||
#define MX_PCI_LATENCY_TIMER 0x0D
|
||||
#define MX_PCI_HEADER_TYPE 0x0E
|
||||
#define MX_PCI_LOIO 0x10
|
||||
|
@ -29,7 +29,7 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
* THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: if_pnreg.h,v 1.26 1999/04/14 18:52:02 wpaul Exp $
|
||||
* $Id: if_pnreg.h,v 1.10 1999/04/14 19:40:08 wpaul Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -390,7 +390,7 @@ struct pn_desc {
|
||||
|
||||
#define PN_MAXFRAGS 16
|
||||
#define PN_RX_LIST_CNT 64
|
||||
#define PN_TX_LIST_CNT 64
|
||||
#define PN_TX_LIST_CNT 128
|
||||
#define PN_MIN_FRAMELEN 60
|
||||
#define PN_FRAMELEN 1536
|
||||
#define PN_RXLEN 1518
|
||||
|
@ -29,7 +29,7 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
* THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: if_tl.c,v 1.28 1999/03/31 04:04:14 wpaul Exp $
|
||||
* $Id: if_tl.c,v 1.29 1999/04/24 20:14:01 peter Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -221,7 +221,7 @@
|
||||
|
||||
#if !defined(lint)
|
||||
static const char rcsid[] =
|
||||
"$Id: if_tl.c,v 1.28 1999/03/31 04:04:14 wpaul Exp $";
|
||||
"$Id: if_tl.c,v 1.29 1999/04/24 20:14:01 peter Exp $";
|
||||
#endif
|
||||
|
||||
/*
|
||||
@ -1715,7 +1715,7 @@ tl_attach(config_id, unit)
|
||||
ifp->if_watchdog = tl_watchdog;
|
||||
ifp->if_init = tl_init;
|
||||
ifp->if_mtu = ETHERMTU;
|
||||
ifp->if_snd.ifq_maxlen = TL_TX_LIST_CNT - 1;
|
||||
ifp->if_snd.ifq_maxlen = IFQ_MAXLEN;
|
||||
callout_handle_init(&sc->tl_stat_ch);
|
||||
|
||||
/* Reset the adapter again. */
|
||||
|
@ -29,7 +29,7 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
* THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: if_vrreg.h,v 1.10 1999/02/23 06:47:52 wpaul Exp $
|
||||
* $Id: if_vrreg.h,v 1.3 1999/02/23 15:38:24 wpaul Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -335,7 +335,7 @@ struct vr_desc {
|
||||
|
||||
#define VR_MAXFRAGS 16
|
||||
#define VR_RX_LIST_CNT 64
|
||||
#define VR_TX_LIST_CNT 64
|
||||
#define VR_TX_LIST_CNT 128
|
||||
#define VR_MIN_FRAMELEN 60
|
||||
#define VR_FRAMELEN 1536
|
||||
#define VR_RXLEN 1520
|
||||
|
@ -29,7 +29,7 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
* THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: if_wbreg.h,v 1.12 1998/11/29 06:40:50 wpaul Exp wpaul $
|
||||
* $Id: if_wbreg.h,v 1.2 1999/01/16 06:25:59 wpaul Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -267,7 +267,7 @@ struct wb_desc {
|
||||
|
||||
#define WB_MAXFRAGS 16
|
||||
#define WB_RX_LIST_CNT 64
|
||||
#define WB_TX_LIST_CNT 64
|
||||
#define WB_TX_LIST_CNT 128
|
||||
#define WB_MIN_FRAMELEN 60
|
||||
|
||||
/*
|
||||
|
Loading…
x
Reference in New Issue
Block a user