Commit Graph

4538 Commits

Author SHA1 Message Date
wiz ea6266ca87 Spell "threshold" correctly. From Zafer Aydogan. 2006-12-25 18:41:45 +00:00
wiz 3ed1aa9185 Spell "separate" correctly. From Zafer Aydogan. 2006-12-25 18:39:47 +00:00
bouyer 39568acf5e Add missing $NetBSD: $ 2006-12-20 21:44:06 +00:00
itohy 41d24e831c Fix bus_dmamap_sync() usage.
This should not be a problem since BUS_DMASYNC_POSTWRITE is probably a no-op.
2006-12-19 14:12:26 +00:00
bouyer 462dc620e3 Add mfi(4), a driver for LSI Logic & Dell MegaRAID SAS RAID controller.
Ported from OpenBSD, tested on i386 and amd64.
2006-12-17 22:57:14 +00:00
tsutsui b2261339c5 Fix and reenable HW VLAN tagging on re(4):
- clear re_vlanctl in DMA descriptors before starting TX and RX
  to avoid stale tags
- use bswap16() rather than be16toh() or htons() on VLAN tag access
  since we already use htole32()

Closes PR kern/32643 and also fixes HW VLAN tagging on big endian machines.
2006-12-16 02:52:17 +00:00
uwe e8e4f16a5c aprint_naive("\n") to terminate "Found" line for quiet boot.
Use aprint_error to report that we are unable to establish power hook.
2006-12-10 00:33:11 +00:00
tsutsui fba4e06d1b No need to include PCI header files. 2006-12-06 13:52:46 +00:00
elad 432c309931 Change kauth(9) KPI for kauth_authorize_device_passthru() to add another
argument, u_long, serving as a bit-mask of generic requests for the
passthru request.

Discussed on tech-security@ and tech-kern@. Okay tls@.
2006-12-02 03:10:42 +00:00
bouyer 49f9b08461 Use mstohz() for callout argument instead of local arithmetic. 2006-11-29 21:37:42 +00:00
tsutsui 29fb2fb408 Remove mii_mediachg() call from re_init().
It causes a few second TRX stalls on each ioctls
(on ifconfig(8) or tcpdump(8) etc.) and PHY seems
initialized properly without it at least on RTL8169S
with internal rgephy(4) PHY. Closes PR kern/34517.

XXX: maybe we should also test this on the original RTL8169
     with external makphy(4).
2006-11-29 14:13:15 +00:00
ad a80609203c Improve error handling. Related to PR/21900. 2006-11-28 23:06:33 +00:00
ad 8b4b54cb8d Improve error handling. Related to PR/21900. 2006-11-28 20:29:14 +00:00
dyoung c11fb5eece Add 'volatile' to rx/tx descriptor fields. 2006-11-26 17:31:32 +00:00
tsutsui 963a39e836 - add RE_RX_DMAMEM_SZ macro to hide a bit confusing hack
(allocating TX padding buffer in RX DMA mem to save resouces)
  and use it where appropriate
- add a comment about the hack in re_attach() too
- pass a correct size on bus_dmamem_unmap() for RX DMA mem
2006-11-25 02:42:18 +00:00
christos 1665d5e960 fix spelling of accommodate; from Zapher. 2006-11-24 19:46:58 +00:00
tsutsui 47af0126d5 Change RXFIFO, RXDMA and TXDMA configrations to values taken from
the Reaktek's driver, which are also used in FreeBSD.
Fixes RX FIFO overrun errors on my Duron 1300MHz PC.
(Note the configuration values for rtk(4) are not changed)

