All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RFC] cmd: fix net list command
@ 2021-11-15 12:11 Michael Walle
  2021-11-15 12:15 ` Marek Vasut
  2021-11-15 14:53 ` Michal Simek
  0 siblings, 2 replies; 30+ messages in thread
From: Michael Walle @ 2021-11-15 12:11 UTC (permalink / raw)
  To: u-boot
  Cc: Grygorii Strashko, Michal Simek, fried.dev, joe.hershberger, sjg,
	Marek Vasut, Michael Walle

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 <michael@walle.cc>
---

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


^ permalink raw reply related	[flat|nested] 30+ messages in thread

end of thread, other threads:[~2021-11-16 14:51 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-15 12:11 [PATCH RFC] cmd: fix net list command Michael Walle
2021-11-15 12:15 ` Marek Vasut
2021-11-15 12:24   ` Michael Walle
2021-11-15 13:17     ` Marek Vasut
2021-11-15 13:46       ` Michael Walle
2021-11-15 14:31         ` Wolfgang Denk
2021-11-15 14:52           ` Michael Walle
2021-11-15 14:57             ` Michal Simek
2021-11-15 15:07               ` Tom Rini
2021-11-15 15:22                 ` Wolfgang Denk
2021-11-15 15:38                   ` Tom Rini
2021-11-15 15:20               ` Wolfgang Denk
2021-11-15 16:12                 ` Michal Simek
2021-11-16 13:29                   ` Wolfgang Denk
2021-11-15 15:12             ` Tom Rini
2021-11-15 15:15               ` Michael Walle
2021-11-15 15:19                 ` Tom Rini
2021-11-15 15:25                   ` Wolfgang Denk
2021-11-15 15:45                     ` Tom Rini
2021-11-16 13:23                       ` Wolfgang Denk
2021-11-15 15:15             ` Wolfgang Denk
2021-11-15 15:21               ` Michael Walle
2021-11-15 16:45                 ` Marek Vasut
2021-11-16  6:14                   ` Ramon Fried
2021-11-16 13:33                     ` Wolfgang Denk
2021-11-16 14:10                       ` Tom Rini
2021-11-16 14:51                         ` Wolfgang Denk
2021-11-15 13:57     ` Tom Rini
2021-11-15 14:53       ` Michael Walle
2021-11-15 14:53 ` Michal Simek

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.