Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp744277pxj; Fri, 11 Jun 2021 10:19:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyotxfn663zzJqORCAvOq95a/OMA5PW5zNtbFqAJhV5t68iLb25bcQK/fqQEEjUuphZvlAG X-Received: by 2002:a17:906:f117:: with SMTP id gv23mr4745464ejb.432.1623431946366; Fri, 11 Jun 2021 10:19:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623431946; cv=none; d=google.com; s=arc-20160816; b=SRuY0T5rKxBs2mcShP7+lg7EXY23v9SJxlB5q47CM/3R5/GvwaB0Ci6tEOFWLw7hvR 5zASHs5uw6E1Gc7BjJQrF4c2A71Xm0TzYttTx+NNr7Hbb3RWGrAbxVt+wwnHr5sCYO3F cqWoKEmDBARAkgTRCM88UfD+pfk6C4x9Kg0nmme99XHK3egmAMWELQKZvkUMSxSaFFTa ja5+F9h4pLwRvYaOi3ATWR4QtMntIGxeV3Sy/gyfsZOSGkOcBbVYSnPZQEv0u4qcP+Px 6IEFBSGksDqYNfDjvA6YL9//aYJqfUrBwO2vkaQCg8ECa+EOLpVY/vQSpBYiJvl7Thg0 DTQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=TvM1tGh9c3xs7mHGT3XCOu41VC7yHDCxbSRhbqeUah4=; b=neyet83HrTEh/9xFxnlgb9N7zp4JH6H1hHJM1uhlLjaMxXNZQjMCf/ljzKbk+9C6Aa 2Q9nsGImnEyyYiTW0OJo8J6kjOuf7BzqgXE1WdfO8teCJvQsaknvC4blTz+wFpGC9Hsw MKkN219X1I9DkHkt0z4n+HfJSth+zJAKLwnF5m271QOEOI9zhyiqkhZnDFrxy5A9JN2B N6dLieLKQWaBVjs9Z2EP74oDQv3qBUzwZDRwLnOrSMJf1yqtByWTDewn7A7NgoUSR4Ap 0x/+HAIqDbbk1NLgRH1FcuhsMFQ1hSK7zp3ke/hm4P1zIwfZ3Y04FcN2fH/h0O4Lmwp6 tMUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=GaCUOtlR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j3si5452925ejj.516.2021.06.11.10.18.37; Fri, 11 Jun 2021 10:19:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=GaCUOtlR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230312AbhFKRS0 (ORCPT + 99 others); Fri, 11 Jun 2021 13:18:26 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:59722 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229510AbhFKRSZ (ORCPT ); Fri, 11 Jun 2021 13:18:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=TvM1tGh9c3xs7mHGT3XCOu41VC7yHDCxbSRhbqeUah4=; b=GaCUOtlRRYolMt+/zTVtDYsfLC LfhOc9v8xu4fRDyMfMJi+kR1KOUFbDhXca/lkPitQMB+ALcljQh63uIn80PWHYp9uhBaGLn0YPPIU WTm4NuUv0Ap+Hnjfou1PJ416+Lc6EdS0tnYtHPlw2kDOsfsLBdCuutoaHd3c4YE23mS4=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1lrklY-008t5y-AG; Fri, 11 Jun 2021 19:16:20 +0200 Date: Fri, 11 Jun 2021 19:16:20 +0200 From: Andrew Lunn To: Jonathan Davies Cc: Oliver Neukum , "David S. Miller" , Jakub Kicinski , 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 Message-ID: References: <20210611152339.182710-1-jonathan.davies@nutanix.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210611152339.182710-1-jonathan.davies@nutanix.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > Suggested-by: Prashanth Sreenivasa > --- > 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. 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. So you need udev to detect there has been a race condition and try again with the rename. Andrew