Commit Graph

2257 Commits

Author SHA1 Message Date
John-Mark Gurney
069114c230 fix the missing lock in sk_jfree (verified w/ an assert)
also fix up handling and proding of the tx, _OACTIVE is now handled
better...

Submitted by:	Peter Edwards (sk_jfree)
Obtained from:	OpenBSD and/or NetBSD (tx prod)
2004-11-15 19:37:21 +00:00
David E. O'Brien
acebe0cb2c Commit more debugging output. This is a little bit of using a large hammer,
but sk(4) is so prevalent on AMD64 motherboards we need to reduce the number
of round trips in the mailing lists trying to get sufficient information to
make sure we've got a handle on all the problems and are working towards
making sk(4) solid.

Submitted by:	bz
2004-11-14 20:17:01 +00:00
Bjoern A. Zeeb
70502bea85 Set ramsize depending on a value from eprom instead of using
hardcoded 128k for Yukon devices. 88E8001 only has 64k of on-chip RAM[1].

[1] http://www.marvell.com/products/pcconn/yukon/Yukon_88E8001_10_073103_final.pdf

Tested by:	amd64, current
Approved by:	rwatson (mentor)
MFC after:	1 week
2004-11-13 20:21:57 +00:00
Christian Brueffer
a62ba928f7 Add altq support.
Patch by mlaier.

Approved by:	mlaier
MFC after:	2 weeks
2004-11-12 18:12:04 +00:00
Christian Brueffer
1f606ecd84 Add device polling support
Original patch by me, improvements by ru

Happy birthday to:	BSDforen.de!
Approved by:		ru
MFC after:		2 weeks
2004-11-10 23:04:39 +00:00
Poul-Henning Kamp
6d6b7a18aa Hide link up/down/media printfs behind bootverbose 2004-11-08 19:21:57 +00:00
Max Laier
f4444d4a61 Another missing ! in front of IFQ_DRV_IS_EMPTY, this time in an even more
sensitive, but less excercised location (the watchdog). While here use the
*_start_locked function directly to avoid drop, grab, drop lock.

I have to be very careful with future ALTQ patches!

Found & reviewed by:	rwatson
MFC after:		3 days
2004-11-08 16:16:04 +00:00
David E. O'Brien
220df35f05 * Correct an off-by-one reading vpd ro data.
* Announce some more fields from ro area for better debugging of broken
  sk(4)s on various boards.

Submitted by:	Bjoern A. Zeeb <bzeeb-lists@lists.zabbadoz.net>
2004-11-01 17:21:04 +00:00
Bruce M Simpson
d6dd4af4ac Forcibly disable interrupts, if we find ourselves servicing one when
the device is suspended or shutting down. This will need to be rethought
slightly if we implement suspend/resume support within vr(4).
This appears to fix the vr_shutdown() panic on SMP machines.

My theory here is there's a race somewhere during vr_detach() with
vr_intr() in the SMP case which was sometimes being triggered,
although quite why this was happening is unclear (vr_stop() also
explicitly disables interrupts by writing to the IMR register).

MFC-to-RELENG_5* candidate.

PR:		kern/62889
Tested by:	seb at struchtrup dot com
MFC after:	10 days
2004-10-27 19:02:23 +00:00
Bruce M Simpson
4cc36d8a8b Workaround for a recursive acquisition of the driver mutex during device
detach; triggered by ether_ifdetach() -> if_delmulti() -> vr_ioctl().
MFC candidate.

PR:		kern/62889
MFC after:	3 days
2004-10-26 19:49:45 +00:00
Alan Cox
2a444f81a0 Use VM_ALLOC_NOBUSY to eliminate an unneeded vm_page_wakeup() call and the
synchronization that one entails.
2004-10-24 07:31:07 +00:00
Alan Cox
91dd969325 Avoid repeated acquisition and release of the vm object lock inside of
two loops in agp_generic_bind_memory().  As an intended side-effect, all
of the calls to vm_page_wakeup() are now performed with the containing
vm object lock held.
2004-10-24 07:12:13 +00:00
Bruce M Simpson
9a3b0b8cdf Really really fix typo this time. 2004-10-19 20:02:07 +00:00
Bruce M Simpson
80f7b487a1 Fix typo sc -> dev. 2004-10-19 16:47:53 +00:00
Bruce M Simpson
33bab57d1e Detach the Rhine completely on shutdown, rather than merely stopping it
as the original logic did. This fixes a race with vr_intr() which was
masked on UP systems and manifested on SMP systems.

PR:		kern/62889
MFC after:	1 day
2004-10-19 15:30:47 +00:00
John-Mark Gurney
7a099cc936 fix (for me) the problems where if_de gets really slow after time
(usually taking 20 seconds to transmit a packet).. no longer fall back
to only transmitting one packet (instead of the entire queue) after we
have processed the entire send queue...  I have no idea why we didn't
start seeing this problem ~6 years ago when this code was introduced...
2004-10-18 23:06:12 +00:00
Max Laier
22d0ab2ef8 Fix sis, bfe and ndis in the same way dc was fixed:
Do not tell the hardware to send when there were no packets enqueued.

Found and reviewed by:	green
MFC after:		1 days
2004-10-08 16:14:42 +00:00
Eric Anholt
161cb1a5c6 Add PCI ID for VIA K8T800Pro chipset. Tested with agptest and X with DRI
enabled, but not 3D.
2004-10-05 04:40:32 +00:00
Maxime Henrion
8c7ff1f331 Read the MAC address in the EEPROM in the correct byte order. This
is a no-op on little endian architectures, but fixes getting the MAC
address for some dc(4) cards on big endian architectures.

