From 9d3ad80abd34f2420998d94606e208518d330bcc Mon Sep 17 00:00:00 2001 From: Jim Harris Date: Tue, 13 Oct 2020 10:03:16 -0700 Subject: [PATCH] bus/pci: copy new id for inserted device on Linux When a device is inserted into an existing BDF slot that has not been probed, we must overwrite the old PCI ID with the ID of the new function. Otherwise we may not probe the function with the correct driver, if at all. Signed-off-by: Jim Harris --- drivers/bus/pci/linux/pci.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c index bf275947f4..619d209ad2 100644 --- a/drivers/bus/pci/linux/pci.c +++ b/drivers/bus/pci/linux/pci.c @@ -352,6 +352,7 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr *addr) if (!rte_dev_is_probed(&dev2->device)) { dev2->kdrv = dev->kdrv; dev2->max_vfs = dev->max_vfs; + dev2->id = dev->id; pci_name_set(dev2); memmove(dev2->mem_resource, dev->mem_resource, @@ -365,7 +366,8 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr *addr) * need to do anything here unless... **/ if (dev2->kdrv != dev->kdrv || - dev2->max_vfs != dev->max_vfs) + dev2->max_vfs != dev->max_vfs || + memcmp(&dev2->id, &dev->id, sizeof(dev2->id))) /* * This should not happens. * But it is still possible if -- 2.20.1