Commit Graph

1695 Commits

Author SHA1 Message Date
Luigi Rizzo
273b222cdb Use ETHER_CRC_LEN instead of SIS_CRC_SIZE
Suggested-by: Archie, Doug Ambrisko
2002-02-07 08:04:24 +00:00
Luigi Rizzo
254d9d5f73 Fix a bug in the driver -- the chip will always include the CRC
in the received packet size, but the upper level routines want
the length without it.

Reported-by: Doug Ambrisko, ambrisko@freebsd.org
2002-02-07 07:47:00 +00:00
Doug Ambrisko
4c2380660a Fix support for 630ET support. We don't need the Linux part to set the
mii access mode.  Fix the device ID and make it read the mac via sis_read_mac.

Reviewed by: 	imp
MFC after:	1 week
2002-02-06 22:06:47 +00:00
Benno Rice
64eecf3a43 Correctly identify the Intel 82830 AGP bridge. 2002-02-05 23:13:25 +00:00
Bruce Evans
3230a24cb4 Merged cy_pcireg.h into the one file that uses it (cy_pci.c). 2002-02-02 02:22:51 +00:00
Bruce Evans
7e8c3cecdf Fixed breakage of interrupt setup in previous commit. It used an
uninitialized variable in the !CY_PCI_FASTINTR case (*blush*).
2002-02-02 02:05:44 +00:00
Doug Ambrisko
45fe21a0a2 Forgot one part of the VLAN support for the dc(4) driver.
Pointed out by: Shin-ichi YOSHIMOTO <yosimoto@waishi.jp>
2002-01-16 21:34:11 +00:00
Doug Ambrisko
db40c1aef4 Add VLAN for the dc(4) driver (ie long frame). The patch is 2 parts.
One to notify the system that the MTU for VLAN can be 1500 so the vlan
will automatically be configured with a 1500 MTU the other is to ignore
the error case if the received frame is to long.

The frame size notification came from code in the SIS driver, and
the support for long frames derived from the NetBSD Tulip driver.

Tested on:	4 port D-Link adapter DFE-570TX 4 Intel 21143
		Netgear card with 82c169 PNIC 10/100BaseTX

Reviewed by:	ru (manpage), wpaul (not objected to), archie
Approved by:	imp
Obtained from:	NetBSD
2002-01-16 16:33:58 +00:00
Bill Paul
ff6f796866 Fix mind-o: compare sc->sis_rev instead of 'command' when trying to
decide how to read the station address.
2002-01-14 20:52:31 +00:00
Bill Paul
07c006c6fb Add support for newer integrated SiS 900 controllers on the 635 and 735
motherboard chipsets. We need to force the chip to reload its MAC address
into the receive filter, and enable software access mode for the PHY.

PR:		kern/33294
2002-01-12 21:12:17 +00:00
Jim Pirzyk
417c87d137 Add support for the Intel 82443MX chipset
PR:		kern/33032
MFC after:	1 month
2001-12-21 01:28:59 +00:00
Bill Paul
29a2220a5c Fix the "conexant chips don't work in full duplexmode" problem. According
to Phil Kernick:

"The problem is that in full duplex mode, the Conexant chip always reports a
carrier lost error, even when the frame is successfully sent.  So, if we
have a Conexant chip, then ignore carrier lost when in full duplex
mode."

Since the Xircom chips seem to have the same issue and since we already
have a workaround for this, just expand the workaround test to also
check for DC_IS_CONEXANT().
2001-12-19 18:23:45 +00:00
Bill Paul
d9700bb5b5 Fix compiler warning in dc_intr(): if the only code that does a "goto"
to a label is inside an #ifdef block, then the label should *also* be
inside an #ifdef block. Hide the "done:" label which is only used if
DEVICE_POLLING is enabled under #ifdef DEVICE_POLLING.
2001-12-19 18:13:44 +00:00
Matthew N. Dodd
fe7075481b Allow retrieval of the virtual address of the AGP aperture
using agp_get_info().

MFC after:	1 week
2001-12-19 08:54:29 +00:00
Mike Silbersack
dcf11ee64e Fix a problem where stats overflow interrupts would cause
a major slowdown, and re-enable stats overflow interrupts.

For future reference, the bug was in our code, and not
some bug in the 3com chips.

Reviewed by:	wpaul
MFC after:	2 days
2001-12-17 22:24:19 +00:00
Archie Cobbs
5c2c21f4a9 Fix access-after-free bug added in revision 1.31.
Detected by:	INVARIANTS
MFC after:	2 days
2001-12-15 19:59:28 +00:00
Peter Wemm
80c706c80e Patch up some existing style bugs and some that crept in with the
DEVICE_POLLING stuff.
2001-12-15 02:51:21 +00:00
Luigi Rizzo
e4fc250c15 Device Polling code for -current.
Non-SMP, i386-only, no polling in the idle loop at the moment.

