Commit Graph

4526 Commits

Author SHA1 Message Date
tsutsui
1359adc400 No need to specify BUS_DMA_ALLOCNOW for sglist map
since it will never be unloaded anyway.
2007-02-18 12:26:13 +00:00
dyoung
5493f188c7 KNF: de-__P, bzero -> memset, bcmp -> memcmp. Remove extraneous
parentheses in return statements.

Cosmetic: don't open-code TAILQ_FOREACH().

Cosmetic: change types of variables to avoid oodles of casts: in
   in6_src.c, avoid casts by changing several route_in6 pointers
   to struct route pointers.  Remove unnecessary casts to caddr_t
   elsewhere.

Pave the way for eliminating address family-specific route caches:
   soon, struct route will not embed a sockaddr, but it will hold
   a reference to an external sockaddr, instead.  We will set the
   destination sockaddr using rtcache_setdst().  (I created a stub
   for it, but it isn't used anywhere, yet.)  rtcache_free() will
   free the sockaddr.  I have extracted from rtcache_free() a helper
   subroutine, rtcache_clear().  rtcache_clear() will "forget" a
   cached route, but it will not forget the destination by releasing
   the sockaddr.  I use rtcache_clear() instead of rtcache_free()
   in rtcache_update(), because rtcache_update() is not supposed
   to forget the destination.

Constify:

   1 Introduce const accessor for route->ro_dst, rtcache_getdst().

   2 Constify the 'dst' argument to ifnet->if_output().  This
     led me to constify a lot of code called by output routines.

   3 Constify the sockaddr argument to protosw->pr_ctlinput.  This
     led me to constify a lot of code called by ctlinput routines.

   4 Introduce const macros for converting from a generic sockaddr
     to family-specific sockaddrs, e.g., sockaddr_in: satocsin6,
     satocsin, et cetera.
2007-02-17 22:34:07 +00:00
alc
0369238ed8 Update documentation URL. Previous one was leading to a "Page not found". 2007-02-16 21:05:40 +00:00
tsutsui
c9962e639e Set ER_RXSTAT_OWNER after all descriptor members are ready. 2007-02-16 13:43:57 +00:00
tsutsui
3fe4f9fc45 Make DMA descriptors volatile to avoid unintended reordering which might
cause some race condition.
2007-02-16 13:43:00 +00:00
tsutsui
937ff586b1 RTK_HWREV_8100E_SPIN2 is a PCIe device so also check it
in rtk_setmulti() to handle quirk. Noticed by OpenBSD.
2007-02-16 13:01:48 +00:00
tsutsui
ce38f32f83 Don't set RTK_CFG1_FULLDUPLEX bit in RTK_CFG1 register
since it's available only on RTL8129. From FreeBSD.

As defined in rtl81x9reg.h, bits of 0x80 and 0x40 in RTK_CFG1
seem to indicate LEDS0 and LEDS1 configuration initialized by
EEPROM settings, and they seem read only on my quick tests with
two 8169S based cards.
2007-02-15 12:33:57 +00:00
tsutsui
187a862850 Use new RTK_HWREV_8100E_SPIN2 macro. (missed in the previous) 2007-02-15 12:24:56 +00:00
tsutsui
6da4c2af88 Clear IFF_OACTIVE in re_txeof() only if there are more than RE_TXDESC_RSVD
free TXDESCs. From FreeBSD, but I'm still wondering why we have to reserve
some free TXDESCs even on re_start().
2007-02-10 12:46:29 +00:00
tsutsui
83a47fa604 Pull a multicast fix from FreeBSD's if_re.c rev 1.81:
Fix rtk_setmulti() so that it works correctly for PCIe chips where
 the multicast hash table are in reverse order compared to older
 devices.

Closes PR kern/35579 from Nino Dehne.
2007-02-10 03:58:32 +00:00
ad
b07ec3fc38 Merge newlock2 to head. 2007-02-09 21:55:00 +00:00
tsutsui
f4797e0850 Accept RX packets which are larger than ETHER_MAX_LEN but can be stored
into RX mbufs. Inspired by OpenBSD.
2007-02-04 06:01:30 +00:00
tsutsui
59ea1d1768 - check more hwrev and use HWREV_* macro. From Realtek driver
via Darrin B.Jewell.
  XXX: maybe we should check this sc_rev on more place
- use RTK_TXCFG_HWREV (0x7cc00000) rather than 0x7c800000
  to mask the hwrev value since bit 0x00400000 is used only by 8139D
  which is not supported by this driver
- fix a tyop
2007-02-04 04:49:58 +00:00
tsutsui
15a85916ca Add another 8100E HWREV number. From Realtek driver and Plan9 driver. 2007-02-04 04:41:43 +00:00
tsutsui
1c17a4f65d Fix EEPROM functions for RTL8169SC chips:
rtl81x9.c:
 Increase delay on EEPROM access since EEPROM on RTL8169 based board
 seems to require slower clock. Also use common EE_DELAY() macro.

rtl8169.c:
 Use common rtk_read_eeprom() function to get Ethernet address on
 8169 chips because EEMODE_AUTOLOAD command was a workaround on
 original FreeBSD's driver and it doesn't work on 8169SC.

Problem reported and fix tested by Frank Lorenzen on current-users,
and also tested on 8139C with rtk(4) driver by me.
2007-01-29 12:11:42 +00:00
dyoung
ba4e9d5953 In rtw_dequeue(), initialize *mp to NULL before anything else, so
that it is either NULL or a valid mbuf.  Previously, it was possible
for rtw_dequeue() to exit with 0 before initializing *mp.  rtw_start()
would have used whatever trash was in *mp, which would lead to
problems later on.
2007-01-29 07:08:09 +00:00
hubertf
eda05c6413 Remove more duplicate headers.
Patch by Slava Semushin <slava.semushin@gmail.com>

Again, this was tested by comparing obj files from a pristine and a patched
source tree against an i386/ALL kernel, and also for src/sbin/fsck_ffs,
src/sbin/fsdb and src/usr.sbin/makefs. Only changes in assert() line numbers
were detected in 'objdump -d' output.
2007-01-29 01:52:43 +00:00
sborrill
625376d814 Add missing bus_space_(read,write)_stream macros.
Approved by martin@
2007-01-26 16:28:18 +00:00
bouyer
26989657fb For the unaligned case:
Be consistant with the spaces around * and +
	Use data32io[th] for 32bit access
	Use stream bus_space access unless we have DRIVE_NOSTREAM
all pointed out by enami tsugutomo, thanks !
2007-01-18 21:42:57 +00:00
martin
53f72a1474 If __NO_STRICT_ALIGNMENT is not defined, take special care to do PIO
transfers with proper alignement - this removes alignement restrictions
of the buffer pointer passed.
Thanks to bouyer, reinoud, jdc for helping with the code, and special
thanks to Dave Huang for testing.
2007-01-14 09:18:39 +00:00
cube
2f04b55c8c Make the IPKDB code compile. 2007-01-13 19:46:21 +00:00
cube
4096a1c345 The definition of bus_space_vaddr on i386 makes it inappropriate as the
first argument to memset(), so change the code very slightly to workaround
that.
2007-01-13 19:45:28 +00:00
cube
c7835953d1 Make it compile with all the options. 2007-01-13 19:41:12 +00:00
cube
1ff20ac39c Make COM_HAYESP compile again. It assumes no register mapping is needed. 2007-01-10 20:59:10 +00:00
itohy
f4c7b0fd4d Fix a typo in comment. 2007-01-10 09:00:00 +00:00
itohy
8e90b03622 Cancel commands and free allocated resources on detach. 2007-01-09 12:53:12 +00:00
dyoung
14431664ca Let the compiler know it should both pack the members of the rx/tx
descriptors without any padding between, and use 4-byte alignment.
2007-01-09 09:36:28 +00:00
dyoung
cf64e801fd ath-specific support for 802.11 fragmentation. From Sam Leffler.
Screen-scraped by me from the WWW source browser at perforce.freebsd.org.
2007-01-09 09:30:24 +00:00
tsutsui
990e13dfb3 Typo. 2007-01-07 12:10:18 +00:00
dyoung
e356b87859 I have made a small change that suppresses "recovery" from (spurious?)
tx timeouts on the beacon queue.  The driver's recovery process
badly disrupts the MAC's receiver.  This needs a closer look, later.

Every other fix is by Charles M. Hannum.  Charles writes:

"With these, the device is quite stable under load, does not experience
xmit timeouts, no longer mysteriously freezes, and does not spew
a lot of garbage.  It does, however, continue to get some "tx fifo
underflow"s.

global, SYSCTL_SETUP():
a) Removed unused sysctl variables.

