Feature #11690
closedAdd an option to rescan PCI buses to allow NIC hotplug
0%
Description
Hi,
Would it be possible to add an option to rescan PCI buses? Maybe just a playback command would be enough.
I am surprised that there are no open issues that mention this. The only thing I was able to find is a forum post from 2012 in which jimp explained that it was not possible at the time.
I was able to hotplug an EM1000 NIC from ESXi after finding out which PCI bus the existing NICs were using with devinfo
:
pcib2 pci2 em0 em1
It looks like pciconf -l em0
can also help us identify the bus number of the current NICs:
em0@pci0:2:0:0: class=0x020000 card=0x075015ad chip=0x100f8086 rev=0x01 hdr=0x00@
I then ran devctl rescan pci2
which made the new interface appear as shown by dmesg
's output:
em2: <Intel(R) PRO/1000 Legacy Network Connection 1.1.0> at device 3.0 on pci2 em2: Ethernet address: xx:xx:xx:xx:xx:xx em2: netmap queues/slots: TX 1/256, RX 1/256 em2: link state changed to UP
Updated by Jim Pingle almost 4 years ago
- Status changed from New to Rejected
I don't think we'd ever recommend doing that. If you must, you can run the command manually, but there could be drastic unintended consequences, especially in cases when the NICs probe in an unexpected order. For example in ESX when you add >4 NICs and they rearrange numbering. The manual probe could be different than the boot time probe and end up with a giant mess.
The safest way to add such NICs is always power off + add + reboot. Anything else is asking for trouble.
Updated by Louis Sautier almost 4 years ago
Hi Jim, thanks for the explanation.
If I understand correctly, the problem would only occur if I add more than 4 NICs at once, right?
Is that ESX behaviour documented anywhere? If the NICs are reordered, I assume that this would also break Linux guests that use predictable interface names.
Updated by Jim Pingle almost 4 years ago
The probe order for >4 NICs is a well documented issue with ESX across multiple operating systems. It may not affect some as much as others if they associate things by MAC address and so on, but for FreeBSD which numbers NICs by the order they are probed, it's a regular problem.