Commit Graph

36 Commits

Author SHA1 Message Date
cube c0bb1f4b42 Use MUTEX_DEFAULT to initialise the mutex, per martin@'s input. 2008-06-17 12:59:32 +00:00
jmcneill a6e01338bc Based on changes to nfe_attach in r1.27, wake newer chips from powerdown
mode on resume as well as at attach time.
2008-05-25 22:57:35 +00:00
cube 4e49392569 Restore jumbo frame support and protect access to the DMA space for
received frames with a mutex.

Tested by Paul Goyette, Martin Husemann and myself.
2008-04-20 08:57:37 +00:00
christos 07975baeb4 join line for symmetry. 2008-04-17 20:16:46 +00:00
xtraeme 035163789f Make this build again... HI XTOS. 2008-04-17 19:50:38 +00:00
christos f0b645b98a sync with openbsd; fixes observed corruption issues. 2008-04-17 19:12:26 +00:00
cube 6495be5eed Split device_t and softc, and related cosmetic changes. 2008-03-26 14:46:21 +00:00
isaki d540dc1cd1 Minor style fix. 2008-02-24 05:34:01 +00:00
dyoung 2ccede0a9c Start patching up the kernel so that a network driver always has
the opportunity to handle an ioctl before generic ifioctl handling
occurs.  This will ease extending the kernel and sharing of code
between drivers.

First steps:  Make the signature of ifioctl_common() match struct
ifinet->if_ioctl.  Convert SIOCSIFCAP and SIOCSIFMTU to the new
ifioctl() regime, throughout the kernel.
2008-02-07 01:21:52 +00:00
tsutsui 9e319fb40f Wakeup some newer chips from powerdown mode. From FreeBSD/Linux driver
via OpenBSD.

Tested by wiz@ in PR kern/37868.
2008-01-26 14:13:06 +00:00
dyoung b480b62270 Make many ethernet drivers share the common code for MII media
handling, ether_mediastatus() and ether_mediachange().  Check for
a non-ENXIO error return from mii_mediachg().  (ENXIO indicates
that a PHY is suspended.)

This patch shrinks the source code size by 979 lines.  There was
a 5100-byte savings on the NetBSD/i386 kernel configuration, ALL.

I have made a few miscellaneous changes, too:

gem(4): use LIST_EMPTY(), LIST_FOREACH().
mtd(4): handle media ioctls, for a change!
axe(4): do not track link status in sc->axe_link any longer
nfe(4), aue(4), axe(4), udav(4), url(4): do not reset all PHYs
        on a change of media

Except for the change to mtd(4), no functional changes are intended.

XXX This patch affects more architectures than I can feasibly
XXX compile and run.  I have compiled macppc, sparc64, i386.  I
XXX have run the patches on i386 boxen with bnx(4) and sip(4).
XXX Compiling and running on evbmips (MERAKI, ADM5120) is in
XXX progress.
2008-01-19 22:10:14 +00:00
tsutsui 4e3d8b015c Handle a quirk of newer MCP6x chips on reading MAC address.
Fix from Richy Kim in PR kern/36576.
2007-12-17 12:41:06 +00:00
jmcneill 4c1d81b2b5 Merge jmcneill-pm branch. 2007-12-09 20:27:42 +00:00
xtraeme 7d0d95af5a Add the MCP{67,73} products on nfe_attach(). 2007-11-14 14:59:50 +00:00
xtraeme a7040ff1de Attach to NVIDIA MCP67/73 Ethernet controllers. 2007-11-14 12:40:54 +00:00
ad d18c6ca4de Merge from vmlocking:
- pool_cache changes.
- Debugger/procfs locking fixes.
- Other minor changes.
2007-11-07 00:23:13 +00:00
ad a2a3828545 machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h 2007-10-19 11:59:34 +00:00
cube 9d4a2bf213 - If the chip doesn't support jumbo frames, don't use bus_dmamap_load_mbuf
which expects a properly filled mbuf chain, but bus_dmamap_load for the
  mbuf storage space instead.

- If the chip supports jumbo frames
    + keep track of which RX descriptor uses which jumbo mbuf buffer, so
      that we can rewrite the physaddr field of the descriptor later, as it
      might be partially overwritten by the hw
    + when we're out of jumbo mbufs, and if the packet is small enough,
      copy it into a cluster mbuf

