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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 8A7BEC433EF for ; Tue, 11 Jan 2022 09:32:03 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D8CDD81E06; Tue, 11 Jan 2022 10:32:00 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=monstr.eu Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=monstr-eu.20210112.gappssmtp.com header.i=@monstr-eu.20210112.gappssmtp.com header.b="YAk2Tf2p"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 26E7181982; Tue, 11 Jan 2022 10:31:59 +0100 (CET) Received: from mail-ed1-x533.google.com (mail-ed1-x533.google.com [IPv6:2a00:1450:4864:20::533]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id CA4F281E06 for ; Tue, 11 Jan 2022 10:31:55 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=monstr.eu Authentication-Results: phobos.denx.de; spf=none smtp.mailfrom=monstr@monstr.eu Received: by mail-ed1-x533.google.com with SMTP id q25so56030208edb.2 for ; Tue, 11 Jan 2022 01:31:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monstr-eu.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=LNAo7J1M2VbPCz47SK2bXSy7Dew80iPoiWeFdBpkOn4=; b=YAk2Tf2pxoGJ1Y1Q7pp0a+mi4vATdJfXQx6O3KMN+nE3ePq0mde8YC63O2ZlY7niWt Ch86vArymVP+WNKdDAYWO90KToowXU3QsqiDKMFRxgePW6b8s39nlD+Zze84oP97qvsT 7iupcUFIty7mvFSW3sZUnYHmiCpnEQP+AZthQ/mHUWyKS98ys57Ln4u62Cp2GqKDCfCn wSMM+xlW5aIgQCvn/N8vYlXJRJjufUr1CXbRbuBFMKOHaVyP1Jn6/t27/ytkgXahau9P kGzdPJgUYcpYU6EIuW+Ga44UcJTFlvnyEZstwSUpK2rZXnaJbsc/ohgwXVnIsfNNZ+0q Ftyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=LNAo7J1M2VbPCz47SK2bXSy7Dew80iPoiWeFdBpkOn4=; b=ifiuY/w390WRwka7rvq1ZS6yY4LOe3xIgS+TY44jADkILpZqHJv60cbGCNSqdqg/Ml 2ZTAROD0kVDxZtLsvKo2nDKg6StMleMswlRlEr81e5yNfsVUENGDA/nBJ2CvkUhtfGUq nMmfJd2SIw6LYu2IFhrFtAQWdCI3aaDvXmQjEIVa7rngKKhYjznN6su478u44eFdNHFj 0oovu0XBPR5aYda+elNgZkZYJ0Tgk/srqiVuR+tt5QtieK45cSGFL2CvvtitPfulqJ+8 hMIX6GwECf1OSVWZxq4wH4omlpwxWgDIrD5SOngvhGgG2qtsgMz+OeN92g74QEWQncaL b2Qg== X-Gm-Message-State: AOAM530BCZcYbFXSNFC5pM3vUhJCpIYDB4yp5OzeBq3BWI51q+85YXjv xzc3D2U4uboSLeAl2JxYGqTingvNr4A8l3SYgCkh0SkoulihcQ== X-Google-Smtp-Source: ABdhPJypzb/AsdLjS5Aol3B+wRzNYu/Wixv4LIIB8Mkx+AB3sgwTHKC1sspwi7bAJbGb2qv3nQjpG5WKl9l2quGPzdg= X-Received: by 2002:a50:d4d0:: with SMTP id e16mr3538643edj.293.1641893515432; Tue, 11 Jan 2022 01:31:55 -0800 (PST) MIME-Version: 1.0 References: <20211122134548.3310678-1-trini@konsulko.com> <20220110140352.GO2773246@bill-the-cat> <062b415e-41e6-c9e2-cd4b-a9338200b0fb@xilinx.com> In-Reply-To: <062b415e-41e6-c9e2-cd4b-a9338200b0fb@xilinx.com> From: Michal Simek Date: Tue, 11 Jan 2022 10:31:44 +0100 Message-ID: Subject: Re: [PATCHv3] net: uclass: Save generated ethernet MAC addresses to the environment To: Tom Rini , Michal Simek Cc: Ramon Fried , U-Boot Mailing List , Wolfgang Denk Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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 po 10. 1. 2022 v 15:09 odes=C3=ADlatel Michal Simek napsal: > > > > On 1/10/22 15:03, Tom Rini wrote: > > On Fri, Jan 07, 2022 at 04:08:34PM +0100, Michal Simek wrote: > >> so 27. 11. 2021 v 20:37 odes=C3=ADlatel Ramon Fried napsal: > >>> > >>> On Mon, Nov 22, 2021 at 3:45 PM Tom Rini wrote: > >>>> > >>>> From: Michal Simek > >>>> > >>>> When a MAC address is randomly generated we currently only update th= e > >>>> appropriate data structure. For consistency and to re-align with > >>>> historic usage, it should be also saved to the appropriate environme= nt > >>>> variable as well. > >>>> > >>>> Cc: Wolfgang Denk > >>>> Signed-off-by: Michal Simek > >>>> Reviewed-by: Ramon Fried > >>>> [trini: Update Kconfig, handle legacy networking case as well] > >>>> Signed-off-by: Tom Rini > >>>> --- > >>>> Changes in v3: > >>>> - Update Kconfig help text with Wolfgang's suggestion > >>>> - Reword the commit message to hopefully be clearer > >>>> > >>>> Changes in v2: > >>>> - Update Kconfig help text to reflect this change. > >>>> - Update the legacy path to match. > >>>> --- > >>>> net/Kconfig | 9 +++++---- > >>>> net/eth-uclass.c | 2 ++ > >>>> net/eth_legacy.c | 2 ++ > >>>> 3 files changed, 9 insertions(+), 4 deletions(-) > >>>> > >>>> diff --git a/net/Kconfig b/net/Kconfig > >>>> index 7a2d14501881..cabe93c6bd29 100644 > >>>> --- a/net/Kconfig > >>>> +++ b/net/Kconfig > >>>> @@ -27,10 +27,11 @@ config BOOTP_SEND_HOSTNAME > >>>> config NET_RANDOM_ETHADDR > >>>> bool "Random ethaddr if unset" > >>>> help > >>>> - Selecting this will allow the Ethernet interface to functi= on > >>>> - even when the ethaddr variable for that interface is unset= . > >>>> - A new MAC address will be generated on every boot and it w= ill > >>>> - not be added to the environment. > >>>> + Selecting this will allow the Ethernet interface to functi= on even > >>>> + when the ethaddr variable for that interface is unset. In= this case, > >>>> + a random MAC address in the locally administered address s= pace is > >>>> + generated. It will be saved to the appropriate environment= variable, > >>>> + too. > >>>> > >>>> config NETCONSOLE > >>>> bool "NetConsole support" > >>>> 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 addr= ess - %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); > >>>> diff --git a/net/eth_legacy.c b/net/eth_legacy.c > >>>> index f383ccce0b92..e7f53b958b2e 100644 > >>>> --- a/net/eth_legacy.c > >>>> +++ b/net/eth_legacy.c > >>>> @@ -164,6 +164,8 @@ int eth_write_hwaddr(struct eth_device *dev, con= st char *base_name, > >>>> net_random_ethaddr(dev->enetaddr); > >>>> printf("\nWarning: %s (eth%d) using random MAC addr= ess - %pM\n", > >>>> dev->name, eth_number, dev->enetaddr); > >>>> + eth_env_set_enetaddr_by_index("eth", dev_seq(dev), > >>>> + pdata->enetaddr); > >>>> #else > >>>> printf("\nError: %s address not set.\n", > >>>> dev->name); > >>>> -- > >>>> 2.25.1 > >>>> > >>> Acked-by: Ramon Fried > >> > >> Ramon/Tom: Did anybody take this patch? Or you want me to take it? > > > > I don't think I picked it up, and I'm fine with it coming via your tree= . > > > > Applied. > M CI found that legacy case code is broken. It was just c&p from DM case that's why I removed it from my queue and sent v4 version. Thanks, Michal --=20 Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91 w: www.monstr.eu p: +42-0-721842854 Maintainer of Linux kernel - Xilinx Microblaze Maintainer of Linux kernel - Xilinx Zynq ARM and ZynqMP ARM64 SoCs U-Boot custodian - Xilinx Microblaze/Zynq/ZynqMP/Versal SoCs