Commit Graph

267 Commits

Author SHA1 Message Date
Warner Losh
c2b37819e4 Add new ID for Intel 82562ET (ICH5/ICH5R) Pro/100 VE Ethernet.
Submitted by: Stefan Bethke
PR: 61320
2004-04-07 15:47:14 +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
David E. O'Brien
f7d39bdcb6 Adjust $FreeBSD$'s. 2004-03-17 03:43:53 +00:00
Matthew N. Dodd
e3bbbec2ca Announce ethernet MAC addresss in ether_ifattach(). 2004-03-14 07:12:25 +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
Doug Rabson
0be389f3ca Remove explicit cardbus attachments from drivers where this is identical
to the pci attachment. Cardbus is a derived class of pci so all pci
drivers are automatically available for matching against cardbus devices.

Reviewed by: imp
2003-11-03 09:22:18 +00:00
Brooks Davis
9bf40ede4a Replace the if_name and if_unit members of struct ifnet with new members
if_xname, if_dname, and if_dunit. if_xname is the name of the interface
and if_dname/unit are the driver name and instance.

This change paves the way for interface renaming and enhanced pseudo
device creation and configuration symantics.

Approved By:	re (in principle)
Reviewed By:	njl, imp
Tested On:	i386, amd64, sparc64
Obtained From:	NetBSD (if_xname)
2003-10-31 18:32:15 +00:00
Brooks Davis
083fbfa64a Remove unused FXP_UNIT() macro. 2003-10-30 23:12:24 +00:00
Sam Leffler
b237430cfe mark interrupt handlers MPSAFE 2003-10-29 18:32:14 +00:00
Sam Leffler
45276e4aa4 change timeout to be MPSAFE
Sponsored by:	FreeBSD Foundation
2003-09-05 22:37:31 +00:00
John Baldwin
e27951b29c Use PCIR_BAR(x) instead of PCIR_MAPS.
Glanced over by:	imp, gibbs
Tested by:		i386 LINT
2003-09-02 17:30:40 +00:00
David E. O'Brien
aad970f1fe Use __FBSDID().
Also some minor style cleanups.
2003-08-24 17:55:58 +00:00
Warner Losh
4fbd232c86 Prefer new location of pci include files (which have only been in the
tree for two or more years now), except in a few places where there's
code to be compatible with older versions of FreeBSD.
2003-08-22 05:54:52 +00:00
John Polstra
f19fc5d8b3 Use the revision ID from PCI configuration space to identify Intel
8255x chips more precisely.  The information was obtained from Intel's
Open Source Software Developer Manual for the 8255x.

MFC after:	1 day
2003-08-04 00:17:16 +00:00
Maxime Henrion
aafb3ebbe3 Use the BUS_DMA_ZERO flag. 2003-07-27 14:00:02 +00:00
Maxime Henrion
28935f2753 De-inline some functions. It doesn't gain us anything and bloats
code size by 3616 bytes.  Furthemore, it was previously ignored by GCC.

While I'm at it, fix some bogus comments.
2003-07-22 15:50:54 +00:00
John Baldwin
c660bdfa66 Unlock the fxp driver lock before calling fxp_poll() to avoid recursing on
the lock when using DEVICE_POLLING.