This is a RELENG_5 candidate.

Tested by:	gallatin (powerpc), marius (sparc64)
First version of the patch written by:	gallatin
2004-10-01 15:23:31 +00:00
Brian Feldman
cbaf877f7d Add ALTQ support for dc(4), based upon a mostly-working patch from mlaier. 2004-10-01 07:04:09 +00:00
Brian Feldman
3d57a2e58e Conditionalize IFF_NEEDSGIANT, like everything else here, on IS_MPSAFE.
The driver doesn't look any less safe without Giant than with, and works
with IS_MPSAFE set to 1 here, so others should probably test it as such.
2004-10-01 07:01:38 +00:00
John-Mark Gurney
22a11c9657 fix jumbo frames as much as they can be fixed for re. We now cap the MTU
to 7422 since it appears that the 8169S can't transmit anything larger..
The 8169S can receive full jumbo frames, but we don't have an mru to let
the upper layers know this...

add fixup so that this driver should work on alignment constrained platforms
(!i386 && !amd64)

MFC after:	5 days
2004-09-28 18:22:24 +00:00
Johan Karlsson
1868ee666e style: Move the { back to the else line to match the }.
Discussed with:		glebius
X-MFC after:		5.3-Release
2004-09-26 09:01:02 +00:00
Stefan Farfeleder
e7b80a8e24 Prefer C99's __func__ over GCC's __FUNCTION__. 2004-09-22 17:16:04 +00:00
John-Mark Gurney
81d4eca1ef fix misspelling of TX...
Submitted by:	Johan Karlsson
MFC after:	3 days
2004-09-19 18:16:28 +00:00
John-Mark Gurney
efefe913d2 comment requirement that rx/tx descriptor counts must be equal due to
shared code...
define rx descriptor count in terms of tx
align defines

MFC after:	3 days
2004-09-19 17:45:56 +00:00
Stefan Eßer
c7754014fa Fix oversight reported by Norikatsu Shigemura for the "sym" driver
(which was derived from the "ncr" driver) and add a MODULE_DEPEND
on "cam".

MT5 candidate, IMHO.
MFC after:	1 week
2004-09-10 19:35:44 +00:00
Gleb Smirnoff
9fdd451496 Do not call xl_init_locked() unconditionally when we are bringed UP. Call
it only if we weren't UP before. In some cases xl_init causes long media
re-negotiation, and ppp(8) fails to open PPPoE connection because it sets
IFF_UP every time before opening PPPoE connection.

PR:		kern/69133
Patch by:	mdodd
Approved by:	wpaul, julian (mentor)
MFC after:	1 week
2004-09-09 12:16:29 +00:00
Christian Brueffer
0b6470435c Fix a couple of typos in comments
MFC after:	3 days
2004-09-06 13:42:38 +00:00
Robert Watson
2a567ae5ec Tag a last set of PCI network interfaces as IFF_NEEDSGIANT until they
are either locked down or demonstrated MPSAFE.
2004-08-28 15:10:35 +00:00
MIHIRA Sanpei Yoshiro
ea263191fd Add support Corega CG-LAPCIGT Gigabit Ethernet(8169S)
PR:		[FreeBSD-users-jp 80667]
Submitted by:	FUJIMOTO Kou <fujimoto@j.dendai.ac.jp>
MFC after:	1 week
2004-08-28 10:59:02 +00:00
Robert Watson
5162f7de6f if_dc includes locking, but that locking is disabled by a #ifdef
by default.  As such, mark if_dc as IFF_NEEDSGIANT until such
time as appropriate locking review and testing can take place,
and the locking can be enabled by default.

RELENG_5 candidate.
2004-08-25 03:37:25 +00:00
Eric Anholt
7eed267f0c Add support for Intel E7205 AGP.
PR:		kern/69858
Submitted by:	Jacobo Arvelo <unix4all at gulic dot org>
2004-08-22 03:55:04 +00:00
Eric Anholt
8c9610c9fe Fix aperture size detection on some ALi chipsets by only using the lowest 4 bits
to check aperture size, avoiding hangs.  Maintain the rest of the bits when
setting/unsetting ATTBASE.  This essentially matches Linux's AGP driver as well.

PR:		kern/70037
Submitted by:	Mark Tinguely <tinguely at casselton dot net>
Obtained from:	NetBSD
2004-08-21 06:24:21 +00:00
Eric Anholt
74674ea7f2 Apply some stylistic changes based off of kern/70037 (content changes to
follow).
2004-08-21 06:18:11 +00:00
John-Mark Gurney
c3e8b950c7 fix LOR's in sk. Original patch from dwhite. This moves the memory
allocation earlier on in sk_attach so we don't have to lock until a bit
later.

PR:		69752
2004-08-20 06:22:04 +00:00
John-Mark Gurney
e7290ad28f put function's name at begining of column... 2004-08-20 05:09:31 +00:00
John-Mark Gurney
50a6c77a02 add pci id for Belkin F5D5005 Gigabit ethernet card. 2004-08-20 05:06:10 +00:00
David E. O'Brien
f49f2ca64e Unconditionally support the AMD64 GART HW. 2004-08-19 20:58:24 +00:00
David E. O'Brien
3c749e3fb1 AMD64 on-CPU GART support.
This also applies to AMD64 HW running 'i386' OS.

