History log of /openbsd-current/sys/dev/pci/if_re_pci.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.58 24-May-2024 jsg

remove unneeded includes; ok miod@


Revision tags: OPENBSD_7_5_BASE
# 1.57 19-Jan-2024 dlg

consolidate pci and cardbus detach code, and have it detach kstats.

this solves one probably with an re(4) going away.


Revision tags: OPENBSD_7_1_BASE OPENBSD_7_2_BASE OPENBSD_7_3_BASE OPENBSD_7_4_BASE
# 1.56 11-Mar-2022 mpi

Constify struct cfattach.


Revision tags: OPENBSD_6_9_BASE OPENBSD_7_0_BASE
# 1.55 24-Jan-2021 jsg

match on Realtek RTL8168H ids for Killer E2500V2 and E2600

checked against linux and windows drivers


# 1.54 23-Jan-2021 jsg

match on another Realtek RTL8168 id

reported and tested by John Batteen on a TP-Link TG-3468


Revision tags: OPENBSD_6_8_BASE
# 1.53 17-Jun-2020 claudio

Remove the bus specific sc_ih (interrup handle) variable and use the common
sc_ih value of struct rl_softc. This fixes a crash in re(4) because
intr_barrier(9) is called with the rl_softc sc_ih which was NULL.
OK kettenis@


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE
# 1.52 11-Apr-2018 patrick

Some (probably newer) re(4) cards don't have the 32-bit memory BAR that
we try to map first. Instead there's a 64-bit memory BAR in the follow-
ing BAR. Since on the MACCHIATObin we currently do not support the IO
space, we have to use the 64-bit memory BAR. Thus, try to map the 64-
bit BAR before falling back to the 32-bit BAR and the IO bar.

ok deraadt@ kettenis@


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.51 12-Jun-2017 kevlo

From FreeBSD (r227593, r307982):
More and more RealTek controllers started to implement EEE feature.
Vendor driver seems to load a kind of firmware for EEE with
additional PHY fixups. It is known that the EEE feature may need
ASPM support. Unfortunately there is no documentation for EEE of
the controller so enabling ASPM may cause more problems.

The Realtek vendor drivers for FreeBSD and Linux also disable ASPM and
clock request. While here, add a define for the ECPM (Enable Clock Power
Management) bit.

Tested by stsp@ and myself.
ok stsp@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.50 28-Dec-2015 jmatthew

Rework re_start and re_txeof to only check the producer/consumer ring
positions when deciding how much work to do, and to adjust rl_tx_free with
atomic operations; split the flag that indicates whether we're using
timer based interrupts or not out into a separate field so it can be
changed from interrupt context without needing a lock; take the kernel
lock when calling re_init and re_start from interrupt context; add an
interrupt barrier in re_stop; and finally mark the interrupt handler
as mpsafe.

started by Jim Smith a while ago, mostly finished up at n2k15
tested by dlg@, chris@ and Dimitris Papastamos on various hardware
ok dlg@


# 1.49 24-Nov-2015 mpi

You only need <net/if_dl.h> if you're using LLADDR() or a sockaddr_dl.


Revision tags: OPENBSD_5_8_BASE
# 1.48 14-Mar-2015 jsg

Remove some includes include-what-you-use claims don't
have any direct symbols used. Tested for indirect use by compiling
amd64/i386/sparc64 kernels.

ok tedu@ deraadt@


Revision tags: OPENBSD_5_7_BASE
# 1.47 08-Mar-2015 tobiasu

Revert patch responsible for locking up machines with
"Realtek 8168" rev 0x01: RTL8168 2 (0x3800).
You will never guess who commited it without OK ;)

ok deraadt



revision 1.45
date: 2015/01/26 09:58:47; author: brad; state: Exp; lines: +22 -2; commitid: AppNYocFYbD7Hqgj;
Set PCIe max read request size to 2K to help with TX performance.

From FreeBSD

Tested with 8168C, 8168D and 8168G.

revision 1.46
date: 2015/02/19 04:58:34; author: dlg; state: Exp; lines: +2 -2; commitid: GSWXECXQW0LeGFmq;
when reading the max packet size in the pcie device config and
status register, correctly mask things so we're left with the mps
field instead of everything but the mps field.

tested by bcallah@ and jim smith


# 1.46 19-Feb-2015 dlg

when reading the max packet size in the pcie device config and
status register, correctly mask things so we're left with the mps
field instead of everything but the mps field.

tested by bcallah@ and jim smith


# 1.45 26-Jan-2015 brad

Set PCIe max read request size to 2K to help with TX performance.

From FreeBSD

Tested with 8168C, 8168D and 8168G.


# 1.44 22-Dec-2014 tedu

unifdef INET


# 1.43 24-Oct-2014 brad

Always put controller into known state before device intialization.

From FreeBSD

ok sthen@ chris@


# 1.42 06-Sep-2014 brad

Various changes to the re(4) feature flags..

Changed RL_FLAG_MACLDPS to RL_FLAG_MACRESET.
Removed RL_FLAG_INVMAR and RL_FLAG_NOJUMBO.
Added RL_FLAG_FASTETHER, RL_FLAG_CMDSTOP_WAIT_TXQ, RL_FLAG_JUMBOV2, RL_FLAG_WOL_MANLINK,
RL_FLAG_WAIT_TXPOLL, RL_FLAG_WOLRXENB.

Also set in the softc the maximum MTU for the various generations of chips.

Input from and Ok jsg@


Revision tags: OPENBSD_5_6_BASE
# 1.41 22-Jul-2014 mpi

Fewer <netinet/in_systm.h>


Revision tags: OPENBSD_5_5_BASE
# 1.40 18-Nov-2013 brad

Enable MSI on the remaining chipsets.

ok naddy@ sthen@


# 1.39 07-Aug-2013 bluhm

Most network drivers include netinet/in_var.h, but apparently they
don't have to. Just remove these include lines.
Compiled on amd64 i386 sparc64; OK henning@ mikeb@


# 1.38 03-Aug-2013 kettenis

Enable MSI on RT810xE.

ok jsg@


Revision tags: OPENBSD_5_3_BASE OPENBSD_5_4_BASE
# 1.37 16-Jan-2013 brad

Sort the PCI ids.

ok dtucker@ jsing@


# 1.36 18-Oct-2012 deraadt

Convert a number of old private copies of code which predates
pci_set_powerstate() to using it instead. Many of these chunks of code had
bugs in them, especially missing delay() calls. Some of them were doing
things our PCI subsystem is now responsible for handling. If you have
any of the affected devices, please keep an eye out for regressions.
ok kettenis


# 1.35 26-Sep-2012 rfreeman

add D-Link DGE-530T to re(4), update re(4) manpage
tested on i386, ok brad@ sthen@ phessler@


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE
# 1.34 09-Jun-2011 kettenis

Backout MSI change. People are seeing watchdog timeouts, which must be caused
by missed interrupts. Commits to the FreeBSD driver suggest that the hardware
has issues. Having MSI for this driver isn't terribly important anyway.


# 1.33 29-May-2011 kettenis

Add MSI support.

ok dlg@, oga@


# 1.32 03-Apr-2011 jasper

use nitems(); no binary change for drivers that are compiled on amd64.

ok claudio@


# 1.31 13-Mar-2011 stsp

Wake On LAN support for re(4).
ok deraadt


Revision tags: OPENBSD_4_9_BASE
# 1.30 07-Sep-2010 deraadt

remove the powerhook code. All architectures now use the ca_activate tree
traversal code to suspend/resume
ok oga kettenis blambert


Revision tags: OPENBSD_4_8_BASE
# 1.29 27-Jul-2010 todd

spacing; ok deraadt@


# 1.28 27-Jul-2010 kettenis

Make sure we stop DMA before we suspend. Remove unused argument to re_stop()
to avoid the dilemma what meaningless value to pass.

ok deraadt@


Revision tags: OPENBSD_4_7_BASE
# 1.27 26-Nov-2009 kettenis

Only re-initialise interfaces on suspend if they were IFF_RUNNING.

ok deraadt@, claudio@


# 1.26 24-Nov-2009 kettenis

Reset the chip an re-initialise the interface after reset. Resetting the
PHY doesn't seem to be necessary on re(4) so don't descend further for now.

Based on a diff from mlarkin@

ok deraadt@


# 1.25 10-Aug-2009 deraadt

More cases of shutdown hooks not needed after card is already stopped. In
these cases the xxstop function is a bit more complicated and has a flag of
some sort, but the use of that flag does not matter; DMA is already ceased
ok dlg


Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.24 22-Jan-2009 kettenis

Make re(4) at pci(4) detachable.

ok jsg@, miod@


# 1.23 12-Oct-2008 brad

If re_attach() fails at any point make sure to disestablish various
resources setup by the bus front ends, especially the shutdown hook.
Found while testing some other changes with a CardBus adapter and
re_attach() was failing early before the interface pointer was
assigned. Then the system was rebooted, the shutdown hook was called
and *boom* in re_stop().


# 1.22 05-Oct-2008 brad

Detect if the adapter is a PCIe adapter and set the RL_FLAG_PCIE flag
if so.


Revision tags: OPENBSD_4_4_BASE
# 1.21 20-Apr-2008 brad

Remove unused flags.

ok dlg@


Revision tags: OPENBSD_4_3_BASE
# 1.20 17-Feb-2008 brad

Simplify the hw revision handling by removing the use of the
rl_type softc field and only relying on the sc_hwrev softc
field thoughout the driver.

Tested by a number of users from tech@

ok dlg@


Revision tags: OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.19 28-Nov-2006 brad

move printing of the interrupt string into re_attach().


# 1.18 06-Nov-2006 deraadt

noone needs to know about the D0 state change; ok miod


# 1.17 16-Oct-2006 tom