To use this code you must compile a kernel with

        options DEVICE_POLLING

and at runtime enable polling with

        sysctl kern.polling.enable=1

The percentage of CPU reserved to userland can be set with

        sysctl kern.polling.user_frac=NN (default is 50)

while the remainder is used by polling device drivers and netisr's.
These are the only two variables that you should need to touch. There
are a few more parameters in kern.polling but the default values
are adequate for all purposes. See the code in kern_poll.c for
more details on them.

Polling in the idle loop will be implemented shortly by introducing
a kernel thread which does the job. Until then, the amount of CPU
dedicated to polling will never exceed (100-user_frac).
The equivalent (actually, better) code for -stable is at

	http://info.iet.unipi.it/~luigi/polling/

and also supports polling in the idle loop.

NOTE to Alpha developers:
There is really nothing in this code that is i386-specific.
If you move the 2 lines supporting the new option from
sys/conf/{files,options}.i386 to sys/conf/{files,options} I am
pretty sure that this should work on the Alpha as well, just that
I do not have a suitable test box to try it. If someone feels like
trying it, I would appreciate it.

NOTE to other developers:
sure some things could be done better, and as always I am open to
constructive criticism, which a few of you have already given and
I greatly appreciated.
However, before proposing radical architectural changes, please
take some time to possibly try out this code, or at the very least
read the comments in kern_poll.c, especially re. the reason why I
am using a soft netisr and cannot (I believe) replace it with a
simple timeout.

Quick description of files touched by this commit:

sys/conf/files.i386
        new file kern/kern_poll.c
sys/conf/options.i386
        new option
sys/i386/i386/trap.c
        poll in trap (disabled by default)
sys/kern/kern_clock.c
        initialization and hardclock hooks.
sys/kern/kern_intr.c
        minor swi_net changes
sys/kern/kern_poll.c
        the bulk of the code.
sys/net/if.h
        new flag
sys/net/if_var.h
        declaration for functions used in device drivers.
sys/net/netisr.h
        NETISR_POLL
sys/dev/fxp/if_fxp.c
sys/dev/fxp/if_fxpvar.h
sys/pci/if_dc.c
sys/pci/if_dcreg.h
sys/pci/if_sis.c
sys/pci/if_sisreg.h
        device driver modifications
2001-12-14 17:56:12 +00:00
Luigi Rizzo
268cc03905 Remove printf's on mbuf/cluster allocation failures. There are now
equivalent and less dangerous (rate limited) messages in
the mbuf allocation code.

MFC after: 3 days
2001-12-14 05:56:35 +00:00
Luigi Rizzo
2dfc960a5b Avoid an unnecessary copy of a packet if it is already in a single mbuf.
Introduce an additional device flag for those NICs which require the
transmit buffers to be aligned to 32-bit boundaries.

(the equivalen fix for STABLE is slightly simpler because there are
no supported chips which require this alignment there.)
2001-12-11 02:47:53 +00:00
David E. O'Brien
6e551fb628 Update to C99, s/__FUNCTION__/__func__/,
also don't use ANSI string concatenation.
2001-12-10 08:09:49 +00:00
Coleman Kane
a28920935a This patch will fix the lockups associated with AMD 751,761,762 based AGP
controllers. There still seems to be some issues with the DRI copying code
for some adapters, at least it doesn't hang the system now. Input would be
appreciated.

PR: 32301
Obtained from:	Eric Anhlot <eanholt@gladstone.uoregon.edu>, Joe <joeo@nks.net>
2001-12-07 05:41:26 +00:00
Peter Wemm
341538b884 MFS (merge from stable): rev 1.13.4.13, fix ordering of IFF_RUNNING mods.
The reason we are required to commit to -current first is so that later
MFC's do not risk the loss of existing bug fixes.  Even if this was not
strictly required in -current, it should still be fixed there too.
2001-12-07 00:58:37 +00:00
Peter Wemm
3b3ec2004a MFS (merge from stable): rev 1.9.2.28, fix ordering of IFF_RUNNING mods.
The reason we are required to commit to -current first is so that later
MFC's do not risk the loss of existing bug fixes.  Even if this was not
strictly required in -current, it should still be fixed there too.
2001-12-07 00:57:57 +00:00
Guido van Rooij
7145906dd6 Add suspend/resume hooks to this driver; necessary to overcome
problems on HP Omnibook 500.

MFC after:	1 week
2001-12-05 10:34:07 +00:00
John Hay
16cba1662f Add VLAN support.
MFC after:	7 days
2001-12-05 09:34:28 +00:00
Luigi Rizzo
40129585e3 Remove error messages on mbuf allocation failures, now
this is done more safely in kern/subr_mbuf.c