Submitted by:	Jung-uk Kim <jkim@niksun.com>
Integration by:	obrien
2004-08-16 12:25:48 +00:00
David E. O'Brien
15720d822e style.9. 2004-08-16 12:23:53 +00:00
Marius Strobl
b7b6c9e6fa - Make OF_getetheraddr() honour the "local-mac-address?" system config
variable. If set to "true" OF_getetheraddr() will now return the unique
  MAC address stored in the "local-mac-address" property of the device's
  OFW node if present and the host address/system default MAC address if
  the node doesn't doesn't have such a property. If set to "false" the
  host address will be returned for all devices like before this change.
  This brings the behaviour of device drivers for NICs with OFW support/
  FCode, i.e. dc(4) for on-board DM9102A on Sun machines, gem(4) and hme(4),
  regarding "local-mac-address?" in line with NetBSD and Solaris.
  The man pages of the respective drivers will be updated separately to
  reflect this change.
- Remove OF_getetheraddr2() which was used as a stopgap in dc(4). Its
  functionality is now part of OF_getetheraddr().
2004-08-14 21:43:37 +00:00
Robert Watson
09e54b95d3 Since the if_de driver doesn't contain locking, mark it as
IFF_NEEDSGIANT so that ifp->if_start won't be called without Giant
when running debug.mpsafenet=1.
2004-08-13 22:48:05 +00:00
Scott Long
8ab79fb0e1 Revert rev 1.93 and replace it by grabbing the vr lock before calling
mii_pollstat().  The previous was causing the vr lock to recurse.

PR:	kern/70189
2004-08-11 04:30:49 +00:00
Eric Anholt
b6e05739c5 Minimal fix to prevent crashes when an AGP v2 card is used with the new v3 VIA
chipsets, based on Linux's via-agp.c.  On boot, the system selects which AGP
version to use based on the inserted card.  If v2 was chosen, the chipset
needs to be programmed with the v2 registers still.  Also included in kern/69953
are changes to make the programming of the v3 registers match linux, but that
will be left out until the need to do so is confirmed (want specs or a tester).

PR:		kern/69953
Submitted by:	Oleg Sharoiko <os@rsu.ru>
Tested by:	Oleg Sharoiko <os@rsu.ru>, Geoff Speicher <geoff@speicher.org>
		(full version from PR)
2004-08-09 21:01:49 +00:00
Brian Feldman
6eb3cb4a13 Fix rl(4)'s lock behavior upon deinitialization. I would get a panic
when kldunloading due to its private locking being acquired recursively.
2004-08-09 20:22:17 +00:00
Robert Watson
0dab4d146c Acquire vr lock before entering vr_setcfg() in vr_miibus_statchg(),
since vr_setcfg() expects it.

Reported by:	Mike Bristow <mike@urgle.com>
2004-08-07 19:40:19 +00:00
Peter Pentchev
3f35d5150b Do not attempt to clean up data that has not been initialized yet.
This fixes two kernel panics on boot when the xl driver fails to
allocate bus/port/memory resources.

Reviewed by:	silence on -net
2004-08-06 09:08:33 +00:00
Max Laier
e3dbc2ddcd Unbreak DEVICE_POLLING build / LINT. Sorry!
Submitted by:	roam
2004-08-02 10:08:28 +00:00
Max Laier
154b8df2ed Second part of ALTQ driver modifications, covering:
an(4), ath(4), hme(4), ndis(4), vr(4) and wi(4)

Please help testing: http://people.freebsd.org/~mlaier/ALTQ_driver/

Tested by:	Vaidas Damosevicius (an, ath, wi)
		Roman Divacky (vr)
Submitted by:	yongari (hme)
2004-08-01 23:58:04 +00:00
Marcel Moolenaar
32240d082c Update for the KDB framework:
o  Call kdb_enter() instead of Debugger().
2004-07-10 21:47:53 +00:00
Bruce M Simpson
69599f22f0 Further improve locking in xl(4):
- Avoid an additional lock acquire/release when leaving xl_intr(), by
   changing xl_start*() to xl_start*_locked(), and calling the appropriate
   routine by chip revision (as the DMA descriptors are different).

 - Simplify the appropriate routines now that they are called with the
   lock held.

This should save a significant amount of CPU cycles spent on servicing
each interrupt for both UP and SMP whilst remaining MPSAFE.

Tested by:	rwatson
2004-07-09 02:28:23 +00:00
Bruce M Simpson
63dff30ee7 Apply the long-overdue hatchet of style(9) death to this file. 2004-07-09 02:19:07 +00:00
Bruce M Simpson
d911052d10 Further locking improvements for vr(4):
- Add *_locked() entry points as needed to avoid unnecessary lock thrashing.
 - Use these entry points wisely.
 - Only acquire the lock once when servicing an interrupt.
 - Check 'suspended' on interrupt to avoid racing detach.
 - Correct a mis-spelled comment.
 - Don't take the lock in vr_reset() to avoid lock thrashing in attach.
  - Comment this.

Reviewed by:	-net (silence)
2004-07-09 00:17:14 +00:00
Bruce M Simpson
ee06f01331 Add a 'suspended' flag to softc so that we can avoid races on detach. 2004-07-09 00:12:41 +00:00
Bruce M Simpson
c73a317e98 Actually turn on driver locking in xl(4). 2004-07-09 00:11:25 +00:00
Bruce M Simpson
cdeef8e7f3 Further rl(4) locking improvements:
- Avoid unnecessary re-acquisition elsewhere by adding *_locked()
   entry points as needed.
 - Correct locking for the DEVICE_POLLING case.
 - Hold the driver lock for the entire duration of interrupt servicing,
   to avoid unneeded, expensive re-acquisition; use *_locked() entry
   points as needed.

