mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-18 15:30:21 +00:00
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>
This commit is contained in:
parent
c9d8fd0a7b
commit
8abff6b13b
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=38592
@ -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))
|
||||
|
@ -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))
|
||||
|
Loading…
Reference in New Issue
Block a user