diff --git a/include/spdk/env.h b/include/spdk/env.h index 576df10f9..3d47aed7b 100644 --- a/include/spdk/env.h +++ b/include/spdk/env.h @@ -282,7 +282,7 @@ size_t spdk_ring_dequeue(struct spdk_ring *ring, void **objs, size_t count); uint64_t spdk_vtophys(void *buf); struct spdk_pci_addr { - uint16_t domain; + uint32_t domain; uint8_t bus; uint8_t dev; uint8_t func; @@ -306,7 +306,7 @@ int spdk_pci_device_map_bar(struct spdk_pci_device *dev, uint32_t bar, void **mapped_addr, uint64_t *phys_addr, uint64_t *size); int spdk_pci_device_unmap_bar(struct spdk_pci_device *dev, uint32_t bar, void *addr); -uint16_t spdk_pci_device_get_domain(struct spdk_pci_device *dev); +uint32_t spdk_pci_device_get_domain(struct spdk_pci_device *dev); uint8_t spdk_pci_device_get_bus(struct spdk_pci_device *dev); uint8_t spdk_pci_device_get_dev(struct spdk_pci_device *dev); uint8_t spdk_pci_device_get_func(struct spdk_pci_device *dev); diff --git a/lib/env_dpdk/pci.c b/lib/env_dpdk/pci.c index 8e80b5d8e..7f1691427 100644 --- a/lib/env_dpdk/pci.c +++ b/lib/env_dpdk/pci.c @@ -235,7 +235,7 @@ spdk_pci_device_unmap_bar(struct spdk_pci_device *device, uint32_t bar, void *ad return 0; } -uint16_t +uint32_t spdk_pci_device_get_domain(struct spdk_pci_device *dev) { return dev->addr.domain; @@ -458,8 +458,8 @@ spdk_pci_device_claim(const struct spdk_pci_addr *pci_addr) .l_len = 0, }; - snprintf(shm_name, sizeof(shm_name), PCI_PRI_FMT, pci_addr->domain, pci_addr->bus, pci_addr->dev, - pci_addr->func); + snprintf(shm_name, sizeof(shm_name), "%04x:%02x:%02x.%x", pci_addr->domain, pci_addr->bus, + pci_addr->dev, pci_addr->func); dev_fd = shm_open(shm_name, O_RDWR | O_CREAT, 0600); if (dev_fd == -1) { @@ -531,7 +531,7 @@ spdk_pci_addr_parse(struct spdk_pci_addr *addr, const char *bdf) return -EINVAL; } - if (domain > 0xFFFF || bus > 0xFF || dev > 0x1F || func > 7) { + if (bus > 0xFF || dev > 0x1F || func > 7) { return -EINVAL; } @@ -548,7 +548,7 @@ spdk_pci_addr_fmt(char *bdf, size_t sz, const struct spdk_pci_addr *addr) { int rc; - rc = snprintf(bdf, sz, PCI_PRI_FMT, + rc = snprintf(bdf, sz, "%04x:%02x:%02x.%x", addr->domain, addr->bus, addr->dev, addr->func); diff --git a/test/lib/test_env.c b/test/lib/test_env.c index 22ed214b6..ea28c8379 100644 --- a/test/lib/test_env.c +++ b/test/lib/test_env.c @@ -196,7 +196,7 @@ spdk_pci_addr_parse(struct spdk_pci_addr *addr, const char *bdf) return -EINVAL; } - if (domain > 0xFFFF || bus > 0xFF || dev > 0x1F || func > 7) { + if (bus > 0xFF || dev > 0x1F || func > 7) { return -EINVAL; }