Fix some "is is"s. ok otto@.


Revision tags: OPENBSD_4_0_BASE
# 1.16 06-Aug-2006 brad

fix message printing when resetting the power state.


# 1.15 01-Jul-2006 brad

(fxp/re)_attach_common -> (fxp/re)_attach


# 1.14 30-Jun-2006 deraadt

do not bother playing tag with the PCI_COMMAND_STATUS_REG


# 1.13 27-Jun-2006 brad

add new RealTek PCI ids.


# 1.12 24-Jun-2006 brad

de-register, ANSI functions and a little cleaning.


# 1.11 17-Jun-2006 brad

add sys/timeout.h


# 1.10 09-Jun-2006 brad

identify 8139's in C+ mode with RL_8139CPLUS instead of RL_8139; no functional change.


# 1.9 07-Jun-2006 brad

rename the Realtek RT8111B entry to RT8168.


# 1.8 23-May-2006 brad

according to the Linux 8139cp driver the TTTech MC322 adapter uses
the 8139C+ chipset, so attach with re(4) instead of rl(4).

ok dlg@


# 1.7 16-May-2006 brad

attach 8139's capable of C+ mode to the re(4) driver, instead of the rl(4)
driver.


# 1.6 27-Mar-2006 brad

revert a small part of the last commit that wasn't supposed to go in.


# 1.5 27-Mar-2006 brad

add the Realtek RT8111B PCI Express Gigabit MAC.


Revision tags: OPENBSD_3_8_BASE OPENBSD_3_9_BASE
# 1.4 09-Aug-2005 mickey

do not set PCI_COMMAND_MASTER_ENABLE explicitly as it's already set in pcisubmatch(); kettenis@ testing; brad@ ok


# 1.3 22-Jul-2005 brad

add Linksys EG1032 rev 3


# 1.2 15-Jun-2005 brad

add D-Link DGE-528T and US Robotics USR997902

From: NetBSD


Revision tags: OPENBSD_3_7_BASE
# 1.1 14-Jan-2005 pvalchev

split re(4) into bus-independent code (ic/re.c) and PCI front-end
(pci/if_re_pci.c) for soon-to-come cardbus support; ok deraadt


# 1.57 19-Jan-2024 dlg

consolidate pci and cardbus detach code, and have it detach kstats.

this solves one probably with an re(4) going away.


Revision tags: OPENBSD_7_1_BASE OPENBSD_7_2_BASE OPENBSD_7_3_BASE OPENBSD_7_4_BASE
# 1.56 11-Mar-2022 mpi

Constify struct cfattach.


Revision tags: OPENBSD_6_9_BASE OPENBSD_7_0_BASE
# 1.55 24-Jan-2021 jsg

match on Realtek RTL8168H ids for Killer E2500V2 and E2600

checked against linux and windows drivers


# 1.54 23-Jan-2021 jsg

match on another Realtek RTL8168 id

reported and tested by John Batteen on a TP-Link TG-3468


Revision tags: OPENBSD_6_8_BASE
# 1.53 17-Jun-2020 claudio

Remove the bus specific sc_ih (interrup handle) variable and use the common
sc_ih value of struct rl_softc. This fixes a crash in re(4) because
intr_barrier(9) is called with the rl_softc sc_ih which was NULL.
OK kettenis@


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE
# 1.52 11-Apr-2018 patrick

Some (probably newer) re(4) cards don't have the 32-bit memory BAR that
we try to map first. Instead there's a 64-bit memory BAR in the follow-
ing BAR. Since on the MACCHIATObin we currently do not support the IO
space, we have to use the 64-bit memory BAR. Thus, try to map the 64-
bit BAR before falling back to the 32-bit BAR and the IO bar.

ok deraadt@ kettenis@


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.51 12-Jun-2017 kevlo

From FreeBSD (r227593, r307982):
More and more RealTek controllers started to implement EEE feature.
Vendor driver seems to load a kind of firmware for EEE with
additional PHY fixups. It is known that the EEE feature may need
ASPM support. Unfortunately there is no documentation for EEE of
the controller so enabling ASPM may cause more problems.

The Realtek vendor drivers for FreeBSD and Linux also disable ASPM and
clock request. While here, add a define for the ECPM (Enable Clock Power
Management) bit.

Tested by stsp@ and myself.
ok stsp@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.50 28-Dec-2015 jmatthew

Rework re_start and re_txeof to only check the producer/consumer ring
positions when deciding how much work to do, and to adjust rl_tx_free with
atomic operations; split the flag that indicates whether we're using
timer based interrupts or not out into a separate field so it can be
changed from interrupt context without needing a lock; take the kernel
lock when calling re_init and re_start from interrupt context; add an
interrupt barrier in re_stop; and finally mark the interrupt handler
as mpsafe.

started by Jim Smith a while ago, mostly finished up at n2k15
tested by dlg@, chris@ and Dimitris Papastamos on various hardware
ok dlg@


# 1.49 24-Nov-2015 mpi

You only need <net/if_dl.h> if you're using LLADDR() or a sockaddr_dl.


Revision tags: OPENBSD_5_8_BASE
# 1.48 14-Mar-2015 jsg

Remove some includes include-what-you-use claims don't
have any direct symbols used. Tested for indirect use by compiling
amd64/i386/sparc64 kernels.

ok tedu@ deraadt@


Revision tags: OPENBSD_5_7_BASE
# 1.47 08-Mar-2015 tobiasu

Revert patch responsible for locking up machines with
"Realtek 8168" rev 0x01: RTL8168 2 (0x3800).
You will never guess who commited it without OK ;)

ok deraadt



revision 1.45
date: 2015/01/26 09:58:47; author: brad; state: Exp; lines: +22 -2; commitid: AppNYocFYbD7Hqgj;
Set PCIe max read request size to 2K to help with TX performance.

From FreeBSD

Tested with 8168C, 8168D and 8168G.

revision 1.46
date: 2015/02/19 04:58:34; author: dlg; state: Exp; lines: +2 -2; commitid: GSWXECXQW0LeGFmq;
when reading the max packet size in the pcie device config and
status register, correctly mask things so we're left with the mps
field instead of everything but the mps field.

tested by bcallah@ and jim smith


# 1.46 19-Feb-2015 dlg

when reading the max packet size in the pcie device config and
status register, correctly mask things so we're left with the mps
field instead of everything but the mps field.

tested by bcallah@ and jim smith


# 1.45 26-Jan-2015 brad

Set PCIe max read request size to 2K to help with TX performance.

From FreeBSD

Tested with 8168C, 8168D and 8168G.


# 1.44 22-Dec-2014 tedu

unifdef INET


# 1.43 24-Oct-2014 brad

Always put controller into known state before device intialization.

From FreeBSD

ok sthen@ chris@


# 1.42 06-Sep-2014 brad

Various changes to the re(4) feature flags..

Changed RL_FLAG_MACLDPS to RL_FLAG_MACRESET.
Removed RL_FLAG_INVMAR and RL_FLAG_NOJUMBO.
Added RL_FLAG_FASTETHER, RL_FLAG_CMDSTOP_WAIT_TXQ, RL_FLAG_JUMBOV2, RL_FLAG_WOL_MANLINK,
RL_FLAG_WAIT_TXPOLL, RL_FLAG_WOLRXENB.

Also set in the softc the maximum MTU for the various generations of chips.

Input from and Ok jsg@


Revision tags: OPENBSD_5_6_BASE
# 1.41 22-Jul-2014 mpi

Fewer <netinet/in_systm.h>


Revision tags: OPENBSD_5_5_BASE
# 1.40 18-Nov-2013 brad

Enable MSI on the remaining chipsets.

ok naddy@ sthen@


# 1.39 07-Aug-2013 bluhm

Most network drivers include netinet/in_var.h, but apparently they
don't have to. Just remove these include lines.
Compiled on amd64 i386 sparc64; OK henning@ mikeb@


# 1.38 03-Aug-2013 kettenis

Enable MSI on RT810xE.

ok jsg@


Revision tags: OPENBSD_5_3_BASE OPENBSD_5_4_BASE
# 1.37 16-Jan-2013 brad

Sort the PCI ids.

ok dtucker@ jsing@


# 1.36 18-Oct-2012 deraadt

Convert a number of old private copies of code which predates
pci_set_powerstate() to using it instead. Many of these chunks of code had
bugs in them, especially missing delay() calls. Some of them were doing
things our PCI subsystem is now responsible for handling. If you have
any of the affected devices, please keep an eye out for regressions.
ok kettenis


# 1.35 26-Sep-2012 rfreeman

add D-Link DGE-530T to re(4), update re(4) manpage
tested on i386, ok brad@ sthen@ phessler@


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE
# 1.34 09-Jun-2011 kettenis

Backout MSI change. People are seeing watchdog timeouts, which must be caused
by missed interrupts. Commits to the FreeBSD driver suggest that the hardware
has issues. Having MSI for this driver isn't terribly important anyway.


# 1.33 29-May-2011 kettenis

Add MSI support.

ok dlg@, oga@


# 1.32 03-Apr-2011 jasper

use nitems(); no binary change for drivers that are compiled on amd64.

ok claudio@


# 1.31 13-Mar-2011 stsp

Wake On LAN support for re(4).
ok deraadt


Revision tags: OPENBSD_4_9_BASE
# 1.30 07-Sep-2010 deraadt

remove the powerhook code. All architectures now use the ca_activate tree
traversal code to suspend/resume
ok oga kettenis blambert


Revision tags: OPENBSD_4_8_BASE
# 1.29 27-Jul-2010 todd

spacing; ok deraadt@


# 1.28 27-Jul-2010 kettenis

Make sure we stop DMA before we suspend. Remove unused argument to re_stop()
to avoid the dilemma what meaningless value to pass.