Also add some debug printf's in RX error case (disabled by default).
2006-11-24 16:30:45 +00:00
martin 3a83155c93 Ooops - make it compile again. 2006-11-24 13:05:29 +00:00
martin bed31b2f32 In preparation for gem @ sbus: split the GEM registers into two halfs
and provide a bus_space_handle_t for each. While there, fix a typo
in gem_bitwait().
2006-11-24 13:01:07 +00:00
martin 22b629efe2 Fix an obvious copy&pasto and make it compile with GEM_DEBUG. 2006-11-23 18:41:25 +00:00
tsutsui 90ee4817fb Umm, fix typo. 2006-11-22 14:32:28 +00:00
bouyer 37152360bf Move part of wdc_sataprobe() to sys/dev/ata/sata_subr.c so that it can be
shared with non-wdc SATA controllers.
2006-11-20 23:42:21 +00:00
tsutsui 34a152af6d No need to check ifp->if_capenable on RX checksumming. 2006-11-18 17:39:44 +00:00
tsutsui d1beedb632 Fix some comments. 2006-11-18 10:37:24 +00:00
tsutsui ea45dc497b Replace magic numbers with macro. 2006-11-18 07:40:13 +00:00
tsutsui d56fc00c0d - sync HWREV definitions with FreeBSD
- recognize 8169SC/8100E/8101E (untested, but won't hurt working devices)
  XXX: 8100E/8101E don't support 1000M; need some flag to set if_baudrate
2006-11-18 07:22:06 +00:00
tsutsui 33b09955d2 Use bitmask ops rather than modulo in RE_NEXT_*() macro since
we can assume each number of descriptors and TX queue is a power of two.
2006-11-18 00:21:36 +00:00
tsutsui 654712938e - add some more register definitions from Realtek driver
- sort
2006-11-17 23:41:42 +00:00
tsutsui 6590e7b074 Prepare and use an inline function which sets 64 bit DMA address into
struct re_desc to avoid unnecessary 64 bit arithmetic on ILP32 ports.
2006-11-17 21:49:49 +00:00
tsutsui 80b92a7179 Use ETHER_HDR_LEN rather than sizeof(struct ether_header).
BTW, should we have the similar ip4csum-tx bug workaround for fxp(4)?
2006-11-17 21:35:24 +00:00
tsutsui f48e88ab0d Add a workaround for hardware ip4csum-tx bug on re(4) chips.
See discussion on tech-kern and tech-net for details:
http://mail-index.netbsd.org/tech-net/2006/10/21/0000.html
http://mail-index.netbsd.org/tech-net/2006/11/04/0003.html
http://mail-index.netbsd.org/tech-net/2006/11/07/0002.html
http://mail-index.netbsd.org/tech-net/2006/11/12/0000.html
etc.
2006-11-17 21:29:36 +00:00
christos 168cd830d2 __unused removal on arguments; approved by core. 2006-11-16 01:32:37 +00:00
bouyer 927492edcd wdc_sataprobe():
- wait up to 1s for SStatus_DET_DEV after SControl_DET_INIT toggle (from
  FreeBSD)
- reset the drive once we know it's there. It may be in some PM state and
  not able to properly reply to IDENTIFY. Tested by Teemu Rinta-aho,
  fixes PR kern/35049 and should also fix PR kern/35008.
2006-11-14 18:39:10 +00:00
dyoung 075fd7d1e9 Stop using typeof() in the bit-twiddling macros, per yamt@'s
suggestion.  This change requires that I use the __PRIuBITS format
string in atw and rtw, so do that.
2006-11-13 03:35:59 +00:00
plunky 57c0199dcf Tidy away wsmouse_input() abstractions and update
documentation to include the W direction.
2006-11-12 19:00:42 +00:00
tsutsui d990bcf038 Replace RTK_ETHER_ALIGN with RE_ETHER_ALIGN, which I missed.
Pointed out by dieter roelants in PR kern/35041.
2006-11-12 15:12:02 +00:00
tsutsui 26a4066f11 Remove an extra semicolon. 2006-11-12 12:02:19 +00:00
itohy 96de608110 Oops, I didn't notice the file had been updated and overwrote
the changes in 1.93....
Rescue the changes in 1.93 (IPv4 checksum fix).
2006-11-12 07:16:14 +00:00
itohy 3b284b614d - In some rare cases, both Tx Complete and Dn Complete bits are set.
I'm not sure what it exactly means, but at least, the packet in question
  is reloaded in ex_txstat() and should not handle the Dn Complete event
  at the moment ---  it should be served on later interrupt.

- Reload packet on collision, too.
2006-11-12 07:07:39 +00:00
tsutsui 0d397b62fe - merge re_encap() into re_start() so that we can handle each error case
more flexible
- account a number of free txq and use it to see if packets are queued or sent
- assume free TX descriptors are not owned by the chip in re_start() and
  panic if there is any inconsistency on them #ifdef DIAGNOSTIC case.
- replace a magic number (reserved TX descs?) with macro
2006-11-12 03:09:37 +00:00
tsutsui cad156cdf4 Add a workaround for a hardware ip4csum-tx bug which would sometimes put
wrong IPv4 checksum on sending 21 or 22 byte IP packets.

See discussion on tech-kern and tech-net for details:
http://mail-index.netbsd.org/tech-kern/2006/11/04/0004.html
2006-11-12 02:49:46 +00:00
tsutsui 6e1aa2e387 Minor style tweaks in re_txeof(). 2006-11-11 13:51:44 +00:00
tsutsui 216b5d71df - declare struct re_txq separately
- reorder bus_dma_segment_t members since they are used only on attach/detach
2006-11-11 13:41:06 +00:00
tsutsui 15ce034c2c Some minor tweaks in re_intr():
- check status bits at once (I'm not sure how gcc optimized them though)
- no need to check (ifp->if_flags & IFF_UP) twice
  (re_init() must be called at splnet() anyway)
- call re_start() only if the interrupt is actually handled here
- call re_start() directly rather than via (*ifp->if_start)()
2006-11-11 12:41:56 +00:00
tsutsui 82ada0b76e Clear a TX timeout only if all queued packets are handled. 2006-11-11 12:13:55 +00:00
tsutsui 677bbfc799 Remove a leftover comment.
(note bus_dmamap_sync(9) is still needed even if no changes are made to
 DMA descriptors but once they are fetched into the CPU cache)
2006-11-11 12:04:08 +00:00
tsutsui 319c2aeb6a - set descriptor DMA addresses before enabling TX and RX
- set RTK_EARLY_TX_THRESH before starting TX and RX
2006-11-11 11:31:30 +00:00
tsutsui df320777c1 Call re_reset() after re_stop() in re_init().
Without this, re(4) on my macppc sometimes falls into mangled state
and generates many errors after ifconfig(8) or tcpdump(8) etc.
2006-11-10 21:49:02 +00:00
elad 87d047b739 Replace securelevel checks with kauth(9) calls. 2006-11-08 00:17:09 +00:00
tsutsui a6058d8988 Rename prefixes of re(4) specific macro and structure members
from RTK_ or rtk_ to RE_ or re_ for maintainability of these sources.
Eventually we should split these files (and struct rtk_softc) into
three elements, rtk(4) specific one, re(4) specific one, and a common
(register definitions, eeprom and multicast functions etc) part.

While here, add a couple of comments around weird definitions.
2006-11-05 16:52:10 +00:00
tsutsui 7274f167d2 - make TX threshold macro more generic
- no need to bother to initialize sc_txthresh in rtk_attach()
  since it's done in rtk_init()
2006-11-05 15:49:41 +00:00
itohy bb94735ed0 Restart transmitter, not reset the entire chip, on transmission errors
like Tx underrun.
This should improve performance on such errors.

Handle fifo threshold properly --- actually it did not handled at all.
Note that the Tx Complete interrupts occur only on errors, and ex_txstat()
is not good place to increment sc->tx_succ_ok.  Increase the sc->tx_succ_ok
count from 100 to 256, since the ex(4) does busmastering and underruns
should rarely happen in normal operations.

Possibly improve some situation for the hang-on-heavy-load problems,
such as kern/11450 and kern/27096.
2006-11-05 07:59:21 +00:00
itohy 4be0089972 Add definition for Tx Reclaim status (TXS_RECLAIM). 2006-11-05 05:57:53 +00:00
tsutsui c5bcc82dd7 Preserve m_pkthdr.csum_flags in TX packets because
it could be lost if bus_dmamap_load_mbuf(9) returns EFBIG.
(though I've never seen the "too mamy segments" message
 which indicates the packet has more than 32 fragments)
2006-11-04 05:18:26 +00:00
tsutsui 445d5743e4 Pull a 8139C+ fix from FreeBSD if_re.c rev 1.73:
Ignore BMCR_LOOP and BMCR_ISO bits which have different meanings on 8139C+.

Tested by Brian A. Seklecki.
2006-11-03 17:16:58 +00:00
tsutsui 304b305c9e Minor cleanups:
- move some driver specific definitions from rtl81x9reg.h to rtl81x9var.h
- move several macro where related structures are declared
- remove unused macro
- fix some comments
- unwrap some lines
2006-11-03 17:01:54 +00:00
tsutsui a8d1516f11 Use #define<space>, which seems consistent in these files. 2006-11-03 14:41:40 +00:00
garbled 8e03013027 Comment out the debug options to siop, and change the undef to define.
This way they will be compiled by the i386 DEBUG kernel and tested.
2006-11-02 15:08:30 +00:00
garbled a68eec4cf9 Make these compile when SIOP_DEBUG is enabled, by nuking the reference to
t_offset, which no longer seems to exist.
2006-11-02 14:55:04 +00:00
itohy 74588a5b22 Turn on PHY power earlier in the initialization.
This should make 3c575CT work and fix following PRs:

kern/12965: 3com 575CT does not work
port-i386/16295: Problems in pci routing table and ex0 (3c575c-tx) networking
2006-10-29 05:56:35 +00:00
christos f26b055a0e PR/34933: Sami Kantoluoto: RealTek 8168B found from Asus P5B motherboard
is not recognized
2006-10-28 23:18:34 +00:00
tsutsui 1696b0bb2f Put common data for each RX DMA descriptor into a new rxsoft structure
for micro optimization.
2006-10-28 03:42:55 +00:00
tsutsui dee13e6f7d Remove redundant byteswap ops. 2006-10-27 13:26:34 +00:00
tsutsui 5ee73a035c Use common macro rather than local one. 2006-10-27 09:57:26 +00:00
bouyer c55d38dab6 Exclude wdc_sataprobe() when no SATA controllers are present. Fix
build of *_TINY kernels.
2006-10-25 20:14:00 +00:00
bouyer 80b1feec65 Add sata registers to struct wdc_regs. Add wdc_sataprobe(), a function
probing drives using the standard SATA registers; taken from various
PCI sata drivers. Export wdc_drvprobe() too.
2006-10-25 17:33:02 +00:00
tsutsui 49466e5a5e Set RTK_RDESC_CMD_OWN in rtk_cmdstat of RX DMA descriptor after
all other descriptor data is written to avoid possible race condition.
2006-10-24 11:17:49 +00:00
tsutsui 5398897f34 Rename RTK_[TR]X_DESC_INC() macro to RTK_NEXT_[TR]X_DESC() and
change them to return rvalues to avoid possible side effects.
Also define RTK_NEXT_TXQ() for rtk_txq index and use it as well.
2006-10-22 01:47:53 +00:00
tsutsui d438fee521 Rename a variable to clarify meaning of index. 2006-10-22 01:23:39 +00:00
tsutsui bc366d3166 Tweak TX descriptor setup code in re_encap() to make it more readable a bit. 2006-10-21 21:29:14 +00:00
tsutsui f89487b7e5 Use aprint_error(9) to print error messages. 2006-10-21 16:13:21 +00:00
tsutsui 5227317a1e Use CSR_WRITE_1() to write RTK_TXSTART register because it is localted
at an odd address (0xd9) and noted "8 bit" in rtl81x9reg.h.

XXX: FreeBSD and OpenBSD also use CSR_WRITE_1() to write RTK_GTXSTART
XXX: for 8169 even though there is a "16 bits" comment at GTXSTART macro.
XXX: Which is correct?
2006-10-21 03:44:47 +00:00
tsutsui f236f53515 In re_newbuf():
- adjust m_data and m_len directly rather than calling m_adj(9)
- more cosmetics
2006-10-20 17:11:36 +00:00
tsutsui 2cc86b486f KNF, remove register decls, TAB/space cosmetics etc. 2006-10-20 16:46:47 +00:00
tsutsui 572ce0789f u_intNN_t -> uintNN_t 2006-10-20 16:31:08 +00:00
tsutsui d27d349474 Use BUS_DMA_COHERENT on mapping DMA memory for TX/RX descriptors.
I can't think of a good way to avoid race condition between writeback and
DMA write against descriptors if cachelinesize > sizeof(struct rtk_desc)...

Anyway, now re(4) is functional on O2 (and probably other mips ports).
2006-10-20 15:44:00 +00:00
tsutsui a7ca335bad Try to avoid race condition between cache writeback from CPU and DMA write
from re(4) chip as much as possible.
2006-10-20 15:19:01 +00:00
tsutsui 620e93c99c while (1) -> for (;;) 2006-10-20 14:51:06 +00:00
tsutsui d2c63dd7b9 - bcopy -> memcpy
- bcmp -> memcmp
2006-10-20 14:28:55 +00:00
tsutsui 55b9847900 There is no particular reason to use BUS_DMA_ALLOCNOW on bus_dmamap_create(9). 2006-10-20 14:00:49 +00:00
tsutsui 920add0c28 Tweak a for() loop a bit in re_rxeof(). 2006-10-20 13:44:31 +00:00
tsutsui 38e9d649da Sync RX mbufs before setting up RX DMA descriptor. 2006-10-20 13:39:47 +00:00
tsutsui e9a7d245ed - call bus_dmamap_sync(9) against DMA descriptors more properly
- make DMA descripter members volatile
Now re(4) works on sgimips O2.

XXX: Still re(4) sometimes stalls on NFS load on sgimips,
XXX: but I'm not sure it's sgimips specific or not.
2006-10-20 11:30:54 +00:00
tsutsui 92846c53e2 Use "#ifdef __NO_STRICT_ALIGNMENT" rather than
"#if defined(__i386__) || defined(__x86_64__)".

XXX: What will happen if RTL8168B is used on !__NO_STRICT_ALIGNMENT hosts?
XXX: If 8168B can't handle RX DMA into 32bit-unaligned memory, should we
XXX: implement some code to copy RX buffers like vge(4)?
XXX: Or is 8168B available only for on-board NIC for PCs?
2006-10-17 14:16:06 +00:00
tsutsui aecd88d07b DMA memory for the TX ring should be aligned at RTK_RING_ALIGN,
not RTK_ETHER_ALIGN.
2006-10-17 14:03:26 +00:00
yamt de1da31163 re_diag: constify. 2006-10-17 09:19:57 +00:00
pooka 5005d343ec * __unused games + other relevant fixes
* give me ANSI C or give me death (at least where it could be easily spotted)
2006-10-16 13:00:36 +00:00
yamt e3c9a705bc re_start: fix tx stall. 2006-10-13 11:06:15 +00:00
yamt 04200ace96 re_txeof: fix watchdog timeout. 2006-10-13 11:02:38 +00:00
dogcow e5fd0c244b more __unused; also, ew, K&R decls. 2006-10-12 20:16:59 +00:00
xtraeme 1b2a823a5f Use __unused in function arguments where appropiate. 2006-10-12 07:43:39 +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
jkunz 007f7a7a2a Bringing up a fpa(4) interface on sparc(64) causes a hard kernel crash
(infinite loop) due to the way fpa(4) interacts with bus_dma(9).
This fixes the problem and makes fpa(4) usable on sparc(64).
2006-10-09 20:45:19 +00:00
gdt 058379036b Use IEEE80211_RADIOTAP_DBM_ANTSIGNAL (and NOISE) instead of DB,
because the Atheros values are at least close.
(discussed on tech-net)
2006-10-07 20:54:40 +00:00
peter 0e931e0449 Fix compilation with AN_DEBUG (use %zu instead of %d). 2006-10-07 14:30:27 +00:00
chs 33c1fd1917 add support for O_DIRECT (I/O directly to application memory,
bypassing any kernel caching for file data).
2006-10-05 14:48:32 +00:00
christos b64edcaded fix empty if 2006-10-04 15:53:24 +00:00
christos 888446efb0 fix empty if 2006-10-04 15:41:25 +00:00
christos 53dabe0e36 fix empty if body. 2006-10-04 15:39:24 +00:00
christos f2e38a9477 prevent empty body in if. 2006-10-04 15:36:23 +00:00