Regards
Sunil Kumar Kori
>-----Original Message-----
>From: Stephen Hemminger <step...@networkplumber.org>
>Sent: Monday, December 16, 2019 9:43 PM
>To: Sunil Kumar Kori <sk...@marvell.com>
>Cc: dev@dpdk.org
>Subject: [EXT] Re: [dpdk-dev] [PATCH] bus/pci: restricted bus scanning to
>allowed devices
>
>External Email
>
>----------------------------------------------------------------------
>> /* Create dummy pci device to get devargs */
>> + dummy_dev.addr.domain =
>matches[i].pc_sel.pc_domain;
>> + dummy_dev.addr.bus = matches[i].pc_sel.pc_bus;
>> + dummy_dev.addr.devid = matches[i].pc_sel.pc_dev;
>> + dummy_dev.addr.function =
>matches[i].pc_sel.pc_func;
>> + dummy_dev.device.devargs =
>> +
> pci_devargs_lookup(&dummy_dev);
>> +
>> + /* Check that device should be ignored or not */
>> + if (pci_ignore_device(&dummy_dev))
>> + continue;
>
>It seems that you are creating dummy_dev as an alternative to passing just the
>PCI bus/device/function. Wouldn't be easier to just use BDF instead. Dummy
>arguments on the stack can lead to more corner cases in the future if device
>subsystem changes.
Agreed and initially I have implemented using BDF only instead of using dummy
device.
But using that approach, I was not able to use existing APIs to get devargs and
ignore device.
I had to write almost same functions to solve the purpose. So just to avoid
having replica of
same code, I followed this approach. Please suggest.
>
>> +/**
>> + * Get the devargs of a PCI device.
>> + *
>> + * @param pci_dev
>> + * PCI device to be validated
>> + * @return
>> + * devargs on succes, NULL otherwise
>> + */
>> +struct rte_devargs *pci_devargs_lookup(struct rte_pci_device
>> +*pci_dev);
>
>Must be marked experimental (or internal).
>The pci_device should be marked const.
Okay but If I go with BDF one then this change is not required anyway.
>
>
>> +
>> +/**
>> + * Validate whether a pci device should be ignored or not.
>> + *
>> + * @param pci_dev
>> + * PCI device to be validated
>> + * @return
>> + * 1 if device is to be ignored, 0 otherwise
>> + */
>> +bool pci_ignore_device(const struct rte_pci_device *pci_dev);
>
>ditto
ditto