ok deraadt@


Revision tags: OPENBSD_4_7_BASE
# 1.27 26-Nov-2009 kettenis

Only re-initialise interfaces on suspend if they were IFF_RUNNING.

ok deraadt@, claudio@


# 1.26 24-Nov-2009 kettenis

Reset the chip an re-initialise the interface after reset. Resetting the
PHY doesn't seem to be necessary on re(4) so don't descend further for now.

Based on a diff from mlarkin@

ok deraadt@


# 1.25 10-Aug-2009 deraadt

More cases of shutdown hooks not needed after card is already stopped. In
these cases the xxstop function is a bit more complicated and has a flag of
some sort, but the use of that flag does not matter; DMA is already ceased
ok dlg


Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.24 22-Jan-2009 kettenis

Make re(4) at pci(4) detachable.

ok jsg@, miod@


# 1.23 12-Oct-2008 brad

If re_attach() fails at any point make sure to disestablish various
resources setup by the bus front ends, especially the shutdown hook.
Found while testing some other changes with a CardBus adapter and
re_attach() was failing early before the interface pointer was
assigned. Then the system was rebooted, the shutdown hook was called
and *boom* in re_stop().


# 1.22 05-Oct-2008 brad

Detect if the adapter is a PCIe adapter and set the RL_FLAG_PCIE flag
if so.


Revision tags: OPENBSD_4_4_BASE
# 1.21 20-Apr-2008 brad

Remove unused flags.

ok dlg@


Revision tags: OPENBSD_4_3_BASE
# 1.20 17-Feb-2008 brad

Simplify the hw revision handling by removing the use of the
rl_type softc field and only relying on the sc_hwrev softc
field thoughout the driver.

Tested by a number of users from tech@

ok dlg@


Revision tags: OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.19 28-Nov-2006 brad

move printing of the interrupt string into re_attach().


# 1.18 06-Nov-2006 deraadt

noone needs to know about the D0 state change; ok miod


# 1.17 16-Oct-2006 tom

Fix some "is is"s. ok otto@.


Revision tags: OPENBSD_4_0_BASE
# 1.16 06-Aug-2006 brad

fix message printing when resetting the power state.


# 1.15 01-Jul-2006 brad

(fxp/re)_attach_common -> (fxp/re)_attach


# 1.14 30-Jun-2006 deraadt

do not bother playing tag with the PCI_COMMAND_STATUS_REG


# 1.13 27-Jun-2006 brad

add new RealTek PCI ids.


# 1.12 24-Jun-2006 brad

de-register, ANSI functions and a little cleaning.


# 1.11 17-Jun-2006 brad

add sys/timeout.h


# 1.10 09-Jun-2006 brad

identify 8139's in C+ mode with RL_8139CPLUS instead of RL_8139; no functional change.


# 1.9 07-Jun-2006 brad

rename the Realtek RT8111B entry to RT8168.


# 1.8 23-May-2006 brad

according to the Linux 8139cp driver the TTTech MC322 adapter uses
the 8139C+ chipset, so attach with re(4) instead of rl(4).

ok dlg@


# 1.7 16-May-2006 brad

attach 8139's capable of C+ mode to the re(4) driver, instead of the rl(4)
driver.


# 1.6 27-Mar-2006 brad

revert a small part of the last commit that wasn't supposed to go in.


# 1.5 27-Mar-2006 brad

add the Realtek RT8111B PCI Express Gigabit MAC.


Revision tags: OPENBSD_3_8_BASE OPENBSD_3_9_BASE
# 1.4 09-Aug-2005 mickey

do not set PCI_COMMAND_MASTER_ENABLE explicitly as it's already set in pcisubmatch(); kettenis@ testing; brad@ ok


# 1.3 22-Jul-2005 brad

add Linksys EG1032 rev 3


# 1.2 15-Jun-2005 brad

add D-Link DGE-528T and US Robotics USR997902

From: NetBSD


Revision tags: OPENBSD_3_7_BASE
# 1.1 14-Jan-2005 pvalchev

split re(4) into bus-independent code (ic/re.c) and PCI front-end
(pci/if_re_pci.c) for soon-to-come cardbus support; ok deraadt


# 1.56 11-Mar-2022 mpi

Constify struct cfattach.


Revision tags: OPENBSD_6_9_BASE OPENBSD_7_0_BASE
# 1.55 24-Jan-2021 jsg

match on Realtek RTL8168H ids for Killer E2500V2 and E2600

checked against linux and windows drivers


# 1.54 23-Jan-2021 jsg

match on another Realtek RTL8168 id

reported and tested by John Batteen on a TP-Link TG-3468


Revision tags: OPENBSD_6_8_BASE
# 1.53 17-Jun-2020 claudio

Remove the bus specific sc_ih (interrup handle) variable and use the common
sc_ih value of struct rl_softc. This fixes a crash in re(4) because
intr_barrier(9) is called with the rl_softc sc_ih which was NULL.
OK kettenis@


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE
# 1.52 11-Apr-2018 patrick

Some (probably newer) re(4) cards don't have the 32-bit memory BAR that
we try to map first. Instead there's a 64-bit memory BAR in the follow-
ing BAR. Since on the MACCHIATObin we currently do not support the IO
space, we have to use the 64-bit memory BAR. Thus, try to map the 64-
bit BAR before falling back to the 32-bit BAR and the IO bar.

ok deraadt@ kettenis@


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.51 12-Jun-2017 kevlo

From FreeBSD (r227593, r307982):
More and more RealTek controllers started to implement EEE feature.
Vendor driver seems to load a kind of firmware for EEE with
additional PHY fixups. It is known that the EEE feature may need
ASPM support. Unfortunately there is no documentation for EEE of
the controller so enabling ASPM may cause more problems.

The Realtek vendor drivers for FreeBSD and Linux also disable ASPM and
clock request. While here, add a define for the ECPM (Enable Clock Power
Management) bit.

Tested by stsp@ and myself.
ok stsp@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.50 28-Dec-2015 jmatthew

Rework re_start and re_txeof to only check the producer/consumer ring
positions when deciding how much work to do, and to adjust rl_tx_free with
atomic operations; split the flag that indicates whether we're using
timer based interrupts or not out into a separate field so it can be
changed from interrupt context without needing a lock; take the kernel
lock when calling re_init and re_start from interrupt context; add an
interrupt barrier in re_stop; and finally mark the interrupt handler
as mpsafe.

started by Jim Smith a while ago, mostly finished up at n2k15
tested by dlg@, chris@ and Dimitris Papastamos on various hardware
ok dlg@


# 1.49 24-Nov-2015 mpi

You only need <net/if_dl.h> if you're using LLADDR() or a sockaddr_dl.


Revision tags: OPENBSD_5_8_BASE
# 1.48 14-Mar-2015 jsg

Remove some includes include-what-you-use claims don't
have any direct symbols used. Tested for indirect use by compiling
amd64/i386/sparc64 kernels.

ok tedu@ deraadt@


Revision tags: OPENBSD_5_7_BASE
# 1.47 08-Mar-2015 tobiasu

Revert patch responsible for locking up machines with
"Realtek 8168" rev 0x01: RTL8168 2 (0x3800).
You will never guess who commited it without OK ;)

ok deraadt



revision 1.45
date: 2015/01/26 09:58:47; author: brad; state: Exp; lines: +22 -2; commitid: AppNYocFYbD7Hqgj;
Set PCIe max read request size to 2K to help with TX performance.

From FreeBSD

Tested with 8168C, 8168D and 8168G.

revision 1.46
date: 2015/02/19 04:58:34; author: dlg; state: Exp; lines: +2 -2; commitid: GSWXECXQW0LeGFmq;
when reading the max packet size in the pcie device config and
status register, correctly mask things so we're left with the mps
field instead of everything but the mps field.

tested by bcallah@ and jim smith


# 1.46 19-Feb-2015 dlg

when reading the max packet size in the pcie device config and
status register, correctly mask things so we're left with the mps
field instead of everything but the mps field.

tested by bcallah@ and jim smith


# 1.45 26-Jan-2015 brad

Set PCIe max read request size to 2K to help with TX performance.

From FreeBSD

Tested with 8168C, 8168D and 8168G.


# 1.44 22-Dec-2014 tedu

unifdef INET


# 1.43 24-Oct-2014 brad

Always put controller into known state before device intialization.

From FreeBSD

ok sthen@ chris@


# 1.42 06-Sep-2014 brad

Various changes to the re(4) feature flags..

Changed RL_FLAG_MACLDPS to RL_FLAG_MACRESET.
Removed RL_FLAG_INVMAR and RL_FLAG_NOJUMBO.
Added RL_FLAG_FASTETHER, RL_FLAG_CMDSTOP_WAIT_TXQ, RL_FLAG_JUMBOV2, RL_FLAG_WOL_MANLINK,
RL_FLAG_WAIT_TXPOLL, RL_FLAG_WOLRXENB.

Also set in the softc the maximum MTU for the various generations of chips.

Input from and Ok jsg@


Revision tags: OPENBSD_5_6_BASE
# 1.41 22-Jul-2014 mpi

Fewer <netinet/in_systm.h>


Revision tags: OPENBSD_5_5_BASE
# 1.40 18-Nov-2013 brad

Enable MSI on the remaining chipsets.

ok naddy@ sthen@


# 1.39 07-Aug-2013 bluhm

Most network drivers include netinet/in_var.h, but apparently they
don't have to. Just remove these include lines.
Compiled on amd64 i386 sparc64; OK henning@ mikeb@


# 1.38 03-Aug-2013 kettenis

Enable MSI on RT810xE.

ok jsg@


Revision tags: OPENBSD_5_3_BASE OPENBSD_5_4_BASE
# 1.37 16-Jan-2013 brad

