Commit Graph

1812 Commits

Author SHA1 Message Date
Bernd Walter
82026026e0 add missing \n to printf
Approved by:	gallatin (mentor)
2002-09-09 17:39:48 +00:00
Mitsuru IWASAKI
efd1491c3f Add support for Corega FEther CB-TXD (CardBus 100M/10M). 2002-09-06 16:38:06 +00:00
Mark Murray
3ecba1c115 Make consistent; turn spaces into tabs where there is a mixture. 2002-09-04 18:14:17 +00:00
Josef Karthauser
9f1c775798 Add a device description for Intel 82801CA/CAM (ICH3) USB controller
USB-C.

PR:	kern/41963
2002-08-28 20:24:49 +00:00
Bruce Evans
7e9e7dc4ed Include <sys/lockmgr.h> for old lock interfaces instead of depending on
namespace pollution in <sys/lock.h>.
2002-08-27 11:51:55 +00:00
Philippe Charnier
93b0017f88 Replace various spelling with FALLTHROUGH which is lint()able 2002-08-25 13:23:09 +00:00
Alan Cox
fff6062ab6 o Retire vm_page_zero_fill() and vm_page_zero_fill_area(). Ever since
pmap_zero_page() and pmap_zero_page_area() were modified to accept
   a struct vm_page * instead of a physical address, vm_page_zero_fill()
   and vm_page_zero_fill_area() have served no purpose.
2002-08-25 00:22:31 +00:00
Alfred Perlstein
8e708563c7 style: put return types on a line by themselves. 2002-08-24 00:02:03 +00:00
Alfred Perlstein
e3d2833a26 style:
put return values on a line by themselves.
 fix some paste issues where whitespace was used instead of tabs.
2002-08-23 23:49:02 +00:00
Alfred Perlstein
26be7d1c1b Put return values from functions on a line by themselves.
Ok'd previously by: wpaul
2002-08-23 23:19:25 +00:00
Doug Ambrisko
740f8a4472 Don't read the PCI config space during mii operations. Instead save whether
or not we have to limit the PHY detection in the softc structure.  Then
just check the flag.

Suggested by:	jdp
Reviewed by:	jdp
MFC after:	3 days
2002-08-19 16:54:26 +00:00
Poul-Henning Kamp
bd86d22c62 Remove the SIS_LOCK/SIS_UNLOCK from sis_attach(). It makes WITNESS
barf and there seem to be little room for contention during attach.
2002-08-19 06:56:50 +00:00
Josef Karthauser
24177c6cb0 Use uhci_pci_match to return the device description and rework the
vendor description code.
2002-08-18 11:52:47 +00:00
Josef Karthauser
f992fafdd7 Add a comment to remind that uhci_pci_match will never return NULL.
Don't display the "New UHCI DeviceId" message unless booting verbosely.
Use a switch statement for the vendor match code.
2002-08-18 11:42:11 +00:00
Maxim Sobolev
62f7648682 Increase size of ifnet.if_flags from 16 bits (short) to 32 bits (int). To avoid
breaking application ABI use unused ifreq.ifru_flags[1] for upper 16 bits in
SIOCSIFFLAGS and SIOCGIFFLAGS ioctl's.

Reviewed by:	-hackers, -net
2002-08-18 07:05:00 +00:00
Josef Karthauser
8f5fc1b728 Consolidate the device recognition code. 2002-08-18 00:24:03 +00:00
Doug Ambrisko
74495bcdab Revert change to detect multiply PHYs in mii code. There might be cases
when this is needed.  Work around bogus second PHY in the DFE-580 card
via a change in the if_ste.c driver.

Suggested by:	jdp
Reviewed by:	jdp
MFC after:	3 days
2002-08-16 23:19:16 +00:00
Josef Karthauser
c5849647cc UHCI_DEBUG -> USB_DEBUG. 2002-08-15 22:41:20 +00:00
Mike Silbersack
f3b2d59e18 Improve handling of TX errors. Early reports indicate that this
elimiates the driver lockup problem reported by many.

Concepts used were taken from Via's if_fet driver.  Verification
and implementation were done by Thomas Nystrom.

