Bug 275251 - Realtek PCIe 2.5GbE Family Controller not being detected
Summary: Realtek PCIe 2.5GbE Family Controller not being detected
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 14.0-RELEASE
Hardware: amd64 Any
: --- Affects Some People
Assignee: freebsd-net (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-11-22 02:38 UTC by iio7
Modified: 2024-03-20 03:54 UTC (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description iio7 2023-11-22 02:38:22 UTC
I have a MSI MAG B660M MORTAR motherboard with a Realtek PCIe 2.5GbE Family Controller which is not detected.

# dmesg|grep ethernet
pci4: <network, ethernet> at device 0.0 (no driver attached)

I suspect that is it.

I can get the card up using the realtek-re-kmod driver however, that doesn't work correctly with the card as it get's "routines:ssl3_get_record:decryption failed or bad record mac, errno 0" when using any kind of OpenSSL encrypted connection whether HTTP, SFTP, or IMAP, etc.

According to the user manual it's a Realtek 8125BG 2.5Gbps LAN controller.
Comment 1 Zhenlei Huang freebsd_committer freebsd_triage 2023-11-22 09:22:29 UTC
(In reply to iio7 from comment #0)
> I have a MSI MAG B660M MORTAR motherboard with a Realtek PCIe 2.5GbE Family 
> Controller which is not detected.

> # dmesg|grep ethernet
> pci4: <network, ethernet> at device 0.0 (no driver attached)

> I suspect that is it.
You may try `pciconf -l | grep none` to identify it further.

> I can get the card up using the realtek-re-kmod driver however, that doesn't work 
> correctly with the card as it get's "routines:ssl3_get_record:decryption failed or
> bad record mac, errno 0" when using any kind of OpenSSL encrypted connection whether
> HTTP, SFTP, or IMAP, etc.
Can you please elaborate the errors?

And what is shown by `ifconfig re0` ?


> According to the user manual it's a Realtek 8125BG 2.5Gbps LAN controller.

CC realtek-re-kmod driver port maintainer Alex .
Comment 2 iio7 2023-11-22 19:58:52 UTC
(In reply to Zhenlei Huang from comment #1)

$ pciconf -l | grep none
none0@pci0:0:8:0: class=0x088000 rev=0x05 hdr=0x00 vendor=0x8086 device=0x464f subvendor=0x1462 subdevice=0x7d42
none1@pci0:0:10:0: class=0x118000 rev=0x01 hdr=0x00 vendor=0x8086 device=0x467d subvendor=0x0000 subdevice=0x0000
none2@pci0:0:20:2: class=0x050000 rev=0x11 hdr=0x00 vendor=0x8086 device=0x7aa7 subvendor=0x0000 subdevice=0x0000
none3@pci0:0:22:0: class=0x078000 rev=0x11 hdr=0x00 vendor=0x8086 device=0x7ae8 subvendor=0x1462 subdevice=0x7d42
none4@pci0:0:31:5: class=0x0c8000 rev=0x11 hdr=0x00 vendor=0x8086 device=0x7aa4 subvendor=0x1462 subdevice=0x7d42
none5@pci0:4:0:0:  class=0x020000 rev=0x05 hdr=0x00 vendor=0x10ec device=0x8125 subvendor=0x1462 subdevice=0x7d42

With the realtek-re-kmod driver I get:

$ ifconfig re0
re0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=201b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,WOL_MAGIC>
        ether 04:7c:16:44:25:0b
        inet 192.168.1.26 netmask 0xffffff00 broadcast 192.168.1.255
        media: Ethernet autoselect (1000baseT <full-duplex>)
        status: active
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>

With the driver from base, there is no interface showing at all.

With the realtek-re-kmod driver I get problems on many OpenSSL related transfers.

$ curl -O https://www.unixsheikh.com/includes/files/the-biggest-myths.pdf
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
12  763k   12 98139    0     0   377k      0  0:00:02 --:--:--  0:00:02  378k
curl: (56) OpenSSL SSL_read: OpenSSL/1.1.1t: error:1408F119:SSL routines:ssl3_get_record:decryption failed or bad record mac, errno 0

This also occurs with IMAP and SFTP.

I have attached an Intel NIC to the same machine (in order to be able to do some work), when I plug out the Ethernet cable from the Realtek NIC and use the Intel NIC all the problems goes away.

I have tried running Linux on the box and tried using cURL, IMAP, etc., and then it works.

Furtermore, I have another older box also with a Realtek NIC which has the exact same SSL problems with the realtek-re-kmod driver.

This is the other box:

$ ifconfig re0
re0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=201b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,WOL_MAGIC>
        ether d0:50:99:59:15:7e
        inet 192.168.1.3 netmask 0xffffff00 broadcast 192.168.1.255
        media: Ethernet autoselect (1000baseT <full-duplex>)
        status: active
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>

# dmesg |grep re0
re0: <Realtek PCIe GbE Family Controller> port 0xe000-0xe0ff mem 0xd0704000-0xd0704fff,0xd0700000-0xd0703fff irq 18 at device 0.0 on pci1
re0: Using Memory Mapping!
re0: Using 1 MSI-X message
re0: ASPM disabled
re0: version:1.98.00
re0: Ethernet address: d0:50:99:59:15:7e
re0: Ethernet address: d0:50:99:59:15:7e
re0: link state changed to UP
re0: <Realtek PCIe GbE Family Controller> port 0xe000-0xe0ff mem 0xd0704000-0xd0704fff,0xd0700000-0xd0703fff irq 18 at device 0.0 on pci1
re0: Using Memory Mapping!
re0: Using 1 MSI-X message
re0: ASPM disabled
re0: version:1.98.00
re0: Ethernet address: d0:50:99:59:15:7e
re0: Ethernet address: d0:50:99:59:15:7e
re0: link state changed to UP

After the upgrade to FreeBSD 14 on the older box, I have removed the realtek-re-kmod driver since that one seems to work well with the driver from base at the moment.
Comment 3 Alex Dupre freebsd_committer freebsd_triage 2023-11-28 15:25:54 UTC
Can you try to manually build the 1.99 branch (https://github.com/alexdupre/rtl_bsd_drv/tree/v1.99) at the latest commit (9d48464) and provide an updated feedback on the SSL issue, please?
Comment 4 iio7 2023-11-30 05:10:36 UTC
(In reply to Alex Dupre from comment #3)

I would very much like to do that, but I haven't done anything build related in years. How do I manually build the 1.99 branch?
Comment 5 iio7 2023-12-06 17:04:07 UTC
I need to know what I need.

The Makefile has this:

.PATH:	${.CURDIR}/../../dev/re

which doesn't make any sense to me.
Comment 6 Olivier Cochard freebsd_committer freebsd_triage 2023-12-08 15:59:54 UTC
Here is a 14.0-RELEASE realtek-re-kmod-199.00 package for you:

fetch https://people.freebsd.org/~olivier/beta_packages/14/realtek-re-kmod-199.00.pkg


And by the way, this problem isn't reproducible on this chipset:

none2@pci0:2:0:0:       class=0x020000 rev=0x05 hdr=0x00 vendor=0x10ec device=0x8125 subvendor=0x10ec subdevice=0x0123
    vendor     = 'Realtek Semiconductor Co., Ltd.'
    device     = 'RTL8125 2.5GbE Controller'
    class      = network
    subclass   = ethernet
Comment 7 iio7 2023-12-08 23:25:11 UTC
(In reply to Olivier Cochard from comment #6)

Thank you, but I like to be able to build it myself. Also for future situations in which I may need to do it again.

How do I build it? Is it just by using ports?
Comment 8 Olivier Cochard freebsd_committer freebsd_triage 2023-12-09 10:00:36 UTC
For local quick development and test, if you don't need to generate a package, because this code is simple (doesn't require lot's of building dependencies), the easiest way is the "raw way":

git clone --branch v1.99 https://github.com/alexdupre/rtl_bsd_drv.git
cd rtl_bsd_drv
make
cp if_re.ko /boot/modules/

If you would like to build a package the recommended way is to use poudriere, but a little more complex because you have to understand some basic port build system knowledge.
Comment 9 iio7 2023-12-16 01:45:10 UTC
(In reply to Olivier Cochard from comment #8)

Thank you very much :)

I finally had the time to test v1.99 out on the machine with the SSL problem and v1.99 has indeed fixed that. It works.

Do you want me to test the other machine in order to see if the card gets recognized with the v1.99?
Comment 10 Alex Dupre freebsd_committer freebsd_triage 2023-12-16 09:23:28 UTC
Any test is helpful. Wasn't the other card already recognized by the 1.98 version, though?
Comment 11 iio7 2023-12-17 00:41:16 UTC
(In reply to Alex Dupre from comment #10)

No, the Realtek PCIe 2.5GbE Family Controller on the MSI MAG B660M MORTAR motherboard is not detected.

# dmesg|grep ethernet
pci4: <network, ethernet> at device 0.0 (no driver attached)

I will test with the new driver and get back.
Comment 12 Alex Dupre freebsd_committer freebsd_triage 2023-12-17 09:06:19 UTC
(In reply to iio7 from comment #11)

Your initial message says "I can get the card up using the realtek-re-kmod driver", so I don't understand what card you are talking about that was not already recognized by the 1.98 version. Anyway, let's see if the ssl issue has been fixed even there with the new driver, thanks.
Comment 13 iio7 2023-12-17 19:12:58 UTC
(In reply to Alex Dupre from comment #12)

I am sorry, it is because I had multiple machines with problems and I think I managed to mix the two bug reports up (having both open in tabs).

Two of the machines was suffering from the SSL problem, that has now been fixed. Originally bug #274995

One of the machines has another problem (not SSL related), which is what this bug report originally addressed, "Realtek PCIe 2.5GbE Family Controller not being detected".

The machine with the problem runs with a MSI MAG B660M MORTAR motherboard with a Realtek PCIe 2.5GbE Family Controller which isn't detected.

# dmesg|grep ethernet
pci4: <network, ethernet> at device 0.0 (no driver attached)

I have tried both with the native FreeBSD driver and this evening with the v1.99 version of the realtek-re-kmod driver (which I compiled).

None of the drivers work. The card is not detected at all.
Comment 14 Alex Dupre freebsd_committer freebsd_triage 2023-12-19 12:59:56 UTC
Can you run `pciconf -lv` and post the relevant lines for the realtek network card, please?
Comment 15 iio7 2023-12-20 16:25:57 UTC
(In reply to Alex Dupre from comment #14)

Yes, of course.

none5@pci0:4:0:0: class=0x020000 rev=0x05 hdr=0x00 vendor=0x10ec device=0x8125 subvendor=0x1462 subdevice=0x7d42
vendor     = 'Realtek Semiconductor Co., Ltd.'
device     = 'RTL8125 2.5GbE Controller'
class      = network
subclass   = ethernet

Please let me know if there is anything else I can do.
Comment 16 Alex Dupre freebsd_committer freebsd_triage 2023-12-21 12:01:05 UTC
(In reply to iio7 from comment #15)

It seems quite weird given that the PCI vendor and device id are supported by the driver, so the driver should try to attach. Are you sure the kernel module has been correctly built/loaded? Any error after loading it?
Comment 17 iio7 2023-12-21 20:06:58 UTC
(In reply to Alex Dupre from comment #16)

Yes it's weird.

Just to make sure I didn't make any mistakes, I did a fresh install of FreeBSD 14 on the machine. As there is no network, I git cloned the files for v1.99 unto a USB stick on another machine and the compiled the driver on the affected box.

After rebooting, the kernel module is clearly loaded:

$ kldstat
Id Refs Address                Size Name
 1   40 0xffffffff80200000  1d34598 kernel
 2    1 0xffffffff81f35000    129d0 if_re.ko
 3    1 0xffffffff82910000     3390 acpi_wmi.ko
 4    1 0xffffffff82914000     3250 ichsmb.ko
 5    1 0xffffffff82918000     2178 smbus.ko
 6    1 0xffffffff8291b000     3360 uhid.ko
 7    1 0xffffffff8291f000     33c0 usbhid.ko
 8    1 0xffffffff82923000     3380 hidbus.ko
 9    1 0xffffffff82927000     3360 wmt.ko
10    1 0xffffffff8292b000     4364 ums.ko

Still, the driver is not attached:

# dmesg|grep ethernet
pci4: <network, ethernet> at device 0.0 (no driver attached)

However, I decided to manually unload the module and load it again, which causes a kernel panic!

I rebooted the box and checked in /var/crash, however all the files are empty:

# ls -l /var/crash
total 4
-rw-r--r--  1 root wheel 0 Dec 21 20:24 bounds
-rw-r--r--  1 root wheel 0 Dec 21 20:24 core.txt.0
-rw-------  1 root wheel 0 Dec 21 20:24 info.0
lrwxr-xr-x  1 root wheel 0 Dec 21 20:24 info.last -> 
-rw-r--r--  1 root wheel 5 Nov 10 09:16 minfree
-rw-------  1 root wheel 0 Dec 21 20:24 vmcore.0
lrwxr-xr-x  1 root wheel 0 Dec 21 20:24 vmcore.last ->

I do not know how to proceed from here.
Comment 18 Alex Dupre freebsd_committer freebsd_triage 2023-12-22 12:51:59 UTC
Did you follow these instructions to load the built module before the kernel? https://github.com/freebsd/freebsd-ports/blob/main/net/realtek-re-kmod/pkg-message#L4-L8
Comment 19 iio7 2023-12-23 02:35:00 UTC
(In reply to Alex Dupre from comment #18)

Yes.
Comment 20 Mariah Carey 2024-03-20 03:54:41 UTC
MARKED AS SPAM