Sort the PCI ids.

ok dtucker@ jsing@


# 1.36 18-Oct-2012 deraadt

Convert a number of old private copies of code which predates
pci_set_powerstate() to using it instead. Many of these chunks of code had
bugs in them, especially missing delay() calls. Some of them were doing
things our PCI subsystem is now responsible for handling. If you have
any of the affected devices, please keep an eye out for regressions.
ok kettenis


# 1.35 26-Sep-2012 rfreeman

add D-Link DGE-530T to re(4), update re(4) manpage
tested on i386, ok brad@ sthen@ phessler@


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE
# 1.34 09-Jun-2011 kettenis

Backout MSI change. People are seeing watchdog timeouts, which must be caused
by missed interrupts. Commits to the FreeBSD driver suggest that the hardware
has issues. Having MSI for this driver isn't terribly important anyway.


# 1.33 29-May-2011 kettenis

Add MSI support.

ok dlg@, oga@


# 1.32 03-Apr-2011 jasper

use nitems(); no binary change for drivers that are compiled on amd64.

ok claudio@


# 1.31 13-Mar-2011 stsp

Wake On LAN support for re(4).
ok deraadt


Revision tags: OPENBSD_4_9_BASE
# 1.30 07-Sep-2010 deraadt

remove the powerhook code. All architectures now use the ca_activate tree
traversal code to suspend/resume
ok oga kettenis blambert


Revision tags: OPENBSD_4_8_BASE
# 1.29 27-Jul-2010 todd

spacing; ok deraadt@


# 1.28 27-Jul-2010 kettenis

Make sure we stop DMA before we suspend. Remove unused argument to re_stop()
to avoid the dilemma what meaningless value to pass.

ok deraadt@


Revision tags: OPENBSD_4_7_BASE
# 1.27 26-Nov-2009 kettenis

Only re-initialise interfaces on suspend if they were IFF_RUNNING.

ok deraadt@, claudio@


# 1.26 24-Nov-2009 kettenis

Reset the chip an re-initialise the interface after reset. Resetting the
PHY doesn't seem to be necessary on re(4) so don't descend further for now.

Based on a diff from mlarkin@

ok deraadt@


# 1.25 10-Aug-2009 deraadt

More cases of shutdown hooks not needed after card is already stopped. In
these cases the xxstop function is a bit more complicated and has a flag of
some sort, but the use of that flag does not matter; DMA is already ceased
ok dlg


Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.24 22-Jan-2009 kettenis

Make re(4) at pci(4) detachable.

ok jsg@, miod@


# 1.23 12-Oct-2008 brad

If re_attach() fails at any point make sure to disestablish various
resources setup by the bus front ends, especially the shutdown hook.
Found while testing some other changes with a CardBus adapter and
re_attach() was failing early before the interface pointer was
assigned. Then the system was rebooted, the shutdown hook was called
and *boom* in re_stop().


# 1.22 05-Oct-2008 brad

Detect if the adapter is a PCIe adapter and set the RL_FLAG_PCIE flag
if so.


Revision tags: OPENBSD_4_4_BASE
# 1.21 20-Apr-2008 brad

Remove unused flags.

ok dlg@


Revision tags: OPENBSD_4_3_BASE
# 1.20 17-Feb-2008 brad

Simplify the hw revision handling by removing the use of the
rl_type softc field and only relying on the sc_hwrev softc
field thoughout the driver.

Tested by a number of users from tech@

ok dlg@


Revision tags: OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.19 28-Nov-2006 brad

move printing of the interrupt string into re_attach().


# 1.18 06-Nov-2006 deraadt

noone needs to know about the D0 state change; ok miod


# 1.17 16-Oct-2006 tom

Fix some "is is"s. ok otto@.


Revision tags: OPENBSD_4_0_BASE
# 1.16 06-Aug-2006 brad

fix message printing when resetting the power state.


# 1.15 01-Jul-2006 brad

(fxp/re)_attach_common -> (fxp/re)_attach


# 1.14 30-Jun-2006 deraadt

do not bother playing tag with the PCI_COMMAND_STATUS_REG


# 1.13 27-Jun-2006 brad

add new RealTek PCI ids.


# 1.12 24-Jun-2006 brad

de-register, ANSI functions and a little cleaning.


# 1.11 17-Jun-2006 brad

add sys/timeout.h


# 1.10 09-Jun-2006 brad

identify 8139's in C+ mode with RL_8139CPLUS instead of RL_8139; no functional change.


# 1.9 07-Jun-2006 brad

rename the Realtek RT8111B entry to RT8168.


# 1.8 23-May-2006 brad

according to the Linux 8139cp driver the TTTech MC322 adapter uses
the 8139C+ chipset, so attach with re(4) instead of rl(4).

ok dlg@


# 1.7 16-May-2006 brad

attach 8139's capable of C+ mode to the re(4) driver, instead of the rl(4)
driver.


# 1.6 27-Mar-2006 brad

revert a small part of the last commit that wasn't supposed to go in.


# 1.5 27-Mar-2006 brad

add the Realtek RT8111B PCI Express Gigabit MAC.


Revision tags: OPENBSD_3_8_BASE OPENBSD_3_9_BASE
# 1.4 09-Aug-2005 mickey

do not set PCI_COMMAND_MASTER_ENABLE explicitly as it's already set in pcisubmatch(); kettenis@ testing; brad@ ok


# 1.3 22-Jul-2005 brad

add Linksys EG1032 rev 3


# 1.2 15-Jun-2005 brad

add D-Link DGE-528T and US Robotics USR997902

From: NetBSD


Revision tags: OPENBSD_3_7_BASE
# 1.1 14-Jan-2005 pvalchev

split re(4) into bus-independent code (ic/re.c) and PCI front-end
(pci/if_re_pci.c) for soon-to-come cardbus support; ok deraadt


# 1.55 24-Jan-2021 jsg

match on Realtek RTL8168H ids for Killer E2500V2 and E2600

checked against linux and windows drivers


# 1.54 23-Jan-2021 jsg

match on another Realtek RTL8168 id

reported and tested by John Batteen on a TP-Link TG-3468


Revision tags: OPENBSD_6_8_BASE
# 1.53 17-Jun-2020 claudio

Remove the bus specific sc_ih (interrup handle) variable and use the common
sc_ih value of struct rl_softc. This fixes a crash in re(4) because
intr_barrier(9) is called with the rl_softc sc_ih which was NULL.
OK kettenis@


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE
# 1.52 11-Apr-2018 patrick

Some (probably newer) re(4) cards don't have the 32-bit memory BAR that
we try to map first. Instead there's a 64-bit memory BAR in the follow-
ing BAR. Since on the MACCHIATObin we currently do not support the IO
space, we have to use the 64-bit memory BAR. Thus, try to map the 64-
bit BAR before falling back to the 32-bit BAR and the IO bar.

ok deraadt@ kettenis@


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.51 12-Jun-2017 kevlo

From FreeBSD (r227593, r307982):
More and more RealTek controllers started to implement EEE feature.
Vendor driver seems to load a kind of firmware for EEE with
additional PHY fixups. It is known that the EEE feature may need
ASPM support. Unfortunately there is no documentation for EEE of
the controller so enabling ASPM may cause more problems.

The Realtek vendor drivers for FreeBSD and Linux also disable ASPM and
clock request. While here, add a define for the ECPM (Enable Clock Power
Management) bit.

Tested by stsp@ and myself.
ok stsp@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.50 28-Dec-2015 jmatthew

Rework re_start and re_txeof to only check the producer/consumer ring
positions when deciding how much work to do, and to adjust rl_tx_free with
atomic operations; split the flag that indicates whether we're using
timer based interrupts or not out into a separate field so it can be
changed from interrupt context without needing a lock; take the kernel
lock when calling re_init and re_start from interrupt context; add an
interrupt barrier in re_stop; and finally mark the interrupt handler
as mpsafe.

started by Jim Smith a while ago, mostly finished up at n2k15
tested by dlg@, chris@ and Dimitris Papastamos on various hardware
ok dlg@


# 1.49 24-Nov-2015 mpi

You only need <net/if_dl.h> if you're using LLADDR() or a sockaddr_dl.


Revision tags: OPENBSD_5_8_BASE
# 1.48 14-Mar-2015 jsg

Remove some includes include-what-you-use claims don't
have any direct symbols used. Tested for indirect use by compiling
amd64/i386/sparc64 kernels.

ok tedu@ deraadt@


Revision tags: OPENBSD_5_7_BASE
# 1.47 08-Mar-2015 tobiasu

Revert patch responsible for locking up machines with
"Realtek 8168" rev 0x01: RTL8168 2 (0x3800).
You will never guess who commited it without OK ;)

ok deraadt



revision 1.45
date: 2015/01/26 09:58:47; author: brad; state: Exp; lines: +22 -2; commitid: AppNYocFYbD7Hqgj;
Set PCIe max read request size to 2K to help with TX performance.

From FreeBSD

Tested with 8168C, 8168D and 8168G.

revision 1.46
date: 2015/02/19 04:58:34; author: dlg; state: Exp; lines: +2 -2; commitid: GSWXECXQW0LeGFmq;
when reading the max packet size in the pcie device config and
status register, correctly mask things so we're left with the mps
field instead of everything but the mps field.

tested by bcallah@ and jim smith


# 1.46 19-Feb-2015 dlg

when reading the max packet size in the pcie device config and
status register, correctly mask things so we're left with the mps
field instead of everything but the mps field.

tested by bcallah@ and jim smith


# 1.45 26-Jan-2015 brad

Set PCIe max read request size to 2K to help with TX performance.

From FreeBSD

Tested with 8168C, 8168D and 8168G.


# 1.44 22-Dec-2014 tedu

unifdef INET


