env: extend PCI address domain to 32 bits

In some cases (for example, Intel VMD or Microsoft Azure), the PCI
domain may be larger than 16 bits.  Extend the domain field of struct
spdk_pci_addr to 32 bits to accomodate this.

Note that equivalent changes must be made in DPDK's struct rte_pci_addr
for larger domains to actually work.

Change-Id: I21c4666a68bc8a4aedfcc82b44042c02734246de
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/366520
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Cunyin Chang <cunyin.chang@intel.com>
This commit is contained in:
Daniel Verkamp 2017-06-21 15:05:47 -07:00 committed by Jim Harris
parent fa3dd136d0
commit 0ac06e088b
3 changed files with 8 additions and 8 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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;
}