pci: fix config access return codes on BSD
BSD implementation for config access in DPDK seems to return 0 on success while Linux implementation returns 0 only on failure. The env wrapper was always treating 0 as an error and caused some of our PCI initialization code to fail prematurely. At one point DPDK harmonized this BSD behavior with Linux, but only for config reads. Fixes #484 Change-Id: I4ea850ea50f5e667fad28e8125209b21c377a2a3 Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Reviewed-on: https://review.gerrithub.io/432401 (master) Reviewed-on: https://review.gerrithub.io/435682 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
fbe6a4a3b0
commit
6bf1af641f
@ -299,6 +299,11 @@ spdk_pci_device_cfg_read(struct spdk_pci_device *dev, void *value, uint32_t len,
|
||||
#else
|
||||
rc = rte_eal_pci_read_config(dev, value, len, offset);
|
||||
#endif
|
||||
|
||||
#if defined(__FreeBSD__) && RTE_VERSION < RTE_VERSION_NUM(18, 11, 0, 0)
|
||||
/* Older DPDKs return 0 on success and -1 on failure */
|
||||
return rc;
|
||||
#endif
|
||||
return (rc > 0 && (uint32_t) rc == len) ? 0 : -1;
|
||||
}
|
||||
|
||||
@ -312,6 +317,11 @@ spdk_pci_device_cfg_write(struct spdk_pci_device *dev, void *value, uint32_t len
|
||||
#else
|
||||
rc = rte_eal_pci_write_config(dev, value, len, offset);
|
||||
#endif
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
/* DPDK returns 0 on success and -1 on failure */
|
||||
return rc;
|
||||
#endif
|
||||
return (rc > 0 && (uint32_t) rc == len) ? 0 : -1;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user