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 E00A4C433EF for ; Mon, 10 Jan 2022 14:09:50 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B9ADB830BE; Mon, 10 Jan 2022 15:09:48 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=xilinx.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=xilinx.onmicrosoft.com header.i=@xilinx.onmicrosoft.com header.b="tMj8Y13s"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B09D58310C; Mon, 10 Jan 2022 15:09:47 +0100 (CET) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2062a.outbound.protection.outlook.com [IPv6:2a01:111:f400:7e89::62a]) (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 2B40A830BE for ; Mon, 10 Jan 2022 15:09:44 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=xilinx.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=michals@xilinx.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ayCdBDItkd/81Zu8EMM/hh1ig7qazfHENraMzZOUvq08CYMp9uZuL3R7BT4qz+nBP5an8TYxAL8fq6RSSgAs05A3tp3U63as3ElnEBltSUJMRLibE1T2yQrafTx+GnO/QrGN4zWv1EGaLplUpdlVP4RHf871QKsyfwFmBvqtxeoT2noDXoOXXnXzUL+5Gg1cbjZd+hC6g4T7d1LNQGeTxNxJ9DqptF99C0MpZJlYDZXqQB3DnlSMoeg8GyLF8OFBRFOyKzTRlcYlbtWlYpLZ6ua4cty9JeFM4JYvsKczKFNKC11IWhYXF2Pg67nJ1cUhevWdv3HYhAXz6AvoMesPPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=5dXDltKHdZfBKb1LiIGlr4hwgkFkAnPalGhbltUPwKI=; b=Wt4YVhjByIxof1hbgUEWi5uw5NhmTIPtBDm6vFZ9yQe8uZN8T8fcXExiiJXuoc7sF1cr8Cm1sr7kolZurUUrVzeUBhWoDt46+G8fEI+dUrNRYRrfWS4jll1gIzRVAR1a1ZKL5JWQXgoD5moM1A+X46N7247FULeVdKgVp3uHZX5U2xJv1Vya/6uy4t6BKhrd9Y+ejPgjtl7OoGH9evq+zD/hIZ+W+4TwPGs3J6XJyDmatRRW5OfHH6v+naNWE1PHQIWFKGD0fUJL9LeRU+4bSO23x4soz9ab/CNHjIn1/0RbyEeJV9ADsrfPGrX9neF5Y1yQRU84NRKHQ8pYMBpHOQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=konsulko.com smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5dXDltKHdZfBKb1LiIGlr4hwgkFkAnPalGhbltUPwKI=; b=tMj8Y13sCr3BP5M05iRWl2rZadQ66VH6XbtaIA/DhTDZ8z/L897/+OGZupBRD2R56V2mPObmw9eoIGFZaUXuXDzlT4SiY8i4JZhA79BpIeDCjglDXafDgX5BC4iMgeeXS+z2kva2F0ZCAYRTsjyXcy0/BzLtsna97xIdDbOzMZM= Received: from DM5PR16CA0021.namprd16.prod.outlook.com (2603:10b6:3:c0::31) by MWHPR02MB2479.namprd02.prod.outlook.com (2603:10b6:300:3c::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4867.11; Mon, 10 Jan 2022 14:09:39 +0000 Received: from DM3NAM02FT020.eop-nam02.prod.protection.outlook.com (2603:10b6:3:c0:cafe::e5) by DM5PR16CA0021.outlook.office365.com (2603:10b6:3:c0::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4867.7 via Frontend Transport; Mon, 10 Jan 2022 14:09:39 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch01.xlnx.xilinx.com; Received: from xsj-pvapexch01.xlnx.xilinx.com (149.199.62.198) by DM3NAM02FT020.mail.protection.outlook.com (10.13.4.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4867.7 via Frontend Transport; Mon, 10 Jan 2022 14:09:39 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.14; Mon, 10 Jan 2022 06:09:38 -0800 Received: from smtp.xilinx.com (172.19.127.96) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Mon, 10 Jan 2022 06:09:38 -0800 Envelope-to: trini@konsulko.com, monstr@monstr.eu, rfried.dev@gmail.com, u-boot@lists.denx.de, wd@denx.de Received: from [10.254.241.49] (port=45996) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1n6vMb-0006aG-E1; Mon, 10 Jan 2022 06:09:33 -0800 Message-ID: <062b415e-41e6-c9e2-cd4b-a9338200b0fb@xilinx.com> Date: Mon, 10 Jan 2022 15:09:31 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.4.1 Subject: Re: [PATCHv3] net: uclass: Save generated ethernet MAC addresses to the environment Content-Language: en-US To: Tom Rini , Michal Simek CC: Ramon Fried , U-Boot Mailing List , Wolfgang Denk References: <20211122134548.3310678-1-trini@konsulko.com> <20220110140352.GO2773246@bill-the-cat> From: Michal Simek In-Reply-To: <20220110140352.GO2773246@bill-the-cat> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 697e2e31-2274-4f70-7895-08d9d442d756 X-MS-TrafficTypeDiagnostic: MWHPR02MB2479:EE_ X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:257; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hNmmKJZYKgIkjEvyYXKGKiCBdxFKgw8KblwUK1fR1CiU6HiMPTt1N1XmZX9LwqEr/VvCGxTA+bctkuUcy5ndMoRIulAEDiUpgz6l5/YnriJVFVkOJbR2amkg7I1luTCAzngkAgGCnn9da3nWCnVVXWgpelRfteBxvujvtLleEZFJfTBPBsZpTls85krd+V3QDHBkhVKyORFLbAOtYF8cNexBmtjJeB8NwbyXCpznr4cYepkWMQ7eTb6WgJQ3XP+/tNUTPo+M7R83Mevw/ME2061wY6BlWIaBdTzUz3ERxmVZLUo4R2ALqjjdissbQX+CEZOPdkwubsH2q0rWjO8+egbb24W6skx/p2PJ5RZfENyHpPNZZ9hTFfBscFw5WkVQ6LY4La0ogxPoqULomuZ0mZI4njGhq43OQbxicW1dClZ47WNc9pyWV6L4TfAQpLppD2pJIfrhdwJ3sWqLGZaRRy5ROAIQ14x9bjRtqFqEHfEog0O4xfI42qf1CoB9+HFQKM70iYO7vdyuzs3QK4DQGFiKDtTl0EPlj8jKM4RO8gxsrQjmOD5nBEix2EjHbNpbA6SLZW3lrC+GItLKhR0BhTgvy9mR1G6oXALBGKXxouu3QZOOeoGTPXgBsH6oyQMYRDloYAuf4FAM1us+E52QLqP7sq6M+V+PmOkOCNCNwLJZg4RFbZnNkCES/nlxahDU6hhJDoVqjp9Xs+KHekxQ9aA55T/KHPuvMVpl0eF+d5E40HYGsH+uaO5n9LJaNi9yonq7zRQcl8x7/9GbRhEGUA== X-Forefront-Antispam-Report: CIP:149.199.62.198; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapexch01.xlnx.xilinx.com; PTR:unknown-62-198.xilinx.com; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(508600001)(66574015)(36860700001)(36756003)(110136005)(54906003)(83380400001)(5660300002)(53546011)(82310400004)(9786002)(2906002)(356005)(31696002)(336012)(8936002)(186003)(4326008)(44832011)(31686004)(426003)(70206006)(70586007)(7636003)(8676002)(2616005)(316002)(26005)(47076005)(50156003)(43740500002); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jan 2022 14:09:39.4396 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 697e2e31-2274-4f70-7895-08d9d442d756 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.62.198]; Helo=[xsj-pvapexch01.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: DM3NAM02FT020.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR02MB2479 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 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ílatel 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 the >>>> appropriate data structure. For consistency and to re-align with >>>> historic usage, it should be also saved to the appropriate environment >>>> 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 function >>>> - even when the ethaddr variable for that interface is unset. >>>> - A new MAC address will be generated on every boot and it will >>>> - not be added to the environment. >>>> + Selecting this will allow the Ethernet interface to function even >>>> + when the ethaddr variable for that interface is unset. In this case, >>>> + a random MAC address in the locally administered address space 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 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); >>>> 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, const char *base_name, >>>> net_random_ethaddr(dev->enetaddr); >>>> printf("\nWarning: %s (eth%d) using random MAC address - %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