Tested by:	Robin P. Blanchard <Robin.Blanchard@gactr.uga.edu>
Reviewed by:	njl
2003-07-11 20:49:36 +00:00
Warner Losh
fa4b32fa80 All current uses of pci_set_powerstate are bogus, at least in theory.
However, they are presently necessary due to bigger bogusness in the
pci bus layer not doing the right thing on suspend/resume or on
initial device probe.  This is exactly the sort of thing that the
BURN_BRIDGES option was invented for.  Mark all of them as
BURN_BRIDGES.  As soon as I have the powerstate stuff properly
integrated into the pci bus code, I intend to remove all these
workarounds.
2003-07-03 14:00:57 +00:00
Scott Long
f6b1c44d1f Mega busdma API commit.
Add two new arguments to bus_dma_tag_create(): lockfunc and lockfuncarg.
Lockfunc allows a driver to provide a function for managing its locking
semantics while using busdma.  At the moment, this is used for the
asynchronous busdma_swi and callback mechanism.  Two lockfunc implementations
are provided: busdma_lock_mutex() performs standard mutex operations on the
mutex that is specified from lockfuncarg.  dftl_lock() is a panic
implementation and is defaulted to when NULL, NULL are passed to
bus_dma_tag_create().  The only time that NULL, NULL should ever be used is
when the driver ensures that bus_dmamap_load() will not be deferred.
Drivers that do not provide their own locking can pass
busdma_lock_mutex,&Giant args in order to preserve the former behaviour.

sparc64 and powerpc do not provide real busdma_swi functions, so this is
largely a noop on those platforms.  The busdma_swi on is64 is not properly
locked yet, so warnings will be emitted on this platform when busdma
callback deferrals happen.

If anyone gets panics or warnings from dflt_lock() being called, please
let me know right away.

Reviewed by:	tmm, gibbs
2003-07-01 15:52:06 +00:00
Nate Lawson
05fb8c3f73 Drop locks before calling if_input() since it may re-enter fxp_start()
in the netisr case. This would result in a lock reversal.  This
fixes the net.isr.enable=1 case.  Better performance might be
obtained by chaining all packets received, dropping the lock, and
then calling if_input() on each one.

Reported by:	hmp
2003-06-23 23:23:49 +00:00
Maxime Henrion
62c0d1bf0e Add a new device ID.
Submitted by:	Tom Alsberg <alsbergt@cs.huji.ac.il>
2003-06-12 11:21:06 +00:00
Mike Silbersack
1104779b70 Replace if_fxp's handrolled defrag function with m_defrag.
No actual bug with the existing code, just tidying things up.

Submitted by:	hmp
2003-06-02 05:16:42 +00:00
Don Lewis
a35e7eaa1a Always set the hardware parse bit in the IPCB structure when this
structure, which is new to the 82550 and 82551, is used to transmit
a packet.  This appears to fix the packet truncation problem that was
observed when using 82550-based fxp cards to transmit ICMP or fragmented
UDP packets of certain lengths which only had one to three bytes in the
second and final mbuf of the packet.  This matches a note in the "Intel
8255x 10/100 Mbps Ethernet Controller Family Open Source Software Developer
Manual", which says that the hardware parse bit should be set when sending
these types of packets.

There have also been unconfirmed reports of similar problems when
transmitting TCP packets, which should not be affected by the above
mentioned change because the hardware parse bit was already being set
if the stack requested hardware checksumming of the packet.  If the
problem remains, the use of the IPCB structure can be disabled to
cause the driver to fall back to using the older 82559 interface with
82550-based cards by setting
        hint.fxp.UNIT_NUMBER.ipcbxmit_disable
to a non-zero value at boot time, or using kenv to set this variable
before using kldload to load the fxp driver.

Approved by:	re (jhb)
2003-05-25 05:04:26 +00:00
Robert Watson
98b2788832 Add a tunable/sysctl "hw.fxp_noflow" which disables flow control support
on if_fxp cards.  When flow control is enabled, if the operating system
doesn't acknowledge the packet buffer filling, the card will begin to
generate ethernet quench packets, but appears to get into a feedback
loop of some sort, hosing local switches.  This is a temporary workaround
for 5.1: the ability to configure flow control should probably be
exposed by some or another management interface on ethernet link layer
devices.

Approved by:	re (bmah)
Reviewed by:	mux
2003-05-16 01:13:16 +00:00
Maxime Henrion
4d340ec485 GCC 3.3 complains about anonymous structures in unions, so
give the fxp_ipcb structure a name in the fxp_rfa structure.

