Bug 225325 - RealTek 8169 network devices don't seem to work with memory mapped registers
Summary: RealTek 8169 network devices don't seem to work with memory mapped registers
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-net (Nobody)
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2018-01-19 18:56 UTC by aaron.styx
Modified: 2018-01-24 12:56 UTC (History)
1 user (show)

See Also:


Attachments
re 8169 fix (419 bytes, patch)
2018-01-19 18:58 UTC, aaron.styx
no flags Details | Diff
/var/log/messages re1 output (1.88 KB, text/plain)
2018-01-23 11:37 UTC, aaron.styx
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description aaron.styx 2018-01-19 18:56:32 UTC
I came across a RealTek network device (device id 0x8169) that doesn't work with memory mapped registers. Reverting to using IO space as is already being done for the 8169SC (0x8167) devices solved the problem. Patch is attached.
Comment 1 aaron.styx 2018-01-19 18:58:11 UTC
Created attachment 189913 [details]
re 8169 fix
Comment 2 Marius Strobl freebsd_committer freebsd_triage 2018-01-22 22:06:45 UTC
(In reply to aaron.styx from comment #1)

Unfortunately, RT_DEVICEID_8169 is rather broad and there definitely are
members of that family which are know to work just fine when using the
SYS_RES_MEMORY-type BAR. What are the exact chip and MAC revisions as
reported in the re(4) attach message that is failing for you? Please post
all lines emitted by re(4) during attach so we also see all resources
assigned.
Also what exactly do you mean by "doesn't work"? In case this is an add-on
card, have you tried it in a different kind of machine?
Comment 3 aaron.styx 2018-01-23 11:37:17 UTC
Created attachment 189996 [details]
/var/log/messages re1 output

After submitting the bug, I did some digging and saw how common this chip is, so I would agree that simply forcing all of them to use IO mapped registers is not the right solution. The attached is the relevant output of /var/log/messages. (Note that this is from a 10.1 Live CD). 

I clearly need to do some more testing with this. I'll try this card in a different machine, and I'd also like to compile with RE_DIAG to see if this is simply a known problem with this device, but that will take me a bit. I'm not sure if the 10.1 live cd build is compiled with this or not...

As for the meaning of "doesn't work," I'm able to set the address and bring the device up with ifconfig, which reports the device is up and active. However, any attempts to ping another host on the network results in 'sendto: Host is down.' Wireshark shows no packets coming from the 1869 re device. 

Other network devices on this machine work as expected, so I know it's not a network issue. Setting hw.re.prefer_iomap=1 also works. The device works on Linux in this machine, though I haven't taken a close look at their driver yet, or figured out if they're using Memory or IO mapped registers.
Comment 4 aaron.styx 2018-01-24 12:56:20 UTC
Tested this card on an older machine and it worked fine with memory mapped registers. The problem system is with an Asus p8h67-m pro. Investigation ongoing...