Skip to contentSkip to conversation

net: eth-uclass: Do not return error when no MAC is found

PATCH New Fabio Estevam 2 participants 7 messages Jan 9, 2020 – Mar 11, 2020 Networking

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: eth-uclass: Do not return error when no MAC is found

On some i.MX8QXP MEK boards with no MAC address stored, the following hang is seen:

Error: ethernet at 5b040000 address not set.

(Board hangs)

One way to avoid this issue is to select CONFIG_NET_RANDOM_ETHADDR, so that a random MAC is provided and boot proceeds, but the lack of MAC should not hang the entire system.

Fix the hang by removing the propagation of error when no MAC is found.

In this case there are already messages indicating that something is not correct:

Error: ethernet at 5b040000 address not set.

Error: ethernet at 5b040000 address 00:00:00:00:00:00 illegal value
eth0: ethernet at 5b040000
Error: ethernet at 5b040000 address 00:00:00:00:00:00 illegal value

---
 net/eth-uclass.c | 1 -
 1 file changed, 1 deletion(-)
net/eth-uclass.c +0 -1
index ed81cbd537..bc2b0aac00 100644
@@ -554,7 +554,6 @@ static int eth_post_probe(struct udevice *dev)
 #else
 		printf("\nError: %s address not set.\n",
 		       dev->name);
-		return -EINVAL;
 #endif
 	}
 
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/1 net: eth-uclass: Do not return error when no MAC is found

Hi Joe,

Quoted 17 lines · Fabio Estevam

On some i.MX8QXP MEK boards with no MAC address stored, the following hang is seen:

Error: ethernet at 5b040000 address not set.

(Board hangs)

One way to avoid this issue is to select CONFIG_NET_RANDOM_ETHADDR, so that a random MAC is provided and boot proceeds, but the lack of MAC should not hang the entire system.

Fix the hang by removing the propagation of error when no MAC is found.

In this case there are already messages indicating that something is not correct:

Quoted 7 lines

Error: ethernet at 5b040000 address not set.

Error: ethernet at 5b040000 address 00:00:00:00:00:00 illegal value
eth0: ethernet at 5b040000
Error: ethernet at 5b040000 address 00:00:00:00:00:00 illegal value

Any comments?

#2 lore raw

PATCH 1/1 net: eth-uclass: Do not return error when no MAC is found

In reply to Fabio Estevam
Quoted 17 lines · Fabio Estevam

On some i.MX8QXP MEK boards with no MAC address stored, the following hang is seen:

Error: ethernet at 5b040000 address not set.

(Board hangs)

One way to avoid this issue is to select CONFIG_NET_RANDOM_ETHADDR, so that a random MAC is provided and boot proceeds, but the lack of MAC should not hang the entire system.

Fix the hang by removing the propagation of error when no MAC is found.

In this case there are already messages indicating that something is not correct:

Quoted 7 lines

Error: ethernet at 5b040000 address not set.

Error: ethernet at 5b040000 address 00:00:00:00:00:00 illegal value
eth0: ethernet at 5b040000
Error: ethernet at 5b040000 address 00:00:00:00:00:00 illegal value

#3 lore raw

PATCH 1/1 net: eth-uclass: Do not return error when no MAC is found

In reply to Fabio Estevam

Hi Fabio,

Quoted 17 lines · Fabio Estevam

On some i.MX8QXP MEK boards with no MAC address stored, the following hang is seen:

Error: ethernet at 5b040000 address not set.

(Board hangs)

One way to avoid this issue is to select CONFIG_NET_RANDOM_ETHADDR, so that a random MAC is provided and boot proceeds, but the lack of MAC should not hang the entire system.

Fix the hang by removing the propagation of error when no MAC is found.

In this case there are already messages indicating that something is not correct:

Quoted 7 lines

Error: ethernet at 5b040000 address not set.

Error: ethernet at 5b040000 address 00:00:00:00:00:00 illegal value
eth0: ethernet at 5b040000
Error: ethernet at 5b040000 address 00:00:00:00:00:00 illegal value

I tried to apply this but it breaks the unit tests. I guess you didn't try "ut dm" in sandbox?

https://travis-ci.org/jhershbe/u-boot/builds/660395782

Please test those and update the tests to pass with your change.

Thanks,
-Joe

#4 lore raw

PATCH 1/1 net: eth-uclass: Do not return error when no MAC is found

Hi Joe,

Quoted 6 lines · Joe Hershberger

I tried to apply this but it breaks the unit tests. I guess you didn't try "ut dm" in sandbox?

https://travis-ci.org/jhershbe/u-boot/builds/660395782

Please test those and update the tests to pass with your change.

Ok, I will revisit this patch after 2020.04.

I think we should probably let net_random_ethaddr() run unconditionally:

net/eth-uclass.c +0 -6
@@ -547,15 +547,9 @@ static int eth_post_probe(struct udevice *dev)
                       dev->name);
        } else if (is_zero_ethaddr(pdata->enetaddr) ||
                   !is_valid_ethaddr(pdata->enetaddr)) {
-#ifdef CONFIG_NET_RANDOM_ETHADDR
                net_random_ethaddr(pdata->enetaddr);
                printf("\nWarning: %s (eth%d) using random MAC address - %pM\n",
                       dev->name, dev->seq, pdata->enetaddr);
-#else
-               printf("\nError: %s address not set.\n",
-                      dev->name);
-               return -EINVAL;
-#endif
        }
 
        eth_write_hwaddr(dev);

Thanks

#5 lore raw

PATCH 1/1 net: eth-uclass: Do not return error when no MAC is found

Quoted 8 lines · Fabio Estevam

Hi Joe,

Quoted 3 lines · Joe Hershberger

I tried to apply this but it breaks the unit tests. I guess you didn't try "ut dm" in sandbox?

Quoted 7 lines
Quoted 3 lines

https://travis-ci.org/jhershbe/u-boot/builds/660395782

Please test those and update the tests to pass with your change.

Ok, I will revisit this patch after 2020.04.

I think we should probably let net_random_ethaddr() run unconditionally:

That may be a better solution... with the warning of course.

Cheers,
-Joe

Quoted 20 lines
net/eth-uclass.c +0 -6
@@ -547,15 +547,9 @@ static int eth_post_probe(struct udevice *dev)
                       dev->name);
        } else if (is_zero_ethaddr(pdata->enetaddr) ||
                   !is_valid_ethaddr(pdata->enetaddr)) {
-#ifdef CONFIG_NET_RANDOM_ETHADDR
                net_random_ethaddr(pdata->enetaddr);
                printf("\nWarning: %s (eth%d) using random MAC address - %pM\n",
                       dev->name, dev->seq, pdata->enetaddr);
-#else
-               printf("\nError: %s address not set.\n",
-                      dev->name);
-               return -EINVAL;
-#endif
        }
 
        eth_write_hwaddr(dev);

Thanks

#6 lore raw

PATCH 1/1 net: eth-uclass: Do not return error when no MAC is found

Hi Joe,

Quoted 1 line · Joe Hershberger

That may be a better solution... with the warning of course.

Thanks for the feedback.

I will submit this solution after 2020.04 is out.

Thanks