From mboxrd@z Thu Jan 1 00:00:00 1970 From: Olivier MATZ Subject: Re: [PATCH v2] devargs: add blacklisting by linux interface name Date: Tue, 13 Oct 2015 14:49:31 +0200 Message-ID: <561CFDDB.90601@6wind.com> References: <1443798007-20122-1-git-send-email-3chas3@gmail.com> <1444058768-9208-1-git-send-email-3chas3@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit To: Chas Williams <3chas3@gmail.com>, dev@dpdk.org Return-path: Received: from mail.droids-corp.org (zoll.droids-corp.org [94.23.50.67]) by dpdk.org (Postfix) with ESMTP id DD7A18E89 for ; Tue, 13 Oct 2015 14:49:37 +0200 (CEST) In-Reply-To: <1444058768-9208-1-git-send-email-3chas3@gmail.com> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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@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