# 1.43 24-Oct-2014 brad

Always put controller into known state before device intialization.

From FreeBSD

ok sthen@ chris@


# 1.42 06-Sep-2014 brad

Various changes to the re(4) feature flags..

Changed RL_FLAG_MACLDPS to RL_FLAG_MACRESET.
Removed RL_FLAG_INVMAR and RL_FLAG_NOJUMBO.
Added RL_FLAG_FASTETHER, RL_FLAG_CMDSTOP_WAIT_TXQ, RL_FLAG_JUMBOV2, RL_FLAG_WOL_MANLINK,
RL_FLAG_WAIT_TXPOLL, RL_FLAG_WOLRXENB.

Also set in the softc the maximum MTU for the various generations of chips.

Input from and Ok jsg@


Revision tags: OPENBSD_5_6_BASE
# 1.41 22-Jul-2014 mpi

Fewer <netinet/in_systm.h>


Revision tags: OPENBSD_5_5_BASE
# 1.40 18-Nov-2013 brad

Enable MSI on the remaining chipsets.

ok naddy@ sthen@


# 1.39 07-Aug-2013 bluhm

Most network drivers include netinet/in_var.h, but apparently they
don't have to. Just remove these include lines.
Compiled on amd64 i386 sparc64; OK henning@ mikeb@


# 1.38 03-Aug-2013 kettenis

Enable MSI on RT810xE.

ok jsg@


Revision tags: OPENBSD_5_3_BASE OPENBSD_5_4_BASE
# 1.37 16-Jan-2013 brad

Sort the PCI ids.

ok dtucker@ jsing@


# 1.36 18-Oct-2012 deraadt

Convert a number of old private copies of code which predates
pci_set_powerstate() to using it instead. Many of these chunks of code had
bugs in them, especially missing delay() calls. Some of them were doing
things our PCI subsystem is now responsible for handling. If you have
any of the affected devices, please keep an eye out for regressions.
ok kettenis


# 1.35 26-Sep-2012 rfreeman

add D-Link DGE-530T to re(4), update re(4) manpage
tested on i386, ok brad@ sthen@ phessler@


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE
# 1.34 09-Jun-2011 kettenis

Backout MSI change. People are seeing watchdog timeouts, which must be caused
by missed interrupts. Commits to the FreeBSD driver suggest that the hardware
has issues. Having MSI for this driver isn't terribly important anyway.


# 1.33 29-May-2011 kettenis

Add MSI support.

ok dlg@, oga@


# 1.32 03-Apr-2011 jasper

use nitems(); no binary change for drivers that are compiled on amd64.

ok claudio@


# 1.31 13-Mar-2011 stsp

Wake On LAN support for re(4).
ok deraadt


Revision tags: OPENBSD_4_9_BASE
# 1.30 07-Sep-2010 deraadt

remove the powerhook code. All architectures now use the ca_activate tree
traversal code to suspend/resume
ok oga kettenis blambert


Revision tags: OPENBSD_4_8_BASE
# 1.29 27-Jul-2010 todd

spacing; ok deraadt@


# 1.28 27-Jul-2010 kettenis

Make sure we stop DMA before we suspend. Remove unused argument to re_stop()
to avoid the dilemma what meaningless value to pass.

ok deraadt@


Revision tags: OPENBSD_4_7_BASE
# 1.27 26-Nov-2009 kettenis

Only re-initialise interfaces on suspend if they were IFF_RUNNING.

ok deraadt@, claudio@


# 1.26 24-Nov-2009 kettenis

Reset the chip an re-initialise the interface after reset. Resetting the
PHY doesn't seem to be necessary on re(4) so don't descend further for now.

Based on a diff from mlarkin@

ok deraadt@


# 1.25 10-Aug-2009 deraadt

More cases of shutdown hooks not needed after card is already stopped. In
these cases the xxstop function is a bit more complicated and has a flag of
some sort, but the use of that flag does not matter; DMA is already ceased
ok dlg


Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.24 22-Jan-2009 kettenis

Make re(4) at pci(4) detachable.

ok jsg@, miod@


# 1.23 12-Oct-2008 brad

If re_attach() fails at any point make sure to disestablish various
resources setup by the bus front ends, especially the shutdown hook.
Found while testing some other changes with a CardBus adapter and
re_attach() was failing early before the interface pointer was
assigned. Then the system was rebooted, the shutdown hook was called
and *boom* in re_stop().


# 1.22 05-Oct-2008 brad

Detect if the adapter is a PCIe adapter and set the RL_FLAG_PCIE flag
if so.


Revision tags: OPENBSD_4_4_BASE
# 1.21 20-Apr-2008 brad

Remove unused flags.

ok dlg@


Revision tags: OPENBSD_4_3_BASE
# 1.20 17-Feb-2008 brad

Simplify the hw revision handling by removing the use of the
rl_type softc field and only relying on the sc_hwrev softc
field thoughout the driver.

Tested by a number of users from tech@

ok dlg@


Revision tags: OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.19 28-Nov-2006 brad

move printing of the interrupt string into re_attach().


# 1.18 06-Nov-2006 deraadt

noone needs to know about the D0 state change; ok miod


# 1.17 16-Oct-2006 tom

Fix some "is is"s. ok otto@.


Revision tags: OPENBSD_4_0_BASE
# 1.16 06-Aug-2006 brad

fix message printing when resetting the power state.


# 1.15 01-Jul-2006 brad

(fxp/re)_attach_common -> (fxp/re)_attach


# 1.14 30-Jun-2006 deraadt

do not bother playing tag with the PCI_COMMAND_STATUS_REG


# 1.13 27-Jun-2006 brad

add new RealTek PCI ids.


# 1.12 24-Jun-2006 brad

de-register, ANSI functions and a little cleaning.


# 1.11 17-Jun-2006 brad

add sys/timeout.h


# 1.10 09-Jun-2006 brad

identify 8139's in C+ mode with RL_8139CPLUS instead of RL_8139; no functional change.


# 1.9 07-Jun-2006 brad

rename the Realtek RT8111B entry to RT8168.


# 1.8 23-May-2006 brad

according to the Linux 8139cp driver the TTTech MC322 adapter uses
the 8139C+ chipset, so attach with re(4) instead of rl(4).

ok dlg@


# 1.7 16-May-2006 brad

attach 8139's capable of C+ mode to the re(4) driver, instead of the rl(4)
driver.


# 1.6 27-Mar-2006 brad

revert a small part of the last commit that wasn't supposed to go in.


# 1.5 27-Mar-2006 brad

add the Realtek RT8111B PCI Express Gigabit MAC.


Revision tags: OPENBSD_3_8_BASE OPENBSD_3_9_BASE
# 1.4 09-Aug-2005 mickey

do not set PCI_COMMAND_MASTER_ENABLE explicitly as it's already set in pcisubmatch(); kettenis@ testing; brad@ ok


# 1.3 22-Jul-2005 brad

add Linksys EG1032 rev 3


# 1.2 15-Jun-2005 brad

add D-Link DGE-528T and US Robotics USR997902

From: NetBSD


Revision tags: OPENBSD_3_7_BASE
# 1.1 14-Jan-2005 pvalchev

split re(4) into bus-independent code (ic/re.c) and PCI front-end
(pci/if_re_pci.c) for soon-to-come cardbus support; ok deraadt


# 1.53 17-Jun-2020 claudio

Remove the bus specific sc_ih (interrup handle) variable and use the common
sc_ih value of struct rl_softc. This fixes a crash in re(4) because
intr_barrier(9) is called with the rl_softc sc_ih which was NULL.
OK kettenis@


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE
# 1.52 11-Apr-2018 patrick

Some (probably newer) re(4) cards don't have the 32-bit memory BAR that
we try to map first. Instead there's a 64-bit memory BAR in the follow-
ing BAR. Since on the MACCHIATObin we currently do not support the IO
space, we have to use the 64-bit memory BAR. Thus, try to map the 64-
bit BAR before falling back to the 32-bit BAR and the IO bar.

ok deraadt@ kettenis@


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.51 12-Jun-2017 kevlo

From FreeBSD (r227593, r307982):
More and more RealTek controllers started to implement EEE feature.
Vendor driver seems to load a kind of firmware for EEE with
additional PHY fixups. It is known that the EEE feature may need
ASPM support. Unfortunately there is no documentation for EEE of
the controller so enabling ASPM may cause more problems.

The Realtek vendor drivers for FreeBSD and Linux also disable ASPM and
clock request. While here, add a define for the ECPM (Enable Clock Power
Management) bit.

Tested by stsp@ and myself.
ok stsp@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.50 28-Dec-2015 jmatthew

Rework re_start and re_txeof to only check the producer/consumer ring
positions when deciding how much work to do, and to adjust rl_tx_free with
atomic operations; split the flag that indicates whether we're using
timer based interrupts or not out into a separate field so it can be
changed from interrupt context without needing a lock; take the kernel
lock when calling re_init and re_start from interrupt context; add an
interrupt barrier in re_stop; and finally mark the interrupt handler
as mpsafe.

started by Jim Smith a while ago, mostly finished up at n2k15
tested by dlg@, chris@ and Dimitris Papastamos on various hardware
ok dlg@


# 1.49 24-Nov-2015 mpi

You only need <net/if_dl.h> if you're using LLADDR() or a sockaddr_dl.


Revision tags: OPENBSD_5_8_BASE
# 1.48 14-Mar-2015 jsg

Remove some includes include-what-you-use claims don't
have any direct symbols used. Tested for indirect use by compiling
amd64/i386/sparc64 kernels.

ok tedu@ deraadt@


Revision tags: OPENBSD_5_7_BASE
# 1.47 08-Mar-2015 tobiasu

Revert patch responsible for locking up machines with
"Realtek 8168" rev 0x01: RTL8168 2 (0x3800).
You will never guess who commited it without OK ;)