Reviewed by:	-net (silence)
2004-07-09 00:07:06 +00:00
Bruce M Simpson
b4e8c523d0 Whitespace nit 2004-07-05 22:52:01 +00:00
Bruce M Simpson
244f35108f Eliminate redundant return keywords. 2004-07-05 22:50:52 +00:00
Bruce M Simpson
140c64b1fc Whitespace pass. 2004-07-05 22:46:28 +00:00
Bruce M Simpson
03b37a461e style(9):
- Space before bracketized non-void function returns.
 - Space before condition for conditional blocks.
2004-07-05 22:42:07 +00:00
Bruce M Simpson
fb7411a6c9 Eliminate redundant return keywords. 2004-07-05 22:36:48 +00:00
Bruce M Simpson
fdafab8443 Whitespace nits 2004-07-05 22:35:18 +00:00
Bruce M Simpson
892b9d7758 style(9) pass on prototypes. 2004-07-05 22:27:26 +00:00
Bruce M Simpson
8e798292c9 Locking cleanup for rl(4).
- Eliminate the use of a recursive mutex.
 - Mark the driver INTR_MPSAFE.

This work is incomplete and will be refined in a future commit.
 - Most notably, _locked() variants of entry points need to be introduced.
 - The mii upcall/downcall may still be racy.
 - Add a stubbed-out guard against racing rl_detach() for the time being.

Tested on:	UP, debug.mpsafenet && !debug.mpsafenet
Reviewed by:	silence on -net
2004-07-05 02:51:32 +00:00
Bruce M Simpson
573eefe98f style(9) and whitespace cleanup.
Use C99 types. Use ANSI function definitions. Sort prototypes.
Split long lines correctly. Punctuate/wordsmith comments.
Use device_printf()/if_printf() where possible.

Reviewed by:	-net (silence)
2004-07-05 02:46:42 +00:00
Bruce M Simpson
7f8851d0b9 Reintroduce and clean up locking in xl(4).
- Eliminate the use of a recursive mutex.
 - Mark the driver as INTR_MPSAFE.
 - Split the default media choice code out into xl_choose_media() to
   avoid making poor assumptions about the state of the lock during attach.
 - The miibus upcall/downcall paths may still be racy.
   Change to commented-out locking assertions there for now.
 - Tested with nfsclient, routed, ssh, ntp, dhclient and quagga bgpd.
 - This needs SMP test coverage. I do not have such resources.

Tested on:	UP, !debug.mpsafenet && debug.mpsafenet
Hardware:	3C905B-TX (0x905510b7)
2004-07-05 02:34:35 +00:00
Bruce M Simpson
f1aeae1b95 Use if_printf() and device_printf() where appropriate, i.e.:
- Use device_printf() during device probe/attach.
 - Move if_xname initialization to before xl_reset() is called.
 - Use if_printf() at all other times after struct ifnet has been
   initialized.
2004-07-05 00:15:23 +00:00
Bruce M Simpson
2cf7254e65 ANSIfy function definitions.
Remove unnecessary return keywords.
Other minor stylistic changes.
2004-07-04 23:31:28 +00:00
Bruce M Simpson
6776cbbd07 Fix whitespace, indentation, long line wrapping and comments. 2004-07-04 22:20:52 +00:00
Bruce M Simpson
16a649385e Fix whitespace and comments. 2004-07-04 22:19:50 +00:00
Stefan Farfeleder
5908d366fb Consistently use __inline instead of __inline__ as the former is an empty macro
in <sys/cdefs.h> for compilers without support for inline.
2004-07-04 16:11:03 +00:00
Bruce M Simpson
968bc43646 SMPng locking cleanup for vr(4).
- Remove recursive locking situations. Remove the MTX_RECURSE bit.
 - Take the lock for any routine which is not called from within if_vr.c
   itself; this includes entry points called by newbus, ifnet, callout,
   ifmedia, and polling subsystems.
 - Remove spl references from the code added to miibus callbacks in rev 1.60.
 - Add the INTR_MPSAFE bit.
 - Tidy up some assignments; locks are not needed for taking the address
   of something at a known offset, for example.
 - Tested on the machine this was committed from.

Tested on:	UP only, !debug.mpsafenet && debug.mpsafenet
Reviewed by:	rwatson
2004-07-03 02:59:02 +00:00
Bruce M Simpson
ca83b553e6 - Another whitespace pass; make locking calls more obvious.
- Use C99 types for vr_miibus_readreg().
2004-07-03 02:52:32 +00:00
Bruce M Simpson
e37a7c5f5a style(9) compliance.
Put some braces around the busy-wait loop in vr_rxeoc() to make the
no-op semicolon more obvious.
No functional changes.
Running on the machine I am committing from without problems.

Reviewed by:	jmallett
2004-07-02 23:51:44 +00:00
Max Laier
7929aa036c Bring in the first chunk of altq driver modifications. This covers the
following drivers: bfe(4), em(4), fxp(4), lnc(4), tun(4), de(4) rl(4),
sis(4) and xl(4)

More patches are pending on: http://peoples.freebsd.org/~mlaier/ Please take
a look and tell me if "your" driver is missing, so I can fix this.

Tested-by:	many
No-objection:	-current, -net
2004-07-02 12:16:02 +00:00
John Baldwin
b68c582ef8 Add support for the VIA Apollo KT400/400A/600 AGP host bridges which use
the VIA v3 register offsets.

