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