Submitted by:	peter
Approved by:	re (jhb)
2003-05-14 20:33:41 +00:00
Maxime Henrion
72490791a8 Fix the unaligned access problems that some people saw on alpha
by using a __packed keyword for the fxp_rfa structure.  The Intel
guys who designed this structure with unaligned fields deserve
to be shot.

Tested by:	kris
Approved by:	re@ (jhb)
2003-05-12 18:15:33 +00:00
Warner Losh
1d2945d595 Fix tpyo in last commit.
Noticed by: kuriyama-san
2003-04-30 04:14:56 +00:00
Warner Losh
704d196541 Get rid of the redundant 'gone' field, and overload suspend instead.
Check for suspend before the device polling, rather than after it.
Check to see if the current thread owns the lock in ioctl and return
EBUSY if it does.

This advances the locking to the point that I can eject my fxp card 10
times in a row, but I agree with Jeff Hsu that we need to get the
network layer locking finished before chasing more of the races here
(actually, he doesn't think this set is worth it even).  There's a
number of races between FXP_LOCK in detach and all other users of
FXP_LOCK, and this gets back to the 'device with sleepers being
forcibly detached' problem as well...
2003-04-30 01:54:38 +00:00
Warner Losh
7634f08a29 (5) from last commit was omitted by mistake:
(5) Return immediately from fxp_intr() if gone is set.
2003-04-29 05:47:14 +00:00
Warner Losh
32cd7a9c00 Fix 5 bugs:
1) always call fxp_stop in fxp_detach.  Since we don't read from
	   the card, there's no need to carefully look at things with
	   bus_child_present.
	2) Call FXP_UNLOCK() before calling bus_teardown_intr to avoid
	   a possible deadlock reported by jhb.
	3) add gone to the softc.  Set it to true in detach.
	4) Return immediately if gone is true in fxp_ioctl
	5) Return immediately if gone is true in fxp_intr
2003-04-29 05:45:09 +00:00
Nate Lawson
4953bccacf Make fxp(4) INTR_MPSAFE (but do not enable MPSAFE just yet):
- Add fxp_start_body() and change fxp_start() to just acquire locks and
  then call fxp_start_body().  Places that would call fxp_start() with
  locks held (mutex recursion) now call fxp_start_body() directly.
  Remove MTX_RECURSE flag from sc_mtx. [gallatin]
- Change fxp_attach() to work without the softc lock, saving interrupt
  hooking until the head of fxp_attach().
- Call ether_ifattach() before overriding ifp parameters. This reverts
  part of 1.155.
- Remove multiple error paths in fxp_attach().
- Teardown interrupt in fxp_detach() before unlocking the softc.
- Make sure mutex is not held in fxp_release()
- Delete the miibus instance and/or self in fxp_release(), not in
  fxp_detach().  This can happen if attach fails partway through.
- Move ifmedia_removeall to fxp_release() since attach may fail after
  media have been allocated.
- Add locking to fxp_suspend, fxp_resume, fxp_start, fxp_intr,
  fxp_poll, fxp_tick, fxp_ioctl, fxp_watchdog.
- Pass in ifp to fxp_intr_body since its callers sometimes already use
  it.
- Add compatibility define for INTR_MPSAFE for 4.x. [gallatin]
- You don't need to bzero softc.

Ideas from:	gallatin, mux
Tested by:	>400M packets of dd/ssh, NFS, ping on i386 UP
2003-04-25 09:01:54 +00:00
Maxim Sobolev
2bce79a21d Update comment to match reality. 2003-04-16 09:16:55 +00:00
Matthew N. Dodd
533294b956 - Don't call pci_enable_io() in drivers (unless needed for resume).
- Don't test memory/port status and emit an error message; the PCI
  bus code will do this now.