PR:		68545
Submitted by:	Ariff Abdullah <skywizard@mybsd.org.my>
2004-07-02 03:39:33 +00:00
Warner Losh
2756272aea Remove saved_* from dc_softc. They are now no longer needed.
Submitted by: Marius Strobl
2004-06-29 20:38:44 +00:00
Warner Losh
c3e7434f34 Remove burn bridges code that saved/restored the pci config registers
that are now handled in the pci bus layer.  They are no longer
necessary.
2004-06-28 20:07:03 +00:00
Poul-Henning Kamp
879a220ec4 Be BURN_BRIDGES compliant. 2004-06-21 21:57:31 +00:00
Poul-Henning Kamp
89c9c53da0 Do the dreaded s/dev_t/struct cdev */
Bump __FreeBSD_version accordingly.
2004-06-16 09:47:26 +00:00
Poul-Henning Kamp
39a105ba4c Use NG_FREE_MSG() instead of FREE(). 2004-06-13 17:15:05 +00:00
Christian Weisgerber
0e939c0cea Replace handrolled CRC calculation with ether_crc32_[lb]e(). 2004-06-09 14:34:04 +00:00
Poul-Henning Kamp
f11d01c3bc Add missing <sys/module.h> includes 2004-05-30 20:00:41 +00:00
Poul-Henning Kamp
41ee9f1c69 Add some missing <sys/module.h> includes which are masked by the
one on death-row in <sys/kernel.h>
2004-05-30 17:57:46 +00:00
Julian Elischer
f8aae7776f Switch to using C99 sparse initialisers for the type methods array.
Should make no binary difference.

Submitted by:	Gleb Smirnoff <glebius@cell.sick.ru>
Reviewed by:	Harti Brandt <harti@freebsd.org>
MFC after:	1 week
2004-05-29 00:51:19 +00:00
John Baldwin
9930009eb6 Wrap the code to save/restore PCI config registers on suspend/resume in
#ifndef BURN_BRIDGES.

Noticed by:	phk
2004-05-24 19:39:23 +00:00
Robert Watson
baad32ada6 Only initialize the if_sis callout as MPSAFE if debug.mpsafenet is set
true.  Otherwise, assertion checks for Giant in the network stack will
fail causing a panic.

Reported by:	simon
2004-05-23 22:22:29 +00:00
Yaroslav Tykhiy
25fbb2c38c A handler for ioctl(SIOCSIFCAP) should not alter a bit in
if_capenable unless the interface driver is actually able
to toggle the respective capability on and off.

Reviewed by:	ru
2004-05-23 21:05:08 +00:00
Maxime Henrion
e0026a65f9 Use __FBSDID. 2004-05-23 10:57:11 +00:00
Maxime Henrion
eb3259747a In agp_generic_bind_memory(), grab the needed pages before acquiring
the agp mutex.  We do this because vm_page_grab() called with the
VM_ALLOC_RETRY flag can sleep.

Pointed out by:	alc
2004-05-23 00:00:10 +00:00
Maxime Henrion
d8a821e8cf Get rid of a lockmgr consumer by making agp(4) use a standard mutex,
since it's always acquiring the lock exclusively.  This was tested
with X on an SMP box, with and without WITNESS.
2004-05-22 13:06:38 +00:00
Maxime Henrion
27d8bee2a7 Plug three lock leaks. 2004-05-22 00:44:08 +00:00
Eric Anholt
f4078c527f Add explicit list of SiS AGP chipsets based on Linux kernel's list.
Prompted by:	i386/59503
2004-05-19 05:25:31 +00:00
Warner Losh
092d0b6b38 Replace the lame big endian crc with wpaul's standard big endian crc
algorithm, supplied by wpaul himself.  The lame one has an origin
that's been called into question, so rather than argue about that (one
could make an excellent fair use argument), replace it with better
code since that's what FreeBSD is about.

Submitted by: wpaul[1], Klaus Klein

[1] Bill called this a silly bikeshed.  Maybe his is not incorrect.
2004-05-19 02:16:46 +00:00
John Baldwin
92cb9c9b67 Different VIA host bridges use different offsets to their AGP config
registers, so add a register offset array to the softc.  We key off the
device ID to determine which set of register offsets.  Currently the 8385
host bridge used on amd64 is the only bridge to use the AGP3_VIA_*
register offsets and all other bridges use the AGP_VIA_* offsets.  It is
currently unclear if the AGP3_VIA_* offsets are for VIA bridges that
implement AGP 3.0 bridges or just for amd64 bridges.

Submitted by:	Kenneth Culver culverk at sweetdreamsracing dot biz
2004-05-13 20:05:42 +00:00
Bruce Evans
b3f32d172b Remove old cy driver files. They have been repo-copied to sys/dev/cy and
sys/dev/ic and adjusted to work there.
2004-05-02 05:38:49 +00:00
Alan Cox
7ef6ba5d27 Push down the responsibility for zeroing a physical page from the
caller to vm_page_grab().  Although this gives VM_ALLOC_ZERO a
different meaning for vm_page_grab() than for vm_page_alloc(), I feel
such change is necessary to accomplish other goals.  Specifically, I
want to make the PG_ZERO flag immutable between the time it is
allocated by vm_page_alloc() and freed by vm_page_free() or
vm_page_free_zero() to avoid locking overheads.  Once we gave up on
the ability to automatically recognize a zeroed page upon entry to
vm_page_free(), the ability to mutate the PG_ZERO flag became useless.
Instead, I would like to say that "Once a page becomes valid, its
PG_ZERO flag must be ignored."
2004-04-24 20:53:55 +00:00
David E. O'Brien
62d4722034 Add support for the AMD 8111. 2004-04-20 13:36:44 +00:00
David E. O'Brien
bbd8da91aa Use BSD spelling, no SysV. 2004-04-19 18:44:04 +00:00
Warner Losh
c5d0726ad0 Boomerang 10/100BT (found in 2c905-TX) chips apparently suffer the
same problems as their Hurricane 575* bretheren in that one could set
the memory mapped port, but that has no effect.  Add a quirk for this.

