[dpdk-dev] [PATCH v2] devargs: add blacklisting by linux interface name
Olivier MATZ
olivier.matz at 6wind.com
Tue Oct 13 14:49:31 CEST 2015
Hi Chas,
On 10/05/2015 05:26 PM, Chas Williams wrote:
> If a system is using deterministic interface names, it may be easier in
> some cases to use the interface name to blacklist an interface.
>
> Signed-off-by: Chas Williams <3chas3 at gmail.com>
> ---
> app/test/test_devargs.c | 2 ++
> lib/librte_eal/common/eal_common_devargs.c | 9 +++++++--
> lib/librte_eal/common/eal_common_options.c | 2 +-
> lib/librte_eal/common/eal_common_pci.c | 10 ++++++++--
> lib/librte_eal/common/include/rte_devargs.h | 2 ++
> lib/librte_eal/common/include/rte_pci.h | 1 +
> lib/librte_eal/linuxapp/eal/eal_pci.c | 15 +++++++++++++++
> 7 files changed, 36 insertions(+), 5 deletions(-)
>
> diff --git a/app/test/test_devargs.c b/app/test/test_devargs.c
> index f7fc59c..27855ff 100644
>
> [...]
>
> @@ -352,6 +354,19 @@ pci_scan_one(const char *dirname, uint16_t domain, uint8_t bus,
> return -1;
> }
>
> + /* get network interface name */
> + snprintf(filename, sizeof(filename), "%s/net", dirname);
> + dir = opendir(filename);
> + if (dir) {
> + while ((e = readdir(dir)) != NULL) {
> + if (e->d_name[0] == '.')
> + continue;
> +
> + strncpy(dev->name, e->d_name, sizeof(dev->name));
> + }
> + closedir(dir);
> + }
> +
> if (!ret) {
> if (!strcmp(driver, "vfio-pci"))
> dev->kdrv = RTE_KDRV_VFIO;
>
For PCI devices that have several interfaces (I think it's the case for
some Mellanox boards), maybe we should not store the interface name?
Another small comment about the strncpy(): it's maybe safer to ensure
that dev->name is properly nul-terminated.
Regards,
Olivier
More information about the dev
mailing list