2003-04-16 03:16:57 +00:00
Matthew N. Dodd
f246e4a17f - Express hard dependencies on bus (pci, isa, pccard) and
network layer (ether).
- Don't abuse module names to facilitate ifconfig module loading;
  such abuse isn't really needed.  (And if we do need type information
  associated with a module then we should make it explicit and not
  use hacks.)
2003-04-15 06:37:30 +00:00
Maxim Sobolev
cf0d8a1e48 Use pci_enable_{busmaster|io}() instead of directly writing into
PCI configuration register.

Submitted by:	mdodd
2003-04-14 15:50:04 +00:00
Maxim Sobolev
bb342a3713 Before attaching device set PCIM_CMD_PORTEN in addition to
PCIM_CMD_MEMEN and PCIM_CMD_BUSMASTEREN, becaise some braindead
BIOSes (such as one found in my vprmatrix notebook) forget
to initialize it properly resulting in attachment failure.
2003-04-14 09:45:25 +00:00
Maxime Henrion
20f0c80f6f - Call ether_ifdetach() before shutting down the hardware.
- Remove a useless device_is_alive() check.
- Disable interrupts if bus_child_present() so that this
  check is more useful.

This fixes the hangs I was seeing when unloading the fxp driver.

Suggestions from:	hsu, njl
2003-04-11 12:52:52 +00:00
Maxime Henrion
b983c7b3ed - Clean up the fxp_release() and fxp_detach() functions.
- Be sure to teardown the interrupt first so that "kldunload if_fxp"
  doesn't panic the box.  It's now deadlocking rather than crashing,
  which isn't really better, but I'm unsure this is fxp(4)'s fault.
- Change a bus_dmamap_sync() call to also do a BUS_DMASYNC_PREREAD
  now that we can pass several operations.
2003-04-10 23:15:12 +00:00
Maxime Henrion
209b07bc4c - Pass a busdma tag and a busdma map to fxp_dma_wait() so that
it can do the necessary bus_dmamap_sync() calls.
- While I'm here, reorder arguments to match other functions.
2003-04-08 18:56:45 +00:00
Maxime Henrion
14fd107181 Add an XXX comment for the atomic operation in the __alpha__
case so that it doesn't confuse more people.  Use the more
correct atomic_clear_16() instead of atomic_clear_short().
2003-04-08 18:35:51 +00:00
Maxime Henrion
bafb64af4f - Endian fixes.
- 6 -> ETHER_ADDR_LEN.
2003-04-08 17:21:15 +00:00
Maxime Henrion
50d81222d8 Fix the hangs people have been seeing. For some reason, the
atomic operation change caused this, so backout it until I
can figure out what's wrong with it.
2003-04-08 13:05:11 +00:00
Maxime Henrion
d73e2e5593 Correct the maxsize and maxsegsz parameters for the
bus_dma_tag_create() calls.  Without this, fxp(4) + PAE
would consume insane amounts of bounce pages.
2003-04-07 17:02:44 +00:00
Maxime Henrion
2c6c094714 Remove an erroneous htole16(). The byte_count field in the
struct fxp_cb_config is a 6-bit field, not a 16-bit integer
as in struct fxp_cb_tx.
2003-04-07 14:53:30 +00:00
Maxime Henrion
5f361cbe0e Move a bus_dmamap_sync() to the correct place. 2003-04-06 23:16:00 +00:00
Maxime Henrion
ec6b76b760 Because alpha can't access memory in 16-bit granularity,
we're using an atomic operation to clear the suspend flag
in fxp_start().  Since other architectures may need the
same thing, we want to do it all the time and not only
in the __alpha__ case.  However, we don't want to use
atomic operations on 16-bit integers, because those may
not be available on any architecture.  We're thus faking
a 32-bit atomic operation here.  This patch also deals
with endianness here.
2003-04-06 23:09:57 +00:00
Maxime Henrion
d45d97d1fc Revert the s/u_int/u_int8_t/ changes, we can't really use other
integer types than int with bit-fields in a portable way.