Submitted by:	Thomas Nystrom <thn@saeab.se>
MFC after:	3 days
2002-08-15 04:04:53 +00:00
Alan Cox
fab965bf7e o Use the VM_ALLOC_WIRED flag instead of calling vm_page_wire(). 2002-08-10 18:42:13 +00:00
Doug Ambrisko
d44ef39e51 Fixes for the D-Link DFE-580 card.
This is pretty much fixes any issue I can find:
     -  Watchdog timeouts were due to starting the TX DMA engine
        before we had a packet ready for it.  So the first packet
        sent never got out only if we sent more then one packet
        at a time did the others make it out and not blow up.
        Of course reseting the chip then caused us not to transmit
        the first packet again ie. catch-22.  This required logic changes.
     -  Combine interrupts on TX packets being queued up.
     -  Don't keep running around the RX ring since we might get
        out of sync so only go around once per receive
     -  Let the RX engine recover via the poll interface which is
        similar to the TX interface.  This way the chip wakes
        up with no effort when we read enough packets.
     -  Do better hand-shaking on RX & TX packets so they don't
        start of to soon.
     -  Force a duplex setting when the link comes up after
        an ste_init or it will default to half-duplex and be
        really slow.  This only happens on subsequent ste_init.
        The first one worked.
     -  Don't call stat_update for every overflow.  We only monitor
        the collisions so the tick interval is good enough for that.
        Just read in the collision stats to minimize bus reads.
     -  Don't read the miibus every tick since it uses delays and
        delays are not good for performance.
     -  Tie link events directly to the miibus code so the port
        gets set correctly if someone changes the port settings.
     -  Reduce the extreme number of {R,T}FD's.  They would consume
        130K of kernel memory for each NIC.
     -  Set the TX_THRESH to wait for the DMA engine to complete
        before running the TX FIFO.  This hurts peak TX performance
        but under bi-directional load the DMA engine can't keep up
        with the FIFO.  Testing shows that we end up in the case
        anyways (a la dc(4) issues but worse since the RX engine hogs
	everything).
     -  When stopping the card do a reset since the reset verifies the
	card has stopped.  Otherwise on heavy RX load the RX DMA engine
	is still stuffing packets into memory.  If that happens after
	we free the DMA area memory bits get scribled in memory and
	bad things happen.

This card still has seemingly unfixable issues under heavy RX load in
which the card takes over the PCI bus.

Sponsored by:	Vernier Networks
MFC after:	1 week
2002-08-07 22:31:27 +00:00
Luigi Rizzo
ffe4fbf0fd Use new interface for ether_input().
Remove some unnecessary assignments to mbuf fields in sis_newbuf(),
the "length" fields are of no use while the mbuf is in the receive ring.

MFC after: 3 days
2002-08-07 16:08:54 +00:00
Mike Silbersack
aff8da7074 Make sure to set the DMA transfer length register, plus one
small style fix.

Submitted by:	Thomas Nystrom <thn@saeab.se>
2002-08-05 13:24:06 +00:00
Luigi Rizzo
32d273402d Use m_getcl() to allocate mbuf+cluster for the receive ring.
Remove the sis_quick variable, as it was there for testing purposes
only.

MFC after: 3 days
2002-08-04 21:52:05 +00:00
Poul-Henning Kamp
e26ebcce25 Repond properly to NGM_TEXT_CONFIG messages. 2002-08-04 20:50:50 +00:00
Mike Silbersack
16afddabdc Make sure to set both sets of registers which control the RX and TX buffer
sizes.  Previously, the end result was at the mercy of the card's default
setting.  This change will reduce the number of buffer underruns for
some users.

PR:		kern/37929
Submitted by:	Thomas Nystrom <thn@saeab.se>
MFC after:	7 days
2002-07-31 19:58:36 +00:00
John Baldwin
c038666eae If we get 0xffff back when reading the status register, assume the card
has gone away instead of spinning in the interrupt handler.  This stops
my machine from hanging when I eject a rl(4)-based cardbus card.

Reviewed by:	imp
2002-07-30 17:31:42 +00:00
Alan Cox
5ec699cdac o If the page returned by vm_page_grab(VM_ALLOC_ZERO) isn't prezeroed,
zero it.

Reviewed by:	dfr, peter
2002-07-21 04:07:26 +00:00
John Baldwin
d6ac80d12f Add PCI IDs for the A, B, and C UHCI controllers in the ICH4.
Sponsored by:	The Weather Channel
2002-07-19 22:17:02 +00:00
John Baldwin
8034890757 - Use more correct values to initialize the AGP controller during setup.
The value we use is still questionable for 440BX chipsets.
- When flushing the TLB just toggle the bit in question instead of writing
  a magic value that could trash other unrelated bits.
2002-07-17 02:52:01 +00:00
Alan Cox
613f5495ed o Lock page queue accesses by vm_page_wire(). 2002-07-14 20:40:32 +00:00
Alan Cox
1f54526952 o Complete the locking of page queue accesses by vm_page_unwire().
o Assert that the page queues lock is held in vm_page_unwire().
 o Make vm_page_lock_queues() and vm_page_unlock_queues() visible
   to kernel loadable modules.
