How to load ure module for USB NIC if device id isn't in the driver?

Started by moonman, September 22, 2024, 12:03:59 AM

Previous topic - Next topic
Hi, I need to add 2 extra ethernet ports to my firewall (a little Intel N100 fanless box with 4 ethernet ports) for low bandwidth-ish devices (PiKVM and a printer). I have 2 MS Surface USB3 gigabit adapters with realtek 8153b chips in them and got them to work with cdc generic driver by settings them to mode 1. The problem is that this driver is pretty bad in terms of maximum bandwidth (250Mbit/s) and latency. realtek 8153b is supposed to be decently supported with the "ure" driver which I am hoping will improve the latency at high load. I suspect that ure driver doesn't get loaded because the device id is just not in the driver code. Is there any way to make the driver load for my device passing device id at runtime (which is possible on linux).

I had these nics running under linux before and they were rock solid with months uptime.

ugen0.3: <RTL8153B GigE [Surface Ethernet Adapter] Microsoft Corp.> at usbus0, cfg=1 md=HOST spd=SUPER (5.0Gbps) pwr=ON (72mA)

  bLength = 0x0012
  bDescriptorType = 0x0001
  bcdUSB = 0x0300
  bDeviceClass = 0x0000  <Probed by interface class>
  bDeviceSubClass = 0x0000
  bDeviceProtocol = 0x0000
  bMaxPacketSize0 = 0x0009
  idVendor = 0x045e
  idProduct = 0x0927
  bcdDevice = 0x3100
  iManufacturer = 0x0001  <Microsoft>
  iProduct = 0x0002  <Ethernet Adapter>
  iSerialNumber = 0x0006  <001008A1A>
  bNumConfigurations = 0x0002

This is the link to the Latest Realtek drivers ,
https://freebsd.pkgs.org/14/freebsd-amd64/realtek-re-kmod-1100.00_1.pkg.html
I have the RTL8125B(G) x 3 on my N100 fanless install. 
I got this pkg file
https://pkg.freebsd.org/FreeBSD:14:amd64/latest/All/realtek-re-kmod-1100.00_1.pkg
download it to another system & put on a USB.

Then ,  put the usb in the other system and did :
# mount usb (in my case it was da0 device, first partition p1 = da0p1)
mkdir /mnt/usbstick
ls -l /dev/da0*
mount -t msdosfs /dev/da0p1 /mnt/usbstick

pkg add /mnt/usbstick/realtek-re-kmod-1100.00_1.pkg

Then unmount the usb
# usb unmount
umount /mnt/usbstick
rm -rf /mnt/usbstick

Now you have to tell it to load at boot :
Edit /boot/loader.conf.local     Add the 2 lines :
if_re_load="YES"
if_re_name="/boot/modules/if_re.ko"

Then reboot and Check:

reboot

Make sure the NIC is present here
ifconfig -a

now you should be able to find it in "Assign interfaces" or the Web-gui .

note:  if it doesn't DHCP an ip on  auto-negotiate ,  in the gui you can specify 2.5 g full duplex.  it has an issue with auto depending on what it's connected to. Mine was cable modem on wan, once changed worked faster than ever.

Hope this helps,  Cheers !

Thank you for trying to help. However 8125b (2.5Gb/s, pcie) is very different from 8153 (Gigabit,USB).

realtek-re-kmod package is for PCI-E only adapters.
Realtek PCIe FE / GBE / 2.5G / 5G Ethernet Family Controller
kernel driver.


Also I am not sure if it's exactly the same driver, but you can also install a package from within the GUI from under System -> Firmware -> Plugins -> os-realtek-re

I know 8153b is supported by "ure" driver in Freebsd, implementation is pretty good, it's just the driver doesn't recognise my hardware because there are a ton of different vendor/device ids for the same chip and the Surface adapter may not be on the list. I know in linux I can force a driver to start using a certain vendor/device id through configuration file/at boot. I am not that familiar with *bsd so I was hoping there is a similar mechanism

I was showing you more "how I did it" than telling you the same driver, though the Realtek site should have one for you, just use it in this same way.

As for the re package in there already, it's an older driver without the "fix" for borking under load.  And as your's is a realtek chipset it might be the same issue.

Just thought it might work or point you in the right direction.   Cheers !