Prodded by:	bde
2003-04-06 21:35:45 +00:00
Maxime Henrion
01c516b02a Use __FBSDID. 2003-04-06 01:27:12 +00:00
Maxime Henrion
6835a8accc Correct the definition of the link_addr and rbd_addr fields
in struct fxp_rfa.  This should have been committed with my
last endianness fixes.
2003-04-06 01:11:38 +00:00
Maxime Henrion
83e6547df1 - Instead of rolling our own alignment-safe function, use le32enc()
which deals with both endianness and alignment issues.
- Collect low-hanging fruits for endianness safety.
- Use 0xffffffff instead of -1 where appropriate.
2003-04-06 01:04:17 +00:00
Maxime Henrion
467295e056 - Use __FXP_BITFIELDX macros to make the configuration bitfield
endian safe.
- Change some u_int to u_int8_t which make more sense here since
  we're really defining bytes.  That produces the same code due to
  how bitfields work.
- Add the definition of the vlan_drop_en bit (not used yet).
- Add some useful comments.

Obtained from:	NetBSD
2003-04-05 23:46:58 +00:00
Maxime Henrion
4cec16537d - Change a FXP_NRFABUFS which would have been a FXP_NTXCB.
- Correct some bus_dmamap_sync() calls.

Submitted by:	jake
2003-04-05 12:43:21 +00:00
Maxime Henrion
201afb0e56 Setup our interrupt only at the end of fxp_attach(), when all
other allocations/initializations have been successful.  I kinda
doubt it will fix the recent breakage that some people are seeing,
but this could have caused problems for sure.
2003-04-05 01:27:17 +00:00
Maxime Henrion
5353c9b6ba Remove useless initialization. 2003-04-03 20:39:43 +00:00
Maxime Henrion
c2a2b443e2 Fix fxp(4), this changed shouldn't have crept in.
Pointy hat to:	mux
Reported by:	Pawel Worach <pawel.worach@nordea.com>
2003-04-03 18:39:48 +00:00
Maxime Henrion
e609b4d7db Remove all the bogus volatile qualifiers from the structs definitions
and associated evil casts to discard them.
2003-04-03 14:08:35 +00:00
Maxime Henrion
b2badf0214 Convert the fxp(4) driver to the busdma API.
This patch is rather big because I had to significantly redesign
the driver to make the busdma conversion possible.  Most notably,
hardware and software structures were carefully splitted to get
rid of all the structs overlapping evilness.

Special thanks to phk and Richard Puga <puga@mauibuilt.com> for
providing me with fxp(4) hardware to do this work.

Thanks to marcel for testing this on ia64, and to Fred Clift
<fclift@verio.net> for testing this on alpha.

Tested on:	i386, ia64, alpha
2003-04-02 16:47:16 +00:00
John Polstra
537b41d5ff Correct names for fxp devices. Sort data by devid in
fxp_ident_table.

PR:		kern/48699
Submitted by:	Sergey A. Osokin <osa@FreeBSD.org.ru>
Obtained from:	NetBSD (the device strings, that is)
MFC after:	4 weeks
2003-03-08 21:44:21 +00:00
Peter Wemm
3c6b084e96 Finish driving a stake through the heart of netns and the associated
ifdefs scattered around the place - its dead Jim!

The SMB stuff had stolen AF_NS, make it official.
2003-03-05 19:24:24 +00:00
Bill Paul
c6d8cd1e00 Remember to set if_capenable when setting up checksum offload in fxp_attach().
Pointed out by: jlemon
2003-02-27 19:41:55 +00:00
Bill Paul
c8bca6dc3d As previously threatened, add TCP/IP checksum offload support to
the fxp driver. This is enabled only for the 82550/82551 chips
(PCI revision code 12 or 13). RX and TX checksum offload are
both supported. Transmit offload is limited to TCP and UDP only
right now: there seems to be a problem with IP header checksumming
on transmit in some cases.

