From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Charles (Chas) Williams" <3chas3@gmail.com> Subject: Re: [PATCH v2] devargs: add blacklisting by linux interface name Date: Wed, 14 Oct 2015 09:41:34 -0400 Message-ID: <1444830094.3494.59.camel@gmail.com> References: <1443798007-20122-1-git-send-email-3chas3@gmail.com> <1444058768-9208-1-git-send-email-3chas3@gmail.com> <561CFDDB.90601@6wind.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Cc: dev@dpdk.org To: Olivier MATZ Return-path: Received: from mail-yk0-f171.google.com (mail-yk0-f171.google.com [209.85.160.171]) by dpdk.org (Postfix) with ESMTP id 14FF28D95 for ; Wed, 14 Oct 2015 15:41:36 +0200 (CEST) Received: by ykaz22 with SMTP id z22so21532857yka.2 for ; Wed, 14 Oct 2015 06:41:35 -0700 (PDT) In-Reply-To: <561CFDDB.90601@6wind.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" On Tue, 2015-10-13 at 14:49 +0200, Olivier MATZ wrote: > Hi Chas, > > > @@ -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? I am not sure what you mean here. If a device has multiple ethernet interfaces, then it should a have seperate PCI device address space for each interface (I dont know of any DPDK drivers that don't make this assumption as well). If the device is multiprotocol, say Infiniband, the device might have a net/ subdirectory, but it will be called something like ib0 which you might want to blacklist for some reason. > Another small comment about the strncpy(): it's maybe safer to ensure > that dev->name is properly nul-terminated. A good idea but it shouldn't happen in practice since dev.name will be IFNAMSIZ. I will fix it in the next version.