Re: [PATCH] net: usbnet: allow overriding of default USB interface naming
From: Jonathan Davies <hidden>
Date: 2021-06-14 14:54:05
Also in:
lkml, netdev
On 14/06/2021 13:23, Andrew Lunn wrote:
quoted
quoted
quoted
Userspace solutions include: 1. udev backing off and retrying in the event of a collision; or 2. avoiding ever renaming a device to a name in the "eth%d" namespace.Picking a different namespace does not cause a lack of collisions to happen, you could have multiple usb network devices being found at the same time, right? So no matter what, 1) has to happen.Within a namespace, the "%d" in "eth%d" means __dev_alloc_name finds a name that's not taken. I didn't check the locking but assume that can only happen serially, in which case two devices probed in parallel would not mutually collide. So I don't think it's necessarily true that 1) has to happen.Say you changed the namespace to usb%d. And you want the device in USB port 1.4 to be usb1 and the device in USB port 1.3 to be usb0. They probe the other way around. You have the same problem, you need to handle the race condition in udev, back off an try again.
The point of the patch was that if your intended names are usb0 and usb1 then the module parameter would allow you to nominate a prefix for the initial names that's not "usb", thereby avoiding collisions. But I can see that the consensus is to live with the possibility of overlap between the names initially assigned by the kernel and the intended names, so this is moot. Thanks for all the input. Jonathan