diff options
author | msmith <msmith@FreeBSD.org> | 1998-08-27 22:41:18 +0000 |
---|---|---|
committer | msmith <msmith@FreeBSD.org> | 1998-08-27 22:41:18 +0000 |
commit | 6e4972118a056b0fc9e35e26a8ff56d250e8ff93 (patch) | |
tree | 7b69bcd5bf920cff66fb7f0b4d4547421e2f7bba /sys/dev/cs | |
parent | eb89ee0b59cfc7687df759944e345ae3717465bc (diff) | |
download | FreeBSD-src-6e4972118a056b0fc9e35e26a8ff56d250e8ff93.zip FreeBSD-src-6e4972118a056b0fc9e35e26a8ff56d250e8ff93.tar.gz |
Enable duplex autodetection if UTP media are autodetected.
Add a sysctl 'machdep.cs_recv_delay' to specify how long to wait after
receiving a packet in order to check for a subsequent (back-to-back)
packet. The cs8900 has a very small receive buffer, so this helps avoid
overflows at the cost of some extra CPU overhead.
Submitted by: Oleg Sharoiko <os@rsu.ru>, MIHIRA "Sanpei" Yoshiro <sanpei@sanpei.org>
Diffstat (limited to 'sys/dev/cs')
-rw-r--r-- | sys/dev/cs/if_cs.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/sys/dev/cs/if_cs.c b/sys/dev/cs/if_cs.c index 1a81c66..feb395c 100644 --- a/sys/dev/cs/if_cs.c +++ b/sys/dev/cs/if_cs.c @@ -27,7 +27,7 @@ */ /* - * $Id: if_cs.c,v 1.2 1998/08/12 18:02:48 bde Exp $ + * $Id: if_cs.c,v 1.3 1998/08/13 20:31:17 msmith Exp $ * * Device driver for Crystal Semiconductor CS8920 based ethernet * adapters. By Maxim Bolotin and Oleg Sharoiko, 27-April-1997 @@ -44,6 +44,7 @@ #include <sys/kernel.h> #include <sys/mbuf.h> #include <sys/socket.h> +#include <sys/sysctl.h> #include <sys/syslog.h> #include <net/if.h> @@ -72,10 +73,6 @@ #define CS_DMA_BUFFER_SIZE 16384 #endif -#ifndef CS_WAIT_NEXT_PACKET -#define CS_WAIT_NEXT_PACKET 570 -#endif - /* * cs_softc: per line info and status */ @@ -105,8 +102,11 @@ static struct cs_softc { static u_long cs_unit = NCS; -static int cs_attach __P((struct cs_softc *, int, int)); -static int cs_attach_isa __P((struct isa_device *)); +static int cs_recv_delay = 570; +SYSCTL_INT(_machdep, OID_AUTO, cs_recv_delay, CTLFLAG_RW, &cs_recv_delay, 0, ""); + +static int cs_attach __P((struct cs_softc *, int, int)); +static int cs_attach_isa __P((struct isa_device *)); static void cs_init __P((void *)); static int cs_ioctl __P((struct ifnet *, u_long, caddr_t)); static int cs_probe __P((struct isa_device *)); @@ -799,7 +799,7 @@ cs_get_packet(struct cs_softc *sc) ifp->if_ipackets++; if (length==ETHER_MAX_LEN-ETHER_CRC_LEN) - DELAY( CS_WAIT_NEXT_PACKET ); + DELAY( cs_recv_delay ); } else { m_freem(m); } @@ -1212,9 +1212,10 @@ cs_mediaset(struct cs_softc *sc, int media) switch (IFM_SUBTYPE(media)) { default: case IFM_AUTO: - if (error=enable_tp(sc)) - if (error=enable_bnc(sc)) - error=enable_aui(sc); + if ((error=enable_tp(sc))==0) + error = cs_duplex_auto(sc); + else if (error=enable_bnc(sc)) + error = enable_aui(sc); break; case IFM_10_T: if (error=enable_tp(sc)) |