I got a HP Thunderbolt 3 Dock off Taobao the other day for around S$50. It’s a nice little dock, but with one little problem – Ethernet wouldn’t come up at all in Linux or Windows.
The Ethernet NIC in the dock was recognized as a “Broadcom NetXtreme BCM57786 Gigabit Ethernet PCIe” (it’s actually a BCM57762 though1), which uses the
tg3
driver. I tried feeding the PCI ID of the BCM57762 in the dock (14e4:16a3
) to the module, but that just wreaked havoc upon my iGPU and WiFi card for
reasons unknown.
Windows didn’t give any promising results either – updating the dock firmware and installing the Broadcom drivers provided by HP didn’t help, or I wouldn’t be here writing this now.
I went back into Linux and recompiled tg3.ko
, replacing the BCM57762 PCI ID defined in there with the PCI ID of the BCM57762 in my dock.2 It worked
fine, but I would have to do that with every computer I wanted to use the dock with. Not a very optimal solution, really.
Luckily, it seemed like the PCI ID of the BCM57762 was stored in the NIC EEPROM, and ethtool
lets you modify it:
-
Recompile
tg3.ko
to include the PCI ID of your BCM57762.
Create a folder with this Makefile:KDIR := /lib/modules/$(shell uname -r)/build PWD := $(shell pwd) default: $(MAKE) -C $(KDIR) M=$(PWD) modules
Then, copy
tg3.c
andtg3.h
for your Linux version into that folder, runmake
(you’ll probably need kernel headers installed for this), and load the module withsudo insmod tg3.ko
. -
Dump the EEPROM.
$ ethtool -e enp7s0 raw on > eeprom.bin
Replaceenp7s0
with the interface name of your NIC. This dump also serves as a backup in case we mess something else up later. -
Find the PCI ID within the EEPROM dump.
$ xxd -u eeprom.bin | grep 16A3 000000a0: 16A3 14E4 1682 14E4 0042 0000 0000 0000 .........B...... 00000d90: 8F42 00D8 3C02 16A3 2442 14E4 AFA2 0028 .B..<...$B.....(
I’m not particularly sure what that second match was about, but the first match has the PCI ID (
14e4:16a3
) and subsystem ID (14e4:1682
) of the NIC so I assumed that was the right one. -
Change the PCI ID to that of a normal BCM57762.
$ sudo ethtool -E enp7s0 magic 0x669955aa offset 0xa1 length 1 value 0x82
Again, replaceenp7s0
and the offset with the appropriate values, if it differs from mine. This changes the byte at offset0xa1
(a3
) to82
, which changes the PCI ID to14e4:1682
.
The magic key is device-specific to prevent accidental writes to the EEPROM, but can be found intg3.h
:
#define TG3_EEPROM_MAGIC 0x669955aa
-
Check that the PCI ID has actually changed. Unload the
tg3
module withsudo rmmod tg3
, then reconnect the dock. The originaltg3
module should load automatically, but you can also check the (hopefully changed) PCI ID withlspci -nn
.
You may also have to reauthorize the dock if it doesn’t show up.
With this, your bargain bin HP Thunderbolt 3 Dock should now have functional Ethernet without having to recompile kernel modules.
-
lspci -vvv
will tell you that the part number is BCM957762. Thelspci
dump in this bug report also shows that the proper PCI ID should be14e4:1682
↩︎ -
This guy here also had a similar idea; he elaborates more on this issue ↩︎