This chip has hardware VLAN support as well. I hope to enable
support for this eventually.
2003-02-26 22:12:04 +00:00
Warner Losh
a163d034fa Back out M_* changes, per decision of the TRB.
Approved by: trb
2003-02-19 05:47:46 +00:00
MIHIRA Sanpei Yoshiro
4bfecf88f4 Add PCI id for fxp(Intel Pro/100 M Mobile Connection).
PR:	i386/41915
Submitted by:	Ross A. Lippert <ripper@eskimo.com>
MFC after:	1 week
2003-01-27 14:31:32 +00:00
Alfred Perlstein
44956c9863 Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.
Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.
2003-01-21 08:56:16 +00:00
Sam Leffler
673d91916d network interface driver changes:
o don't strip the Ethernet header from inbound packets; pass packets
  up the stack intact (required significant changes to some drivers)
o reference common definitions in net/ethernet.h (e.g. ETHER_ALIGN)
o track ether_ifattach/ether_ifdetach API changes
o track bpf changes (use BPF_TAP and BPF_MTAP)
o track vlan changes (ifnet capabilities, revised processing scheme, etc.)
o use if_input to pass packets "up"
o call ether_ioctl for default handling of ioctls

Reviewed by:	many
Approved by:	re
2002-11-14 23:54:55 +00:00
Ian Dowse
947e381597 Properly fix the occassional random crash issue that revision 1.142
just limited to the DEVICE_POLLING case. This removes the FXP_RFA_RNRMARK
hack, and replaces it with a softc flag that is used to record when
the handling of a no-resource condition was deferred due to running
out of DEVICE_POLLING cycles. This was tested on -stable, but the
code is essentially the same as in -current. It should only affect
the case where DEVICE_POLLING is defined.

The details of the mechanism behind the crashes are still uncertain
but the most likely cause seems to be some kind of hardware confusion
when the no-resource recovery code is accidentally invoked while
the receiver is still active. This could have happened if the
hardware left the 0x4000 bit of the RFA status word set. The comments
in the commit log for revision 1.142 stating that the driver could
clash with the hardware writing to this status word were not correct.

