mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] net: specify device name in warning
@ 2018-05-18 18:06 Vivien Didelot
  2018-05-18 20:20 ` Sam Ravnborg
  0 siblings, 1 reply; 3+ messages in thread
From: Vivien Didelot @ 2018-05-18 18:06 UTC (permalink / raw)
  To: barebox; +Cc: Vivien Didelot

When a SoC such as VF610 has no addresses programmed for both its
interfaces, the "No MAC address set" warning can be confusing:

    booting 'net'
    WARNING: net: warning: No MAC address set. Using random address a2:e8:be:79:72:01
    WARNING: net: warning: No MAC address set. Using random address aa:d5:d7:10:c0:42

This patch simply specifies the device name in the warning for clarity:

    booting 'net'
    WARNING: net: warning: No MAC address set for eth0. Using random address 5e:92:6b:b8:6e:92
    WARNING: net: warning: No MAC address set for eth1. Using random address 7e:bb:cd:7a:c1:e8

Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
---
 net/net.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/net.c b/net/net.c
index 94954677c..da7afb014 100644
--- a/net/net.c
+++ b/net/net.c
@@ -330,7 +330,7 @@ static struct net_connection *net_new(struct eth_device *edev, IPaddr_t dest,
 		char str[sizeof("xx:xx:xx:xx:xx:xx")];
 		random_ether_addr(edev->ethaddr);
 		ethaddr_to_string(edev->ethaddr, str);
-		pr_warn("warning: No MAC address set. Using random address %s\n", str);
+		pr_warn("warning: No MAC address set for %s. Using random address %s\n", edev->devname, str);
 		eth_set_ethaddr(edev, edev->ethaddr);
 	}
 
-- 
2.17.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH] net: specify device name in warning
  2018-05-18 18:06 [PATCH] net: specify device name in warning Vivien Didelot
@ 2018-05-18 20:20 ` Sam Ravnborg
  2018-05-18 20:36   ` Vivien Didelot
  0 siblings, 1 reply; 3+ messages in thread
From: Sam Ravnborg @ 2018-05-18 20:20 UTC (permalink / raw)
  To: Vivien Didelot; +Cc: barebox

Hi Vivien

On Fri, May 18, 2018 at 02:06:36PM -0400, Vivien Didelot wrote:
> When a SoC such as VF610 has no addresses programmed for both its
> interfaces, the "No MAC address set" warning can be confusing:
> 
>     booting 'net'
>     WARNING: net: warning: No MAC address set. Using random address a2:e8:be:79:72:01
>     WARNING: net: warning: No MAC address set. Using random address aa:d5:d7:10:c0:42
> 
> This patch simply specifies the device name in the warning for clarity:
> 
>     booting 'net'
>     WARNING: net: warning: No MAC address set for eth0. Using random address 5e:92:6b:b8:6e:92
>     WARNING: net: warning: No MAC address set for eth1. Using random address 7e:bb:cd:7a:c1:e8
> 
> Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
> ---
>  net/net.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/net.c b/net/net.c
> index 94954677c..da7afb014 100644
> --- a/net/net.c
> +++ b/net/net.c
> @@ -330,7 +330,7 @@ static struct net_connection *net_new(struct eth_device *edev, IPaddr_t dest,
>  		char str[sizeof("xx:xx:xx:xx:xx:xx")];
>  		random_ether_addr(edev->ethaddr);
>  		ethaddr_to_string(edev->ethaddr, str);
> -		pr_warn("warning: No MAC address set. Using random address %s\n", str);
> +		pr_warn("warning: No MAC address set for %s. Using random address %s\n", edev->devname, str);
>  		eth_set_ethaddr(edev, edev->ethaddr);

You have a device - so a more consistent way seems to use dev_warn()

	Sam

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH] net: specify device name in warning
  2018-05-18 20:20 ` Sam Ravnborg
@ 2018-05-18 20:36   ` Vivien Didelot
  0 siblings, 0 replies; 3+ messages in thread
From: Vivien Didelot @ 2018-05-18 20:36 UTC (permalink / raw)
  To: Sam Ravnborg; +Cc: barebox

Hi Sam,

Sam Ravnborg <sam@ravnborg.org> writes:

> On Fri, May 18, 2018 at 02:06:36PM -0400, Vivien Didelot wrote:
>> When a SoC such as VF610 has no addresses programmed for both its
>> interfaces, the "No MAC address set" warning can be confusing:
>> 
>>     booting 'net'
>>     WARNING: net: warning: No MAC address set. Using random address a2:e8:be:79:72:01
>>     WARNING: net: warning: No MAC address set. Using random address aa:d5:d7:10:c0:42
>> 
>> This patch simply specifies the device name in the warning for clarity:
>> 
>>     booting 'net'
>>     WARNING: net: warning: No MAC address set for eth0. Using random address 5e:92:6b:b8:6e:92
>>     WARNING: net: warning: No MAC address set for eth1. Using random address 7e:bb:cd:7a:c1:e8
>> 
>> Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
>> ---
>>  net/net.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/net/net.c b/net/net.c
>> index 94954677c..da7afb014 100644
>> --- a/net/net.c
>> +++ b/net/net.c
>> @@ -330,7 +330,7 @@ static struct net_connection *net_new(struct eth_device *edev, IPaddr_t dest,
>>  		char str[sizeof("xx:xx:xx:xx:xx:xx")];
>>  		random_ether_addr(edev->ethaddr);
>>  		ethaddr_to_string(edev->ethaddr, str);
>> -		pr_warn("warning: No MAC address set. Using random address %s\n", str);
>> +		pr_warn("warning: No MAC address set for %s. Using random address %s\n", edev->devname, str);
>>  		eth_set_ethaddr(edev, edev->ethaddr);
>
> You have a device - so a more consistent way seems to use dev_warn()

This looks better indeed, I'll respin!


Thanks,

        Vivien

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

end of thread, other threads:[~2018-05-18 20:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-18 18:06 [PATCH] net: specify device name in warning Vivien Didelot
2018-05-18 20:20 ` Sam Ravnborg
2018-05-18 20:36   ` Vivien Didelot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox