Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp7437143rwl; Fri, 30 Dec 2022 08:26:48 -0800 (PST) X-Google-Smtp-Source: AMrXdXtRwWAAYqx7+JINKDwfJGqbuH0DCn41E2ZARHZ7WrjZVhIekqHiUmDWtDCvnh7bX5+NcfRB X-Received: by 2002:a05:6a20:9498:b0:9d:efbf:8143 with SMTP id hs24-20020a056a20949800b0009defbf8143mr50378407pzb.12.1672417608532; Fri, 30 Dec 2022 08:26:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672417608; cv=none; d=google.com; s=arc-20160816; b=siSulSl7jNhrnRSIeazGJKWbeL7KhYJQY8Pgi7KAyKwRLspab1dl0reXcsUWdWuqcv 53qhNKKynDM5yFhR8gMTnbwqlE+iwFghmUY9efoTYHralK29cf22XwkkDqkcyFZT0fvY 2bqD9QkVZdhtqzdGzV8ZeycL/gow8g3Fq4aBIMBK1YMsos6MFsPEuUJUBHEfSaJKcMaK tFeYvYp1x6ZFfJ7DpS0ZDG6KXJg0ncj7N0losCVohAL7EkaRdOmm9HdG2nUZ9iQkHtdz lyLgKoPOromytvnCwtmWVY3A953My+xN+vb3rUIst+i2IC5wqor1duMCpD4rWt8E1Svk ijiQ== 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=XsTtrjg75si90dxfNtwbabByETT2NBXCVBmC40eZH04=; b=UKME/axrt4cooDvh+vqyweKZaqD8IBMvXKUtsm3MUH3Cl2pjA1AO/m/DKi3AklzEdx VvsR4Fc1oOwhOG1tuu0QGN66wBgj3UzLXIcGRRKLIHQsDaut686wnHm4Pu2rdcXf53Yj FFW8vGhYTyz1ZD5sxJE+TVrMak8wRruriccZwqRyLicSHvpyc3BE57XQoKMR3L6FZPmB fE2BoBLfhhfdY0Y+i14HRRSGKDSyrW2DwlVVKMYwlYMJEd4y57e7Jp/Z4QcU50oVhRta VR+mG+Isnv4n8sMg5gHpXwF5bKrc+jfBVkHje9wUmCfjD1xYuN8JZtT8ZEFxm0LiqpVu gH1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=IZ0KhtNn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q64-20020a632a43000000b0044c3ec9ea71si23161708pgq.630.2022.12.30.08.26.39; Fri, 30 Dec 2022 08:26:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=IZ0KhtNn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235223AbiL3QRt (ORCPT + 63 others); Fri, 30 Dec 2022 11:17:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42282 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231150AbiL3QRr (ORCPT ); Fri, 30 Dec 2022 11:17:47 -0500 Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F163636F; Fri, 30 Dec 2022 08:17:46 -0800 (PST) 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=XsTtrjg75si90dxfNtwbabByETT2NBXCVBmC40eZH04=; b=IZ0KhtNn2y1QLsmjvOkmntLu97 IbeYhdPHWUsp0yyWMS9oytIY+1lx1y1oqlUglRtNTiMkqNaGYHa+p4NoQEEoJbRFCtUx6oJ+Umoho BHgk7XDQen41+LoPAmU+XCiLwtQrKUJGHHpsGHXwcCIFKn2Zyn6FwP/7p2sztzXXEIdY=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1pBI4N-000leV-Mk; Fri, 30 Dec 2022 17:17:19 +0100 Date: Fri, 30 Dec 2022 17:17:19 +0100 From: Andrew Lunn To: Leon Romanovsky Cc: Alexander Duyck , Jakub Kicinski , Lixue Liang , anthony.l.nguyen@intel.com, linux-kernel@vger.kernel.org, jesse.brandeburg@intel.com, davem@davemloft.net, edumazet@google.com, pabeni@redhat.com, netdev@vger.kernel.org, lianglixue@greatwall.com.cn Subject: Re: [PATCH v7] igb: Assign random MAC address instead of fail in case of invalid one Message-ID: References: <20221213074726.51756-1-lianglixuehao@126.com> <20221214085106.42a88df1@kernel.org> <20221214125016.5a23c32a@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Dec 28, 2022 at 11:15:01AM +0200, Leon Romanovsky wrote: > On Mon, Dec 19, 2022 at 07:30:45AM -0800, Alexander Duyck wrote: > > On Sun, Dec 18, 2022 at 12:41 AM Leon Romanovsky wrote: > > > > > > On Wed, Dec 14, 2022 at 12:50:16PM -0800, Jakub Kicinski wrote: > > > > On Wed, 14 Dec 2022 20:53:30 +0200 Leon Romanovsky wrote: > > > > > On Wed, Dec 14, 2022 at 08:51:06AM -0800, Jakub Kicinski wrote: > > > > > > On Wed, 14 Dec 2022 09:22:13 +0200 Leon Romanovsky wrote: > > > > > > > NAK to any module driver parameter. If it is applicable to all drivers, > > > > > > > please find a way to configure it to more user-friendly. If it is not, > > > > > > > try to do the same as other drivers do. > > > > > > > > > > > > I think this one may be fine. Configuration which has to be set before > > > > > > device probing can't really be per-device. > > > > > > > > > > This configuration can be different between multiple devices > > > > > which use same igb module. Module parameters doesn't allow such > > > > > separation. > > > > > > > > Configuration of the device, sure, but this module param is more of > > > > a system policy. > > > > > > And system policy should be controlled by userspace and applicable to as > > > much as possible NICs, without custom module parameters. > > > > > > I would imagine global (at the beginning, till someone comes forward and > > > requests this parameter be per-device) to whole stack parameter with policies: > > > * Be strict - fail if mac is not valid > > > * Fallback to random > > > * Random only ??? > > > > > > Thanks > > > > So are you suggesting you would rather see something like this as a > > sysctl then? Maybe something like net.core.netdev_mac_behavior where > > we have some enum with a predetermined set of behaviors available? I > > would be fine with us making this a global policy if that is the route > > we want to go. It would just be a matter of adding the sysctl and an > > accessor so that drivers can determine if it is set or not. > > Something like that and maybe convert drivers and/or to honor this policy. Converting drivers is very unlikely to happen. There are over 240 calls to register_netdev() under drivers/net/ethernet. Who has the time to add such code to so many drivers? What many drivers do is called one of platform_get_ethdev_addr(), of_get_mac_address(), or device_get_ethdev_address() etc, which will look around DT, ACPI and maybe in NVMEM, etc. It is not user space controllable policy, but most drivers fall back to a random MAC address, and a warning, if no fixed MAC addresses can be found. So i would recommend doing what most drivers do, if everything else fails, us a random address. Andrew