From 018f6611f0513a3133e472648a0debebb08f21a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jarom=C3=ADr=20Smr=C4=8Dek?= <4plague@gmail.com> Date: Fri, 15 Sep 2023 13:33:55 +0200 Subject: [PATCH] Improved PCI address parsing in intitialization --- src/dp_port.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/dp_port.c b/src/dp_port.c index 7dcc21b5e..4c90b247a 100644 --- a/src/dp_port.c +++ b/src/dp_port.c @@ -453,8 +453,10 @@ static int dp_port_fill_info(struct dp_port *port) if (!busname || strncmp(busname, "pci", 4) != 0) return DP_ERROR; + domain_num = 0; // can be omitted in the name pciaddr = rte_dev_name(info.device); - if (sscanf(pciaddr, "%04x:%02x:%02x.%02x", &domain_num, &bus_num, &dev_num, &func_num) != 4) + if (sscanf(pciaddr, "%04x:%02x:%02x.%02x", &domain_num, &bus_num, &dev_num, &func_num) != 4 + && sscanf(pciaddr, "%02x:%02x.%02x", &bus_num, &dev_num, &func_num) != 3) return DP_ERROR; port->pci_addr.domain = domain_num;