[systemd-devel] persistent network device names

Keller, Jacob E jacob.e.keller at intel.com
Mon Jul 27 12:05:37 PDT 2015


On Mon, 2015-07-27 at 21:53 +0300, Andrei Borzenkov wrote:
> В Mon, 27 Jul 2015 18:29:57 +0000
> "Keller, Jacob E" <jacob.e.keller at intel.com> пишет:
> 
> > On Mon, 2015-07-27 at 21:12 +0300, Andrei Borzenkov wrote:
> > > В Mon, 27 Jul 2015 17:52:59 +0000
> > > "Keller, Jacob E" <jacob.e.keller at intel.com> пишет:
> > > 
> > > > Hello,
> > > > 
> > > > I am working with a network device that can create virtual 
> > > > function
> > > > devices. When I create a large (>8) vfs for this device I get 
> > > > some
> > > > weird device names,
> > > > 
> > > > If I create 64 vfs, I see something like:
> > > > 
> > > > ens8
> > > > ens8f[1-7]
> > > > ens8s[1-7]
> 
> Are you sure? I do not see where such names would be generated.
> 

Yes. These are generated via the hotplug section of udev-builtin
-net_id.c rules

on line: 230 or so.

The problem is that some of the devices are considered part of the
"hotplug" slot while others are not, so I get two conflicting schemes
depending on how it lands in the slot.

> > > > enp8s[1-7]f[1-7]
> > > > 
> > > 
> > > All those names come directly from kernel. udev does not invent 
> > > them 
> > > -
> > > this is exactly what lspci shows. If it does not match lspci, you
> > > should provide more information.
> > > 
> > > > ens8f1-64 or something?
> > > > 
> > > 
> > > Then kernel should enumerate them so; you really need to discuss 
> > > it
> > > there.
> > 
> > It looks like my issue comes from the "hotplug_slot" stuff, which
> > overwrites the "enp8s0f0" into "ens8"... that is what causes this 
> > dual
> > -name scheme confusion.
> > 
> 
> You can disable hotplug slot-based naming by setting suitable
> NamePolicy for network links (drop "slot"). 

How can I define my own version of the net_id which does what I would
like and run that in my udev rule? I assume IMPORT{program} of some
sort?

I'd like to write a single udev rule which does the right thing that I
can drop in, without having to modify the link files for every single
link.

One possible fix/change to the hotplug code is drop the ":00" at the
end of the slot.. this seems to be pretty consistent on my machine the
slots are all the 0000:08:00.0 and we're comparing all of "08:00"
instead of "08" only. This plus making the func number be composed of
both the "slot" and "func".

But I am not sure this would work for everyone or not.

Regards,
Jake


More information about the systemd-devel mailing list