ok deraadt



revision 1.45
date: 2015/01/26 09:58:47; author: brad; state: Exp; lines: +22 -2; commitid: AppNYocFYbD7Hqgj;
Set PCIe max read request size to 2K to help with TX performance.

From FreeBSD

Tested with 8168C, 8168D and 8168G.

revision 1.46
date: 2015/02/19 04:58:34; author: dlg; state: Exp; lines: +2 -2; commitid: GSWXECXQW0LeGFmq;
when reading the max packet size in the pcie device config and
status register, correctly mask things so we're left with the mps
field instead of everything but the mps field.

tested by bcallah@ and jim smith


# 1.46 19-Feb-2015 dlg

when reading the max packet size in the pcie device config and
status register, correctly mask things so we're left with the mps
field instead of everything but the mps field.

tested by bcallah@ and jim smith


# 1.45 26-Jan-2015 brad

Set PCIe max read request size to 2K to help with TX performance.

From FreeBSD

Tested with 8168C, 8168D and 8168G.


# 1.44 22-Dec-2014 tedu

unifdef INET


# 1.43 24-Oct-2014 brad

Always put controller into known state before device intialization.

From FreeBSD

ok sthen@ chris@


# 1.42 06-Sep-2014 brad

Various changes to the re(4) feature flags..

Changed RL_FLAG_MACLDPS to RL_FLAG_MACRESET.
Removed RL_FLAG_INVMAR and RL_FLAG_NOJUMBO.
Added RL_FLAG_FASTETHER, RL_FLAG_CMDSTOP_WAIT_TXQ, RL_FLAG_JUMBOV2, RL_FLAG_WOL_MANLINK,
RL_FLAG_WAIT_TXPOLL, RL_FLAG_WOLRXENB.

Also set in the softc the maximum MTU for the various generations of chips.

Input from and Ok jsg@


Revision tags: OPENBSD_5_6_BASE
# 1.41 22-Jul-2014 mpi

Fewer <netinet/in_systm.h>


Revision tags: OPENBSD_5_5_BASE
# 1.40 18-Nov-2013 brad

Enable MSI on the remaining chipsets.

ok naddy@ sthen@


# 1.39 07-Aug-2013 bluhm

Most network drivers include netinet/in_var.h, but apparently they
don't have to. Just remove these include lines.
Compiled on amd64 i386 sparc64; OK henning@ mikeb@


# 1.38 03-Aug-2013 kettenis

Enable MSI on RT810xE.

ok jsg@


Revision tags: OPENBSD_5_3_BASE OPENBSD_5_4_BASE
# 1.37 16-Jan-2013 brad

Sort the PCI ids.

ok dtucker@ jsing@


# 1.36 18-Oct-2012 deraadt

Convert a number of old private copies of code which predates
pci_set_powerstate() to using it instead. Many of these chunks of code had
bugs in them, especially missing delay() calls. Some of them were doing
things our PCI subsystem is now responsible for handling. If you have
any of the affected devices, please keep an eye out for regressions.
ok kettenis


# 1.35 26-Sep-2012 rfreeman

add D-Link DGE-530T to re(4), update re(4) manpage
tested on i386, ok brad@ sthen@ phessler@


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE
# 1.34 09-Jun-2011 kettenis

Backout MSI change. People are seeing watchdog timeouts, which must be caused
by missed interrupts. Commits to the FreeBSD driver suggest that the hardware
has issues. Having MSI for this driver isn't terribly important anyway.


# 1.33 29-May-2011 kettenis

Add MSI support.

ok dlg@, oga@


# 1.32 03-Apr-2011 jasper

use nitems(); no binary change for drivers that are compiled on amd64.

ok claudio@


# 1.31 13-Mar-2011 stsp

Wake On LAN support for re(4).
ok deraadt


Revision tags: OPENBSD_4_9_BASE
# 1.30 07-Sep-2010 deraadt

remove the powerhook code. All architectures now use the ca_activate tree
traversal code to suspend/resume
ok oga kettenis blambert


Revision tags: OPENBSD_4_8_BASE
# 1.29 27-Jul-2010 todd

spacing; ok deraadt@


# 1.28 27-Jul-2010 kettenis

Make sure we stop DMA before we suspend. Remove unused argument to re_stop()
to avoid the dilemma what meaningless value to pass.

ok deraadt@


Revision tags: OPENBSD_4_7_BASE
# 1.27 26-Nov-2009 kettenis

Only re-initialise interfaces on suspend if they were IFF_RUNNING.

ok deraadt@, claudio@


# 1.26 24-Nov-2009 kettenis

Reset the chip an re-initialise the interface after reset. Resetting the
PHY doesn't seem to be necessary on re(4) so don't descend further for now.

Based on a diff from mlarkin@

ok deraadt@


# 1.25 10-Aug-2009 deraadt

More cases of shutdown hooks not needed after card is already stopped. In
these cases the xxstop function is a bit more complicated and has a flag of
some sort, but the use of that flag does not matter; DMA is already ceased
ok dlg


Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.24 22-Jan-2009 kettenis

Make re(4) at pci(4) detachable.

ok jsg@, miod@


# 1.23 12-Oct-2008 brad

If re_attach() fails at any point make sure to disestablish various
resources setup by the bus front ends, especially the shutdown hook.
Found while testing some other changes with a CardBus adapter and
re_attach() was failing early before the interface pointer was
assigned. Then the system was rebooted, the shutdown hook was called
and *boom* in re_stop().


# 1.22 05-Oct-2008 brad

Detect if the adapter is a PCIe adapter and set the RL_FLAG_PCIE flag
if so.


Revision tags: OPENBSD_4_4_BASE
# 1.21 20-Apr-2008 brad

Remove unused flags.

ok dlg@


Revision tags: OPENBSD_4_3_BASE
# 1.20 17-Feb-2008 brad

Simplify the hw revision handling by removing the use of the
rl_type softc field and only relying on the sc_hwrev softc
field thoughout the driver.

Tested by a number of users from tech@

ok dlg@


Revision tags: OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.19 28-Nov-2006 brad

move printing of the interrupt string into re_attach().


# 1.18 06-Nov-2006 deraadt

noone needs to know about the D0 state change; ok miod


# 1.17 16-Oct-2006 tom

Fix some "is is"s. ok otto@.


Revision tags: OPENBSD_4_0_BASE
# 1.16 06-Aug-2006 brad

fix message printing when resetting the power state.


# 1.15 01-Jul-2006 brad

(fxp/re)_attach_common -> (fxp/re)_attach


# 1.14 30-Jun-2006 deraadt

do not bother playing tag with the PCI_COMMAND_STATUS_REG


# 1.13 27-Jun-2006 brad

add new RealTek PCI ids.


# 1.12 24-Jun-2006 brad

de-register, ANSI functions and a little cleaning.


# 1.11 17-Jun-2006 brad

add sys/timeout.h


# 1.10 09-Jun-2006 brad

identify 8139's in C+ mode with RL_8139CPLUS instead of RL_8139; no functional change.


# 1.9 07-Jun-2006 brad

rename the Realtek RT8111B entry to RT8168.


# 1.8 23-May-2006 brad

according to the Linux 8139cp driver the TTTech MC322 adapter uses
the 8139C+ chipset, so attach with re(4) instead of rl(4).

ok dlg@


# 1.7 16-May-2006 brad

attach 8139's capable of C+ mode to the re(4) driver, instead of the rl(4)
driver.


# 1.6 27-Mar-2006 brad

revert a small part of the last commit that wasn't supposed to go in.


# 1.5 27-Mar-2006 brad

add the Realtek RT8111B PCI Express Gigabit MAC.


Revision tags: OPENBSD_3_8_BASE OPENBSD_3_9_BASE
# 1.4 09-Aug-2005 mickey

do not set PCI_COMMAND_MASTER_ENABLE explicitly as it's already set in pcisubmatch(); kettenis@ testing; brad@ ok


# 1.3 22-Jul-2005 brad

add Linksys EG1032 rev 3


# 1.2 15-Jun-2005 brad

add D-Link DGE-528T and US Robotics USR997902

From: NetBSD


Revision tags: OPENBSD_3_7_BASE
# 1.1 14-Jan-2005 pvalchev

split re(4) into bus-independent code (ic/re.c) and PCI front-end
(pci/if_re_pci.c) for soon-to-come cardbus support; ok deraadt


# 1.52 11-Apr-2018 patrick

Some (probably newer) re(4) cards don't have the 32-bit memory BAR that
we try to map first. Instead there's a 64-bit memory BAR in the follow-
ing BAR. Since on the MACCHIATObin we currently do not support the IO
space, we have to use the 64-bit memory BAR. Thus, try to map the 64-
bit BAR before falling back to the 32-bit BAR and the IO bar.

ok deraadt@ kettenis@


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.51 12-Jun-2017 kevlo

From FreeBSD (r227593, r307982):
More and more RealTek controllers started to implement EEE feature.
Vendor driver seems to load a kind of firmware for EEE with
additional PHY fixups. It is known that the EEE feature may need
ASPM support. Unfortunately there is no documentation for EEE of
the controller so enabling ASPM may cause more problems.

The Realtek vendor drivers for FreeBSD and Linux also disable ASPM and
clock request. While here, add a define for the ECPM (Enable Clock Power
Management) bit.

Tested by stsp@ and myself.
ok stsp@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.50 28-Dec-2015 jmatthew

Rework re_start and re_txeof to only check the producer/consumer ring
positions when deciding how much work to do, and to adjust rl_tx_free with
atomic operations; split the flag that indicates whether we're using
timer based interrupts or not out into a separate field so it can be
changed from interrupt context without needing a lock; take the kernel
lock when calling re_init and re_start from interrupt context; add an
interrupt barrier in re_stop; and finally mark the interrupt handler
as mpsafe.