2002-07-13 20:55:21 +00:00
Luigi Rizzo
2e4fb41fa5 Fix if_timer logic to make sure that there is always a timeout
pending if there are packets queued for transmission.

Several drivers still have the same problem.

MFC after: 3 days
2002-06-30 22:16:22 +00:00
Luigi Rizzo
bcb9ef4fe6 Fix if_timer logic to make sure that there is always a timeout
pending if there are packets queued for transmission.

MFC after: 3 days
2002-06-30 22:05:46 +00:00
Luigi Rizzo
4dfae5a5e8 Make sure that if_timer does not get reset if there are packets
still queued for transmission. This should solve the problem of
the device stalling on transmissions if some link event prevents
transmission.

There are other drivers which have the same problem and need to be
fixed in the same way.

MFC after: 3 days
2002-06-30 21:59:08 +00:00
Alfred Perlstein
7c41487d14 catch up with mextfree callback change when TI_PRIVATE_JUMBOS is defined.
Pointed out by: kdm
2002-06-29 11:26:05 +00:00
Peter Wemm
160554fbf4 Remove a couple of __P() stragglers. 2002-06-29 02:32:34 +00:00
Alfred Perlstein
69a3693f3e catch up with mextadd callback taking a void argument instead of a caddr_t. 2002-06-29 01:49:22 +00:00
Alfred Perlstein
64f0b9d749 remove or replace caddr_t with void.
make the mbuf external free function take a void * rather than caddr_t.
2002-06-28 23:48:23 +00:00
Kenneth D. Merry
98cb733c67 At long last, commit the zero copy sockets code.
MAKEDEV:	Add MAKEDEV glue for the ti(4) device nodes.

ti.4:		Update the ti(4) man page to include information on the
		TI_JUMBO_HDRSPLIT and TI_PRIVATE_JUMBOS kernel options,
		and also include information about the new character
		device interface and the associated ioctls.

man9/Makefile:	Add jumbo.9 and zero_copy.9 man pages and associated
		links.

jumbo.9:	New man page describing the jumbo buffer allocator
		interface and operation.

zero_copy.9:	New man page describing the general characteristics of
		the zero copy send and receive code, and what an
		application author should do to take advantage of the
		zero copy functionality.

NOTES:		Add entries for ZERO_COPY_SOCKETS, TI_PRIVATE_JUMBOS,
		TI_JUMBO_HDRSPLIT, MSIZE, and MCLSHIFT.

conf/files:	Add uipc_jumbo.c and uipc_cow.c.

conf/options:	Add the 5 options mentioned above.

kern_subr.c:	Receive side zero copy implementation.  This takes
		"disposable" pages attached to an mbuf, gives them to
		a user process, and then recycles the user's page.
		This is only active when ZERO_COPY_SOCKETS is turned on
		and the kern.ipc.zero_copy.receive sysctl variable is
		set to 1.

uipc_cow.c:	Send side zero copy functions.  Takes a page written
		by the user and maps it copy on write and assigns it
		kernel virtual address space.  Removes copy on write
		mapping once the buffer has been freed by the network
		stack.

uipc_jumbo.c:	Jumbo disposable page allocator code.  This allocates
		(optionally) disposable pages for network drivers that
		want to give the user the option of doing zero copy
		receive.

uipc_socket.c:	Add kern.ipc.zero_copy.{send,receive} sysctls that are
		enabled if ZERO_COPY_SOCKETS is turned on.

		Add zero copy send support to sosend() -- pages get
		mapped into the kernel instead of getting copied if
		they meet size and alignment restrictions.

uipc_syscalls.c:Un-staticize some of the sf* functions so that they
		can be used elsewhere.  (uipc_cow.c)

