[dpdk-dev] [PATCH v3 1/3] pci: If a driver's probe function fails, unmap resources.

2017-01-11 Thread Ben Walker
If resources were mapped prior to probe, unmap them if probe fails. This does not handle the case where the kernel driver was forcibly unbound prior to probe. Signed-off-by: Ben Walker --- lib/librte_eal/common/eal_common_pci.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff

[dpdk-dev] [PATCH v3 3/3] pci: Pass rte_pci_addr to functions instead of separate args

2017-01-11 Thread Ben Walker
Instead of passing domain, bus, devid, func, just pass an rte_pci_addr. Signed-off-by: Ben Walker --- lib/librte_eal/linuxapp/eal/eal_pci.c | 32 +--- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib

[dpdk-dev] [PATCH v3 2/3] pci: Separate detaching ethernet ports from PCI devices

2017-01-11 Thread Ben Walker
Attaching and detaching ethernet ports from an application is not the same thing as physically removing a PCI device, so clarify the flags indicating support. All PCI devices are assumed to be physically removable, so no flag is necessary in the PCI layer. Signed-off-by: Ben Walker --- doc

[dpdk-dev] [PATCH v3] eal: Support running as unprivileged user

2017-01-31 Thread Ben Walker
For Linux kernel 4.0 and newer, the ability to obtain physical page frame numbers for unprivileged users from /proc/self/pagemap was removed. Instead, when an IOMMU is present, simply choose our own DMA addresses instead. Signed-off-by: Ben Walker --- lib/librte_eal/common/eal_private.h

[dpdk-dev] [PATCH v4] eal: Support running as unprivileged user

2017-01-31 Thread Ben Walker
For Linux kernel 4.0 and newer, the ability to obtain physical page frame numbers for unprivileged users from /proc/self/pagemap was removed. Instead, when an IOMMU is present, simply choose our own DMA addresses instead. Signed-off-by: Ben Walker --- lib/librte_eal/common/eal_private.h

[dpdk-dev] [PATCH] Fix overwriting of dev_flags in rte_eth_dev after initialization

2017-02-09 Thread Ben Walker
. Signed-off-by: Ben Walker --- drivers/net/bnxt/bnxt_ethdev.c | 2 +- drivers/net/e1000/em_ethdev.c| 2 +- drivers/net/e1000/igb_ethdev.c | 4 ++-- drivers/net/fm10k/fm10k_ethdev.c | 2 +- drivers/net/i40e/i40e_ethdev.c | 2 +- drivers/net/i40e/i40e_ethdev_vf.c| 2

[dpdk-dev] [PATCH v3 1/3] pci: rte_eal_pci_scan now handles removal of PCI devices

2017-02-09 Thread Ben Walker
rte_eal_pci_scan can be called repeatedly to re-scan the PCI bus. If a device was removed from the system, the associated driver will automatically be unloaded. Signed-off-by: Ben Walker --- Only code style changes compared to last submission. It is also rebased onto the latest from master

[dpdk-dev] [PATCH v3 2/3] pci: Move driver registration above pci scan

2017-02-09 Thread Ben Walker
The user needs to register drivers before scanning, so it makes the most sense to put the registration functions above the scan function in the header file. Signed-off-by: Ben Walker --- Only rebased onto latest master with the rest of this series. No changes. lib/librte_eal/common/include

[dpdk-dev] [PATCH v3 3/3] pci: Clarify interfaces for dynamic attach/detach of drivers

2017-02-09 Thread Ben Walker
. Signed-off-by: Ben Walker --- This patch was previously the fourth in the series, behind another more controversial change. That change has been removed and this patch was reordered to be independent of those changes. lib/librte_eal/common/eal_common_dev.c | 4 +- lib/librte_eal/common

[dpdk-dev] [PATCH] eal: Support running as unprivileged user

2017-01-03 Thread Ben Walker
For Linux kernel 4.0 and newer, the ability to obtain physical page frame numbers for unprivileged users from /proc/self/pagemap was removed. Instead, when an IOMMU is present, simply choose our own DMA addresses instead. Signed-off-by: Ben Walker --- lib/librte_eal/common/eal_private.h

[dpdk-dev] [PATCH v2] eal: Support running as unprivileged user

2017-01-03 Thread Ben Walker
For Linux kernel 4.0 and newer, the ability to obtain physical page frame numbers for unprivileged users from /proc/self/pagemap was removed. Instead, when an IOMMU is present, simply choose our own DMA addresses instead. Signed-off-by: Ben Walker --- lib/librte_eal/common/eal_private.h

