Commit Graph

5056 Commits

Author SHA1 Message Date
tsutsui
200d1adc6c Add hardware checksum support for newer PCIe 8168/8111/8102 chips,
per device info taken from FreeBSD driver.  Tested by snj@ on 8111C.

Should closes PR kern/40955.

Note on old 8169 chips IP hw csum must be enabled to use TCP/UDP hw csums,
but I'm not sure if these newer chips still have the same restriction.
2009-03-21 07:58:30 +00:00
tsutsui
3c5f553e65 Try to avoid zstty hangs on higher speed:
z8530sc.c:
 Check pending interrupts in a loop until all requests are handled.
 The old comments said it would cause horrible latency to sun3x floppy etc,
 but serial ports should have higher priority than disks anyway.

z8530tty.c:
 Don't enable and disable TX interrupts on each transmit start and completion
 because it could cause possible race conditions.
 Instead, set ZSWR0_RESET_TXINT on each TIE interrupt to clear the request
 as other kbd drivers attached at zs(4).

Tested on cobalt, macppc, news68k, sparc, and sun3.
2009-03-20 16:28:57 +00:00
tsutsui
4b2a9ec9d1 Access LDPS register in re_reset() only on 8169S single chip variants.
From OpenBSD and FreeBSD drivers via PR kern/41009, and
Realtek-supplied FreeBSD driver.
2009-03-20 06:31:31 +00:00
cegger
e2cb85904d bcopy -> memcpy 2009-03-18 17:06:41 +00:00
cegger
c363a9cb62 bzero -> memset 2009-03-18 16:00:08 +00:00
cegger
df7f595ecd Ansify function definitions w/o arguments. Generated with sed. 2009-03-18 10:22:21 +00:00
dsl
7cc9af7d64 ANSIfy functions with function-pointer arguments 2009-03-16 23:11:09 +00:00
tsutsui
7a44ef30a5 Pull a fix from hme.c rev 1.73 (to #if 0'ed out part):
> Fix a bug in calculation of checksum deduction:
> - To get 16 bit one's complement value from uint32_t variable,
>   higher 16 bits should be ignored.
> - RFC 1624 describes methods to recalculate checksum field in headers,
>   i.e. one's complement of one's complement sum that could be 0x0000,
>   but we don't have to use the strategy to deduct one's complement sum
>   itself which won't be zero but should be 0xffff.
2009-03-16 12:13:04 +00:00
tsutsui
24a0836984 Fix a bug in calculation of checksum deduction:
- To get 16 bit one's complement value from uint32_t variable,
  higher 16 bits should be ignored.
- RFC 1624 describes methods to recalculate checksum field in headers,
  i.e. one's complement of one's complement sum that could be 0x0000,
  but we don't have to use the strategy to deduct one's complement sum
  itself which won't be zero but should be 0xffff.

Found on debugging mec(4) on sgimips O2.
2009-03-16 12:02:00 +00:00
cegger
05d33dc7bf ansify function definitions 2009-03-16 09:32:38 +00:00
cegger
317b4e018f ansify function definitions 2009-03-15 17:24:43 +00:00
cegger
4b83748ce5 ansify function definitions 2009-03-15 15:52:12 +00:00
tsutsui
8d2f130b12 Tweak comments and conditionals about EXT_RFA and IPCB. 2009-03-15 14:48:11 +00:00
tsutsui
3acfa89d3b Adjust comments about sc_flags. 2009-03-15 14:18:38 +00:00
dsl
82357f6d42 ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
2009-03-14 21:04:01 +00:00
dsl
454af1c0e8 Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
2009-03-14 15:35:58 +00:00
dsl
02cdf4d2c8 Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
2009-03-14 14:45:51 +00:00
tsutsui
b057550bcf u_intNN_t -> uintNN_t 2009-03-11 13:12:41 +00:00
tsutsui
567ce9e6ef Computed checksum value by the FXPF_82559_RXCSUM feature includes data
in IP headers, so we have to deduct not only IP option headers but all
IP headers.  But in TCP/UDP layer we can assume the IP header is valid
and a sum of the IP header part should be 0xffff, so we don't have to
bother to deduct it from the computed checksum.
2009-03-09 10:33:33 +00:00
tsutsui
a8ba219be8 Replace incorrect local ether_cmp() function with memcmp(9)
on checking multicast addresses, which is not so critical.
Noticed by FUKAUMI Naoki.
2009-03-07 16:46:25 +00:00
tsutsui
cf97a4b35d Add TCPv4/UDPv4 RX hardware checksum support for i82559 and later chips
which don't have EXT_RFA and IPCB support. From hme(4) driver and
FreeBSD's fxp(4). Tested on i82559.

XXX: Probably we should have a common function to parse RX packet headers
XXX: to handle a raw checksum value and share it among hme(4) and gem(4) etc.
2009-03-07 15:03:25 +00:00
tsutsui
ee11921a7a Add an `else' missed in rev 1.49 otherwise RX hardware checksum on hme(4)
is not activated at all. Ok'ed by christos@, tested on macppc.
2009-03-07 00:12:36 +00:00
hauke
f971ff9cd3 Workaround from jmcneill for a panic at shutdown.
Fixes PR kern/40947 and should be pulled up to netbsd-5.
2009-03-06 17:10:41 +00:00
tsutsui
26c579d9c4 Use FXPF_EXT_RFA flag instead of FXPF_EXT_TXCB to see IPCB capability
because EXT_RFA for RX cksum is always available with IPCB for TX cksum
but i82558 and i82559 have only EXT_TXCB without IPCB.

Tested on the following fxp cards:
fxp0 at pci0 dev 14 function 0: Intel i82557 Ethernet, rev 2
fxp0 at pci0 dev 14 function 0: i82559 Ethernet, rev 8
fxp0 at pci0 dev 14 function 0: i82550 Ethernet, rev 12
2009-03-04 10:15:08 +00:00
cube
102a4f0ad3 I smell rotting code. (Give a chance to the user to at least set the flags
of the interface, if not use it because it otherwise doesn't work.)
2009-02-23 00:05:44 +00:00
mrg
ce8a6e2599 - remove FXPF_IPCB flag. it should always/only be used with the code
conditional on FXPF_EXT_TXCB, so, replace all uses with that
- for the pci frontend, reestablish some flags lost the the prior
  changes and simplify one of the cases

this fixes PR 40677 and may fix PR 40431.
2009-02-20 05:49:34 +00:00
jmcneill
dc02b079e4 Remove vesafb-specific hacks. 2009-02-19 00:39:25 +00:00
mlelstv
c94f3d9355 Don't release CCB twice. Found by code inspection. 2009-02-16 18:05:19 +00:00
bouyer
73920b4161 More printf format fixes. 2009-02-13 23:31:23 +00:00
bouyer
c54134b00b When an error is reported on a write, data may have been transfered
to the device's cache anyway and so cmdh_prdbc reports a completed
transfer. If we use it to update ata_bio->bcount this has 2 conseqences:
- the automatic LBA48 workaround doesn't qick in because bcount is used
  to compute the last sector of the transfer (wd(4) part of kern/40569)
- wd(4) will report a B_ERROR buffer with a b_resid of 0, which panics
  a DIAGNOSTIC kernel
Fix by ignoring cmdh_prdbc if we had a write with errors, and in this case
leave ata_bio->bcount at its initial value.

While there use NOERROR instead of 0 for ata_bio->error (cosmetic).

thanks to Matthias Scheler for tests.
2009-02-12 11:44:11 +00:00
rumble
0e95582ed1 WD33C93 has only two registers, which often times aren't mapped to adjacent
bus space locations. Map them individually, instead.
2009-02-12 06:24:45 +00:00
rumble
4ef2271e2d If sc_dmamode is set to SBIC_CTL_NO_DMA, then actually don't do DMA. Now
PIO mode actually works.
2009-02-12 06:20:58 +00:00
dyoung
613d59f38b Define some bitfields that come from a reference driver. 2009-02-06 02:02:26 +00:00
tsutsui
191f7dda19 - u_int8_t -> uint8_t
- use ANSI function decls
2009-02-02 15:59:20 +00:00
bouyer
c768d4a900 One more device_t/softc split fallout (a missing device_private()). 2009-01-29 12:14:40 +00:00
bouyer
9b761cfd2a As ic_ident is from 2 to ICP_NCCBS + 2, we need more than just ICP_NCCBS
sense structures in icp_scr map; otherwise we'll compute an offset past the
allocated memory (and past the end of the dmap map) from the ic_ident.
To be safe use ICP_NCCB_RESERVE instead of 2; as I'm not sure why
ICP_NCCB_RESERVE is 4.
2009-01-29 12:13:30 +00:00
sborrill
25201bad1e Correct PHY types (5 is LP, _not_ N). 2009-01-28 14:49:10 +00:00
tsutsui
398fb3fdca - use device_t and cfdata_t
- rename variables for readability after device_t/softc split
- use proper pointer types

No binary changes.
2009-01-27 11:26:15 +00:00
bjh21
11aab16b02 Split device_t from wd33c93_softc. Reviewed by cube; tested on sgimips
by tsutsui.
2009-01-25 15:23:42 +00:00
bjh21
1cd868fdf2 The introduction of config_stdsubmatch() lost an important feature of
upc_submatch() whereby it made sure that the correct driver attached.
Since this didn't really belong in the submatch function anyway,
reintroduce it in the match functions for upc's children.

This allows my A5000 to find at least one of its hard disks.
2009-01-25 14:34:14 +00:00
christos
bf9ab82c0e Make this compile &foo[0] does not work for void * :-) Wojciech Galazka 2009-01-23 19:49:16 +00:00
bjh21
ce80665a62 Convert more printfs to aprint_* and use the latter more consistently. 2009-01-20 20:57:26 +00:00
mrg
71e27a6efb The PCI revision numbers are unique to a PCI vendor/product
ID pair.  Misuse of the revision numbers was causing some of the chip
features to be disabled on some integrated Intel chips.  So, move the
determination of the features into the bus frontend, where the
vendor/product ID is known.  (Note: sc_rev should be removed.  The
microcode patch stuff is also busted and needs to be fixed.)  Also,
poll the actual flow control status in inphy, rather than making
assumptions.

contributed anonymously.
2009-01-18 10:37:03 +00:00
mhitch
23a9d45ee2 When checking drive status, bump the pointer to the previous status
rather than using just drive 0 status.  Another drive with a different
status would cause the previous status state to flip-flop and repeatedly
output state change messages.
2009-01-16 05:40:50 +00:00
mhitch
258f66824c Another missed part of the device_t/softc split. Fixes ld(4) devices
on mlx(4) controller.
2009-01-16 04:20:28 +00:00
yamt
70de973662 g/c BUFQ_FOO() macros and use bufq_foo() directly. 2009-01-13 13:33:58 +00:00
cegger
c288f70f98 use new exported constants from net80211.
no functional change.
2009-01-10 13:03:19 +00:00
cegger
13175d24c8 BCM4328 has MAC rev 12.
XXX Driver now tells me, this chip has unsupported PHY type 4.
2009-01-10 12:57:50 +00:00
macallan
d6ded78b71 Fix previous screwup.
This is the real bwi driver.
Ported by Taylor R. Campbell
2009-01-09 20:49:42 +00:00
macallan
c83792f07e A driver for Broadcom BCM4302 wlan controllers, otherwise known as
Airport Extreme.
Ported from Dragonfly and OpenBSD by Urban Boquist
2009-01-09 19:50:24 +00:00