Tested by:	Guy Helmer <ghelmer@palisadesys.com>
2002-11-07 16:04:07 +00:00
Ian Dowse
cb0d1e061b Revision 1.136 introduced two features that may cause undefined
behaviour of the hardware: a possibly reserved bit of the receive
descriptor (RFA) `status' field is borrowed to record no-resource
(RNR) events, and the same status field is read and written to at
a time that may clash with the hardware updating this field.

There is no hardware documentation available to determine if these
things are safe to do; the second issue almost certainly isn't, and
the first is only safe if there is documentation saying that this
bit is free to be used by the driver. The PR referenced below
provides extremely convincing evidence that the changes cause random
crashes on some (unusual) hardware.

Since these features are only required by the DEVICE_POLLING case,
this commit makes their use conditional on that option. It does not
change the DEVICE_POLLING case, but at least people with the rare
hardware on which this code causes problems can now avoid the crashes
by not enabling DEVICE_POLLING.

PR:		kern/42260
Reviewed by:	luigi
Problem revision found by: Pawel Malachowski <pawmal@unia.3lo.lublin.pl>
Tested by:	Pawel Malachowski <pawmal@unia.3lo.lublin.pl>
MFC after:	1 week
2002-10-30 19:08:56 +00:00
Poul-Henning Kamp
858b84f550 '&' is not needed to pointerize functions.
Spotted by:	FlexeLint
2002-10-20 20:42:25 +00:00
Paul Saab
a7d681929a Add some PCI id's for fxp. I've only tested 0x103B, but the Intel
Linux driver defines 0x103[B-E] so add those as well.

Obtained from:	Intel Linux e100 driver
MFC:		Immediately if re@ allows it, otherwise after 4.7-RELEASE
2002-09-24 23:13:38 +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
Luigi Rizzo
fd9430fea6 use the new interface to ether_input(), with eh = NULL and
the MAC header in the mbuf.

MFC after: 3 days
2002-08-09 01:48:28 +00:00
Luigi Rizzo
9e2518582d Use m_getcl() to allocate buffers for the receive ring.
MFC after: 3 days
2002-08-05 00:21:24 +00:00
Luigi Rizzo
2b5989e943 Fix handling of Receiver Not Ready errors when doing polling.
Also take this chance to cleanup the code in fxp_intr_body.

Add a missing block of code to disable interrupts when
reinitializing the interface while doing polling (the RELENG_4
version was correct).

MFC after: 3 days
2002-08-04 22:33:28 +00:00
Mike Silbersack
e2102ae475 Revert rev 1.131.
1.131 is slightly broken, and I would commit the fix to that here, but it
has been reported that any deviation from the original code is causing
problems with some 82557 chips, causing them to lock hard.

Until those issues have been figured out, going back to the original
code is the best plan.

Frustrated:	Silby
2002-07-29 04:32:35 +00:00
Luigi Rizzo
e823d3404b whitespace commit: fix indentation in fxp_intr_body.
This is also done in preparation of a subsequent fix
for the handling of RNR conditions in polling mode.
2002-07-29 02:48:09 +00:00
Luigi Rizzo
41aa0ba271 Fix if_timer logic so that there is always a timeout pending if there
are packets queued for transmission.

This driver is strange -- it never sets IFF_OACTIVE, so all
transmissions always cause a call to fxp_start. However, if the
link gets stuck, there was nothing to reset it, so there was still
a possibility of lockups.

MFC after: 3 days
2002-06-30 22:28:00 +00:00
Mike Silbersack
f32932bc1b Add another Intel chipset (i82562).
PR:		39974
Submitted by:	Morten Aaboe Jensen <morten@codemonkey.dk>
MFC after:	1 day
2002-06-29 01:56:14 +00:00
Doug Ambrisko
e94c058ad1 Add device id. for fxp chip on Intel D845EPT2L boards. This seems to
make the onboard NIC work.

Sponsored by:	Vernier Networks
MFC after:	1 day
2002-06-05 18:34:08 +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
Mike Silbersack
c9fbdd0fa4 Remove mbuf exhaustion warning messages; these are handled by the
mbuf system in a rate-limited fashion now.

Reviewed by:	luigi
MFC after:	1 week
2002-02-04 03:15:27 +00:00
Jonathan Lemon
a1a9c8f7e6 Initialize the sysctl_ctx list early, which avoids a panic in case other
allocatiosn fail and fxp_release() is called.
2002-01-22 17:51:44 +00:00
Jonathan Lemon
0988236390 Explicitly reload the multicast filters when the hardware is reinitialized
instead of relying on the previous filters to be present.

Back out r1.125, as a reset is needed to unload any existing microcode,
(which clears the multicast addresses), as it is superceded by this change.
2002-01-07 15:08:54 +00:00
Jun Kuriyama
470c78a6ea Possibly typo fix (s/FXP_PORT_SOFTWARE_RESET/FXP_PORT_SELECTIVE_RESET/)
in fxp_stop().

Reference:	http://www.freebsd.org/cgi/mid.cgi?id=7md718f0qo.wl@waterblue.imgsrc.co.jp
Submitted by:	Keiichi SHIMA <keiichi@iij.ad.jp>
2001-12-24 05:32:58 +00:00
Peter Wemm
6481f3012e Fix (again) some blatent style bugs in DEVICE_POLLING code. 2001-12-15 02:41:52 +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
Jonathan Lemon
001cfa9228 Tone down and remove some obnoxious warnings that are slightly overkill. 2001-12-13 16:13:31 +00:00
Jonathan Lemon
d9cdd9607f Emit a warning if the mbuf or mbuf cluster allocation failed.
Requested by: Mike Barcroft
2001-11-02 05:10:40 +00:00
Jonathan Lemon
208b417fd5 Aargh. I really shouldn't do late night commits. Remove a floating point
multiply, and replace it with a close equivalent.  1.488 =~ 1.5
2001-10-25 19:36:44 +00:00
Jonathan Lemon
72a32a26aa Add support for loadable microcode which implements interrupt coalescing
and packet bundling.  Make the microcode settings controllable via sysctl
and loader tunables.

Submitted by: Marko Zec <zec@tel.fer.hr>
  (with some munging and dynamic sysctl support by me)

Also extend the workaround for Dynamic Standby mode to later '559 chips,
not just the ICH2 variants.
2001-10-25 05:32:01 +00:00
Jonathan Lemon
9a7a8c90d1 . Add structure elements for sysctl.
. Document default values for microcode
2001-10-25 05:27:25 +00:00
Jonathan Lemon
3ceb25205d . Add structure definition for microcode download.
Submitted by: Marko Zec <zec@tel.fer.hr>

  . Add some PCI chip revision entries.
  . Make size of txcb dependent on pointer size rather than arch #define
2001-10-25 05:25:58 +00:00
Jonathan Lemon
b4c45df0a7 Add Intel's loadable microcode to implement receive side bundling.
This is taken verbatim from the Intel's e100-1.6.22 release, with
the addition of their LICENSE file at the top.

Submitted by: Marko Zec <zec@tel.fer.hr>
2001-10-25 05:23:31 +00:00
Brooks Davis
920b58e88f Deconditionalize vlan support. 2001-09-05 23:33:58 +00:00
Jonathan Lemon
00c4116b3e Systems based on the ICH2/ICH2-M chip from Intel have a defect where
the chip can cause a PCI protocol violation in under certain scenarios.
The workaround is to rewrite the EEPROM to disable Dynamic Standby Mode.

Once the EEPROM is rewritten, the system needs to be rebooted in order
to pick up the new settings.

This has been tested on several ICH2/ICH2-M systems, found in 815E based
boards, and usually identified by the presence of the 82562 ET/EM PHY.

Thanks to: Mike Tansca, Paul Saab for samples of the problematic boards.
2001-08-27 16:07:12 +00:00
Jonathan Lemon
48e417eb5a Reset the device's powerstate to d0 when resuming from a suspend
operation, not just when we initally attach to the device.

Submitted by: warner
2001-07-25 18:00:17 +00:00
Jonathan Lemon
74396a0a26 Only turn on MWI if the PCI configuration word indicates that it
is supported, in addition to checking for a valid cacheline size.
Add a missing splx() in fxp_tick that got dropped.

Found by: peter
MFC in: 3 days
2001-07-19 15:48:00 +00:00
Jonathan Lemon
11457bbf08 While in the interrupt loop, check for a bogus interrupt value of 0xff.
This may be returned if the underlying hardware is a pc-card which has
been ejected.

Reviewed by: warner
2001-06-04 22:01:44 +00:00
Jonathan Lemon
2e2b823898 Add workaround for embedded NICs, in particular, the 815E boards.
There appears to be a bug where the chip will lock up when running
in 10Mb/s mode.
2001-05-17 23:50:24 +00:00
Jonathan Lemon
dedabebf33 Use " |= " to enable special media handling for fxp with no MII, instead
of " &= ".  Also change the MII PHY device mask to check the correct bits.

Cookie to:	Andre Albsmeier <andre.albsmeier@mchp.siemens.de>
Pointy hat to:	me
2001-05-15 18:52:40 +00:00
Jonathan Lemon
db1e093307 Remove safety belt that checks for miibus in the config file. This
was only intended for -stable, not -current.
2001-05-13 05:38:59 +00:00