Two-days'-delay-thanks-to: @home shutting down service
2001-12-04 02:30:53 +00:00
Brooks Davis
437e48e931 Don't pass an interface pointer to VLAN_INPUT{,_TAG}. Get it from the
mbuf instead.

Suggested by:	fenner
2001-12-03 17:28:27 +00:00
Luigi Rizzo
aec846d484 Per jlemon request, reintroduce some printf() when an
mbuf allocation fails, and fix (i hope) a couple of style bugs.

I believe these printf() are extremely dangerous because now they can
occur on every incoming packet and are not rate limited. They were
meant to warn the sysadmin about lack of resources, but now they
can become a nice way to panic your system under load.

Other drivers (e.g. the fxp driver) have nothing like this.

There is a pending discussion on putting this kind of warnings
elsewhere, and I hope we can fix this soon.
2001-11-29 23:47:47 +00:00
Luigi Rizzo
01faf54bb0 For i386 architecture, remove an expensive m_devget() (and the
underlying unaligned bcopy) on incoming packets that are already
available (albeit unaligned) in a buffer.
The performance improvement varies, depending on CPU and memory
speed, but can be quite large especially on slow CPUs. I have seen
over 50% increase on forwarding speed on the sis driver for the
486/133 (embedded systems), which does exactly the same thing.

The behaviour is controlled by a sysctl variable, hw.dc_quick which
defaults to 1. Set it to 0 to restore the old behaviour.

After running a few experiments (in userland, though) I am convinced
that doing the m_devget() is detrimental to performance in almost
all cases.

Even if your CPU has degraded performance with misaligned data,
the bcopy() in the driver has the same overhead due to misaligment
as the one that you save in the uiomove(), plus you do one extra
copy and pollute the cache.

But more often than not, you do not even have to touch the payload,
e.g. when you are forwarding packets, and even in the often-cited
case of NFS, you often end up passing a pointer to the payload to
the disk controller.

In any case, you can play with the sysctl variable to toggle between
the two behaviours, and see if it makes a difference.

MFC-after: 3 days
2001-11-29 22:46:48 +00:00
Luigi Rizzo
920dcd3fcb Remove the need for an expensive m_devget on the i386, which does not
have alignment problems.

On small boxes (e.g. the net4501 from Soekris, featuring a 486/133)
this provides huge performance benefits: the peak forwarding rate
with avg.sized packets goes up by 50-70% because of this change
alone. Faster CPUs might benefit less from this change, but in any
case the CPU has better things to do than waste time on useless
memory-to-memory copies.

Several drivers (for Tulip-like cards) might benefit from a similar
change.

Right now the new behaviour is controlled by a sysctl variable,
hw.sis_quick which defaults to 1 (on), you can set it to 0 to
reintroduce the old behaviour (and compare the results).  The
variable is only there to show how much you can gain with this
change, it will go away soon.

Also, slightly simplify the code to initialize the ring buffers,
and remove a couple of dangerous printf's which could trigger on
any packet in case of mbuf shortage.

MFC-after: 3 days
2001-11-28 16:10:37 +00:00
Luigi Rizzo
49a79b6661 Fix a bug in the driver -- under load, the receive unit could become
idle and the driver would not detect the event, requiring userland
to cycle the interface to bring it up again.
The fix consists in adding SIS_IMR_RX_IDLE to the interrupt mask and
add a command in sis_intr() to restart the receiver when this happens.

While at it, make the test of status bits more efficient.
2001-11-27 16:29:11 +00:00
Ruslan Ermilov
3e0cee70d7 Don't automatically unbind/deallocate memory when releasing.
This fixes the VT switching problem with the i810 X driver.

Explained by:	David Dawes <dawes@XFree86.Org>
Reviewed by:	dfr
2001-11-27 14:12:21 +00:00
Mitsuru IWASAKI
0c66d318dd Add suspend/resume code mostly merged from fxp driver. 2001-11-23 14:27:33 +00:00
John Baldwin
99efe4f0f8 Remove ifnet.if_mpsafe for now. If this is needed, it won't be needed
until much later when the network stack locking is farther along.