rtw_io_enable():
b) Change rtw_io_enable to take a softc, and make it call
   rtw_txring_fixup().
c) Enable the PCI multiple read/write bit.
d) Always reset rdb_next to 0 when starting the receive engine.

rtw_intr_rx():
e) When processing receive packets, store the next pointer in rdb_next
   and read it back on the next round, to fix a race condition vs.
   rtw_tune() during AP discovery and association.
f) Remove the special "skip to 0th descriptor" code, because it is no
   longer needed.

rtw_collect_txring():
g) In the "force" case, stop when we catch up to the hardware xmit
   pointer.

rtw_intr_beacon():
h) Resetting tdb_next here looked fishy to me, in light of changes in
   rtw_collect_txring().  XXX However, this is the one part I haven't
   tested.

rtw_txring_fixup():
i) Add function and line arguments, so we can print out information
   about the caller.
j) In addition to reading the hardware pointer, skip over any
   additional packets with OWN set -- we may have queued more.

rtw_rxring_fixup():
k) Remove this, because it's completely wrong.

rtw_intr_ioerror():
l) Don't handle receive overruns here; handle them in the normal receive
   path.  Also changed RTW_INTR_RX and RTW_INTR_IOERROR accordingly.
m) Do not fiddle with CR; the transmit engine is still running just
   fine.