[dpdk-dev] [PATCH] eal: Fix device registration on FreeBSD

2017-03-21 Thread Ben Walker
The FreeBSD implementation wasn't registering new devices with the device framework on start up. However, common code attempts to unregister them on shutdown which causes a SEGFAULT. This fix makes the FreeBSD code do the same thing as the Linux code for registration. Signed-off-by: Ben W

[dpdk-dev] [PATCH] pci: Don't call probe callback if driver already loaded.

2016-10-25 Thread Ben Walker
If the user asks to probe multiple times, the probe callback should only be called on devices that don't have a driver already loaded. This is useful if a driver is registered after the execution of a program has started and the list of devices needs to be re-scanned. Signed-off-by: Ben W

[dpdk-dev] eal/pci: Improve automatic selection of IOVA mode

2019-05-30 Thread Ben Walker
In SPDK, not all drivers are registered with DPDK at start up time. Previously, that meant DPDK always chose to set itself up in IOVA_PA mode. Instead, when the correct iova choice is unclear based on the devices and drivers known to DPDK at start up time, use other heuristics (such as whether /pro

[dpdk-dev] [PATCH 02/12] eal/pci: Inline several functions into rte_pci_get_iommu_class

2019-05-30 Thread Ben Walker
This is in preparation for future simplifications. The functions are simply inlined for now. Signed-off-by: Ben Walker Change-Id: I129992c9b44f4575a28cc05b78297e15b6be4249 --- drivers/bus/pci/linux/pci.c | 176 +++- 1 file changed, 71 insertions(+), 105 deletions

[dpdk-dev] [PATCH 05/12] eal/pci: Add function pci_ignore_device

2019-05-30 Thread Ben Walker
This performs a check for whether the device should be ignored due to whitelist or blacklist. This check eventually needs to apply to all of the other checks in rte_pci_get_iommu_class. Signed-off-by: Ben Walker Change-Id: I8e63e4c2e4199f34561ea1d911e13d6d74a47322 --- drivers/bus/pci/linux

[dpdk-dev] [PATCH 07/12] eal/pci: Reverse if check in rte_pci_get_iommu_class

2019-05-30 Thread Ben Walker
It's simpler to reverse the if statement here, especially with an upcoming simplification. Signed-off-by: Ben Walker Change-Id: I6cff80231032304f3f865fdf38157554fad7fd07 --- drivers/bus/pci/linux/pci.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/bu

[dpdk-dev] [PATCH 11/12] eal/pci: rte_pci_get_iommu_class handles no drivers

2019-05-30 Thread Ben Walker
In the case where no drivers are registered with the system, rte_pci_get_iommu_class should return RTE_IOVA_DC. Signed-off-by: Ben Walker Change-Id: Ia5b0cae100cfcfe46a9e4996328f9746ce33cfd3 --- drivers/bus/pci/linux/pci.c | 79 ++--- 1 file changed, 38

[dpdk-dev] [PATCH 03/12] eal/pci: Rework loops in rte_pci_get_iommu_class

2019-05-30 Thread Ben Walker
Make all of the loops first iterate over devices, then drivers. This is in preparation for combining them into a single loop. Signed-off-by: Ben Walker Change-Id: Ifb2bfcc60570a5d5a13481be3da0fc74bf00ef1f --- drivers/bus/pci/linux/pci.c | 12 ++-- 1 file changed, 6 insertions(+), 6

[dpdk-dev] [PATCH 01/12] eal: Make rte_eal_using_phys_addrs work sooner

2019-05-30 Thread Ben Walker
This function only returned the correct answer after a call to initialize the memory subsystem. Make it work prior to that. Signed-off-by: Ben Walker Change-Id: I8f3c5128fbf5da884a956bbcc72c5a13564825d5 --- lib/librte_eal/linux/eal/eal_memory.c | 63 --- 1 file changed

[dpdk-dev] [PATCH 06/12] eal/pci: Correctly test whitelist/blacklist in rte_pci_get_iommu_class

2019-05-30 Thread Ben Walker
All of the checks should respect the white and black lists. Signed-off-by: Ben Walker Change-Id: Ie66176bea49987d1fc0a03dbee2638d9dd6efbc5 --- drivers/bus/pci/linux/pci.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci

[dpdk-dev] [PATCH 09/12] eal/pci: Simplify rte_pci_get_iommu class by using a switch

2019-05-30 Thread Ben Walker
Take several independent if statements and convert to a switch statement. Signed-off-by: Ben Walker Change-Id: Ia77c88ea484b529e8b0c9e09e8ef22cf3210e669 --- drivers/bus/pci/linux/pci.c | 21 - 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/drivers/bus/pci

[dpdk-dev] [PATCH 04/12] eal/pci: Collapse two loops in rte_pci_get_iommu_class

2019-05-30 Thread Ben Walker
Two of these loops easily collapse into a single loop. This sets the stage for future simplifications. Signed-off-by: Ben Walker Change-Id: I3353f2e3585808cebff3f11805f96e4a1cc7fb3a --- drivers/bus/pci/linux/pci.c | 31 ++- 1 file changed, 10 insertions(+), 21

[dpdk-dev] [PATCH 12/12] eal: If bus can't decide PA or VA, try to access PA

2019-05-30 Thread Ben Walker
If the bus can't determine a preference for IOVA_PA vs. IOVA_VA by looking at the devices and drivers, as a last resort test if physical addresses are even accessible in /proc/self/pagemap. If they are, use IOVA_PA. If they are not, use IOVA_VA. Change-Id: If1eeb723283b80b24bd973987054fdad62f59cbd

[dpdk-dev] [PATCH 10/12] eal/pci: Finding a device bound to UIO does not force PA

2019-05-30 Thread Ben Walker
If a device is found that is bound to the UIO driver, only force IOVA_PA if there is a driver registered to use it. Signed-off-by: Ben Walker Change-Id: I8015f11a33ab1b7662bf374d6944eff8d7a74a07 --- drivers/bus/pci/linux/pci.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff

[dpdk-dev] [PATCH 08/12] eal/pci: Collapse loops in rte_pci_get_iommu_class

2019-05-30 Thread Ben Walker
The three loops can now be easily combined into one. This is slightly less efficient than before because it doesn't break out early. But that can be addressed later. Signed-off-by: Ben Walker Change-Id: Ic97155bb478dddbcbeaa6d51947684ffef219a52 --- drivers/bus/pci/linux/pci.c

[dpdk-dev] [PATCH v2 01/12] eal: Make rte_eal_using_phys_addrs work sooner

2019-05-30 Thread Ben Walker
This function only returned the correct answer after a call to initialize the memory subsystem. Make it work prior to that. Signed-off-by: Ben Walker --- lib/librte_eal/linux/eal/eal_memory.c | 63 --- 1 file changed, 28 insertions(+), 35 deletions(-) diff --git a/lib

[dpdk-dev] [PATCH v2 03/12] eal/pci: Rework loops in rte_pci_get_iommu_class

2019-05-30 Thread Ben Walker
Make all of the loops first iterate over devices, then drivers. This is in preparation for combining them into a single loop. Signed-off-by: Ben Walker --- drivers/bus/pci/linux/pci.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/bus/pci/linux/pci.c b

[dpdk-dev] [PATCH v2 04/12] eal/pci: Collapse two loops in rte_pci_get_iommu_class

2019-05-30 Thread Ben Walker
Two of these loops easily collapse into a single loop. This sets the stage for future simplifications. Signed-off-by: Ben Walker --- drivers/bus/pci/linux/pci.c | 31 ++- 1 file changed, 10 insertions(+), 21 deletions(-) diff --git a/drivers/bus/pci/linux/pci.c b

[dpdk-dev] [PATCH v2 02/12] eal/pci: Inline several functions into rte_pci_get_iommu_class

2019-05-30 Thread Ben Walker
This is in preparation for future simplifications. The functions are simply inlined for now. Signed-off-by: Ben Walker --- drivers/bus/pci/linux/pci.c | 176 +++- 1 file changed, 71 insertions(+), 105 deletions(-) diff --git a/drivers/bus/pci/linux/pci.c b

[dpdk-dev] [PATCH v2 05/12] eal/pci: Add function pci_ignore_device

2019-05-30 Thread Ben Walker
This performs a check for whether the device should be ignored due to whitelist or blacklist. This check eventually needs to apply to all of the other checks in rte_pci_get_iommu_class. Signed-off-by: Ben Walker --- drivers/bus/pci/linux/pci.c | 44 + 1 file

[dpdk-dev] [PATCH v2 08/12] eal/pci: Collapse loops in rte_pci_get_iommu_class

2019-05-30 Thread Ben Walker
The three loops can now be easily combined into one. This is slightly less efficient than before because it doesn't break out early. But that can be addressed later. Signed-off-by: Ben Walker --- drivers/bus/pci/linux/pci.c | 19 +++ 1 file changed, 3 insertions(+

[dpdk-dev] [PATCH v2 07/12] eal/pci: Reverse if check in rte_pci_get_iommu_class

2019-05-30 Thread Ben Walker
It's simpler to reverse the if statement here, especially with an upcoming simplification. Signed-off-by: Ben Walker --- drivers/bus/pci/linux/pci.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c

[dpdk-dev] [PATCH v2 09/12] eal/pci: Simplify rte_pci_get_iommu class by using a switch

2019-05-30 Thread Ben Walker
Take several independent if statements and convert to a switch statement. Signed-off-by: Ben Walker --- drivers/bus/pci/linux/pci.c | 21 - 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c index

[dpdk-dev] [PATCH v2 06/12] eal/pci: Correctly test whitelist/blacklist in rte_pci_get_iommu_class

2019-05-30 Thread Ben Walker
All of the checks should respect the white and black lists. Signed-off-by: Ben Walker --- drivers/bus/pci/linux/pci.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c index 6d311f4e0..d2464d2ae 100644 --- a

[dpdk-dev] [PATCH v2 10/12] eal/pci: Finding a device bound to UIO does not force PA

2019-05-30 Thread Ben Walker
If a device is found that is bound to the UIO driver, only force IOVA_PA if there is a driver registered to use it. Signed-off-by: Ben Walker --- drivers/bus/pci/linux/pci.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci

[dpdk-dev] [PATCH v2 11/12] eal/pci: rte_pci_get_iommu_class handles no drivers

2019-05-30 Thread Ben Walker
In the case where no drivers are registered with the system, rte_pci_get_iommu_class should return RTE_IOVA_DC. Signed-off-by: Ben Walker --- drivers/bus/pci/linux/pci.c | 91 - 1 file changed, 50 insertions(+), 41 deletions(-) diff --git a/drivers/bus/pci

[dpdk-dev] [PATCH v2 12/12] eal: If bus can't decide PA or VA, try to access PA

2019-05-30 Thread Ben Walker
If the bus can't determine a preference for IOVA_PA vs. IOVA_VA by looking at the devices and drivers, as a last resort test if physical addresses are even accessible in /proc/self/pagemap. If they are, use IOVA_PA. If they are not, use IOVA_VA. Signed-off-by: Ben Walker --- lib/librt

[dpdk-dev] [PATCH] Add rte_mempool_free

2016-05-16 Thread Ben Walker
check for a clean shutdown when used in conjunction with tools like AddressSanitizer. Further, the call itself verifies that all elements have been returned to the pool or it fails. Signed-off-by: Ben Walker --- lib/librte_mempool/rte_dom0_mempool.c | 22 +++ lib/librte_mempool

[dpdk-dev] Improved PCI hotplug support

2016-11-23 Thread Ben Walker
This series of patches adds support for PCI hot insert and remove. Detection of new devices or removed devices is accomplished by polling rte_eal_pci_probe, with the registered PCI drivers being loaded or unloaded when a new device is found or previously known device is removed. There are some add

[dpdk-dev] [PATCH 1/7] pci: If a driver's probe function fails, unmap resources.

2016-11-23 Thread Ben Walker
If resources were mapped prior to probe, unmap them if probe fails. This does not handle the case where the kernel driver was forcibly unbound prior to probe. Signed-off-by: Ben Walker --- lib/librte_eal/common/eal_common_pci.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff

[dpdk-dev] [PATCH 3/7] pci: Pass rte_pci_addr to functions instead of separate args

2016-11-23 Thread Ben Walker
Instead of passing domain, bus, devid, func, just pass an rte_pci_addr. Signed-off-by: Ben Walker --- lib/librte_eal/linuxapp/eal/eal_pci.c | 32 +--- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib

[dpdk-dev] [PATCH 2/7] pci: Separate detaching ethernet ports from PCI devices

2016-11-23 Thread Ben Walker
Attaching and detaching ethernet ports from an application is not the same thing as physically removing a PCI device, so clarify the flags indicating support. All PCI devices are assumed to be physically removable, so no flag is necessary in the PCI layer. Signed-off-by: Ben Walker --- doc

[dpdk-dev] [PATCH 4/7] pci: rte_eal_pci_scan now handles removal of PCI devices

2016-11-23 Thread Ben Walker
rte_eal_pci_scan can be called repeatedly to re-scan the PCI bus. If a device was removed from the system, the associated driver will automatically be unloaded. Signed-off-by: Ben Walker --- lib/librte_eal/linuxapp/eal/eal_pci.c | 58 +++ 1 file changed, 58

[dpdk-dev] [PATCH 5/7] pci: Move driver registration above pci scan

2016-11-23 Thread Ben Walker
The user needs to register drivers before scanning, so it makes the most sense to put the registration functions above the scan function in the header file. Signed-off-by: Ben Walker --- lib/librte_eal/common/include/rte_pci.h | 56 - 1 file changed, 28

[dpdk-dev] [PATCH 6/7] pci: Combine rte_eal_pci_scan and rte_eal_pci_probe

2016-11-23 Thread Ben Walker
, so simplify the api down to just rte_eal_pci_probe which can be called repeatedly through the lifetime of the application to scan for new or removed PCI devices and load or unload drivers as required. Signed-off-by: Ben Walker --- app/test/test_pci.c | 2 +- lib

[dpdk-dev] [PATCH 7/7] pci: Clarify interfaces for dynamic attach/detach of drivers

2016-11-23 Thread Ben Walker
. Signed-off-by: Ben Walker --- lib/librte_eal/common/eal_common_dev.c | 4 +- lib/librte_eal/common/eal_common_pci.c | 111 +--- lib/librte_eal/common/include/rte_pci.h | 22 --- 3 files changed, 45 insertions(+), 92 deletions(-) diff --git a/lib/librte_eal

[dpdk-dev] [PATCH v2 1/7] pci: If a driver's probe function fails, unmap resources.

2016-11-23 Thread Ben Walker
If resources were mapped prior to probe, unmap them if probe fails. This does not handle the case where the kernel driver was forcibly unbound prior to probe. Signed-off-by: Ben Walker --- lib/librte_eal/common/eal_common_pci.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff

[dpdk-dev] [PATCH v2 3/7] pci: Pass rte_pci_addr to functions instead of separate args

2016-11-23 Thread Ben Walker
Instead of passing domain, bus, devid, func, just pass an rte_pci_addr. Signed-off-by: Ben Walker --- lib/librte_eal/linuxapp/eal/eal_pci.c | 32 +--- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib

[dpdk-dev] [PATCH v2 2/7] pci: Separate detaching ethernet ports from PCI devices

2016-11-23 Thread Ben Walker
Attaching and detaching ethernet ports from an application is not the same thing as physically removing a PCI device, so clarify the flags indicating support. All PCI devices are assumed to be physically removable, so no flag is necessary in the PCI layer. Signed-off-by: Ben Walker --- doc

[dpdk-dev] [PATCH v2 4/7] pci: rte_eal_pci_scan now handles removal of PCI devices

2016-11-23 Thread Ben Walker
rte_eal_pci_scan can be called repeatedly to re-scan the PCI bus. If a device was removed from the system, the associated driver will automatically be unloaded. Signed-off-by: Ben Walker --- lib/librte_eal/linuxapp/eal/eal_pci.c | 62 +++ 1 file changed, 62

[dpdk-dev] [PATCH v2 5/7] pci: Move driver registration above pci scan

2016-11-23 Thread Ben Walker
The user needs to register drivers before scanning, so it makes the most sense to put the registration functions above the scan function in the header file. Signed-off-by: Ben Walker --- lib/librte_eal/common/include/rte_pci.h | 56 - 1 file changed, 28

[dpdk-dev] [PATCH v2 6/7] pci: Combine rte_eal_pci_scan and rte_eal_pci_probe

2016-11-23 Thread Ben Walker
api down to just rte_eal_pci_probe which can be called repeatedly through the lifetime of the application to scan for new or removed PCI devices and load or unload drivers as required. Signed-off-by: Ben Walker --- app/test/test_pci.c | 2 +- lib/librte_eal/bsdapp

[dpdk-dev] [PATCH v2 7/7] pci: Clarify interfaces for dynamic attach/detach of drivers

2016-11-23 Thread Ben Walker
. Signed-off-by: Ben Walker --- lib/librte_eal/common/eal_common_dev.c | 4 +- lib/librte_eal/common/eal_common_pci.c | 109 +--- lib/librte_eal/common/include/rte_pci.h | 22 --- 3 files changed, 43 insertions(+), 92 deletions(-) diff --git a/lib/librte_eal