From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 249D2C433F5 for ; Thu, 4 Nov 2021 02:09:37 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3787E60F9D for ; Thu, 4 Nov 2021 02:09:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 3787E60F9D Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=ti.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A1E7C83642; Thu, 4 Nov 2021 03:09:30 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=ti.com header.i=@ti.com header.b="PrsvoNDA"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1A2AA83645; Thu, 4 Nov 2021 03:09:29 +0100 (CET) Received: from lelv0143.ext.ti.com (lelv0143.ext.ti.com [198.47.23.248]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 7F3DB83305 for ; Thu, 4 Nov 2021 03:09:24 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=grygorii.strashko@ti.com Received: from fllv0034.itg.ti.com ([10.64.40.246]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 1A429LEq052109; Wed, 3 Nov 2021 21:09:21 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1635991761; bh=IslxVoVQa3xDuqvCciJplQylZbctU27TGWwnM/xW9qA=; h=Subject:To:CC:References:From:Date:In-Reply-To; b=PrsvoNDADD1hU6FhyFr1pQuxJIu+AAaJZoVZEgaps80MfbeyYsma7Rgcpk5CiCpru I+HUFuwCliOwUROmdKIsNPeilnwh9VAPX3B18Fa9E4z6UCvSHtne8NV2tJpNCu+Jet 6gYUJRXGggljZ+yBb1US/h6Si6Uismq6XgxMV4SE= Received: from DLEE109.ent.ti.com (dlee109.ent.ti.com [157.170.170.41]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 1A429LIv090824 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 3 Nov 2021 21:09:21 -0500 Received: from DLEE109.ent.ti.com (157.170.170.41) by DLEE109.ent.ti.com (157.170.170.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.14; Wed, 3 Nov 2021 21:09:21 -0500 Received: from lelv0326.itg.ti.com (10.180.67.84) by DLEE109.ent.ti.com (157.170.170.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.14 via Frontend Transport; Wed, 3 Nov 2021 21:09:21 -0500 Received: from [10.250.100.73] (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id 1A429JeC022647; Wed, 3 Nov 2021 21:09:19 -0500 Subject: Re: [PATCH] net: uclass: Save ethernet MAC address when generated To: Michal Simek , Michael Walle , CC: , , , References: <20211102090015.2395446-1-michael@walle.cc> From: Grygorii Strashko Message-ID: <1d5f84ab-e481-8779-4b5b-adfbc4ff3bf3@ti.com> Date: Thu, 4 Nov 2021 04:09:07 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean On 02/11/2021 12:27, Michal Simek wrote: > > > On 11/2/21 10:00, Michael Walle wrote: >>> On Fri, Oct 29, 2021 at 2:14 PM Michal Simek wrote: >>>> >>>> When MAC address is randomly generated it should be also saved to >>>> variables. This step is there when MAC address is passed via pdata but not >>>> when it is randomly generated. >>>> >>>> Signed-off-by: Michal Simek >>>> --- >>>> >>>>   net/eth-uclass.c | 2 ++ >>>>   1 file changed, 2 insertions(+) >>>> >>>> diff --git a/net/eth-uclass.c b/net/eth-uclass.c >>>> index 0da0e85be031..58c308f33276 100644 >>>> --- a/net/eth-uclass.c >>>> +++ b/net/eth-uclass.c >>>> @@ -583,6 +583,8 @@ static int eth_post_probe(struct udevice *dev) >>>>                  net_random_ethaddr(pdata->enetaddr); >>>>                  printf("\nWarning: %s (eth%d) using random MAC address - %pM\n", >>>>                         dev->name, dev_seq(dev), pdata->enetaddr); >>>> +               eth_env_set_enetaddr_by_index("eth", dev_seq(dev), >>>> +                                             pdata->enetaddr); >>>>   #else >>>>                  printf("\nError: %s address not set.\n", >>>>                         dev->name); >>>> -- >>>> 2.33.1 >>>> >>> Reviewed-by: Ramon Fried >> >> Please note, that this will change behavior. Before this commit, the >> random mac address was local to u-boot (at least for most network drivers). >> After this commit, it will also be communicated to linux. >> >> I'm not sure what to think of this. At the very least, this should be >> documented in the commit message and in the Kconfig help text. > > Thanks for bringing this up. I have no issue that this address is being propagated to Linux but others can feel this as an issue. > I can definitely extend commit message to say it. Propagating random MAC to Linux might be not a good idea as Linux will silently use it while in many cases it means that smth is wrong, and message like "Driver uses random MAC!" helps narrow down issues earlier. For example, we occasionally copy-pasted wrong mac in DT and detected this only after some time when started connecting similar boards to each other :( Also, Linux may have it's own way to retrieve MAC if not provided by u-boot. Wouldn't be enough to just print MAC console when random is used? > > I found this via net list command where you can see controllers but you can't see their mac addresses which is IMHO wrong. -- Best regards, grygorii