[dpdk-dev,v2,05/15] pci: use scan_mode configuration

Message ID 20170714211213.34436-6-jblunck@infradead.org (mailing list archive)
State Rejected, archived
Delegated to: Thomas Monjalon
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Jan Blunck July 14, 2017, 9:12 p.m. UTC
  When scanning/probing devices the bus doesn't need to look at the
devargs->type field: if the bus is in blacklist probing mode and there is
no devargs found for the device it is white-listed. Therefore it is enough
to let the bus check for the scan_mode.

Signed-off-by: Jan Blunck <jblunck@infradead.org>
---
 lib/librte_eal/common/eal_common_pci.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
  

Comments

Ferruh Yigit Sept. 4, 2017, 4:22 p.m. UTC | #1
On 7/14/2017 10:12 PM, Jan Blunck wrote:
> When scanning/probing devices the bus doesn't need to look at the
> devargs->type field: if the bus is in blacklist probing mode and there is
> no devargs found for the device it is white-listed. Therefore it is enough
> to let the bus check for the scan_mode.
> 
> Signed-off-by: Jan Blunck <jblunck@infradead.org>
> ---
>  lib/librte_eal/common/eal_common_pci.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c
> index 72fcc35c2..fb0e29ac4 100644
> --- a/lib/librte_eal/common/eal_common_pci.c
> +++ b/lib/librte_eal/common/eal_common_pci.c
> @@ -197,8 +197,7 @@ rte_pci_probe_one_driver(struct rte_pci_driver *dr,
>  
>  	/* no initialization when blacklisted, return without error */
>  	if (dev->device.devargs != NULL &&
> -		dev->device.devargs->type ==
> -			RTE_DEVTYPE_BLACKLISTED_PCI) {
> +		rte_pci_bus.bus.conf.scan_mode == RTE_BUS_SCAN_BLACKLIST) {

If eal blacklist command issued (-b), even for one device, bus scan_mode
set to RTE_BUS_SCAN_BLACKLIST. Only devices provided with -b should be
blacklisted, all other devices in the bus should be probed.

If check done based on "scan_mode", this will blacklist all devices in
the bus, unless I am missing something.

I see this is to remove "devargs->type" but I don't think so this can be
replaced with "conf.scan_mode" check.

And while thinking about this, I wonder what "scan_mode" really mean?
and where it is used/useful?

>  		RTE_LOG(INFO, EAL, "  Device is blacklisted, not"
>  			" initializing\n");
>  		return 1;
> @@ -404,8 +403,7 @@ rte_pci_probe(void)
>  		/* probe all or only whitelisted devices */
>  		if (probe_all)
>  			ret = pci_probe_all_drivers(dev);
> -		else if (devargs != NULL &&
> -			devargs->type == RTE_DEVTYPE_WHITELISTED_PCI)
> +		else if (devargs != NULL)

if "probe_all" is not set, this means "scan_mode" is WHITELIST. And only
physical devices white-listed will have devargs, so this check looks OK,
but I believe this requires some comment, otherwise this is not clear.

Also why not check blacklist here?

>  			ret = pci_probe_all_drivers(dev);
>  		if (ret < 0) {
>  			RTE_LOG(ERR, EAL, "Requested device " PCI_PRI_FMT
>
  

Patch

diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c
index 72fcc35c2..fb0e29ac4 100644
--- a/lib/librte_eal/common/eal_common_pci.c
+++ b/lib/librte_eal/common/eal_common_pci.c
@@ -197,8 +197,7 @@  rte_pci_probe_one_driver(struct rte_pci_driver *dr,
 
 	/* no initialization when blacklisted, return without error */
 	if (dev->device.devargs != NULL &&
-		dev->device.devargs->type ==
-			RTE_DEVTYPE_BLACKLISTED_PCI) {
+		rte_pci_bus.bus.conf.scan_mode == RTE_BUS_SCAN_BLACKLIST) {
 		RTE_LOG(INFO, EAL, "  Device is blacklisted, not"
 			" initializing\n");
 		return 1;
@@ -404,8 +403,7 @@  rte_pci_probe(void)
 		/* probe all or only whitelisted devices */
 		if (probe_all)
 			ret = pci_probe_all_drivers(dev);
-		else if (devargs != NULL &&
-			devargs->type == RTE_DEVTYPE_WHITELISTED_PCI)
+		else if (devargs != NULL)
 			ret = pci_probe_all_drivers(dev);
 		if (ret < 0) {
 			RTE_LOG(ERR, EAL, "Requested device " PCI_PRI_FMT