started by Jim Smith a while ago, mostly finished up at n2k15
tested by dlg@, chris@ and Dimitris Papastamos on various hardware
ok dlg@


# 1.49 24-Nov-2015 mpi

You only need <net/if_dl.h> if you're using LLADDR() or a sockaddr_dl.


Revision tags: OPENBSD_5_8_BASE
# 1.48 14-Mar-2015 jsg

Remove some includes include-what-you-use claims don't
have any direct symbols used. Tested for indirect use by compiling
amd64/i386/sparc64 kernels.

ok tedu@ deraadt@


Revision tags: OPENBSD_5_7_BASE
# 1.47 08-Mar-2015 tobiasu

Revert patch responsible for locking up machines with
"Realtek 8168" rev 0x01: RTL8168 2 (0x3800).
You will never guess who commited it without OK ;)

ok deraadt



revision 1.45
date: 2015/01/26 09:58:47; author: brad; state: Exp; lines: +22 -2; commitid: AppNYocFYbD7Hqgj;
Set PCIe max read request size to 2K to help with TX performance.

From FreeBSD

Tested with 8168C, 8168D and 8168G.

revision 1.46
date: 2015/02/19 04:58:34; author: dlg; state: Exp; lines: +2 -2; commitid: GSWXECXQW0LeGFmq;
when reading the max packet size in the pcie device config and
status register, correctly mask things so we're left with the mps
field instead of everything but the mps field.

tested by bcallah@ and jim smith


# 1.46 19-Feb-2015 dlg

when reading the max packet size in the pcie device config and
status register, correctly mask things so we're left with the mps
field instead of everything but the mps field.

tested by bcallah@ and jim smith


# 1.45 26-Jan-2015 brad

Set PCIe max read request size to 2K to help with TX performance.

From FreeBSD

Tested with 8168C, 8168D and 8168G.


# 1.44 22-Dec-2014 tedu

unifdef INET


# 1.43 24-Oct-2014 brad

Always put controller into known state before device intialization.

From FreeBSD

ok sthen@ chris@


# 1.42 06-Sep-2014 brad

Various changes to the re(4) feature flags..

Changed RL_FLAG_MACLDPS to RL_FLAG_MACRESET.
Removed RL_FLAG_INVMAR and RL_FLAG_NOJUMBO.
Added RL_FLAG_FASTETHER, RL_FLAG_CMDSTOP_WAIT_TXQ, RL_FLAG_JUMBOV2, RL_FLAG_WOL_MANLINK,
RL_FLAG_WAIT_TXPOLL, RL_FLAG_WOLRXENB.

Also set in the softc the maximum MTU for the various generations of chips.

Input from and Ok jsg@


Revision tags: OPENBSD_5_6_BASE
# 1.41 22-Jul-2014 mpi

Fewer <netinet/in_systm.h>


Revision tags: OPENBSD_5_5_BASE
# 1.40 18-Nov-2013 brad

Enable MSI on the remaining chipsets.

ok naddy@ sthen@


# 1.39 07-Aug-2013 bluhm

Most network drivers include netinet/in_var.h, but apparently they
don't have to. Just remove these include lines.
Compiled on amd64 i386 sparc64; OK henning@ mikeb@


# 1.38 03-Aug-2013 kettenis

Enable MSI on RT810xE.

ok jsg@


Revision tags: OPENBSD_5_3_BASE OPENBSD_5_4_BASE
# 1.37 16-Jan-2013 brad

Sort the PCI ids.

ok dtucker@ jsing@


# 1.36 18-Oct-2012 deraadt

Convert a number of old private copies of code which predates
pci_set_powerstate() to using it instead. Many of these chunks of code had
bugs in them, especially missing delay() calls. Some of them were doing
things our PCI subsystem is now responsible for handling. If you have
any of the affected devices, please keep an eye out for regressions.
ok kettenis


# 1.35 26-Sep-2012 rfreeman

add D-Link DGE-530T to re(4), update re(4) manpage
tested on i386, ok brad@ sthen@ phessler@


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE
# 1.34 09-Jun-2011 kettenis

Backout MSI change. People are seeing watchdog timeouts, which must be caused
by missed interrupts. Commits to the FreeBSD driver suggest that the hardware
has issues. Having MSI for this driver isn't terribly important anyway.


# 1.33 29-May-2011 kettenis

Add MSI support.

ok dlg@, oga@


# 1.32 03-Apr-2011 jasper

use nitems(); no binary change for drivers that are compiled on amd64.

ok claudio@


# 1.31 13-Mar-2011 stsp

Wake On LAN support for re(4).
ok deraadt


Revision tags: OPENBSD_4_9_BASE
# 1.30 07-Sep-2010 deraadt

remove the powerhook code. All architectures now use the ca_activate tree
traversal code to suspend/resume
ok oga kettenis blambert


Revision tags: OPENBSD_4_8_BASE
# 1.29 27-Jul-2010 todd

spacing; ok deraadt@


# 1.28 27-Jul-2010 kettenis

Make sure we stop DMA before we suspend. Remove unused argument to re_stop()
to avoid the dilemma what meaningless value to pass.

ok deraadt@


Revision tags: OPENBSD_4_7_BASE
# 1.27 26-Nov-2009 kettenis

Only re-initialise interfaces on suspend if they were IFF_RUNNING.

ok deraadt@, claudio@


# 1.26 24-Nov-2009 kettenis

Reset the chip an re-initialise the interface after reset. Resetting the
PHY doesn't seem to be necessary on re(4) so don't descend further for now.

Based on a diff from mlarkin@

ok deraadt@


# 1.25 10-Aug-2009 deraadt

More cases of shutdown hooks not needed after card is already stopped. In
these cases the xxstop function is a bit more complicated and has a flag of
some sort, but the use of that flag does not matter; DMA is already ceased
ok dlg


Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.24 22-Jan-2009 kettenis

Make re(4) at pci(4) detachable.

ok jsg@, miod@


# 1.23 12-Oct-2008 brad

If re_attach() fails at any point make sure to disestablish various
resources setup by the bus front ends, especially the shutdown hook.
Found while testing some other changes with a CardBus adapter and
re_attach() was failing early before the interface pointer was
assigned. Then the system was rebooted, the shutdown hook was called
and *boom* in re_stop().


# 1.22 05-Oct-2008 brad

Detect if the adapter is a PCIe adapter and set the RL_FLAG_PCIE flag
if so.


Revision tags: OPENBSD_4_4_BASE
# 1.21 20-Apr-2008 brad

Remove unused flags.

ok dlg@


Revision tags: OPENBSD_4_3_BASE
# 1.20 17-Feb-2008 brad

Simplify the hw revision handling by removing the use of the
rl_type softc field and only relying on the sc_hwrev softc
field thoughout the driver.

Tested by a number of users from tech@

ok dlg@


Revision tags: OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.19 28-Nov-2006 brad

move printing of the interrupt string into re_attach().


# 1.18 06-Nov-2006 deraadt

noone needs to know about the D0 state change; ok miod


# 1.17 16-Oct-2006 tom

Fix some "is is"s. ok otto@.


Revision tags: OPENBSD_4_0_BASE
# 1.16 06-Aug-2006 brad

fix message printing when resetting the power state.


# 1.15 01-Jul-2006 brad

(fxp/re)_attach_common -> (fxp/re)_attach


# 1.14 30-Jun-2006 deraadt

do not bother playing tag with the PCI_COMMAND_STATUS_REG


# 1.13 27-Jun-2006 brad

add new RealTek PCI ids.


# 1.12 24-Jun-2006 brad

de-register, ANSI functions and a little cleaning.


# 1.11 17-Jun-2006 brad

add sys/timeout.h


# 1.10 09-Jun-2006 brad

identify 8139's in C+ mode with RL_8139CPLUS instead of RL_8139; no functional change.


# 1.9 07-Jun-2006 brad

rename the Realtek RT8111B entry to RT8168.


# 1.8 23-May-2006 brad

according to the Linux 8139cp driver the TTTech MC322 adapter uses
the 8139C+ chipset, so attach with re(4) instead of rl(4).

ok dlg@


# 1.7 16-May-2006 brad

attach 8139's capable of C+ mode to the re(4) driver, instead of the rl(4)
driver.


# 1.6 27-Mar-2006 brad

revert a small part of the last commit that wasn't supposed to go in.


# 1.5 27-Mar-2006 brad

add the Realtek RT8111B PCI Express Gigabit MAC.


Revision tags: OPENBSD_3_8_BASE OPENBSD_3_9_BASE
# 1.4 09-Aug-2005 mickey

do not set PCI_COMMAND_MASTER_ENABLE explicitly as it's already set in pcisubmatch(); kettenis@ testing; brad@ ok


# 1.3 22-Jul-2005 brad

add Linksys EG1032 rev 3


# 1.2 15-Jun-2005 brad

add D-Link DGE-528T and US Robotics USR997902

From: NetBSD


Revision tags: OPENBSD_3_7_BASE
# 1.1 14-Jan-2005 pvalchev

split re(4) into bus-independent code (ic/re.c) and PCI front-end
(pci/if_re_pci.c) for soon-to-come cardbus support; ok deraadt


Revision tags: OPENBSD_6_2_BASE
# 1.51 12-Jun-2017 kevlo

From FreeBSD (r227593, r307982):
More and more RealTek controllers started to implement EEE feature.
Vendor driver seems to load a kind of firmware for EEE with
additional PHY fixups. It is known that the EEE feature may need
ASPM support. Unfortunately there is no documentation for EEE of
the controller so enabling ASPM may cause more problems.

