[dpdk-dev] [PATCH] bus/pci: restricted bus scanning to allowed devices
Stephen Hemminger
stephen at networkplumber.org
Mon Dec 16 17:13:17 CET 2019
> /* 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.
> +/**
> + * 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.
> +
> +/**
> + * 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
More information about the dev
mailing list