Approved by:	jlemon
2001-11-14 18:36:37 +00:00
Jun Kuriyama
6183dc49fb Add support for Intel's i820/i840/i845/i850/i860 chipset.
Submitted by:	nork@cityfujisawa.ne.jp (Norikatsu Shigemura)
PR:		kern/31559, kern/31825
MFC after:	1 week
2001-11-08 16:03:23 +00:00
Peter Wemm
da73fe05e1 Add AMD766 OHCI USB controller. Remove unused VENDORID lists. 2001-11-06 23:44:03 +00:00
Poul-Henning Kamp
45f40c7569 This file was part of something grander, which doesn't seem to be
around anymore.
2001-11-06 07:26:21 +00:00
Poul-Henning Kamp
4bdc9660e5 Remove unneeded call to cdevsw_add() 2001-11-04 08:44:49 +00:00
Peter Wemm
84e5eebd09 No FreeBSD/vax here either. 2001-11-03 08:32:28 +00:00
Peter Wemm
d5f6245f80 Add ICH3 (82801CA/CAM) and 460GX 2001-11-03 05:03:00 +00:00
Luigi Rizzo
935fe01014 Enable round-robin arbitration between transmit and receive unit
in the 21143, instead of giving priority to the receive unit.
This gives a 10-15% performance improvement in the forwarding rate
under heavy load.

Reviewed-by: Bill Paul
2001-10-27 00:59:17 +00:00
Luigi Rizzo
617b3dd758 Defs for three (unused so far) bits in PCI command/status register
were off by one bit.
2001-10-25 17:43:26 +00:00
Alan Cox
eab754b91d Implement TCP/IP checksum off-loading on send for the 3c905B and later
generation cards.
2001-10-22 06:45:42 +00:00
Matt Jacob
f2465b0df3 Remove this driver from FreeBSD.
Jonathon Lemon's driver (gx) is at least as fast and has more features
and is likely to be better supported.

It is also possible that Intel might support this chipset in FreeBSD
with their own driver. Somewhat secretive and furtive rumblings from
certain Yahoo employees have indicated that this might happen soon.

I'm a little unhappy at the lack of discussion on the net list about
this, or on developers, or on hackers, or the lack of mention on
audit. This then leaves me to try and figure out the right thing
to do.

I've concluded that the right thing to do is to remove wx from FreeBSD,
as this is probably best for FreeBSD.
2001-10-20 18:48:45 +00:00
Matt Jacob
819e7ffdf3 Whack on this soon to be deprecated driver.
What the heck, the OpenBSD version will benefit.

1. Add wx_txint_delay as a tunable (defaults to 5000 now, or ~5ms) and switch
to using delayed TXDW interrupts. Since the chip continues to reload the
TIDV with this value for each descriptor written back, this allows continued
deferral of the actual interrupt until the last packet completes (assuming
that 5ms between multiple packets transmitting is reasonable).

2. Add two other SYSCTL entities:

hw.wx.dump_stats
hw.wx.clear_stats

to be used, hackey hackey, to get the watchdog routine to dump/clear
the current softc statistics.

Usage would be:

	sysctl -w hw.wx.dump_stats=UNIT

to cause the current stats to be dumped for UNIT.

3. Attempt to clean up wx_detach routine so we don't panic. Well, things
still panic, but given that the code is just like other NIC drivers,
I suspect it's actually something elsewhere, like e1000phy, that's actually
blowing up.

4. Skip the entire test for runt packets- after doing somet thinking
and experimenting, I believe that the chip only doesn't like it if
the whole frame to xmit is < 16 bytes- each TFD can be some fragment
of that. This should improve performance a chunk because of all of the
(14 byte ETHERHEADER + DATA) mbuf chains.

5. Keep track of total frame length. Try not to xmit an odd byte frame-
this is supposed to get around some dumb Cisco switch problems.

6. On the last packet, also set Interrupt Delay && Report Packet Sent
(see #1 above)

7. Attempt to do xmit garbage collection *first* in order to avoid setting
IFF_OACTIVE if at all possible.

MFC after:	1 week
2001-10-15 06:59:41 +00:00
Matt Jacob
572ce00d3e Note that this driver is soon to be deprecated and removed from FreeBSD. 2001-10-09 00:14:41 +00:00
Matt Jacob
77049e810b Let's not kid ourselves- we don't *really* support jumbframes yet.
We only support the size of frame we are currently allocating, which
is MCLBYTES - sizeof (struct ether_header) usable, so don't set an
MTU that would go over this.
2001-10-02 22:36:49 +00:00
Matt Jacob
1c3903d23f Various fixes and improvements- some from the folks at Sitara Networks (thx) 2001-10-02 22:21:21 +00:00
Matt Jacob
4a5470eebd Remove all OpenBSD/NetBSD code. It was the right place to start from, but
it now really gets in the way.

This allows us to fix several problems- not least of which was problems
of ordering about when you'd have a device softc for an miibus child
available or not. Move some steps of things around.

Put the ifnet/arpcom structure at the head of the softc (PR 29249).

Don't do tx gc in the interrupt service routine- that seems to make
things a bit more efficient.

Enable jumbo support by default- but this version of 'jumbo' is broken
because it really is just using multiple tfd/rfd's to match a packet,
which will never be > CLSIZE anyway.

This should begin the first steps toward cleaning this driver up.

PR:		29249
MFC after:	1 week
2001-10-02 00:13:44 +00:00