The Realtek vendor drivers for FreeBSD and Linux also disable ASPM and
clock request. While here, add a define for the ECPM (Enable Clock Power
Management) bit.

Tested by stsp@ and myself.
ok stsp@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.50 28-Dec-2015 jmatthew

Rework re_start and re_txeof to only check the producer/consumer ring
positions when deciding how much work to do, and to adjust rl_tx_free with
atomic operations; split the flag that indicates whether we're using
timer based interrupts or not out into a separate field so it can be
changed from interrupt context without needing a lock; take the kernel
lock when calling re_init and re_start from interrupt context; add an
interrupt barrier in re_stop; and finally mark the interrupt handler
as mpsafe.

started by Jim Smith a while ago, mostly finished up at n2k15
tested by dlg@, chris@ and Dimitris Papastamos on various hardware
ok dlg@


# 1.49 24-Nov-2015 mpi

You only need <net/if_dl.h> if you're using LLADDR() or a sockaddr_dl.


Revision tags: OPENBSD_5_8_BASE
# 1.48 14-Mar-2015 jsg

Remove some includes include-what-you-use claims don't
have any direct symbols used. Tested for indirect use by compiling
amd64/i386/sparc64 kernels.

ok tedu@ deraadt@


Revision tags: OPENBSD_5_7_BASE
# 1.47 08-Mar-2015 tobiasu

Revert patch responsible for locking up machines with
"Realtek 8168" rev 0x01: RTL8168 2 (0x3800).
You will never guess who commited it without OK ;)

ok deraadt



revision 1.45
date: 2015/01/26 09:58:47; author: brad; state: Exp; lines: +22 -2; commitid: AppNYocFYbD7Hqgj;
Set PCIe max read request size to 2K to help with TX performance.

From FreeBSD

Tested with 8168C, 8168D and 8168G.

revision 1.46
date: 2015/02/19 04:58:34; author: dlg; state: Exp; lines: +2 -2; commitid: GSWXECXQW0LeGFmq;
when reading the max packet size in the pcie device config and
status register, correctly mask things so we're left with the mps
field instead of everything but the mps field.

tested by bcallah@ and jim smith


# 1.46 19-Feb-2015 dlg

when reading the max packet size in the pcie device config and
status register, correctly mask things so we're left with the mps
field instead of everything but the mps field.

tested by bcallah@ and jim smith


# 1.45 26-Jan-2015 brad

Set PCIe max read request size to 2K to help with TX performance.

From FreeBSD

Tested with 8168C, 8168D and 8168G.


# 1.44 22-Dec-2014 tedu

unifdef INET


# 1.43 24-Oct-2014 brad

Always put controller into known state before device intialization.

From FreeBSD

ok sthen@ chris@


# 1.42 06-Sep-2014 brad

Various changes to the re(4) feature flags..

Changed RL_FLAG_MACLDPS to RL_FLAG_MACRESET.
Removed RL_FLAG_INVMAR and RL_FLAG_NOJUMBO.
Added RL_FLAG_FASTETHER, RL_FLAG_CMDSTOP_WAIT_TXQ, RL_FLAG_JUMBOV2, RL_FLAG_WOL_MANLINK,
RL_FLAG_WAIT_TXPOLL, RL_FLAG_WOLRXENB.

Also set in the softc the maximum MTU for the various generations of chips.

Input from and Ok jsg@


Revision tags: OPENBSD_5_6_BASE
# 1.41 22-Jul-2014 mpi

Fewer <netinet/in_systm.h>


Revision tags: OPENBSD_5_5_BASE
# 1.40 18-Nov-2013 brad

Enable MSI on the remaining chipsets.

ok naddy@ sthen@


# 1.39 07-Aug-2013 bluhm

Most network drivers include netinet/in_var.h, but apparently they
don't have to. Just remove these include lines.
Compiled on amd64 i386 sparc64; OK henning@ mikeb@


# 1.38 03-Aug-2013 kettenis

Enable MSI on RT810xE.

ok jsg@


Revision tags: OPENBSD_5_3_BASE OPENBSD_5_4_BASE
# 1.37 16-Jan-2013 brad

Sort the PCI ids.

ok dtucker@ jsing@


# 1.36 18-Oct-2012 deraadt

Convert a number of old private copies of code which predates
pci_set_powerstate() to using it instead. Many of these chunks of code had
bugs in them, especially missing delay() calls. Some of them were doing
things our PCI subsystem is now responsible for handling. If you have
any of the affected devices, please keep an eye out for regressions.
ok kettenis


# 1.35 26-Sep-2012 rfreeman

add D-Link DGE-530T to re(4), update re(4) manpage
tested on i386, ok brad@ sthen@ phessler@


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE
# 1.34 09-Jun-2011 kettenis

Backout MSI change. People are seeing watchdog timeouts, which must be caused
by missed interrupts. Commits to the FreeBSD driver suggest that the hardware
has issues. Having MSI for this driver isn't terribly important anyway.


# 1.33 29-May-2011 kettenis

Add MSI support.

ok dlg@, oga@


# 1.32 03-Apr-2011 jasper

use nitems(); no binary change for drivers that are compiled on amd64.

ok claudio@


# 1.31 13-Mar-2011 stsp

Wake On LAN support for re(4).
ok deraadt


Revision tags: OPENBSD_4_9_BASE
# 1.30 07-Sep-2010 deraadt

remove the powerhook code. All architectures now use the ca_activate tree
traversal code to suspend/resume
ok oga kettenis blambert


Revision tags: OPENBSD_4_8_BASE
# 1.29 27-Jul-2010 todd

spacing; ok deraadt@


# 1.28 27-Jul-2010 kettenis

Make sure we stop DMA before we suspend. Remove unused argument to re_stop()
to avoid the dilemma what meaningless value to pass.

ok deraadt@


Revision tags: OPENBSD_4_7_BASE
# 1.27 26-Nov-2009 kettenis

Only re-initialise interfaces on suspend if they were IFF_RUNNING.

ok deraadt@, claudio@


# 1.26 24-Nov-2009 kettenis

Reset the chip an re-initialise the interface after reset. Resetting the
PHY doesn't seem to be necessary on re(4) so don't descend further for now.

Based on a diff from mlarkin@

ok deraadt@


# 1.25 10-Aug-2009 deraadt

More cases of shutdown hooks not needed after card is already stopped. In
these cases the xxstop function is a bit more complicated and has a flag of
some sort, but the use of that flag does not matter; DMA is already ceased
ok dlg


Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.24 22-Jan-2009 kettenis

Make re(4) at pci(4) detachable.

ok jsg@, miod@


# 1.23 12-Oct-2008 brad

If re_attach() fails at any point make sure to disestablish various
resources setup by the bus front ends, especially the shutdown hook.
Found while testing some other changes with a CardBus adapter and
re_attach() was failing early before the interface pointer was
assigned. Then the system was rebooted, the shutdown hook was called
and *boom* in re_stop().


# 1.22 05-Oct-2008 brad

Detect if the adapter is a PCIe adapter and set the RL_FLAG_PCIE flag
if so.


Revision tags: OPENBSD_4_4_BASE
# 1.21 20-Apr-2008 brad

Remove unused flags.

ok dlg@


Revision tags: OPENBSD_4_3_BASE
# 1.20 17-Feb-2008 brad

Simplify the hw revision handling by removing the use of the
rl_type softc field and only relying on the sc_hwrev softc
field thoughout the driver.

Tested by a number of users from tech@

ok dlg@


Revision tags: OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.19 28-Nov-2006 brad

move printing of the interrupt string into re_attach().


# 1.18 06-Nov-2006 deraadt

noone needs to know about the D0 state change; ok miod


# 1.17 16-Oct-2006 tom

Fix some "is is"s. ok otto@.


Revision tags: OPENBSD_4_0_BASE
# 1.16 06-Aug-2006 brad

fix message printing when resetting the power state.


# 1.15 01-Jul-2006 brad

(fxp/re)_attach_common -> (fxp/re)_attach


# 1.14 30-Jun-2006 deraadt

do not bother playing tag with the PCI_COMMAND_STATUS_REG


# 1.13 27-Jun-2006 brad

add new RealTek PCI ids.


# 1.12 24-Jun-2006 brad

de-register, ANSI functions and a little cleaning.


# 1.11 17-Jun-2006 brad

add sys/timeout.h


# 1.10 09-Jun-2006 brad

identify 8139's in C+ mode with RL_8139CPLUS instead of RL_8139; no functional change.


# 1.9 07-Jun-2006 brad

rename the Realtek RT8111B entry to RT8168.


# 1.8 23-May-2006 brad

according to the Linux 8139cp driver the TTTech MC322 adapter uses
the 8139C+ chipset, so attach with re(4) instead of rl(4).

ok dlg@


# 1.7 16-May-2006 brad

attach 8139's capable of C+ mode to the re(4) driver, instead of the rl(4)
driver.


# 1.6 27-Mar-2006 brad

revert a small part of the last commit that wasn't supposed to go in.


# 1.5 27-Mar-2006 brad

add the Realtek RT8111B PCI Express Gigabit MAC.


Revision tags: OPENBSD_3_8_BASE OPENBSD_3_9_BASE
# 1.4 09-Aug-2005 mickey

do not set PCI_COMMAND_MASTER_ENABLE explicitly as it's already set in pcisubmatch(); kettenis@ testing; brad@ ok


# 1.3 22-Jul-2005 brad

add Linksys EG1032 rev 3


# 1.2 15-Jun-2005 brad

add D-Link DGE-528T and US Robotics USR997902

From: NetBSD


Revision tags: OPENBSD_3_7_BASE
# 1.1 14-Jan-2005 pvalchev

split re(4) into bus-independent code (ic/re.c) and PCI front-end
(pci/if_re_pci.c) for soon-to-come cardbus support; ok deraadt