Subject: CVS commit: [netbsd-4] src/sys/dev/pci
To: None <source-changes@NetBSD.org>
From: Pavel Cahyna <pavel@netbsd.org>
List: source-changes
Date: 10/07/2007 15:48:28
Module Name:	src
Committed By:	pavel
Date:		Sun Oct  7 15:48:28 UTC 2007

Modified Files:
	src/sys/dev/pci [netbsd-4]: if_nfe.c if_nfereg.h if_nfevar.h

Log Message:
Pull up following revisions (requested by cube in ticket #920):
	sys/dev/pci/if_nfe.c: revision 1.14, 1.18-1.19
	sys/dev/pci/if_nfereg.h: revision 1.4
	sys/dev/pci/if_nfevar.h: revision 1.3
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.

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.

- 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).


To generate a diff of this commit:
cvs rdiff -r1.7.2.1 -r1.7.2.2 src/sys/dev/pci/if_nfe.c
cvs rdiff -r1.1.26.1 -r1.1.26.2 src/sys/dev/pci/if_nfereg.h
cvs rdiff -r1.1 -r1.1.26.1 src/sys/dev/pci/if_nfevar.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.