# I'll have to see if I can dig up documentation on these parts to see
# if there's someway software can know this other than a table...
2004-04-13 19:34:20 +00:00
Ruslan Ermilov
f4ab22c94a Implemented per-interface polling(4) control. 2004-04-11 20:34:08 +00:00
Ruslan Ermilov
2ea4f0effc Implemented per-interface polling(4) control. 2004-04-11 16:23:16 +00:00
Ruslan Ermilov
43de1cf4be Implemented per-interface polling(4) control. 2004-04-11 15:18:09 +00:00
Ruslan Ermilov
054b4ce6e5 Implemented per-interface polling(4) control. 2004-04-11 14:42:25 +00:00
Ruslan Ermilov
e695984e6f First driver with user-configurable polling(4). 2004-04-11 13:47:15 +00:00
Ruslan Ermilov
e2c039a234 Actually fix the TX performance with polling(4) enabled
by increasing the TX list size from 64 to 128, which is
adequate for HZ=1000.

Submitted by:	Vsevolod Lobko
2004-04-06 11:04:54 +00:00
Ruslan Ermilov
e0098a5113 - Improved the TX performance with polling(4) by only checking the
status registers for error conditions and updating statistics
  when there are cycles left (inspired by the nge(4) driver).

- Removed the TX list counter and the producer/consumer gap; it's
  enough to just ensure we don't reuse the last (free) descriptor,
  as the chip may not have read its next pointer yet.  If we reuse
  it, the TX may stall under a heavy TX load with polling enabled.

- Dropped code to recharge the watchdog timer, it's pointless; the
  watchdog routine will re-init the chip and both RX and TX lists.
2004-04-06 07:58:32 +00:00
Ruslan Ermilov
629498c421 - Rewritten TX to use only two pointers to track producer/consumer.
- Added polling(4) support!
- Bugfix: don't forget to set IFF_OACTIVE when TX list is full.
- Minor: tidy up vr_encap().
2004-04-05 17:39:57 +00:00
Bruce Evans
42d122e125 Converted the isa probe and attach to new-bus so that this driver works
without the (defunct) isa compatibility shims.  The new-bus-specific
parts are very similar to the ones for the pci probe and attach.

This was held up too long waiting for a repo copy to src/sys/dev/cy,
so I decided to fix the files in their old place.  This gives easier
to read and merge diffs anyway.

The "count" line in src/sys/conf/files won't be changed until after
the repo copy, so old kernel configs that specify a count need not be
(and must not be) changed until then.  The count is just ignored in
the driver.  One unfinished detail is dynamic allocation of arrays
with <count> and (<count> * 32) entries, and iteration over the arrays.
This is now kludged with a fixed count of 10 (up to 10 cards with up
to 32 ports each).

Prodded by:	imp
Submitted by:	mostly by imp
Approved by:	imp
2004-04-05 08:16:23 +00:00
Warner Losh
071138c5fd Add register definitions for the status and command registers for AGP.
PR: 64846
Submitted by: Samy Al Bahra
2004-04-05 02:32:07 +00:00
Nate Lawson
25128fcc8a Add the ability to disable agp devices at the loader prompt. Usage is
hint.agp.0.disabled="1"

Submitted by:	jhb
2004-04-03 22:55:12 +00:00
Ruslan Ermilov
2593748c60 Recharge the watchdog timer if there's still some TX work left. 2004-04-03 15:55:21 +00:00
Peter Edwards
e9c2ca4e26 Before MFC'ing the previous commit, I noticed I'd left out a case.
Add in missing case for i845G in the attach routine. I'll MFC this
with the rest of the change after the 4.10 codefreeze lifts.

Reviewed By: Doug Rabson
2004-04-03 13:24:37 +00:00
Ruslan Ermilov
b08f499b32 Fixed a few bugs in the rl(4) driver:
Under polling(4), we counted non-existent output packets and wasted
CPU cycles, corrected.  (PR kern/64975.)

The fix in revision 1.71 to correct resetting of the watchdog timer
was wrong.

In rl(4), the TX list does not have a gap between the consumer and
producer, so the "empty TX list" test was wrong, corrected.

Also, resetting the timer to five each time we know there is still
some TX work to do was a bad idea -- under polling(4), if the chip
goes out to lunch, this results in the watchdog routine to _never_
be called.  Instead, let the timer downgrade to zero and fire the
watchdog, then reset it to five when it is zero AND there is some
TX work left.  (Most other network drivers need this fix too.)

MFC after:	3 days
2004-04-03 00:42:33 +00:00
Ruslan Ermilov
6ec31f009a Performance tuning.
Moved the RX ring resyncing code to ste_rxeoc(), and only run it
if we were asked to POLL_AND_CHECK_STATUS, under DEVICE_POLLING.
(This significantly reduces the CPU load.)

Improved the RX ring resyncing code by re-checking if the head
is still empty before doing resyncing.  This mostly affects the
DEVICE_POLLING mode, where we run this code periodically.  We
could start checking with an empty head (well, an empty ring
even), and after doing a few iterations, the chip might write
a few entries, including the head, and we would bogusly consider
this case as requiring resyncing.  On a test box, this reduced
the number of resyncs done by a factor of 10.

In ste_txeof(sc), only reset the watchdog timer to zero when
the TX list is completely empty.

Converted ste_tx_prev_idx to a pointer -- faster.

