Bug 186401 - [re] Problem with RTL8111/8168B initialization
Summary: [re] Problem with RTL8111/8168B initialization
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: Unspecified
Hardware: Any Any
: Normal Affects Only Me
Assignee: Pyun YongHyeon
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-02-03 08:20 UTC by marcinkk
Modified: 2018-05-28 19:46 UTC (History)
0 users

See Also:


Attachments
re.stopreq.diff (625 bytes, patch)
2014-02-07 04:47 UTC, pyunyh
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description marcinkk 2014-02-03 08:20:00 UTC
The problem is described there: https://forums.freebsd.org/viewtopic.php?f=32&t=22664&p=248509#p248509. I don't know if I can use formating here. The answer on forum sugessts filling bug report, so I've done it.

I've installed FreeBSD 10.0 RELEASE amd64 on new machine: MSI B85M-G43 (MS-7823).

With the following line in rc.conf:

    ifconfig_re0="DHCP"


the Realtek NIC was detected and re(4) driver was initialized but the card can't get IP configuration from DHCP. After boot I can see in ifconfig re0:

    re0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
            options=8209b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,WOL_MAGIC,LINKSTATE>
            ether 44:8a:5b:26:cc:ae
            nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
            media: Ethernet autoselect (1000baseT <full-duplex,master>)
            status: active


The card doesn't have IP and doesn't work. I've tried set IP manually but it didn't help. After reading the posts in mentioned topic I've tried some options. I've logged to the system and make the command ifconfig re0 tso and the card gets IP in few seconds and everything worked fine. So I've changed rc.conf to:

    ifconfig_re0="DHCP tso"


But it didn't help. And I've noticed that any change in one of the 3 parameters suggested on forum to turn off earlier: tso, rxcsum, txcsum changed after login makes the NIC working: ifconfig re0 -rxcsum or ifconfig re0 -txcsum helps too. It could be also -rxcsum inf rc.conf and ifconfig re0 rxcsum after login. And so on...

pciconf says:

    re0@pci0:2:0:0: class=0x020000 card=0x78231462 chip=0x816810ec rev=0x0c 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 rxe000, size 256, enabled
        bar   [18] = type Memory, range 64, base rxf7c00000, size 4096, enabled
        bar   [20] = type Prefetchable Memory, range 64, base rxf0000000, 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 0 corrected
        ecap 0002[140] = VC 1 max VC0
        ecap 0003[160] = Serial 1 01000000684ce000
        ecap 0018[170] = LTR 1


So I made a little workaround putting to /etc/rc.local line:

    /sbin/ifconfig re0 tso


And I still have problems on start with the initial communication with DHCP but the interface wakes up after rc.local file is processed and seems to work properly afterwards.

The rc.conf has only:

    ifconfig_re0="DHCP"


How to make it better? Is there a problem with driver initialization?

PS. I've had the same problem while trying to install. The system was installed using USB->Ethernet adapter.

Fix: 

Change one of the tso, rxcsum and txcsum parameters for the re0 interface after booting. Maybe any change of the possible interface parameters?
How-To-Repeat: Boot the system from CD on the MSI B85M-G43 (MS-7823) motherboard...
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2014-02-04 01:46:14 UTC
Responsible Changed
From-To: freebsd-amd64->freebsd-net

reclassify.
Comment 2 Pyun YongHyeon freebsd_committer freebsd_triage 2014-02-05 08:07:04 UTC
State Changed
From-To: open->feedback

Would you show me dmesg output(re(4)/rgephy(4) only)? 


Comment 3 Pyun YongHyeon freebsd_committer freebsd_triage 2014-02-05 08:07:04 UTC
Responsible Changed
From-To: freebsd-net->yongari

Grab.
Comment 4 pyunyh 2014-02-06 00:32:26 UTC
On Wed, Feb 05, 2014 at 11:25:00AM +0100, Marcin Kucharczyk wrote:
> I don't know how it works. I've creted bug report and it dissapeared and it
> came back ...
> 