Those changes make my nfe(4) stable in both cases (defining NFE_NO_JUMBO
for the first one).
2007-09-24 13:17:53 +00:00
cube 5b396aa2c0 From OpenBSD, rev 1.72:
In nfe_start() do a fast return if IFF_OACTIVE is set, in
this case we need a Tx interrupt to clean up the DMA ring
before if_start can be properly called.
2007-09-24 13:11:08 +00:00
dyoung dcd8923429 Change a bazillion occurrences of code resembling this,
error = (cmd == SIOCADDMULTI) ?
	    ether_addmulti(ifr, &sc->sc_ec) :
	    ether_delmulti(ifr, &sc->sc_ec);

	if (error == ENETRESET) {

to this,

	if ((error = ether_ioctl(ifp, cmd, data)) == ENETRESET) {

which does the same thing.

(A bazillion is a very large number.  This seems to make the i386
ALL kernel smaller by 3kB to 4kB.)

Use ifreq_getaddr() twice in es(4).

Whitespace nits.
2007-09-01 07:32:22 +00:00
ad 88ab7da936 Merge some of the less invasive changes from the vmlocking branch:
- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
2007-07-09 20:51:58 +00:00
christos 53524e44ef Kill caddr_t; there will be some MI fallout, but it will be fixed shortly. 2007-03-04 05:59:00 +00:00
tsutsui a111aec3cd Apply patches which may fix RX stall problem on nfe(4):
- make DMA descriptors volatile to avoid possible unintended reordering
  which might cause some race conditions
- process interrupts until all NFE_IRQ_WANTED bits are handled

and also put misc fixes:
- return 1 and call nfe_start() in nfe_intr() only if any own interrupts
  are actually handled
- use bus_dmamap_load_mbuf(9) for RX mbufs rather than bus_dmamap_load(9)
  with mtod(9) and MCLBYTES
- check sc->txq.queued to see if TX descriptors are queued or handled
  in nfe_start() and nfe_txeof()
- use proper BUS_DMASYNC_{PRE,POST} ops
- prepare and use NFE_[RT]X_NEXTDESC() macro
- rename NFE_TX_TCP_CSUM to NFE_TX_TCP_UDP_CSUM since it also enables
  hardware udp4csum-tx for UDP4 packets
- some minor optimization
- misc KNF

Tested and confirmed by matthew green by
"to send >25MB/sec to nfe0 for over one hour,"
and also tested by me (with light TRX load on 100baseTX though)
for a month.
2007-02-28 17:40:11 +00:00
tsutsui e699b95246 Enable hardware checksum support by hardware info taken from FreeBSD.
Tested on nForce3 250 and nForce4 by Chuck Silvers, Cesar Catrian Carreno,
and me.
2007-01-09 10:29:27 +00:00
jmcneill d9c4129a70 A few changes to make this work on the Microsoft Xbox. Should also help
with other users who have been experiencing watchdog timeouts:
 * Mask all interrupts while servicing a tx or rx interrupt.
 * On init, clear IRQ status registers (workaround for buggy netbooters).
2007-01-05 01:33:57 +00:00
tsutsui 7c3bb7972d Pull a TX timeout fix from OpenBSD:
> Defer setting of the valid bit in the first TX descriptor after
> all descriptors have been setup.  Otherwise, hardware may start
> processing descriptors faster than us and crap out.
> Fixes "watchdog timeout" errors.
>
> Original idea from Matthew Dillon @DragonFly.
2007-01-01 04:13:25 +00:00
tsutsui 3b8f579381 Minor style fixes in nfe_attach:
- print PCI device name and revision
- print interrupt and Ethernet address like other devices

Before:
---
nfe0 at pci0 dev 5 function 0LKLN: Picked IRQ 20 with weight 1
: ioapic0 pin 20 (irq 9), address xx:xx:xx:xx:xx:xx

After:
---
nfe0 at pci0 dev 5 function 0: NVIDIA nForce3 ethernet #4 (rev. 0xa2)
LKLN: Picked IRQ 20 with weight 1
nfe0: interrupting at ioapic0 pin 20 (irq 9)
nfe0: Ethernet address xx:xx:xx:xx:xx:xx

(note "Picked IRQ" message is logged by aprint_verbose(9) in acpi(4))
2007-01-01 03:43:04 +00:00
alc 24803bd1c4 remove the KASSERT() introduced in last commit and use VLAN_OUTPUT_TAG() macro.
tested by martin@
pointed out and ok by pavel@, also ok from christos@
2006-12-27 18:36:09 +00:00
alc 9254207181 CID-3667: check if 'mtag != NULL' before dereferencing it 2006-12-25 23:58:36 +00:00
christos 168cd830d2 __unused removal on arguments; approved by core. 2006-11-16 01:32:37 +00:00
christos 4d595fd7b1 - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
2006-10-12 01:30:41 +00:00
jmcneill f135e0d607 Add "name" parameter to powerhook_establish, to aid debugging. No objections
on tech-kern@
2006-09-24 03:53:07 +00:00
xtraeme ea4f30c7b7 Add support for MCP61/65 controllers... from obsd. 2006-09-03 07:42:04 +00:00
chs c5e2153c1e work around another mbuf leak, the hardware doesn't seem
to work quite the way that the driver expects.
2006-03-26 00:34:14 +00:00
chs a940d15b3c handle another difference between the BSDs:
free the original mbuf in the jumbo-free callback too.
2006-03-16 17:26:13 +00:00
chs 388c5496c2 add nfe driver and manpage from OpenBSD. 2006-03-12 22:40:42 +00:00