n) Do not fiddle with IMR; it was unnecessary.
o) Don't touch the receive engine at all; not necessary now that we're
   leaving CR alone.
p) Remove the rtw_do_chip_reset case; it was dangerous and not actually
   used.

rtw_intr():
q) Don't mask off ISR bits when we pass down the ISR value; it's not
   necessary, and sometimes the other bits useful in debugging output.

rtw_seg_too_short():
r) Don't spew here; the caller will do it if necessary.  (Stops spewage
   in an expected case.)

rtw_rxdesc_blk:
s) Minor change to make the elements have the same order as txdesc_blk.

general:
t) Added a bunch of debugging output, #ifdef RTW_DIAG, that was useful
   while investigating the ring management problems.  Also moved
   rtw_txring_fixup() into RTW_DIAG, as I believe the transmit pointer
   is always kept in sync now, and the function has potential race
   conditions.
2007-01-06 08:27:53 +00:00
dyoung
6439fa375f Add a hint to the compiler that rx/tx descriptors deserve 4-byte
alignment.  Helps GCC produce better code on ARM.
2007-01-06 06:09:03 +00:00
dyoung
d7436b96b1 After we examine a rx/tx descriptor and find that it's still owned
by the NIC, re-sync the descriptor so that a cacheline will not
"cover" the NIC's modifications to the descriptor when we next
examine it.

This compiles, but I have not tested it, yet.
2007-01-06 06:07:55 +00:00
elad
d5ebb97b46 Consistent usage of KAUTH_GENERIC_ISSUSER. 2007-01-04 18:44:45 +00:00
ad
dfe565a4b0 - Print number of channels and firmware revision.
- Cut polling delay to make crashdumps faster.
2006-12-29 14:07:08 +00:00
ad
65c4eaafe1 Bump the hardware queue depth up to 256. 2006-12-28 19:17:12 +00:00
itohy
3e588075d6 Stop callout on detach. 2006-12-28 03:13:54 +00:00
tsutsui
03841e683e Wrap a sanity check in re_newbuf() with #ifdef DIAGNOSTIC and
make it fatal on failure.
2006-12-26 13:45:43 +00:00
tsutsui
91031286e2 Use __predict_false() in several conditionals. 2006-12-26 13:40:58 +00:00
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