if_media.c:	In the SIOCGIFMEDIA ioctl in ifmedia_ioctl(), avoid
		calling malloc() with M_WAITOK.  Return an error if
		the M_NOWAIT malloc fails.

		The ti(4) driver and the wi(4) driver, at least, call
		this with a mutex held.  This causes witness warnings
		for 'ifconfig -a' with a wi(4) or ti(4) board in the
		system.  (I've only verified for ti(4)).

ip_output.c:	Fragment large datagrams so that each segment contains
		a multiple of PAGE_SIZE amount of data plus headers.
		This allows the receiver to potentially do page
		flipping on receives.

if_ti.c:	Add zero copy receive support to the ti(4) driver.  If
		TI_PRIVATE_JUMBOS is not defined, it now uses the
		jumbo(9) buffer allocator for jumbo receive buffers.

		Add a new character device interface for the ti(4)
		driver for the new debugging interface.  This allows
		(a patched version of) gdb to talk to the Tigon board
		and debug the firmware.  There are also a few additional
		debugging ioctls available through this interface.

		Add header splitting support to the ti(4) driver.

		Tweak some of the default interrupt coalescing
		parameters to more useful defaults.

		Add hooks for supporting transmit flow control, but
		leave it turned off with a comment describing why it
		is turned off.

if_tireg.h:	Change the firmware rev to 12.4.11, since we're really
		at 12.4.11 plus fixes from 12.4.13.

		Add defines needed for debugging.

		Remove the ti_stats structure, it is now defined in
		sys/tiio.h.

ti_fw.h:	12.4.11 firmware.

ti_fw2.h:	12.4.11 firmware, plus selected fixes from 12.4.13,
		and my header splitting patches.  Revision 12.4.13
		doesn't handle 10/100 negotiation properly.  (This
		firmware is the same as what was in the tree previously,
		with the addition of header splitting support.)

sys/jumbo.h:	Jumbo buffer allocator interface.

sys/mbuf.h:	Add a new external mbuf type, EXT_DISPOSABLE, to
		indicate that the payload buffer can be thrown away /
		flipped to a userland process.

socketvar.h:	Add prototype for socow_setup.

tiio.h:		ioctl interface to the character portion of the ti(4)
		driver, plus associated structure/type definitions.

uio.h:		Change prototype for uiomoveco() so that we'll know
		whether the source page is disposable.

ufs_readwrite.c:Update for new prototype of uiomoveco().

vm_fault.c:	In vm_fault(), check to see whether we need to do a page
		based copy on write fault.

vm_object.c:	Add a new function, vm_object_allocate_wait().  This
		does the same thing that vm_object allocate does, except
		that it gives the caller the opportunity to specify whether
		it should wait on the uma_zalloc() of the object structre.

		This allows vm objects to be allocated while holding a
		mutex.  (Without generating WITNESS warnings.)

		vm_object_allocate() is implemented as a call to
		vm_object_allocate_wait() with the malloc flag set to
		M_WAITOK.

vm_object.h:	Add prototype for vm_object_allocate_wait().

vm_page.c:	Add page-based copy on write setup, clear and fault
		routines.

vm_page.h:	Add page based COW function prototypes and variable in
		the vm_page structure.

Many thanks to Drew Gallatin, who wrote the zero copy send and receive
code, and to all the other folks who have tested and reviewed this code
over the years.
2002-06-26 03:37:47 +00:00
Jens Schweikhardt
21dc7d4f57 Fix typo in the BSD copyright: s/withough/without/
Spotted and suggested by:	des
MFC after:	3 weeks
2002-06-02 20:05:59 +00:00
Mike Silbersack
000c679b3c Enhance the use of the watchdog timer in this driver so that it will
allow recovery from transmission lockups which occur in the middle
of the descriptor list, rather than just at the beginning.

For some unknown reason, Rhine II chips have a tendency to stop
transmitting while under heavy load, possibly due to collisions.
Whether this behavior is due to a hardware bug or a driver glitch
is unknown as of now.

In either case, this change allows the driver to gracefully recover
from such situations.

Special thanks go to The Anarcat <anarcat@anarcat.dyndns.org>, who
bugged me into looking at this and to
Dominic Marks <dominic_marks@btinternet.com>, who performed a great
deal of testing to help characterize this problem.

MFC after:	3 days
2002-05-15 17:05:28 +00:00
John Baldwin
d204693572 Add support for the D-Link DFE-690TXD Cardbus card which has a RealTek 8139
with its own PCI ID.
2002-05-06 13:43:00 +00:00
Mitsuru IWASAKI
e8388e1466 Add suspend/resume code mostly merged from fxp/rl driver.
This is temporary hack, better and generalized solution probably
should be implemented at lower layer(MII or PCI?).
Tested by:	shoko.araki@soliton.co.jp
MFC after:	1 week
2002-05-06 10:55:42 +00:00
Poul-Henning Kamp
9ebe64ca1b Don't grab the lock until somewhat later in attach to avoid a lock
reversal.
2002-05-03 08:44:53 +00:00
Poul-Henning Kamp
45521525a7 Move us yet closer to IFM_* definitions in NetBSD. 2002-04-29 05:32:44 +00:00
Poul-Henning Kamp
b418ad5c2e Follow NetBSD and s/IFM_1000_TX/IFM_1000_T/ 2002-04-28 20:34:20 +00:00
Mike Barcroft
a30d4b3270 Move the new byte order function prototypes from <sys/param.h> to
<sys/endian.h>.  This puts us in line with NetBSD and OpenBSD.
2002-04-26 22:48:23 +00:00
Poul-Henning Kamp
14021ab570 Redo the pps bit to avoid digging into the private bits of the timecounter. 2002-04-26 21:22:02 +00:00
Poul-Henning Kamp
7bf758bff0 Simplify the RFC2783 and PPS_SYNC timestamp collection API. 2002-04-26 20:24:28 +00:00
Semen Ustimenko
9cd64fb3dd Move tx(4) driver to sys/dev/tx. BTW split hardware structures and constants
into if_txreg.h.

