From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <3chas3@gmail.com> 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:subject:from:to:cc:date:in-reply-to:references :content-type:mime-version:content-transfer-encoding; bh=2kNqZhf6LySeENIPqouXp2uAsgTAXwC0N6GUBByfWq0=; b=n8yLnhKpCZ1SK8sQ5flDs8qNX8+9Ue8a/MWY+pAPWpPkZT73fLo2Sa0bRbXm41yg6+ 6xsRFLQZppH6EgcwqMxqSp4hBx1kS+Ar3oQhO7y9WpZjOIOk4fc/b+f65jUff6qkHnwN UCpmDPHhrchjhPYkz2XC5e6m+S75ZWo7WI8BdXmkZZr8JOvdq9kj6OEMUe6kFs3RYXIn uNaqKoHRoDyHcvX/Uo+/2K0cHdJH8ZVyNfVcz+DK7Trg9BHEnRZbLL0Cj0uFzsyhgK4W DHhXsjExEBoSla1cW3NycJT6UwDvcOiDnAvLbmpqXl3SOMUqUeUHxBW8biOw41F9uPeY 1x7Q== X-Received: by 10.129.52.147 with SMTP id b141mr2190450ywa.41.1444830095479; Wed, 14 Oct 2015 06:41:35 -0700 (PDT) Received: from foobar.home (pool-71-163-182-126.washdc.fios.verizon.net. [71.163.182.126]) by smtp.googlemail.com with ESMTPSA id b9sm5822700ywe.9.2015.10.14.06.41.34 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Oct 2015 06:41:34 -0700 (PDT) Message-ID: <1444830094.3494.59.camel@gmail.com> From: "Charles (Chas) Williams" <3chas3@gmail.com> To: Olivier MATZ Date: Wed, 14 Oct 2015 09:41:34 -0400 In-Reply-To: <561CFDDB.90601@6wind.com> References: <1443798007-20122-1-git-send-email-3chas3@gmail.com> <1444058768-9208-1-git-send-email-3chas3@gmail.com> <561CFDDB.90601@6wind.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.12.11 (3.12.11-1.fc21) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Cc: dev@dpdk.org 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: Wed, 14 Oct 2015 13:41:36 -0000 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.