Removed some bitrot.
2004-04-02 23:36:49 +00:00
Ruslan Ermilov
ba7bc837d0 Moved the statistical counter under hw.ste.rxsyncs.
Suggested by:	njl
2004-04-01 12:55:38 +00:00
Ruslan Ermilov
065566e6a3 Under a heavy RX load, at least with D-Link DFE-550TX adapters,
the driver's RX ring head may fall behind the chip, causing the
stuck traffic, disordered packets, etc.  Work around this by
adopting the technique of resyncing RX head used in dc(4) and
xl(4) drivers, but do it in a slightly different place to reduce
the number of resyncs needed.

Also, set the NIC's RX polling period to a more meaningful value,
to stop overloading the PCI bus (this also reduces the number of
resyncs by a factor of 3 or more in a long run; the actual number
is very dependent on a nature of the traffic).

Maintain the statistics counter as the hw.ste_rxsyncs sysctl.

In cooperation with:	Vsevolod Lobko
OK'ed by:		ambrisko
MFC after:		5 days
2004-03-31 21:10:01 +00:00
Ruslan Ermilov
001407b9c2 Added polling(4) support for ste(4).
MFC after:	5 days
2004-03-31 20:39:20 +00:00
Stephen McKay
39faff5a4f Support the D-Link DGE-530T. Mine appears to have a blank eeprom, so assume
they all do and handle that without alarming the user.  Also pull in a bit
of defensive code from OpenBSD that triggers when a card is recognised but
not properly classified as either Genesis or Yukon.  Not that I could ever
have needed this. :-)

Obtained from: OpenBSD/NetBSD (partially)
MFC after: 2 weeks
2004-03-31 12:35:51 +00:00
Ruslan Ermilov
3b6b14d465 Switch ste_encap() over to using m_defrag().
No functional change, the previous ste_encap() was correct WRT
long mbuf chains; this just reduces code duplication.

MFC after:	3 days
Prodded by:	ambrisko
2004-03-30 19:23:38 +00:00
Ruslan Ermilov
a9b2cd0aa6 Properly reprogram the hardware when IFF_ALLMULTI flag is set. 2004-03-24 17:43:45 +00:00
Mike Silbersack
8affb13446 solid reports that it is buggy *and* that it slows down transmit
speed.

Buggy report:           Matt Dillon & others
Slowness report:        I can't find the e-mail

MFC After: 1 minute
2004-03-19 23:20:23 +00:00
Nate Lawson
5f96beb9e0 Convert callers to the new bus_alloc_resource_any(9) API.
Submitted by:	Mark Santcroos <marks@ripe.net>
Reviewed by:	imp, dfr, bde
2004-03-17 17:50:55 +00:00
Matthew N. Dodd
e3bbbec2ca Announce ethernet MAC addresss in ether_ifattach(). 2004-03-14 07:12:25 +00:00
Peter Edwards
ad50c14e4d Recognise the 82845G AGP bridge, and poke it appropriately at
attach/detach time.

Assigning the default behaviour to this particular device is
incorrect, corrupting the video BIOS aperture, and breaking
VESA support in the kernel and XFree86.

Reviewed By:	dfr
MFC after:	1 week
PR:		kern/62906
2004-03-13 16:06:32 +00:00
Maxime Henrion
aa0444ecdb Stop setting ifp->if_output to ether_output() since ether_ifattach()
does it for us already.
2004-03-11 14:04:59 +00:00
Poul-Henning Kamp
dc08ffec87 Device megapatch 4/6:
Introduce d_version field in struct cdevsw, this must always be
initialized to D_VERSION.

Flip sense of D_NOGIANT flag to D_NEEDGIANT, this involves removing
four D_NOGIANT flags and adding 145 D_NEEDGIANT flags.
2004-02-21 21:10:55 +00:00
Poul-Henning Kamp
c9c7976f7f Device megapatch 1/6:
Free approx 86 major numbers with a mostly automatically generated patch.

A number of strategic drivers have been left behind by caution, and a few
because they still (ab)use their major number.
2004-02-21 19:42:58 +00:00
Poul-Henning Kamp
96cf36028e This is not a D_TTY driver. 2004-02-15 10:08:09 +00:00
Bill Paul
94215c94fe Fix multicast and promiscuous mode handling for Yukon devices.
Submitted by:	Jung-uk Kim <jkim@niksun.com>
2004-01-21 22:32:15 +00:00
Bill Paul
9afca9391c Calculate the right register offset when clearing TX buffer pointer
registers in rl_stop().

PR:		kern/60250
2004-01-21 22:29:51 +00:00
Alan Cox
2dc8633eab Replace calls to vm_page_alloc_contig() by calls to contigmalloc().
vm_page_alloc_contig() will be removed after the three remaining drivers
that use it are also converted to contigmalloc().
2004-01-13 07:45:10 +00:00
Maxime Henrion
ec6a729924 Some integrated Davicom cards in sparc64 boxes have an all zeros
MAC address in the EEPROM, and we need to get it from OpenFirmware.
This isn't very pretty but time is lacking to do this in a better
way this near 5.2-RELEASE.  This is a RELENG_5_2 candidate.

Original version by:	Marius Strobl <marius@alchemy.franken.de>
Tested by:		Pete Bentley <pete@sorted.org>
Reviewed by:		jake
2004-01-08 19:08:27 +00:00
Don Lewis
4ff4a9bee9 The transmit frame status is stored in the last transmit descriptor for the
frame, not the first.  It is probably also not safe to free the mbuf chain
as soon as the OWN bit is cleared on the first descriptor since the chip
may not be done copying the frame into the transmit FIFO.  Revert the part of
of busdma conversion (if_dc.c rev 1.115) which changed dc_txeof() to look for
the status in the first descriptor and free the mbuf chain when processing
the first descriptor for the frame, and revert the matching changes elsewhere
in the driver.  This part of the busdma change caused the driver to report
spurious collisions and output errors, even when running in full-duplex mode.
Reverting the mbuf chain handling slightly complicates dc_dma_map_txbuf(),
since it is responsible for setting the OWN bits on the descriptors, but does
not normally have direct access to the mbuf chain.

