All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Davies <jonathan.davies@nutanix.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: Oliver Neukum <oneukum@suse.com>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	netdev@vger.kernel.org, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] net: usbnet: allow overriding of default USB interface naming
Date: Mon, 14 Jun 2021 10:32:22 +0100	[thread overview]
Message-ID: <e35ddece-3fd2-4252-6786-af507ba819d2@nutanix.com> (raw)
In-Reply-To: <YMOaZB6xf2xOpC0S@lunn.ch>

On 11/06/2021 18:16, Andrew Lunn wrote:
> On Fri, Jun 11, 2021 at 03:23:39PM +0000, Jonathan Davies wrote:
>> When the predictable device naming scheme for NICs is not in use, it is
>> common for there to be udev rules to rename interfaces to names with
>> prefix "eth".
>>
>> Since the timing at which USB NICs are discovered is unpredictable, it
>> can be interfere with udev's attempt to rename another interface to
>> "eth0" if a freshly discovered USB interface is initially given the name
>> "eth0".
>>
>> Hence it is useful to be able to override the default name. A new usbnet
>> module parameter allows this to be configured.
>>
>> Signed-off-by: Jonathan Davies <jonathan.davies@nutanix.com>
>> Suggested-by: Prashanth Sreenivasa <prashanth.sreenivasa@nutanix.com>
>> ---
>>   drivers/net/usb/usbnet.c | 13 ++++++++++---
>>   1 file changed, 10 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
>> index ecf6284..55f6230 100644
>> --- a/drivers/net/usb/usbnet.c
>> +++ b/drivers/net/usb/usbnet.c
>> @@ -72,6 +72,13 @@ static int msg_level = -1;
>>   module_param (msg_level, int, 0);
>>   MODULE_PARM_DESC (msg_level, "Override default message level");
>>   
>> +#define DEFAULT_ETH_DEV_NAME "eth%d"
>> +
>> +static char *eth_device_name = DEFAULT_ETH_DEV_NAME;
>> +module_param(eth_device_name, charp, 0644);
>> +MODULE_PARM_DESC(eth_device_name, "Device name pattern for Ethernet devices"
>> +				  " (default: \"" DEFAULT_ETH_DEV_NAME "\")");
> 
> Module parameter are not liked in the network stack.

Thanks, I wasn't aware. Please help me understand: is that in an effort 
to avoid configurability altogether, or because there's some preferred 
mechanism for performing configuration?

> It actually seems like a udev problem, and you need to solve it
> there. It is also not specific to USB. Any sort of interface can pop
> up at an time, especially with parallel probing of busses.

Yes, this is also applicable to the naming done for all ethernet 
devices. But I've seen the problem multiple times for USB NICs, which is 
why I proposed a fix here first.

> So you need
> udev to detect there has been a race condition and try again with the
> rename.

(See reply to similar question in sibling thread.)

Thanks,
Jonathan

  reply	other threads:[~2021-06-14  9:32 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-11 15:23 [PATCH] net: usbnet: allow overriding of default USB interface naming Jonathan Davies
2021-06-11 17:16 ` Andrew Lunn
2021-06-14  9:32   ` Jonathan Davies [this message]
2021-06-14 12:40     ` Oliver Neukum
2021-06-12  7:01 ` Greg KH
2021-06-14  9:32   ` Jonathan Davies
2021-06-14  9:43     ` Greg KH
2021-06-14 10:58       ` Jonathan Davies
2021-06-14 12:23         ` Andrew Lunn
2021-06-14 14:53           ` Jonathan Davies
2021-06-14 13:51         ` Greg KH
2021-06-14 14:53           ` Jonathan Davies
2021-06-14 19:20             ` Jakub Kicinski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e35ddece-3fd2-4252-6786-af507ba819d2@nutanix.com \
    --to=jonathan.davies@nutanix.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=oneukum@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.