Home | History | Annotate | Download | only in ic
History log of /src/sys/dev/ic/rtl81x9.c
RevisionDateAuthorComments
 1.115  29-Jun-2024  riastradh if_stats(9): Add ifp argument to if_stat..._ref.

This will enable us to pass the ifp through to a dtrace probe inside.

No functional change intended in this change, but this is an API
change visible to modules so it shouldn't be pulled up.

PR kern/58377
 1.114  21-May-2023  andvar s/thar/that/ in comments.
 1.113  25-Sep-2022  thorpej Remove unnecessary include of <sys/malloc.h>.
 1.112  25-Jun-2022  tsutsui Pass proper status values to rnd_add_uint32(9) as rnd(9) man page claims.
 1.111  12-Mar-2020  thorpej Add support for MBUFTRACE.
 1.110  07-Feb-2020  thorpej Use callout_setfunc() / callout_schedule().
 1.109  04-Feb-2020  thorpej Use ifmedia_fini().
 1.108  29-Jan-2020  thorpej Adopt <net/if_stats.h>.
 1.107  01-Aug-2019  msaitoh branches: 1.107.2;
Use unsigned in rtk_setmulti() to avoid undefined behavoir. Found bk kUBSan.
 1.106  28-May-2019  msaitoh branches: 1.106.2;
Use ETHER_LOCK()/ETHER_UNLOCK() for all ethernet drivers to protect ec_multi*.
 1.105  23-May-2019  msaitoh No functional change:
- Simplify MII structure initialization and reference.
- u_int*_t -> uint*_t.
- KNF
 1.104  22-Jan-2019  msaitoh Change MII PHY read/write API from:

int (*mii_readreg_t)(device_t, int, int);
void (*mii_writereg_t)(device_t, int, int, int);
to:

int (*mii_readreg_t)(device_t, int, int, uint16_t *);
int (*mii_writereg_t)(device_t, int, int, uint16_t);

Now we can test if a read/write operation failed or not by the return value.

In 802.3 spec says that the PHY shall not respond to read/write transaction
to the unimplemented register(22.2.4.3). Detecting timeout can be used to
check whether a register is implemented or not (if the register conforms to
the spec). ukphy(4) can be used this for MII_MMDACR and MII_MMDAADR.

Note that I noticed that the following code do infinite loop in the
read/wirte function. If it accesses unimplemented PHY register, it will hang.
It should be fixed:

arm/at91/at91emac.c
arm/ep93xx/epe.c
arm/omap/omapl1x_emac.c
mips/ralink/ralink_eth.c
arch/powerpc/booke/dev/pq3etsec.c(read)
dev/cadence/if_cemac.c <- hkenken
dev/ic/lan9118.c


Tested with the following device:

axe+ukphy
axe+rgephy
axen+rgephy (tested by Andrius V)
wm+atphy
wm+ukphy
wm+igphy
wm+ihphy
wm+makphy
sk+makphy
sk+brgphy
sk+gentbi
msk+makphy
sip+icsphy
sip+ukphy
re+rgephy
bge+brgphy
bnx+brgphy
gsip+gphyter
rtk+rlphy
fxp+inphy (tested by Andrius V)
tlp+acphy
ex+exphy
epic+qsphy
vge+ciphy (tested by Andrius V)
vr+ukphy (tested by Andrius V)
vte+ukphy (tested by Andrius V)

Not tested (MAC):
arm:at91emac
arm:cemac
arm:epe
arm:geminigmac
arm:enet
arm:cpsw
arm:emac(omac)
arm:emac(sunxi)
arm:npe
evbppc:temac
macppc:bm
macppc:gm
mips:aumac
mips:ae
mips:cnmac
mips:reth
mips:sbmac
playstation2:smap
powerpc:tsec
powerpc:emac(ibm4xx)
sgimips:mec
sparc:be
sf
ne(ax88190, dl10019)
awge
ep
gem
hme
smsh
mtd
sm
age
alc
ale
bce
cas
et
jme
lii
nfe
pcn
ste
stge
tl
xi
aue
mue
smsc
udav
url

Not tested (PHY):
amhphy
bmtphy
dmphy
etphy
glxtphy
ikphy
iophy
lxtphy
nsphyter
pnaphy
rdcphy
sqphy
tlphy
tqphy
urlphy
 1.103  26-Jun-2018  msaitoh branches: 1.103.2;
Implement the BPF direction filter (BIOC[GS]DIRECTION). It provides backward
compatibility with BIOC[GS]SEESENT ioctl. The userland interface is the same
as FreeBSD.

This change also fixes a bug that the direction is misunderstand on some
environment by passing the direction to bpf_mtap*() instead of checking
m->m_pkthdr.rcvif.
 1.102  20-Feb-2017  ozaki-r branches: 1.102.12;
Apply deferred if_start to more drivers
 1.101  15-Dec-2016  ozaki-r branches: 1.101.2;
Move bpf_mtap and if_ipackets++ on Rx of each driver to percpuq if_input

The benefits of the change are:
- We can reduce codes
- We can provide the same behavior between drivers
- Where/When if_ipackets is counted up
- Note that some drivers still update packet statistics in their own
way (periodical update)
- Moved bpf_mtap run in softint
- This makes it easy to MP-ify bpf

Proposed on tech-kern and tech-net
 1.100  10-Jun-2016  ozaki-r branches: 1.100.2;
Introduce m_set_rcvif and m_reset_rcvif

The API is used to set (or reset) a received interface of a mbuf.
They are counterpart of m_get_rcvif, which will come in another
commit, hide internal of rcvif operation, and reduce the diff of
the upcoming change.

