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 93472C433F5 for ; Mon, 15 Nov 2021 12:12:12 +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 304D661BE3 for ; Mon, 15 Nov 2021 12:12:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 304D661BE3 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=walle.cc 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 DF60B8369E; Mon, 15 Nov 2021 13:12:08 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=walle.cc 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; secure) header.d=walle.cc header.i=@walle.cc header.b="e2SNV2Dz"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0B2EC83658; Mon, 15 Nov 2021 13:12:06 +0100 (CET) Received: from ssl.serverraum.org (ssl.serverraum.org [176.9.125.105]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id F23D48369E for ; Mon, 15 Nov 2021 13:12:00 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=walle.cc Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=michael@walle.cc Received: from mwalle01.kontron.local. (unknown [IPv6:2a02:810c:c240:2017:fa59:71ff:fe9b:b851]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ssl.serverraum.org (Postfix) with ESMTPSA id 47E2122221; Mon, 15 Nov 2021 13:11:57 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2016061301; t=1636978318; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=yt4ZOTfqkURV/zbPGFtjSgT9BvRPg416LBk+MYW5okU=; b=e2SNV2Dzjb4opwFz86fqmZsdAADaQ4sHZtRibbOaDac52ZX7G4QYODHRgK1I9cDzDM6ZZM dh3Orhx+xT+QtH46Hev5UrkXdN46z9AuaF74Y8qlwxtQijIGqOhH+duZfBgcJakerNHfWH 46zY2HGWWHyP2GU5z7XTnaFeY3o3nlI= From: Michael Walle To: u-boot@lists.denx.de Cc: Grygorii Strashko , Michal Simek , fried.dev@gmail.com, joe.hershberger@ni.com, sjg@chromium.org, Marek Vasut , Michael Walle Subject: [PATCH RFC] cmd: fix net list command Date: Mon, 15 Nov 2021 13:11:52 +0100 Message-Id: <20211115121152.3470910-1-michael@walle.cc> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.35 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 Don't get the MAC address by the environment, but by the platform data of the udevice. This will fix "net list" if the MAC address is randomly generated and won't change behavior when linux is booted. Signed-off-by: Michael Walle --- Hi, this is a proposal to fix the "net list" in a way that linux still can have its own fallback mechanism of MAC addresses even if the bootloader has CONFIG_NET_RANDOM_ETHADDR enabled. The intention is to replace [1], where if I understood correctly, the intention was to fix "net list". [1] https://lore.kernel.org/u-boot/3996ba2ee4e6ac136c0802dc0df4ef9b1750157c.1635506067.git.michal.simek@xilinx.com/ cmd/net.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cmd/net.c b/cmd/net.c index 651c1411f4..1df0f4eb99 100644 --- a/cmd/net.c +++ b/cmd/net.c @@ -486,14 +486,14 @@ U_BOOT_CMD( static int do_net_list(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { const struct udevice *current = eth_get_dev(); - unsigned char env_enetaddr[ARP_HLEN]; const struct udevice *dev; + struct eth_pdata *pdata; struct uclass *uc; uclass_id_foreach_dev(UCLASS_ETH, dev, uc) { - eth_env_get_enetaddr_by_index("eth", dev_seq(dev), env_enetaddr); - printf("eth%d : %s %pM %s\n", dev_seq(dev), dev->name, env_enetaddr, - current == dev ? "active" : ""); + pdata = dev_get_plat(dev); + printf("eth%d : %s %pM %s\n", dev_seq(dev), dev->name, + pdata->enetaddr, current == dev ? "active" : ""); } return CMD_RET_SUCCESS; } -- 2.30.2