Score:0

PTP support for RTL8125B-CG NIC in Ubuntu 20.04

ca flag

I have an RTL8125B-CG NIC which, from what I gather from their product page, has hardware support for PTP. However, sudo ethtool -T does not detect any HW timestamping capabilities.

I've tried with the r8169 driver and with the r8125 driver from Realtek (both this one from Github and this one from Realtek's download page), but without success. In the Makefile in the source code, there seems to be a flag which indicate that PTP support is not enabled by default, but when I enable this flag I can't compile (I get the error presented in this issue).

Anyone have any experience or know what I can do to get PTP support enabled?

I'm running Ubuntu 20.04 and the 5.11.0-36-generic kernel.

Score:0
ca flag

See the issue on Github for an answer: https://github.com/awesometic/realtek-r8125-dkms/issues/9

In short, the issue with compilation was that in the newest version of the driver (9.006.04) Realtek had removed the spinlock_t lock member variable from struct rtl8125_private, but not updated the PTP file accordingly. Hence, all the spin_lock_irqsave and spin_lock_irqrestore routines won't compile. There are two ways to fix this:

  1. Comment out all of the spin_lock_irqsave and spin_lock_irqrestore routines in the PTP file, or
  2. Add back the spinlock_t lock member in the struct rtl8125_private.

The latter is probably more safe since we don't know if the IRQs are vital for the function of the driver. That being said, I did try both solutions and both made the driver compile and report PTP HW capabilities, so I don't know which is best.

However, I still think the driver is quite buggy, as I still can't use HW timestamping is slave mode, and I have trouble getting reliable results. I often run into the problem that ptp4l from linuxptp times out trying to get a timestamp from the driver. I have two different computers with r8125 NICs, and it works sometimes on one computer and very seldomly on the other. I suspect the PTP function has not been well tested by Realtek, although this is just speculation on my part.

in flag
Hi Eirik, welcome to the community. In order to make your answer more useful for the other members, you should always include at least a summary of the actual solution in your post, and use external links only as a reference. Would you mind editing your answer?
eirik-ff avatar
ca flag
Of course, sorry! I've updated my answer now. :)
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.