2

I have two identical network cards installed in my system (same device, same vendor).

Now I wanted to stub one network card in order to use PCIe passthrough.

I've come to realize that the two network cards have identical device ids:

$ lspci -nn
02:00.0 Ethernet controller [0200]: Realtek Semiconductor Co., Ltd. Device [10ec:8161] (rev 15)
03:00.0 Ethernet controller [0200]: Realtek Semiconductor Co., Ltd. Device [10ec:8161] (rev 15)

As you can see the PCI device id 10ec:8161 is the same for both network cards. I expected them to be different (i.e. that each network card has its own unique PCI device id).

Is this normal behaviour? How would I go about just stubbing one of the two network cards (using vfio-pci) ? Is it even possible?

0

1 Answer 1

3

This is not a device ID but a product ID – 10ec is the PCI vendor ID for Realtek and 8161 is the product or model ID for their "RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller". It is not a serial number and is not supposed to be unique, quite the opposite.

The unique "bus ID" of each card on your PCI bus is the leftmost column, with [0000:]02:00.0 being your first card and 03:00.0 being the second. Most tools dealing with PCI reference devices by their bus ID, which usually remains stable as long as the topology doesn't change, e.g. a card installed in that specific slot is going to remain 03:00.

(The format of a bus ID as shown by lspci is "[domain:]bus:device.function".)

Your lspci output does not contain any globally unique ID; in fact I'm not sure whether PCI devices generally have one. (Running sudo lspci -v appears to show a capability "[13c] Device Serial Number:" for some devices, but not all of them.)


If I understand correctly, writing a VID:PID to the "new_id" file of a PCI driver only allows that driver to be bound to matching devices, but doesn't actively kick out any other drivers (i.e. you still have to unbind each device from its original driver and bind it to vfio-pci). Looking at DPDK's tools, the latter part is still done by bus ID:

echo 10ec 8161 > /sys/bus/pci/drivers/vfio-pci/new_id
[...]
echo 0000:03:00.0 > /sys/bus/pci/drivers/r8169/unbind
echo 0000:03:00.0 > /sys/bus/pci/drivers/vfio-pci/bind
2
  • First of all: thank you so much for this very quick reply! I tried to find some information about PCI identifiers in general, but I found it very hard to find anything :/ Ok. So if that "id" is to identify a product and not a device is it even possible to stub just one of the two network cards [if they're identical]? (for example with vfio-pci.ids=...)
    – Marco
    Jan 28 at 16:29
  • 1
    Not sure, but if the usage docs at docs.kernel.org/driver-api/vfio.html#vfio-usage-example show the device being manually unbound from its original driver by bus ID, wouldn't it be possible to also manually bind the same device to vfio-pci using some form of echo 03:00.0 > /sys/bus/pci/drivers/vfio-pci/bind? (It seems that's what DPDK does.)
    – user1686
    Jan 28 at 16:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.