All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCHv3] net: uclass: Save generated ethernet MAC addresses to the environment
@ 2021-11-22 13:45 Tom Rini
  2021-11-27 19:37 ` Ramon Fried
  0 siblings, 1 reply; 6+ messages in thread
From: Tom Rini @ 2021-11-22 13:45 UTC (permalink / raw)
  To: u-boot; +Cc: Michal Simek, Wolfgang Denk, Ramon Fried

From: Michal Simek <michal.simek@xilinx.com>

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 <wd@denx.de>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
[trini: Update Kconfig, handle legacy networking case as well]
Signed-off-by: Tom Rini <trini@konsulko.com>
---
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


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

* Re: [PATCHv3] net: uclass: Save generated ethernet MAC addresses to the environment
  2021-11-22 13:45 [PATCHv3] net: uclass: Save generated ethernet MAC addresses to the environment Tom Rini
@ 2021-11-27 19:37 ` Ramon Fried
  2022-01-07 15:08   ` Michal Simek
  0 siblings, 1 reply; 6+ messages in thread
From: Ramon Fried @ 2021-11-27 19:37 UTC (permalink / raw)
  To: Tom Rini; +Cc: U-Boot Mailing List, Michal Simek, Wolfgang Denk

On Mon, Nov 22, 2021 at 3:45 PM Tom Rini <trini@konsulko.com> wrote:
>
> From: Michal Simek <michal.simek@xilinx.com>
>
> 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 <wd@denx.de>
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
> [trini: Update Kconfig, handle legacy networking case as well]
> Signed-off-by: Tom Rini <trini@konsulko.com>
> ---
> 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 <rfried.dev@gmail.com>

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

* Re: [PATCHv3] net: uclass: Save generated ethernet MAC addresses to the environment
  2021-11-27 19:37 ` Ramon Fried
@ 2022-01-07 15:08   ` Michal Simek
  2022-01-10 14:03     ` Tom Rini
  0 siblings, 1 reply; 6+ messages in thread
From: Michal Simek @ 2022-01-07 15:08 UTC (permalink / raw)
  To: Ramon Fried, Michal Simek; +Cc: Tom Rini, U-Boot Mailing List, Wolfgang Denk

so 27. 11. 2021 v 20:37 odesílatel Ramon Fried <rfried.dev@gmail.com> napsal:
>
> On Mon, Nov 22, 2021 at 3:45 PM Tom Rini <trini@konsulko.com> wrote:
> >
> > From: Michal Simek <michal.simek@xilinx.com>
> >
> > 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 <wd@denx.de>
> > Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> > Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
> > [trini: Update Kconfig, handle legacy networking case as well]
> > Signed-off-by: Tom Rini <trini@konsulko.com>
> > ---
> > 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 <rfried.dev@gmail.com>

Ramon/Tom: Did anybody take this patch?  Or you want me to take it?

Thanks,
Michal

-- 
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Xilinx Microblaze
Maintainer of Linux kernel - Xilinx Zynq ARM and ZynqMP ARM64 SoCs
U-Boot custodian - Xilinx Microblaze/Zynq/ZynqMP/Versal SoCs

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

* Re: [PATCHv3] net: uclass: Save generated ethernet MAC addresses to the environment
  2022-01-07 15:08   ` Michal Simek
@ 2022-01-10 14:03     ` Tom Rini
  2022-01-10 14:09       ` Michal Simek
  0 siblings, 1 reply; 6+ messages in thread
From: Tom Rini @ 2022-01-10 14:03 UTC (permalink / raw)
  To: Michal Simek
  Cc: Ramon Fried, Michal Simek, U-Boot Mailing List, Wolfgang Denk

[-- Attachment #1: Type: text/plain, Size: 4006 bytes --]

On Fri, Jan 07, 2022 at 04:08:34PM +0100, Michal Simek wrote:
> so 27. 11. 2021 v 20:37 odesílatel Ramon Fried <rfried.dev@gmail.com> napsal:
> >
> > On Mon, Nov 22, 2021 at 3:45 PM Tom Rini <trini@konsulko.com> wrote:
> > >
> > > From: Michal Simek <michal.simek@xilinx.com>
> > >
> > > 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 <wd@denx.de>
> > > Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> > > Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
> > > [trini: Update Kconfig, handle legacy networking case as well]
> > > Signed-off-by: Tom Rini <trini@konsulko.com>
> > > ---
> > > 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 <rfried.dev@gmail.com>
> 
> 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.

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

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

* Re: [PATCHv3] net: uclass: Save generated ethernet MAC addresses to the environment
  2022-01-10 14:03     ` Tom Rini
@ 2022-01-10 14:09       ` Michal Simek
  2022-01-11  9:31         ` Michal Simek
  0 siblings, 1 reply; 6+ messages in thread
From: Michal Simek @ 2022-01-10 14:09 UTC (permalink / raw)
  To: Tom Rini, Michal Simek; +Cc: Ramon Fried, U-Boot Mailing List, Wolfgang Denk



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 <rfried.dev@gmail.com> napsal:
>>>
>>> On Mon, Nov 22, 2021 at 3:45 PM Tom Rini <trini@konsulko.com> wrote:
>>>>
>>>> From: Michal Simek <michal.simek@xilinx.com>
>>>>
>>>> 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 <wd@denx.de>
>>>> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
>>>> Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
>>>> [trini: Update Kconfig, handle legacy networking case as well]
>>>> Signed-off-by: Tom Rini <trini@konsulko.com>
>>>> ---
>>>> 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 <rfried.dev@gmail.com>
>>
>> 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

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

* Re: [PATCHv3] net: uclass: Save generated ethernet MAC addresses to the environment
  2022-01-10 14:09       ` Michal Simek
@ 2022-01-11  9:31         ` Michal Simek
  0 siblings, 0 replies; 6+ messages in thread
From: Michal Simek @ 2022-01-11  9:31 UTC (permalink / raw)
  To: Tom Rini, Michal Simek; +Cc: Ramon Fried, U-Boot Mailing List, Wolfgang Denk

po 10. 1. 2022 v 15:09 odesílatel Michal Simek <michal.simek@xilinx.com> napsal:
>
>
>
> 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 <rfried.dev@gmail.com> napsal:
> >>>
> >>> On Mon, Nov 22, 2021 at 3:45 PM Tom Rini <trini@konsulko.com> wrote:
> >>>>
> >>>> From: Michal Simek <michal.simek@xilinx.com>
> >>>>
> >>>> 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 <wd@denx.de>
> >>>> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> >>>> Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
> >>>> [trini: Update Kconfig, handle legacy networking case as well]
> >>>> Signed-off-by: Tom Rini <trini@konsulko.com>
> >>>> ---
> >>>> 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 <rfried.dev@gmail.com>
> >>
> >> 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

CI found that legacy case code is broken. It was just c&p from DM case
that's why I removed it from my queue and sent v4
version.

Thanks,
Michal


-- 
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Xilinx Microblaze
Maintainer of Linux kernel - Xilinx Zynq ARM and ZynqMP ARM64 SoCs
U-Boot custodian - Xilinx Microblaze/Zynq/ZynqMP/Versal SoCs

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

end of thread, other threads:[~2022-01-11  9:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-22 13:45 [PATCHv3] net: uclass: Save generated ethernet MAC addresses to the environment Tom Rini
2021-11-27 19:37 ` Ramon Fried
2022-01-07 15:08   ` Michal Simek
2022-01-10 14:03     ` Tom Rini
2022-01-10 14:09       ` Michal Simek
2022-01-11  9:31         ` 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.