Probably
http://www.freebsd.org/doc/en_US.ISO8859-1/articles/problem-reports/article.html
shall answer your question.
I also added bug-followup@FreeBSD.org to CC list in order to make
GNATS track this mail.

> I found the message: "Would you show me dmesg output(re(4)/rgephy(4)
> only)?"
> 
> As I understood this is required:
> 
> # dmesg | grep rgephy0
> 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
> 
> # dmesg | grep re0
> re0: <RealTek 8168/8111 B/C/CP/D/DP/E/F/G PCIe Gigabit Ethernet> port
> 0xe000-0xe0ff mem 0xf7c00000-0xf7c00fff,0xf0000000-0xf0003fff irq 16 at
> device 0.0 on pci2
> re0: Using 1 MSI-X message
> re0: Chip rev. 0x4c000000
> re0: MAC rev. 0x00000000
> miibus0: <MII bus> on re0
> re0: Ethernet address: 44:8a:5b:26:cc:ae
> re0: link state changed to DOWN
> re0: link state changed to UP
> 

Thanks for the information.  It seems your controller is RTL8168G.
Recently marius@ committed a fix for several RealTek controllers.
I guess it's worth to try the fix(r261531).  Because there were
a couple of style changes to re(4), I guess it would be better
to grab latest re(4) driver source from HEAD and rebuild the driver
on 10.0-RELEASE.

Grab if_re.c and if_rlreg.h from the following URLs.
http://svnweb.freebsd.org/base/head/sys/dev/re/if_re.c
http://svnweb.freebsd.org/base/head/sys/pci/if_rlreg.h
Use latest revision of the file.
Copy if_re.c to /usr/src/sys/dev/re directory.
and copy if_rlreg.h to /usr/src/sys/pci directory and rebuild
kernel/reboot.
Of course you may want to save if_re.c and if_rlreg.h files to safe
place before overwriting them.

Let me know whether latest driver works or not.
Thanks.
Comment 5 pyunyh 2014-02-07 04:47:33 UTC
On Thu, Feb 06, 2014 at 12:43:28PM +0100, Marcin Kucharczyk wrote:
> 2014-02-06 1:32 GMT+01:00 Yonghyeon PYUN <pyunyh@gmail.com>:
> 
> > Grab if_re.c and if_rlreg.h from the following URLs.
> > http://svnweb.freebsd.org/base/head/sys/dev/re/if_re.c
> > http://svnweb.freebsd.org/base/head/sys/pci/if_rlreg.h
> > Use latest revision of the file.
> > Copy if_re.c to /usr/src/sys/dev/re directory.
> > and copy if_rlreg.h to /usr/src/sys/pci directory and rebuild
> > kernel/reboot.
> > Of course you may want to save if_re.c and if_rlreg.h files to safe
> > place before overwriting them.
> >
> > Let me know whether latest driver works or not.
> > Thanks.
> >
> 
> No change: boot, login and no network but after ifconfig re0 tso works
> fine...
> 

Thanks for testing.  Could you try attached patch?

> Regards, Marcin
Comment 6 richardr 2014-02-11 01:31:42 UTC
I have what I believe is the same problem as Marcin. The interface
despite being shown in ifconfig does not function until I take it down
and then bring it back up. I have recompiled my kernel using the re
driver from HEAD and then again with the patch applied and neither
solved my problem.

output of pciconf -lbev:
re0@pci0:1:0:0: class=0x020000 card=0x77211462 chip=0x816810ec rev=0x06
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 rxe000, size 256, enabled
    bar   [18] = type Prefetchable Memory, range 64, base rxd0004000,
size 4096, enabled
    bar   [20] = type Prefetchable Memory, range 64, base rxd0000000,
size 16384, enabled
     Corrected = Advisory Non-Fatal Error
Comment 7 Eitan Adler freebsd_committer freebsd_triage 2018-05-28 19:46:11 UTC
batch change:

For bugs that match the following
-  Status Is In progress 
AND
- Untouched since 2018-01-01.
AND
- Affects Base System OR Documentation

DO:

Reset to open status.


Note:
I did a quick pass but if you are getting this email it might be worthwhile to double check to see if this bug ought to be closed.