No functional change.
 1.99  08-Jun-2016  pgoyette Revert previous (rev. 1.98). It breaks at least one user's card.

PR kern/44433
 1.98  01-Jun-2016  pgoyette Enable writing to the EPROM before trying to change our MAC address.

From PR kern/44433
 1.97  09-Feb-2016  ozaki-r Introduce softint-based if_input

This change intends to run the whole network stack in softint context
(or normal LWP), not hardware interrupt context. Note that the work is
still incomplete by this change; to that end, we also have to softint-ify
if_link_state_change (and bpf) which can still run in hardware interrupt.

This change softint-ifies at ifp->if_input that is called from
each device driver (and ieee80211_input) to ensure Layer 2 runs
in softint (e.g., ether_input and bridge_input). To this end,
we provide a framework (called percpuq) that utlizes softint(9)
and percpu ifqueues. With this patch, rxintr of most drivers just
queues received packets and schedules a softint, and the softint
dequeues packets and does rest packet processing.

To minimize changes to each driver, percpuq is allocated in struct
ifnet for now and that is initialized by default (in if_attach).
We probably have to move percpuq to softc of each driver, but it's
future work. At this point, only wm(4) has percpuq in its softc
as a reference implementation.

Additional information including performance numbers can be found
in the thread at tech-kern@ and tech-net@:
http://mail-index.netbsd.org/tech-kern/2016/01/14/msg019997.html

Acknowledgment: riastradh@ greatly helped this work.
Thank you very much!
 1.96  13-Apr-2015  riastradh Convert sys/dev to use <sys/rndsource.h>.
 1.95  10-Aug-2014  tls branches: 1.95.4;
Merge tls-earlyentropy branch into HEAD.
 1.94  22-Jul-2012  matt branches: 1.94.2; 1.94.12;
Fix mii_statchg to take a 'struct ifnet *' instead of device_t. This fixes
problem with a common MDIO bus used for multiple interfaces.
Some drivers converted to CFATTACL_DECL_NEW.
 1.93  02-Feb-2012  tls Entropy-pool implementation move and cleanup.

1) Move core entropy-pool code and source/sink/sample management code
to sys/kern from sys/dev.

2) Remove use of NRND as test for presence of entropy-pool code throughout
source tree.

3) Remove use of RND_ENABLED in device drivers as microoptimization to
avoid expensive operations on disabled entropy sources; make the
rnd_add calls do this directly so all callers benefit.

4) Fix bug in recent rnd_add_data()/rnd_add_uint32() changes that might
have lead to slight entropy overestimation for some sources.

5) Add new source types for environmental sensors, power sensors, VM
system events, and skew between clocks, with a sample implementation
for each.

