From 05c625f1f68eb6a2a3686caba3588ca4e2d5145e Mon Sep 17 00:00:00 2001 From: Vladimir Zhigulin Date: Fri, 19 Apr 2024 12:08:02 +0200 Subject: vlib: avoid pci scan without registrations Type: improvement Signed-off-by: Vladimir Zhigulin Change-Id: Id1d78a36cec10a01fbf266b016ba364519e5cb66 --- src/vlib/linux/pci.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src/vlib') diff --git a/src/vlib/linux/pci.c b/src/vlib/linux/pci.c index f7c63bc3607..29ca3d97523 100644 --- a/src/vlib/linux/pci.c +++ b/src/vlib/linux/pci.c @@ -1561,14 +1561,17 @@ linux_pci_init (vlib_main_t * vm) ASSERT (sizeof (vlib_pci_addr_t) == sizeof (u32)); - addrs = vlib_pci_get_all_dev_addrs (); - vec_foreach (addr, addrs) + if (pm->pci_device_registrations) { - vlib_pci_device_info_t *d; - if ((d = vlib_pci_get_device_info (vm, addr, 0))) + addrs = vlib_pci_get_all_dev_addrs (); + vec_foreach (addr, addrs) { - init_device_from_registered (vm, d); - vlib_pci_free_device_info (d); + vlib_pci_device_info_t *d; + if ((d = vlib_pci_get_device_info (vm, addr, 0))) + { + init_device_from_registered (vm, d); + vlib_pci_free_device_info (d); + } } } -- cgit 1.2.3-korg