From mboxrd@z Thu Jan 1 00:00:00 1970 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) Received: from was59-1-82-226-113-214.fbx.proxad.net ([82.226.113.214] helo=[192.168.0.10]) by mail.droids-corp.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84) (envelope-from ) id 1Zlz1l-0002Jv-4e; Tue, 13 Oct 2015 14:50:01 +0200 Message-ID: <561CFDDB.90601@6wind.com> Date: Tue, 13 Oct 2015 14:49:31 +0200 From: Olivier MATZ User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.7.0 MIME-Version: 1.0 To: Chas Williams <3chas3@gmail.com>, dev@dpdk.org References: <1443798007-20122-1-git-send-email-3chas3@gmail.com> <1444058768-9208-1-git-send-email-3chas3@gmail.com> In-Reply-To: <1444058768-9208-1-git-send-email-3chas3@gmail.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v2] devargs: add blacklisting by linux interface name X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Oct 2015 12:49:38 -0000 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