[dpdk-dev] [PATCH v2] devargs: add blacklisting by linux interface name

Charles (Chas) Williams 3chas3 at gmail.com
Wed Oct 14 15:41:34 CEST 2015


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.




More information about the dev mailing list