ok releng to go in before the branch due to the difficulty of later
pullup (widespread #ifdef removal and moved files). Tested with release
builds on amd64 and evbarm and live testing on amd64.
 1.92  13-Nov-2010  uebayasi branches: 1.92.8; 1.92.12;
Don't pull in the whole uvm(9) API to access only PAGE_SIZE and
some other constants. These are provided by sys/param.h now.
 1.91  27-Jul-2010  jakllsch Make the Realtek PCI network interfaces detachable.
Use __arraycount to avoid null table entries.
Miscellaneous other touch-ups in bus front-ends.
 1.90  05-Apr-2010  joerg Push the bpf_ops usage back into bpf.h. Push the common ifp->if_bpf
check into the inline functions as well the fourth argument for
bpf_attach.
 1.89  28-Mar-2010  snj Spell "enough" properly.
 1.88  19-Jan-2010  pooka branches: 1.88.2; 1.88.4;
Redefine bpf linkage through an always present op vector, i.e.
#if NBPFILTER is no longer required in the client. This change
doesn't yet add support for loading bpf as a module, since drivers
can register before bpf is attached. However, callers of bpf can
now be modularized.

Dynamically loadable bpf could probably be done fairly easily with
coordination from the stub driver and the real driver by registering
attachments in the stub before the real driver is loaded and doing
a handoff. ... and I'm not going to ponder the depths of unload
here.

Tested with i386/MONOLITHIC, modified MONOLITHIC without bpf and rump.
 1.87  15-Sep-2009  dyoung Simplify activation routines: do not call mii_activate(), it is a
no-op. Do not block interrupts, if_deactivate() will take care of
that for us.
 1.86  27-Apr-2009  tsutsui Wrap one more printf() with #ifdef DEBUG, which was missed on rev 1.52.
 1.85  26-Apr-2009  tsutsui Always make local functions static. Local symbols are still preserved
on link by ld(1) with -X option on most ports for debug.
 1.84  26-Apr-2009  tsutsui - use (uint8_t *) for RX buffer
- remove unnecessary pointer casts
 1.83  25-Apr-2009  tsutsui Use roundup2() macro.
 1.82  25-Apr-2008  tsutsui branches: 1.82.2; 1.82.10; 1.82.16;
Split device_t/softc for re(4) and rtk(4).
 1.81  19-Jan-2008  dyoung branches: 1.81.6; 1.81.8;
Make many ethernet drivers share the common code for MII media
handling, ether_mediastatus() and ether_mediachange(). Check for
a non-ENXIO error return from mii_mediachg(). (ENXIO indicates
that a PHY is suspended.)

This patch shrinks the source code size by 979 lines. There was
a 5100-byte savings on the NetBSD/i386 kernel configuration, ALL.

I have made a few miscellaneous changes, too:

gem(4): use LIST_EMPTY(), LIST_FOREACH().
mtd(4): handle media ioctls, for a change!
axe(4): do not track link status in sc->axe_link any longer
nfe(4), aue(4), axe(4), udav(4), url(4): do not reset all PHYs
on a change of media

Except for the change to mtd(4), no functional changes are intended.

XXX This patch affects more architectures than I can feasibly
XXX compile and run. I have compiled macppc, sparc64, i386. I
XXX have run the patches on i386 boxen with bnx(4) and sip(4).
XXX Compiling and running on evbmips (MERAKI, ADM5120) is in
XXX progress.
 1.80  08-Jan-2008  joerg Short-cut interrupt processing if device has been suspended.
uvm_fault reported by xtraeme.
 1.79  09-Dec-2007  jmcneill branches: 1.79.2;
Merge jmcneill-pm branch.
 1.78  06-Nov-2007  uwe branches: 1.78.2; 1.78.4;
Use device_t and device_private(). Convert attach to use aprint_*.
 1.77  19-Oct-2007  ad branches: 1.77.2;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.76  26-Aug-2007  dyoung branches: 1.76.2; 1.76.6;
Constify: LLADDR -> CLLADDR. I'm aiming here to make it easier to
identify sockaddr_dl abuse that remains in the kernel, especially
the potential for overwriting memory past the end of a sockaddr_dl
with, e.g., memcpy(LLADDR(), ...).
 1.75  09-Jul-2007  ad branches: 1.75.2; 1.75.6;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
 1.74  18-May-2007  joerg If the interrupt status register reads as 0xffff in rtk_intr, assume
that the card is gone and abort the loop. This fixes hot-plugging of
cardbus cards.

From FreeBSD's rl(4).
 1.73  18-May-2007  joerg Make rtk_list_tx_init return void. The return value was constant and
never used.
 1.72  21-Mar-2007  tsutsui Cleanup handling of quikrs on each RealTek chip:
- replace rtk_type member in rtk_softc which has chip types
with new rtk_quirk that represents quirks on each chip:
- RTKQ_8129 doesn't have internal MII (used in rtk(4))
- RTKQ_8139CPLUS has different register layout (for re(4))
- RTKQ_8169NONS (original 8169) requires some settings on init
- RTKQ_PCIE requires different settings in setmulti
so that we don't have to check each hwrev values or types everywhere
and newer variants will also work without changes if they don't
have other quirks
(sc_rev is unchenged for now for reference to the Realtek's driver)
- don't check hwrev register in re_pci_match() but check
only PCI_VENDER(), PCI_PRODUCT() and PCI_REVISION()
so that we no longer have to map pci space there
- add a new HWREV value for another 8168 variant
- try to map PCI mem space more properly
- remove (probably unneeded) ifp->if_baudrate initialization

Tested on a newer 8168 variant by Dennis den Brok on tech-kern,
and also tested on 8139 and 8169C on macppc, and 8139C+ on landisk
by me.
 1.71  04-Mar-2007  christos branches: 1.71.2; 1.71.4; 1.71.6;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.70  16-Feb-2007  tsutsui branches: 1.70.2;
RTK_HWREV_8100E_SPIN2 is a PCIe device so also check it
in rtk_setmulti() to handle quirk. Noticed by OpenBSD.
 1.69  10-Feb-2007  tsutsui 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.
 1.68  04-Feb-2007  tsutsui Accept RX packets which are larger than ETHER_MAX_LEN but can be stored
into RX mbufs. Inspired by OpenBSD.
 1.67  29-Jan-2007  tsutsui 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.
 1.66  16-Nov-2006  christos branches: 1.66.2;
__unused removal on arguments; approved by core.
 1.65  05-Nov-2006  tsutsui - make TX threshold macro more generic
- no need to bother to initialize sc_txthresh in rtk_attach()
since it's done in rtk_init()
 1.64  12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.63  29-Sep-2006  tsutsui - KNF
- u_intNN_t -> uintNN_t
- misc cosmetics
 1.62  29-Sep-2006  tsutsui ANSIfy.
 1.61  29-Sep-2006  tsutsui TAB/space cleanup.
 1.60  29-Sep-2006  tsutsui Set a timeout only if any TX packet is actually queued.
 1.59  29-Sep-2006  tsutsui rtk_intr() should return 1 only if any interrupts are actually handled.
 1.58  29-Sep-2006  tsutsui Use `SIMPLEQ_EMPTY()' rather than `SIMPLEQ_FIRST() == NULL'.
 1.57  29-Sep-2006  tsutsui Handle more wraparound case on RX ring-buffer calculation.
(it might cause problem only if RTK_RXBUFLEN < 64KB)
 1.56  29-Sep-2006  tsutsui Pull mii_readreg fix from FreeBSD if_rl.c rev 1.81:

> When reading PHY regs over the i2c bus, the turnaround ACK bit
> is read one clock edge too late. This bit is driven low by
> slave (as any other input data bits from slave) when the clock
> is LOW. The current code did read the bit after the clock was
> driven high again.
 1.55  29-Sep-2006  tsutsui In rtk_txeof(), clear the timeout timer only if there is no pending packet.
 1.54  29-Sep-2006  tsutsui In rtk_rxeof():
- discard too short packets as well as too large ones
- trim CRC off rather than setting M_HASFCS

Closes PR kern/31348.
 1.53  24-Sep-2006  jmcneill Add "name" parameter to powerhook_establish, to aid debugging. No objections
on tech-kern@
 1.52  08-Dec-2005  xtraeme branches: 1.52.20; 1.52.22;
Not everyone want to see debugging printf()s unless "options DEBUG"
is compiled in.
 1.51  27-Feb-2005  perry branches: 1.51.2; 1.51.4;
nuke trailing whitespace
 1.50  13-Feb-2005  jdolecek KNF
 1.49  04-Feb-2005  perry de-__P
 1.48  23-Jan-2005  dan branches: 1.48.2;
attach rtk(4) as an event source to rnd(4)
patches from Sean Davis in PR/28547
(also added a detach hook)
 1.47  30-Oct-2004  thorpej branches: 1.47.4;
When adding/deleting multicast addresses, only whack the address
filter if the interface is marked RUNNING.

Fixes kern/27678.
 1.46  28-May-2004  toshii A couple of changes for adding re(4) (Realtek gigabit ethernet):
- add necessary members in rtk_softc
- make functions used by re(4) non-static
 1.45  21-Feb-2003  tsutsui branches: 1.45.2; 1.45.4;
hz -> Hz
 1.44  15-Jan-2003  bouyer Use a properly zero'd buffer to pad the packet to ETHER_MIN_LEN-ETHER_CRC_LEN
 1.43  07-Nov-2002  thorpej Fix signed/unsigned comparison warnings.
 1.42  22-Oct-2002  fair Change the "dontcare bits" argument to ifmedia_init() to IFM_IMASK
so that it is possible select PHY instances other than the first
one (instance zero), if there is more than one PHY attached.
 1.41  01-Jun-2002  lukem SIMPLEQ rototill:
- implement SIMPLEQ_REMOVE(head, elm, type, field). whilst it's O(n),
this mirrors the functionality of SLIST_REMOVE() (the other
singly-linked list type) and FreeBSD's STAILQ_REMOVE()
- remove the unnecessary elm arg from SIMPLEQ_REMOVE_HEAD().
this mirrors the functionality of SLIST_REMOVE_HEAD() (the other
singly-linked list type) and FreeBSD's STAILQ_REMOVE_HEAD()
- remove notes about SIMPLEQ not supporting arbitrary element removal
- use SIMPLEQ_FOREACH() instead of home-grown for loops
- use SIMPLEQ_EMPTY() appropriately
- use SIMPLEQ_*() instead of accessing sqh_first,sqh_last,sqe_next directly
- reorder manual page; be consistent about how the types are listed
- other minor cleanups
 1.40  13-Nov-2001  lukem branches: 1.40.8; 1.40.10;
add/cleanup RCSID
 1.39  20-Aug-2001  wiz precede, not preceed, and a whitespace fix.
 1.38  14-Aug-2001  mrg mtod() with uintptr_t, not bus_addr_t.
 1.37  07-Aug-2001  kanaoka Fix typo in a message.
 1.36  25-Jul-2001  kanaoka - Increase Early TX threshold if underrun occurred.
 1.35  19-Jul-2001  thorpej Use BUS_DMA_READ and BUS_DMA_WRITE in some obvious places.
 1.34  07-Jul-2001  thorpej branches: 1.34.2;
bzero -> memset
 1.33  07-Jul-2001  thorpej bcopy -> strcpy
 1.32  12-Jun-2001  thorpej Don't need INET or NS includes here.
 1.31  02-Feb-2001  thorpej branches: 1.31.2;
Rework the transmit logic. Use a "free" and "dirty" list of
transmit jobs. The previous logic occasionally, under heavy
load, would attempt to sync and unload DMA maps that weren't
currently in use, and also occasionally leaked mbufs under
heavy load.

Yay, NFS now works pretty well on my Dreamcast.
 1.30  02-Feb-2001  thorpej Put the rx buf pointer into the softc directly.
 1.29  01-Feb-2001  thorpej Fix a bug in ring-buffer wrap calculation. On the Dreamcast,
it causes assertions to fail in the PCI bounce buffer code. On
other platforms, it causes the address of the next packet to
be mis-calculated, leading to packet loss.
 1.28  29-Jan-2001  enami Handle allmulti case correctly as a NetBSD network driver;
if we are requested range of multicast address or too many multicast address,
program multicast filter to receive all multicast address. And set/clear
IFF_ALLMULTI flag properly.
 1.27  11-Jan-2001  tsutsui Don't copy Rx packet to mbuf if it has invalid length; just discard it.
Fixes kern/11877.
 1.26  19-Dec-2000  thorpej Fix a problem with the ALTQ changes that can cause bogus memory
refernces. Problem reported by Luke Mewburn.
 1.25  14-Dec-2000  thorpej ALTQ'ify.
 1.24  09-Dec-2000  tsutsui Add (missed) bus_dmemem_free() in rtk_detach().
 1.23  05-Dec-2000  tsutsui - Since rtk_rxeof() was rewritten, we don't have to reserve a few bytes
before the Rx buffer.
- Reduce delay on EEPROM access.
- Some more cosmetics.
 1.22  03-Dec-2000  tsutsui Clean up receive interrupt routine:
- Use MGETHDR + MCLGET + memcpy rathar than m_devget + m_adj + m_copyback.
- Call bus_dmamap_sync(9) correctly for Rx buffer.

Mostly from thorpej's if_rtp.c.
 1.21  30-Nov-2000  tsutsui Clarify RX status header length and some cosmetics.
 1.20  30-Nov-2000  tsutsui After rev 1.16 rtk driver uses the CRC from the chip,
so no need to adjust Rx address for it. Fixes kern/11301.
 1.19  26-Nov-2000  takemura Add new powerhook argument values, PWR_SOFTSUSPEND, PWR_SOFTSTANDBY and
PWR_SOFTRESUME. Apm calls powerhook with the values in normal interrupt
priority level while others are protected with splhigh().
 1.18  15-Nov-2000  thorpej branches: 1.18.2;
Move bpfattach()/bpfdetach() calls into ether_ifattach()/ether_ifdetach().
 1.17  14-Nov-2000  thorpej NBPG -> PAGE_SIZE
 1.16  15-Oct-2000  thorpej Don't trim off the FCS, pass it up.
 1.15  11-Oct-2000  thorpej Use ether_ioctl().
 1.14  01-Oct-2000  thorpej Move the check for "promisc + unicast + not for us" into ether_input(),
and change Ethernet drivers to always pass all received frames to
ether_input() (with a few exceptions, which are documented in the
code).
 1.13  25-Sep-2000  enami Fix merge lossage in disabled code.
 1.12  01-Sep-2000  drochner -fix multicast filter programming
-support access to MII_ANER too for completeness
-remove some hacks which disappeared in FreeBSD if_rl.c
rev. 1.25 (Aug 31 14:45:49 1999)
(the driver could need more updating, but this is what I've tested
for months)
 1.11  21-May-2000  tsutsui branches: 1.11.4;
Call bus_dmamap_unload() if any Tx mbuf remains in rtk_stop().
 1.10  19-May-2000  tsutsui - Change RL_* -> RTK_*
- Free bus_dma resources if attach fails
- Add detach and power management code

Patch from Masanori Kanaoka <kanaoka@ann.hi-ho.ne.jp> in kern/10156.
 1.9  15-May-2000  thorpej splimp() -> splnet()
 1.8  15-May-2000  thorpej Symbol namespace cleanup: rl_ -> rtk_
 1.7  12-May-2000  thorpej Use ether_crc32_be().
 1.6  01-May-2000  tsutsui - Move some initialization into MI rl_attach() from each bus attachment.
- Use proper CARDBUS_* macro in if_rl_cardbus.c
- Use product ID read from PCI configuration space rather than from EEPROM
in if_rl_pci.c.

Patch sent from Masanori Kanaoka <kanaoka@ann.hi-ho.ne.jp> and
some cosmetic changes by me.
 1.5  30-Apr-2000  tsutsui Modify EEPROM read functions and handle also 9356 EEPROM.
Fixes kern/9861.
 1.4  26-Apr-2000  tsutsui - Allocate mbuf dynamically on Tx and use bus_dmamap_load_mbuf(9).
- Call bus_dmamap_sync(9) as appropriate.
- Leave only register declarations in rtl81x9reg.h and
split other stuff into rtl81x9var.h.

bus_dma(9) code mostly taken from thorpej's if_rtp.c.
 1.3  25-Apr-2000  tsutsui Fix two endian problems. rtk now works on macppc.

- Use le32toh() on reading rxstat from the Rx DMA buffer.
- rl_read_eeprom() should return EEPROM values in little endian
when caller requires byte-stream data.

bus_dma(9) fixes are still on-going.

XXX rtk on macppc seems to make tons of CRC errors...
XXX Does it work fine on i386 or others?
 1.2  24-Apr-2000  tsutsui Merge changes of sys/pci/if_rl.c rev. 1.8->1.10. (from kern/9870)
Also remove unused pbase, vbase and PCI_CAP_PWRMGMT declarations.
 1.1  10-Apr-2000  haya Incorporate the changes of RL81x9 driver provided by M. Kanaoka
<kanaoka@ann.hi-ho.ne.jp>. He separated the driver into IC specific
portion and bus attachment portion and added cardbus attachent.
 1.11.4.6  27-Oct-2001  he Pull up revisions 1.29-1.31,1.33-1.34,1.36 (via patch, requested by jdolecek):
Apply assorted stability fixes:
o increase early TX threshold if underrun occurred
o reworked transmit logic
o fix bug in ring-buffer wrap calculation
Should fix problems with hung network interfaces of this type.
Tested by jdolecek on 1.5.1.
 1.11.4.5  06-May-2001  he Pull up revision 1.19 (via patch, requested by he):
Add new powerhook argument values, PWR_SOFTSUSPEND, PWR_SOFTSTANDBY and
PWR_SOFTRESUME. Apm calls powerhook with the values in normal interrupt
priority level while others are protected with splhigh().
 1.11.4.4  13-Mar-2001  he Pull up revision 1.28 (requested by tsutsui):
Handle allmulti case correctly as a NetBSD network driver;
if we are requested range of multicast address or too many
multicast address, program multicast filter to receive all
multicast address. And set/clear IFF_ALLMULTI flag properly.
 1.11.4.3  26-Feb-2001  he Pull up revision 1.27 (requested by tsutsui):
Don't copy Rx packet to mbuf if it has invalid length; just
discard. Fixes PR#11877.
 1.11.4.2  25-Jan-2001  jhawk Pull up revisions 1.12, 1.21-1.24 via patch (requested by tsutsui):
Clean up receive interrupt routine and fix DMA buffer handing
for receive buffering.
Add missed bus_dmamem_free() in rtk_detach().
Some cosmetic fixes.
 1.11.4.1  11-Sep-2000  drochner pull up rev. 1.12 (approved by thorpej):
-fix multicast filter programming
-support access to MII_ANER too for completeness
-remove some hacks which disappeared in FreeBSD if_rl.c
rev. 1.25 (Aug 31 14:45:49 1999)
(the driver could need more updating, but this is what I've tested
for months)
 1.18.2.8  11-Feb-2001  bouyer Sync with HEAD.
 1.18.2.7  18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 1.18.2.6  05-Jan-2001  bouyer Sync with HEAD
 1.18.2.5  13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.18.2.4  08-Dec-2000  bouyer Sync with HEAD.
 1.18.2.3  22-Nov-2000  bouyer Sync with HEAD.
 1.18.2.2  20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.18.2.1  15-Nov-2000  bouyer file rtl81x9.c was added on branch thorpej_scsipi on 2000-11-20 11:40:53 +0000
 1.31.2.6  17-Jan-2003  thorpej Sync with HEAD.
 1.31.2.5  11-Nov-2002  nathanw Catch up to -current
 1.31.2.4  20-Jun-2002  nathanw Catch up to -current.
 1.31.2.3  14-Nov-2001  nathanw Catch up to -current.
 1.31.2.2  24-Aug-2001  nathanw Catch up with -current.
 1.31.2.1  21-Jun-2001  nathanw Catch up to -current.
 1.34.2.4  23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.34.2.3  10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.34.2.2  25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.34.2.1  03-Aug-2001  lukem update to -current
 1.40.10.1  26-Jan-2003  he Pull up revision 1.44 (via patch, requested by bouyer in ticket #1086):
Use a properly zeroed buffer to pad small packets to make
sure the chip doesn't send random data.
 1.40.8.1  20-Jun-2002  gehenna catch up with -current.
 1.45.4.1  21-Jun-2004  tron branches: 1.45.4.1.2;
Pull up revision 1.46 (requested by toshii in ticket #517):
A couple of changes for adding re(4) (Realtek gigabit ethernet):
- add necessary members in rtk_softc
- make functions used by re(4) non-static
 1.45.4.1.2.2  16-Apr-2005  tron Pull up revision 1.48 (requested by dan in ticket #1116):
attach rtk(4) as an event source to rnd(4)
patches from Sean Davis in PR/28547
(also added a detach hook)
 1.45.4.1.2.1  24-Jan-2005  he Pull up revision 1.47 (requested by thorpej in ticket #939):
When adding or deleting multicast addresses, only change
the address filter if the interface is marked RUNNING.
Fixes PR#27678.
 1.45.2.9  11-Dec-2005  christos Sync with head.
 1.45.2.8  04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.45.2.7  15-Feb-2005  skrll Sync with HEAD.
 1.45.2.6  04-Feb-2005  skrll Sync with HEAD.
 1.45.2.5  24-Jan-2005  skrll Sync with HEAD.
 1.45.2.4  02-Nov-2004  skrll Sync with HEAD.
 1.45.2.3  21-Sep-2004  skrll Fix the sync with head I botched.
 1.45.2.2  18-Sep-2004  skrll Sync with HEAD.
 1.45.2.1  03-Aug-2004  skrll Sync with HEAD
 1.47.4.1  29-Apr-2005  kent sync with -current
 1.48.2.2  19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.48.2.1  12-Feb-2005  yamt sync with head.
 1.51.4.7  21-Jan-2008  yamt sync with head
 1.51.4.6  15-Nov-2007  yamt sync with head.
 1.51.4.5  27-Oct-2007  yamt sync with head.
 1.51.4.4  03-Sep-2007  yamt sync with head.
 1.51.4.3  26-Feb-2007  yamt sync with head.
 1.51.4.2  30-Dec-2006  yamt sync with head.
 1.51.4.1  21-Jun-2006  yamt sync with head.
 1.51.2.2  04-Oct-2007  bouyer Pull up following revision(s) (requested by tsutsui in ticket #1852):
sys/dev/ic/rtl81x9var.h: revision 1.39
sys/dev/cardbus/if_re_cardbus.c: revision 1.13
sys/dev/pci/if_re_pci.c: revision 1.27 via patch
sys/dev/pci/if_rtk_pci.c: revision 1.32
sys/dev/cardbus/if_rtk_cardbus.c: revision 1.32
sys/dev/ic/rtl8169.c: revision 1.84, 1.85
sys/dev/ic/rtl81x9reg.h: revision 1.27
sys/dev/ic/rtl81x9.c: revision 1.72
Cleanup handling of quikrs on each RealTek chip:
Pull a fix for PCIe variants from FreeBSD
 1.51.2.1  03-Mar-2007  bouyer Pull up following revision(s) (requested by tsutsui in ticket #1673):
distrib/sets/lists/man/mi 1.844, 1.871
share/man/man4/Makefile 1.372, 1.379 via patch
share/man/man4/re.4 1.8, 1.9, 1.11, 1.12
share/man/man4/rgephy.4 1.1
share/man/man4/rlphy.4 1.1, 1.2
sys/arch/amd64/conf/GENERIC 1.79, 1.89
sys/arch/amd64/conf/INSTALL 1.45, 1.49
sys/arch/i386/conf/GENERIC 1.717, 1.747
sys/arch/i386/conf/GENERIC_LAPTOP 1.164
sys/arch/i386/conf/INSTALL 1.277, 1.283
sys/arch/i386/conf/INSTALL_LAPTOP 1.96, 1.98
sys/arch/i386/conf/XEN2_DOM0 1.22 via patch
sys/arch/macppc/conf/GENERIC 1.220, 1.246
sys/arch/macppc/conf/INSTALL 1.96, 1.100
sys/dev/cardbus/if_re_cardbus.c 1.10
sys/dev/cardbus/if_rtk_cardbus.c 1.29-1.31
sys/dev/ic/rtl8169.c 1.14, 1.20, 1.24, 1.25, 1.28-1.61, 1.63, 1.64-1.81 via patch
sys/dev/ic/rtl81x9.c 1.52, 1.54-1.63, 1.65, 1.67-1.70
sys/dev/ic/rtl81x9reg.h 1.15-1.26
sys/dev/ic/rtl81x9var.h 1.19, 1.21-1.37
sys/dev/mii/files.mii 1.38
sys/dev/mii/miidevs 1.62, 1.64
sys/dev/mii/rgephy.c 1.10, 1.13-1.16
sys/dev/mii/rlphy.c 1.1, 1.6, 1.7, 1.11 via patch
sys/dev/pci/if_re_pci.c 1.13, 1.15-1.17, 1.19-1.23
sys/dev/pci/if_rtk_pci.c 1.25, 1.28, 1.29, 1.31
sys/dev/pci/pcidevs 1.851, 1.852

on re(4):
- improve stability (I believe ;-)
- add a workaround for hardware ip4csum-tx bug
- support newer chips (8169SB/SC, PCIe based 8168 etc.)
- fix 8139C+ support
- enable hardware VLAN
- misc bus_dma(9) fix (which makes re(4) work on mips ports)

on rtk(4):
- fix kern/31348
- fix possible panic on dreamcast
 1.52.22.2  10-Dec-2006  yamt sync with head.
 1.52.22.1  22-Oct-2006  yamt sync with head
 1.52.20.3  09-Feb-2007  ad Sync with HEAD.
 1.52.20.2  01-Feb-2007  ad Sync with head.
 1.52.20.1  18-Nov-2006  ad Sync with head.
 1.66.2.6  24-May-2007  riz Pull up following revision(s) (requested by joerg in ticket #663):
sys/dev/ic/rtl81x9.c: revision 1.74
If the interrupt status register reads as 0xffff in rtk_intr, assume
that the card is gone and abort the loop. This fixes hot-plugging of
cardbus cards.
From FreeBSD's rl(4).
 1.66.2.5  16-May-2007  jdc Pull up revision 1.72 (requested by tsutsui in ticket #640).

Cleanup handling of quikrs on each RealTek chip:
- replace rtk_type member in rtk_softc which has chip types
with new rtk_quirk that represents quirks on each chip:
- RTKQ_8129 doesn't have internal MII (used in rtk(4))
- RTKQ_8139CPLUS has different register layout (for re(4))
- RTKQ_8169NONS (original 8169) requires some settings on init
- RTKQ_PCIE requires different settings in setmulti
so that we don't have to check each hwrev values or types everywhere
and newer variants will also work without changes if they don't
have other quirks
(sc_rev is unchenged for now for reference to the Realtek's driver)
- don't check hwrev register in re_pci_match() but check
only PCI_VENDER(), PCI_PRODUCT() and PCI_REVISION()
so that we no longer have to map pci space there
- add a new HWREV value for another 8168 variant
- try to map PCI mem space more properly
- remove (probably unneeded) ifp->if_baudrate initialization

Tested on a newer 8168 variant by Dennis den Brok on tech-kern,
and also tested on 8139 and 8169C on macppc, and 8139C+ on landisk
by me.
 1.66.2.4  24-Feb-2007  bouyer branches: 1.66.2.4.2;
Pull up following revision(s) (requested by tsutsui in ticket #462):
sys/dev/ic/rtl8169.c: revision 1.80 - 1.81
sys/dev/ic/rtl81x9.c: revision 1.70
Use new RTK_HWREV_8100E_SPIN2 macro. (missed in the previous)
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.
RTK_HWREV_8100E_SPIN2 is a PCIe device so also check it
in rtk_setmulti() to handle quirk. Noticed by OpenBSD.
 1.66.2.3  10-Feb-2007  tron Pull up following revision(s) (requested by tsutsui in ticket #437):
sys/dev/ic/rtl81x9.c: revision 1.69
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.
 1.66.2.2  10-Feb-2007  tron Pull up following revision(s) (requested by tsutsui in ticket #437):
sys/dev/ic/rtl81x9.c: revision 1.68
Accept RX packets which are larger than ETHER_MAX_LEN but can be stored
into RX mbufs. Inspired by OpenBSD.
 1.66.2.1  10-Feb-2007  tron Pull up following revision(s) (requested by tsutsui in ticket #437):
sys/dev/ic/rtl81x9.c: revision 1.67
sys/dev/ic/rtl8169.c: revision 1.77
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.
 1.66.2.4.2.2  04-Jun-2007  wrstuden Update to today's netbsd-4.
 1.66.2.4.2.1  03-Jun-2007  wrstuden Catch up with now-somewhat-dated netbsd-4. These changes took longer
than expected for me to actually get around to merging.
 1.70.2.2  24-Mar-2007  yamt sync with head.
 1.70.2.1  12-Mar-2007  rmind Sync with HEAD.
 1.71.6.1  29-Mar-2007  reinoud Pullup to -current
 1.71.4.1  11-Jul-2007  mjf Sync with head.
 1.71.2.5  23-Oct-2007  ad Sync with head.
 1.71.2.4  09-Oct-2007  ad Sync with head.
 1.71.2.3  01-Jul-2007  ad Adapt to callout API change.
 1.71.2.2  27-May-2007  ad Sync with head.
 1.71.2.1  10-Apr-2007  ad Sync with head.
 1.75.6.4  06-Nov-2007  joerg Sync with HEAD.
 1.75.6.3  26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.75.6.2  05-Oct-2007  joerg Remove the power management nonsense in the PCI versions of
rtk(4) and re(4). It is not really likely to work anyway.
Use PNP power management for the cardbus attachment as well and
remove the power management handlers from the chipset code.
 1.75.6.1  03-Sep-2007  jmcneill Sync with HEAD.
 1.75.2.1  03-Sep-2007  skrll Sync with HEAD.
 1.76.6.2  13-Nov-2007  bouyer Sync with HEAD
 1.76.6.1  25-Oct-2007  bouyer Sync with HEAD.
 1.76.2.3  23-Mar-2008  matt sync with HEAD
 1.76.2.2  09-Jan-2008  matt sync with HEAD
 1.76.2.1  06-Nov-2007  matt sync with HEAD
 1.77.2.3  18-Feb-2008  mjf Sync with HEAD.
 1.77.2.2  27-Dec-2007  mjf Sync with HEAD.
 1.77.2.1  19-Nov-2007  mjf Sync with HEAD.
 1.78.4.1  11-Dec-2007  yamt sync with head.
 1.78.2.1  26-Dec-2007  ad Sync with head.
 1.79.2.2  20-Jan-2008  bouyer Sync with HEAD
 1.79.2.1  08-Jan-2008  bouyer Sync with HEAD
 1.81.8.1  18-May-2008  yamt sync with head.
 1.81.6.1  02-Jun-2008  mjf Sync with HEAD.
 1.82.16.1  13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.82.10.1  28-Apr-2009  skrll Sync with HEAD.
 1.82.2.4  11-Aug-2010  yamt sync with head.
 1.82.2.3  11-Mar-2010  yamt sync with head
 1.82.2.2  16-Sep-2009  yamt sync with head
 1.82.2.1  04-May-2009  yamt sync with head.
 1.88.4.2  05-Mar-2011  rmind sync with head
 1.88.4.1  30-May-2010  rmind sync with head
 1.88.2.2  17-Aug-2010  uebayasi Sync with HEAD.
 1.88.2.1  30-Apr-2010  uebayasi Sync with HEAD.
 1.92.12.1  18-Feb-2012  mrg merge to -current.
 1.92.8.2  30-Oct-2012  yamt sync with head
 1.92.8.1  17-Apr-2012  yamt sync with head
 1.94.12.1  07-Apr-2014  tls Be a little more clear and consistent about harvesting entropy from devices:

1) deprecate RND_FLAG_NO_ESTIMATE

2) define RND_FLAG_COLLECT_TIME, RND_FLAG_COLLECT_VALUE

3) define RND_FLAG_ESTIMATE_TIME, RND_FLAG_ESTIMATE_VALUE

4) define RND_FLAG_DEFAULT: RND_FLAG_COLLECT_TIME|
RND_FLAG_COLLECT_VALUE|RND_FLAG_ESTIMATE_TIME

5) Make entropy harvesting from environmental sensors a little more generic
and remove it from individual sensor drivers.

6) Remove individual open-coded delta-estimators for values from a few
places in the tree (uvm, environmental drivers).

7) 0 -> RND_FLAG_DEFAULT, actually gather entropy from various drivers
that had stubbed out code, other minor cleanups.
 1.94.2.2  03-Dec-2017  jdolecek update from HEAD
 1.94.2.1  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.95.4.5  28-Aug-2017  skrll Sync with HEAD
 1.95.4.4  05-Feb-2017  skrll Sync with HEAD
 1.95.4.3  09-Jul-2016  skrll Sync with HEAD
 1.95.4.2  19-Mar-2016  skrll Sync with HEAD
 1.95.4.1  06-Jun-2015  skrll Sync with HEAD
 1.100.2.2  20-Mar-2017  pgoyette Sync with HEAD
 1.100.2.1  07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.101.2.1  21-Apr-2017  bouyer Sync with HEAD
 1.102.12.2  26-Jan-2019  pgoyette Sync with HEAD
 1.102.12.1  28-Jul-2018  pgoyette Sync with HEAD
 1.103.2.3  13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.103.2.2  08-Apr-2020  martin Merge changes from current as of 20200406
 1.103.2.1  10-Jun-2019  christos Sync with HEAD
 1.106.2.1  28-Jan-2020  martin Pull up following revision(s) (requested by msaitoh in ticket #667):

sys/dev/ic/rtl81x9var.h: revision 1.57
sys/dev/ic/rtl81x9.c: revision 1.107
sys/dev/ic/rtl81x9reg.h: revision 1.51
sys/dev/ic/rtl8169.c: revision 1.160
sys/dev/ic/rtl81x9reg.h: revision 1.52
sys/dev/ic/rtl8169.c: revision 1.161

Use unsigned in rtk_setmulti() to avoid undefined behavior. Found bk kUBSan.
8168H model didn't link up well. some models seems to require to enable TX/RX after configuration.
RTKQ_TXRXEN_LATER quirk flag added. it may be able to unify with RTKQ_RXDV_GATED flag?
Sort RTK_HWREV_* by value.

Improve some chip revisions support:
- Add 8168FP, 8411, 8168G, 8401E, 8105E, 8105E_SPIN1, 8106E and 8402 from
{Free,Open}BSD.
- Renumber RTK_HWREV_8103E from 0x24C00000 to 0x34c00000. 0x24C00000 is newly
used as RTK_HWREV_8102EL_SPIN1. Same as {Free,Open}BSD.
 1.107.2.1  29-Feb-2020  ad Sync with head.

RSS XML Feed