Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2825044rwb; Wed, 30 Nov 2022 11:21:24 -0800 (PST) X-Google-Smtp-Source: AA0mqf4xy0E/i6W4IeBazfYM8D/a0cqxSRmW3Hl36SFnJFyinMOO6i2irvZxe5LQzleTfgxxiae3 X-Received: by 2002:a17:907:2bce:b0:7bf:2321:f1f0 with SMTP id gv14-20020a1709072bce00b007bf2321f1f0mr14516212ejc.533.1669836084461; Wed, 30 Nov 2022 11:21:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669836084; cv=none; d=google.com; s=arc-20160816; b=BfjqLv/b5X5Req0NiUGbBkuofHmon1RcQWNr/c92FQnkQ5Rl5Ww0bxOnIBYqykueXx OjGGKaT9IO9Y+0eI+yjPdcHkbDtA7ad4enqT8XSXU9PmuBKrWKFFTppqL4Wm8+f/YosF 0SRbD4/hdnu0V9Gi6zI5oqBlO20MDgnssTADSn1FwbdReDbYtCeWeQNT+TFhdN6Vmetk FnmEMxd1piU9arFGp11WlYALhSfzyG+IX2ltmQp+Cv1HmApCwBf3SvrIbEkZqw7/bJqW uRKRqsqjPAL7StWoNV9g4z2KTI35wVKswh5aAYKbhQswYpFHrtNlXmkN4ZCD8fNhfDzr XX2g== 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=FgdMCq+V+XgxrwzzGwB2JIJwQhAokuYjtod4U33OFXs=; b=k1LXWeTflzYNBhFF/Km+46VhqB1YOPSjwxP204tSJrhx0cB6shAToeUZpSfqGsgYGf 92UGsMvrvPZNXPOCV/AX/+FYcIkHW0KrV61iyjDpDnUDjh0XriLPC1pZDHVSgYTOwPX0 vte5rkWKnLV3ZslOjK1YmzBnlGJ/DLQ71BhUQfvdeDiZg7+qwwn9JfFybtcEtiR8UXTh /Ws9FJFHL4SfrQlZVh73J+aRPd2ua6RsXgmmM49KuMW60qs0Ax2Y1K9EMheojxiOB/zE GPWLxRZG044n13d/oxpmKkQh/l4XvYHWIFjzNT4/rmM3kAm8VxdD3+25UT/rR2DiEVns WHRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=SUhJVGr7; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sh39-20020a1709076ea700b0078ae5192906si1846378ejc.193.2022.11.30.11.21.04; Wed, 30 Nov 2022 11:21:24 -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=@gmail.com header.s=20210112 header.b=SUhJVGr7; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230200AbiK3S0v (ORCPT + 83 others); Wed, 30 Nov 2022 13:26:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229761AbiK3S0o (ORCPT ); Wed, 30 Nov 2022 13:26:44 -0500 Received: from mail-qk1-x72c.google.com (mail-qk1-x72c.google.com [IPv6:2607:f8b0:4864:20::72c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28E6D14039; Wed, 30 Nov 2022 10:26:43 -0800 (PST) Received: by mail-qk1-x72c.google.com with SMTP id z17so12924000qki.11; Wed, 30 Nov 2022 10:26:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=FgdMCq+V+XgxrwzzGwB2JIJwQhAokuYjtod4U33OFXs=; b=SUhJVGr7UAz7Ej0sPcQ8gotPM+yu1ALclfoKnXiWCSIpBXCa+bSMh+vLBq+7LF+rm6 CDMPdo/WS+CM+cnc0IzL/W8MXzdPuVaxIsvskKPGH0IisYAOwgQkpNiIhPTkMZKeMleU cpjfdndcLkEnezELSzrZ0aTtWO+XPerpAth3CQpsk6NWy6O8z8QMoZvQ97Q7UxzUpF2R LTK6Z3hZtsAZ/8TGeOfZBY3FuXVuBZZmLrmXwKZPBPHaAuzsJ7V9ZsdylLcWVLVmmxla 8sIc/e4Q5Qk24NsQy/DSz7ukVeCY8mRKaagu90ZHIWwV4bqac49WzLzDathvJPjZ4LKk 4BHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=FgdMCq+V+XgxrwzzGwB2JIJwQhAokuYjtod4U33OFXs=; b=AxK8vfm+qCc2lJJRa6DJSWPgsjVJfXb5XGklzg97SEHR93pQ+ue3Aj4rI+5kT0EA+H mPoCNe58F2f+rtZx9R9UPjaJ9Eg3jGUYBibknkM1ql7XOAv/kIhn3PYVrrMGLRSLp+vA WDwzmmuPmbDippDUR8ItWh8kerUHUow3DmgheK5/WsgR9L69DEXyKAPXKx9a8/oIZr6U EyLlapMVYqMdRtHE5yET5U5q51Jd/p8RwVkHsAeYJ4JDwGPwtMBkk/uWyAQGtdGOqDzX JdzFBZS1HjWMuRL4IcKLCz5q6DlMcQI2CyY7Cki0UxHipoAzdFku6jgn6C92R2wpNYQu fEnQ== X-Gm-Message-State: ANoB5pl0T78N7sMRU4zPnez0CfB7Ta2l0PKNlmOlUllJ5YHjAErrB7YJ Zxgj7j3IpMv0JctXsv9AmRbRu3jVBiiUycC1O3MHJg== X-Received: by 2002:a37:c96:0:b0:6ed:9450:9f5 with SMTP id 144-20020a370c96000000b006ed945009f5mr55296215qkm.310.1669832802088; Wed, 30 Nov 2022 10:26:42 -0800 (PST) Received: from cth-desktop-dorm.rtp.nc.cth451.me ([2605:a601:a674:c801:49d0:f39a:eef4:72e0]) by smtp.gmail.com with ESMTPSA id l10-20020ac848ca000000b003a494b61e67sm1237579qtr.46.2022.11.30.10.26.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Nov 2022 10:26:41 -0800 (PST) Date: Wed, 30 Nov 2022 13:26:40 -0500 From: Tianhao Chai To: Brian Masney Cc: irusskikh@marvell.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] net: atlantic: fix check for invalid ethernet addresses Message-ID: <20221130182640.GA394566@cth-desktop-dorm.rtp.nc.cth451.me> References: <20221130174259.1591567-1-bmasney@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,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, Nov 30, 2022 at 12:57:23PM -0500, Brian Masney wrote: > I have a question about the original commit that introduced this check: > 553217c24426 ("ethernet: aquantia: Try MAC address from device tree"). > The commit message talks about getting the MAC address from device tree, > however I don't see any compatible lines in this driver, nor a > of_match_table. As far as I can tell, this driver is only setup to be > accessed over PCIe. In aq_nic_ndev_register(), the code calls platform_get_ethdev_address(), which in turn access the device tree via OF interface. > The random MAC address is not ideal for our lab since we'd like to have > stable addresses. I'd like to have the bootloader be able to inject a > MAC address that's generated based on the board's serial number. I > assume that it would go in the chosen node in device tree. One of the > issues is that there are multiple NICs on this board, so I'm not sure > how that would go in the chosen node and identify this particular NIC. > Does anyone know of a place in the kernel where this is already done? I'm not familar with this particular board, but this probably shouldn't be done in kernel. AFAIK uboot allows overriding MAC with env 'ethaddr'. uboot then either writes this MAC into DT or calls NIC specific code to set the MAC into NIC memory before booting the kernel. The other way around I can think of is to use systemd-networkd or some other network management daemon to override the mac address as it tries to establish a network connection. This might be less hassle if you don't want to mess with the boot loader, but for embedded devices you'd need a different root fs image for every board. Acked-by: Tianhao Chai