> -----Original Message-----
> From: dev <dev-boun...@dpdk.org> On Behalf Of vattun...@marvell.com
> Sent: Monday, September 23, 2019 14:57
> To: dev@dpdk.org
> Cc: gaetan.ri...@6wind.com; ferruh.yi...@intel.com;
> anatoly.bura...@intel.com; Thomas Monjalon <tho...@monjalon.net>;
> jer...@marvell.com; Vamsi Attunuru <vattun...@marvell.com>
> Subject: [dpdk-dev] [PATCH v1 1/1] bus/pci: probe PCI devices in whitelisted
> order
> 
> From: Vamsi Attunuru <vattun...@marvell.com>
> 
> Current pci bus driver scans pci devices in the order that it read from sysfs.
> Accordingly all or whitelisted devices are getting probed.
> 
> Patch modifies the probing order of whitelisted pci devices in a sequence the
> devices are whitelisted(using EAL flags).

Thanks, it would be nice to have opportunity to control probing order,
it might be useful for bonded devices and representors either.

Acked-by: Viacheslav Ovsiienko <viachesl...@mellanox.com>

> 
> It ensures the eth devices that application uses are probed in device
> whitelisted sequence, in turn it facilitates the packet forwarding 
> applications
> to work without any packet loss or performance drop when the underneath
> network ports have different bandwidths. By altering the whitelist order
> applications like testpmd, l2fwd can forward the ingress traffic to egress 
> port
> that has of equivalent bandwidth.
> 
> Signed-off-by: Vamsi Attunuru <vattun...@marvell.com>
> ---
>  drivers/bus/pci/pci_common.c | 67 ++++++++++++++++++++++++++++++----
> ----------
>  1 file changed, 46 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c
> index 6b46b4f..c27a0e9 100644
> --- a/drivers/bus/pci/pci_common.c
> +++ b/drivers/bus/pci/pci_common.c
> @@ -293,32 +293,57 @@ rte_pci_probe(void)
>       struct rte_pci_device *dev = NULL;
>       size_t probed = 0, failed = 0;
>       struct rte_devargs *devargs;
> -     int probe_all = 0;
> +     struct rte_pci_addr addr;
>       int ret = 0;
> 
> -     if (rte_pci_bus.bus.conf.scan_mode != RTE_BUS_SCAN_WHITELIST)
> -             probe_all = 1;
> -
> -     FOREACH_DEVICE_ON_PCIBUS(dev) {
> -             probed++;
> +     if (rte_pci_bus.bus.conf.scan_mode != RTE_BUS_SCAN_WHITELIST) {
> +             /* Probe all devices */
> +             FOREACH_DEVICE_ON_PCIBUS(dev) {
> +                     probed++;
> 
> -             devargs = dev->device.devargs;
> -             /* probe all or only whitelisted devices */
> -             if (probe_all)
>                       ret = pci_probe_all_drivers(dev);
> -             else if (devargs != NULL &&
> -                     devargs->policy == RTE_DEV_WHITELISTED)
> -                     ret = pci_probe_all_drivers(dev);
> -             if (ret < 0) {
> -                     if (ret != -EEXIST) {
> -                             RTE_LOG(ERR, EAL, "Requested device "
> -                                     PCI_PRI_FMT " cannot be used\n",
> -                                     dev->addr.domain, dev->addr.bus,
> -                                     dev->addr.devid, dev-
> >addr.function);
> -                             rte_errno = errno;
> -                             failed++;
> +                     if (ret < 0) {
> +                             if (ret != -EEXIST) {
> +                                     RTE_LOG(ERR, EAL, "Requested
> device "
> +                                             PCI_PRI_FMT " cannot be
> used\n",
> +                                             dev->addr.domain, dev-
> >addr.bus,
> +                                             dev->addr.devid,
> +                                             dev->addr.function);
> +                                     rte_errno = errno;
> +                                     failed++;
> +                             }
> +                             ret = 0;
> +                     }
> +             }
> +     } else {
> +             /* Probe only whitelisted devices */
> +             RTE_EAL_DEVARGS_FOREACH("pci", devargs) {
> +                     if (devargs->policy != RTE_DEV_WHITELISTED)
> +                             continue;
> +
> +                     devargs->bus->parse(devargs->name, &addr);
> +
> +                     FOREACH_DEVICE_ON_PCIBUS(dev) {
> +                             if (rte_pci_addr_cmp(&dev->addr, &addr))
> +                                     continue;
> +                             probed++;
> +                             ret = pci_probe_all_drivers(dev);
> +                             if (ret < 0) {
> +                                     if (ret != -EEXIST) {
> +                                             RTE_LOG(ERR, EAL,
> +                                                     "Requested device "
> +                                                      PCI_PRI_FMT
> +                                                     "cannot be used\n",
> +                                                     dev->addr.domain,
> +                                                     dev->addr.bus,
> +                                                     dev->addr.devid,
> +                                                     dev->addr.function);
> +                                             rte_errno = errno;
> +                                             failed++;
> +                                     }
> +                                     ret = 0;
> +                             }
>                       }
> -                     ret = 0;
>               }
>       }
> 
> --
> 2.8.4

Reply via email to