Tested by:
  Dejan Lesjak <dejan.lesjak at ijs.si>  alpha/<Intel 21143 10/100BaseTX>
  "Xin LI" <delphij at frontfree.net>    i386/<Macronix 98713 10/100BaseTX>
  Wiktor Niesiobedzki <bsd at w.evip.pl> i386/<3Com OfficeConnect 10/100B>

Reviewed by:	mux
2004-01-08 06:22:15 +00:00
Bill Paul
a06598ec58 Fix detection of RealTek 8129 PCI cards. Apparently, these cards
report a hardware rev of 0x00000000. Sadly, the 8169 gigE MAC
also reports 0x00000000, so testing against this for exclusion
results in both cards being skipped by rl_probe(). Make the 8169
test more specific by matching against both the hwrev and the PCI
ID for this chip.

PR: kern/60824
2004-01-02 17:22:12 +00:00
Poul-Henning Kamp
8c27747768 Vastly improve performance of IRQ handling on stopped interfaces with
this driver by introducing a flag saying we already stopped the device.

On my Soekris net4801, this took a ping -i 0.001 from spending 80% of
time in interrupt handling to 10% (approx numbers).

This was a particular problem for the net4801 because the tree
interfaces share the same interrupt, but it would be a problem for
any configuration where an unused if_sis interface shares an interrupt
with a busy device.

Other drivers may have similar problems.

Thanks to:	Luigi
2003-12-25 22:14:25 +00:00
Peter Wemm
a89ec05e3e Catch a few places where NULL (pointer) was used where 0 (integer) was
expected.
2003-12-23 02:36:43 +00:00
Poul-Henning Kamp
48529e81e4 Attempt to get the short cable fix to work better on the if_sis:
Only do short-cable on revisions that need it.

Move generic initialization before short-cable fix, in order to not
clobber short cable fix register setting.
2003-12-12 10:15:39 +00:00
David E. O'Brien
a55a017f42 Don't use caddr_t in mchash(). Also use C99 spellings over BSD ones.
Requested by:	bde,imp
2003-12-08 07:54:15 +00:00
Warner Losh
65b4a1b917 Remote meteor driver. It hasn't compiled in over 3 years. If someone
makes it compile again, and can test it, we can restore the driver to
the tree.
2003-12-07 04:41:11 +00:00
MIHIRA Sanpei Yoshiro
773c505f3c Add support for ELECOM/Laneed CardBus FastEtherner Card(LD-CBL/TXA)
Submitted by:	Masahiro Yamagishi <night@pluto.dti.ne.jp>
Approved by:	re (scottl)
2003-12-06 02:29:31 +00:00
Bruce Evans
fb0ca10d0c Fixed some minor indentation bugs.
Approved by:	re (scottl)
2003-12-02 12:47:08 +00:00
Bruce Evans
933a354fe5 Fixed breakage of the pci case of the cy driver by the new interrupt
code.  Both the driver and the new code were wrong.  Driver interrupt
handlers are supposed to take "void *vsc" arg, but some including all
COMPAT_ISA drivers and the pci part of the cy driver want an "int unit"
arg.  They got this using bogus casts of function pointers which should
have kept working despite their bogusness.  However, the new interrupt
code doesn't honor requests to pass an arg of ((void *)0), so things
are very broken if the arg is actually a representation of unit 0.

The fix is to use a normal "void *vsc" arg for the pci case and a
wrapper for the COMPAT_ISA case (of the cy driver).  This cleans up
new-busification of the pci case but takes the COMPAT_ISA case a little
further from new-bus.  The corresponding bug for the COMPAT_ISA case
has already been fixed similarly using a wrapper in compat_isa.c and
we need another wrapper just to undo that.

Fixed some directly related style bugs (mainly by removing compatibility
cruft).

cy.c:
Fixed an indirectly related old bug in cyattach_common().  A wrong status
was returned in the unlikely event that malloc() failed.

Approved by:	re (scottl)
2003-12-02 12:36:00 +00:00
Sam Leffler
d927d7ab84 correct typo in interrupt handling for the 2nd port of 2-port cards
Submitted by:	luigi
Reviewed by:	checking original openbsd code
Approved by:	re (scottl)
2003-11-29 19:33:01 +00:00
Warner Losh
347934fa63 Sometimes cardbus attachments don't attach, so while we track down
this problem put these lines back in.  While they should be
unnecessary, they appear to be sometimes necessary.

Reviewed in concept: dfr
Approved by: re (scottl@)
2003-11-28 05:28:29 +00:00
Sam Leffler
5120abbfb4 Drop the driver lock around calls to if_input to avoid a LOR when
the packets are immediately returned for sending (e.g.  when bridging
or packet forwarding).  There are more efficient ways to do this
but for now use the least intrusive approach.

Reviewed by:	imp, rwatson
2003-11-14 19:00:32 +00:00
David E. O'Brien
4dc52c32bf Remove duplicate FBSDID's, move others to their right place. 2003-11-14 17:16:58 +00:00
Warner Losh
3373489b49 reconst poison
re-de u_intXX_t
2003-11-14 05:45:39 +00:00
David E. O'Brien
aa8255025a Try to create some sort of consistency in how the routings to find the
multicast hash are written.  There are still two distinct algorithms used,
and there actually isn't any reason each driver should have its own copy
of this function as they could all share one copy of it (if it grew an
additional argument).
2003-11-13 20:55:53 +00:00