MFC after:	1 week
2002-04-19 22:43:57 +00:00
Luigi Rizzo
7632341a30 Add DEVICE_POLLING support to the "rl" driver.
The diffs are very similar to the ones for the "sis" driver.

MFC After: 5 days
2002-04-16 22:03:14 +00:00
Coleman Kane
9264fbc80a Fix some nits in AMD AGP driver. Remove excess malloc and move a bzero
out of the way, so it won't cause trouble.

Submitted by:	Frank Mayher <frank@exit.com>
MFC after: 1 week
2002-04-15 18:57:26 +00:00
Bill Paul
9a29439fb9 Nortel Networks sells a RealTek 8139-based NIC that's basically
the same thing as the SMC 1211, but with their own vendor ID.
Update the device list to support this NIC. (Discovered these
cards lying around the lab at work.)
2002-04-11 06:12:51 +00:00
Bill Paul
a72c060fb0 Teach the rlphy driver how to do parallel link detection. If the link partner
doesn't support NWAY, the RealTek PHY (both the integrated ones on 8139
chips and the RTL8201L 10/100 PHY) will not report the link speed via
the ANLPAR or BMSR registers. For the 8201L, we need to look in magic
vendor-specific PHY register 0x19. For the 8139 MAC+PHY combo, we have
to be able to test the RL_MEDIASTAT register.

The changes to rlphy.c are based largely on the patch from PR 30836,
however I tried to eliminate some magic numbers by creating an entry
for the 8201 PHY in miidevs.

Also updated if_rl.c to allow the rlphy driver to read the RL_MEDIASTAT
register via the rl_miibus_readreg() routine.
2002-04-07 20:55:50 +00:00
John Baldwin
6008862bc2 Change callers of mtx_init() to pass in an appropriate lock type name. In
most cases NULL is passed, but in some cases such as network driver locks
(which use the MTX_NETWORK_LOCK macro) and UMA zone locks, a name is used.

Tested on:	i386, alpha, sparc64
2002-04-04 21:03:38 +00:00
Nicolas Souchu
e1e245b7a5 smbus_alloc_bus is not part of the smbus interface anymore 2002-03-23 18:27:16 +00:00
Nicolas Souchu
c17d43407f Major rework of the iicbus/smbus framework:
- VIA chipset SMBus controllers added
	- alpm driver updated
	- Support for dynamic modules added
	- bktr FreeBSD smbus updated but not tested
	- cleanup
2002-03-23 15:49:15 +00:00
Alfred Perlstein
e51a25f850 Remove __P. 2002-03-20 02:08:01 +00:00
Peter Wemm
1a8f253b64 Cast pointers to uintptr_t rather than u_int32_t. This doesn't work too
well on machines with 64 bit pointers.
2002-03-19 23:28:35 +00:00
Bruce Evans
eabfc7877d Work around a PLX9050 bug that causes system lockup in certain systems,
depending on the MMIO addresses allocated to the board.

PR:		30965, 20845 (maybe)
Submitted by:	Daniela Squassoni <daniela@cyclades.com>
Tested by:	Arjan Knepper <arjan@jak.nl>
		Scott Klement <klemscot@klements.com>
2002-03-17 04:10:38 +00:00
Peter Wemm
0574a5a746 Fix warning; amdsmb_abort() is not used. 2002-02-26 01:04:58 +00:00
Josef Karthauser
a10b07e4ec Fix a formatting error. 2002-02-17 12:41:50 +00:00
Josef Karthauser
97e5881fe1 KNF style the code, ready for an MFC. 2002-02-17 12:29:39 +00:00
Josef Karthauser
1b262fd0c5 KNF style the code, ready for an MFC. 2002-02-17 11:58:58 +00:00
Mike Silbersack
27d5f39f68 Remove mbuf exhaustion warning messages; these are handled by the
mbuf system in a rate-limited fashion now.

MFC after:	3 days
2002-02-11 23:38:30 +00:00
Josef Karthauser
d740688b87 Fix some bugs in the ohci driver with respect to irq setup failure.
Submitted by:	nyan
2002-02-11 14:39:57 +00:00
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