Bug 193743 - [re] RTL8111/8168B PCI Express Gigabit Ethernet controller: doesn't work properly, problems getting UP automatically
Summary: [re] RTL8111/8168B PCI Express Gigabit Ethernet controller: doesn't work prop...
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: amd64 Any
: --- Affects Some People
Assignee: Marius Strobl
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-09-18 10:23 UTC by O. Hartmann
Modified: 2015-07-30 03:08 UTC (History)
3 users (show)

See Also:
koobs: mfc-stable10?


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description O. Hartmann 2014-09-18 10:23:36 UTC
Running FreeBSD 11.0-CURRENT (11.0-CURRENT #5 r271728: Thu Sep 18 01:18:25 CEST 2014 amd64) on a Lenovo ThinkPad Edge E540 laptop, 
CPU: Intel(R) Core(TM) i5-4200M CPU @ 2.50GHz (2494.28-MHz K8-class CPU), the built-in LAN adaptor doen't work correctly as it doesn't get up automatically. 


Symptoms:

After booting the system, the OS does recognise the NIC properly and initializes the hardware. But then, the NIC is "dead" or down - no connection. Carrier is "active". Sometimes - sporadically - DHCP offers/requests where fullfilled, but then the NIC is "dead".

Solution:

After the box and NIC is up, turning the NIC down and then up and waiting a second or two makes the NIC working as expected.

This phenomenon occurs on different types of switches (Netgear, HP Procurve, Cisco). 


The hardware reveals itself to the OS as

re0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500   options=8219b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,TSO4,WOL_MAGIC,LINKSTATE>

and

miibus0: <MII bus> on re0
rgephy0: <RTL8251 1000BASE-T media interface> PHY 1 on miibus0
rgephy0:  none, 10baseT, 10baseT-FDX, 10baseT-FDX-flow, 100baseTX, 100baseTX-FDX, 100baseTX-FDX-flow, 1000baseT-FDX, 1000baseT-FDX-master, 1000baseT-FDX-flow, 1000baseT-FDX-flow-master, auto, auto-flow



pciconf -lbcev:

[...]
re0@pci0:4:0:0: class=0x020000 card=0x502817aa chip=0x816810ec rev=0x10 hdr=0x00
    vendor     = 'Realtek Semiconductor Co., Ltd.'
    device     = 'RTL8111/8168B PCI Express Gigabit Ethernet controller'
    class      = network
    subclass   = ethernet
    bar   [10] = type I/O Port, range 32, base rx3000, size 256, enabled
    bar   [18] = type Memory, range 64, base rxf1d04000, size 4096, enabled
    bar   [20] = type Memory, range 64, base rxf1d00000, size 16384, enabled
    cap 01[40] = powerspec 3  supports D0 D1 D2 D3  current D0
    cap 05[50] = MSI supports 1 message, 64 bit 
    cap 10[70] = PCI-Express 2 endpoint IRQ 1 max data 128(128) link x1(x1)
                 speed 2.5(2.5) ASPM disabled(L0s/L1)
    cap 11[b0] = MSI-X supports 4 messages, enabled
                 Table in map 0x20[0x0], PBA in map 0x20[0x800]
    cap 03[d0] = VPD
    ecap 0001[100] = AER 2 0 fatal 0 non-fatal 1 corrected
    ecap 0002[140] = VC 1 max VC0
    ecap 0003[160] = Serial 1 01000000684ce000
    ecap 0018[170] = LTR 1
    ecap 001e[178] = unknown 1
  PCI-e errors = Correctable Error Detected
     Corrected = Receiver Error
Comment 1 Guido Falsi freebsd_committer 2014-09-18 10:57:01 UTC
I reported a similar issue some time ago, this is the relevant thread on net@FreeBSD.org:

http://lists.freebsd.org/pipermail/freebsd-net/2013-September/036645.html

Some patches were tried at the time but the problem was not solved.

I'm currently working around this with a startup script doing:

start_cmd="ifconfig ${refix_if} tso"

(tso is already on by default, just touching the flag wakes up the adapter).


My machine is a Fujitsu siemens tower Esprimo PH300 E85+.

pciconf -lbcev:

re0@pci0:3:0:0: class=0x020000 card=0x11c01734 chip=0x816810ec rev=0x07 hdr=0x00
    vendor     = 'Realtek Semiconductor Co., Ltd.'
    device     = 'RTL8111/8168B PCI Express Gigabit Ethernet controller'
    class      = network
    subclass   = ethernet
    bar   [10] = type I/O Port, range 32, base rxd000, size 256, enabled
    bar   [18] = type Prefetchable Memory, range 64, base rxf2104000, size 4096, enabled
    bar   [20] = type Prefetchable Memory, range 64, base rxf2100000, size 16384, enabled
    cap 01[40] = powerspec 3  supports D0 D1 D2 D3  current D0
    cap 05[50] = MSI supports 1 message, 64 bit 
    cap 10[70] = PCI-Express 2 endpoint IRQ 1 max data 128(128) link x1(x1)
                 speed 2.5(2.5) ASPM disabled(L0s/L1)
    cap 11[b0] = MSI-X supports 4 messages, enabled
                 Table in map 0x20[0x0], PBA in map 0x20[0x800]
    cap 03[d0] = VPD
    ecap 0001[100] = AER 1 0 fatal 0 non-fatal 1 corrected
    ecap 0002[140] = VC 1 max VC0
    ecap 0003[160] = Serial 1 0100000004000001
  PCI-e errors = Correctable Error Detected
                 Unsupported Request Detected
     Corrected = Advisory Non-Fatal Error
Comment 2 O. Hartmann 2015-04-09 14:11:40 UTC
See also:

Bug 197535 - [re] [panic] if_re (Realtek 8168) causes memory write after free and kernel panic

and https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=d6e572911a4cb2b9fcd1c26a38d5317a3971f2fd

(reported by Luca Pizzamiglio).

The proposed patch solved the problems I encountered. Obviously Linux people also encountered this problem and solved it - but FreeBSD not.

it would be nice having this nasty and unnecessary issue solved.
Comment 3 commit-hook freebsd_committer 2015-04-09 21:36:28 UTC
A commit references this bug:

Author: marius
Date: Thu Apr  9 21:35:45 UTC 2015
New revision: 281337
URL: https://svnweb.freebsd.org/changeset/base/281337

Log:
  Don't enable RX and TX before their initial configuration is done, i. e.
  after setting up interrupt moderation but before turning interrupts on.
  This matches what Realtek's r8168 Linux driver does as of version 8.039.00
  and fixes problems with certain incarnations of certain MAC revisions
  like the interface requiring an extra up/down-cycle after boot to start
  working or DMA configuration not being adhered to.

  PR:		193743, 197535
  MFC after:	1 week

Changes:
  head/sys/dev/re/if_re.c
Comment 4 Sean Bruno freebsd_committer 2015-05-03 21:00:10 UTC
This has been committed.
Comment 5 Dron 2015-06-30 13:30:34 UTC
Hello.
Seems problem exists also in 10.x Can this be backported to 10.x and included in next patchlevel?
Thanks.
Comment 6 Kubilay Kocak freebsd_committer freebsd_triage 2015-06-30 15:24:57 UTC
Re-open per request and comment #5 and assign to committer who resolved
Comment 7 commit-hook freebsd_committer 2015-07-05 20:17:33 UTC
A commit references this bug:

Author: marius
Date: Sun Jul  5 20:16:38 UTC 2015
New revision: 285177
URL: https://svnweb.freebsd.org/changeset/base/285177

Log:
  MFC: r281337

  Don't enable RX and TX before their initial configuration is done, i. e.
  after setting up interrupt moderation but before turning interrupts on.
  This matches what Realtek's r8168 Linux driver does as of version 8.039.00
  and fixes problems with certain incarnations of certain MAC revisions
  like the interface requiring an extra up/down-cycle after boot to start
  working or DMA configuration not being adhered to.

  PR:		193743, 197535
  Approved by:	re (kib)

Changes:
_U  stable/10/
  stable/10/sys/dev/re/if_re.c
Comment 8 commit-hook freebsd_committer 2015-07-05 20:17:41 UTC
A commit references this bug:

Author: marius
Date: Sun Jul  5 20:16:46 UTC 2015
New revision: 285178
URL: https://svnweb.freebsd.org/changeset/base/285178

Log:
  MFC: r281337

  Don't enable RX and TX before their initial configuration is done, i. e.
  after setting up interrupt moderation but before turning interrupts on.
  This matches what Realtek's r8168 Linux driver does as of version 8.039.00
  and fixes problems with certain incarnations of certain MAC revisions
  like the interface requiring an extra up/down-cycle after boot to start
  working or DMA configuration not being adhered to.

  PR:	193743, 197535

Changes:
_U  stable/9/sys/
_U  stable/9/sys/dev/
  stable/9/sys/dev/re/if_re.c
Comment 9 commit-hook freebsd_committer 2015-07-05 20:17:46 UTC
A commit references this bug:

Author: marius
Date: Sun Jul  5 20:16:52 UTC 2015
New revision: 285179
URL: https://svnweb.freebsd.org/changeset/base/285179

Log:
  MFC: r281337

  Don't enable RX and TX before their initial configuration is done, i. e.
  after setting up interrupt moderation but before turning interrupts on.
  This matches what Realtek's r8168 Linux driver does as of version 8.039.00
  and fixes problems with certain incarnations of certain MAC revisions
  like the interface requiring an extra up/down-cycle after boot to start
  working or DMA configuration not being adhered to.

  PR:	193743, 197535

Changes:
_U  stable/8/sys/
_U  stable/8/sys/dev/
_U  stable/8/sys/dev/re/
  stable/8/sys/dev/re/if_re.c