[PATHv11 10/43] net/lwip: implement lwIP port to U-Boot

Tom Rini trini at konsulko.com
Mon Nov 27 19:31:43 CET 2023


On Mon, Nov 27, 2023 at 06:56:53PM +0600, Maxim Uvarov wrote:

> Implement port of lwIP stack to the U-Boot. lwIP is well known full IP stack
> which provides wide functionality, various examples, API closer to linux userland.
> Rich debug printing and possibility to run lwIP apps under linux make it
> easier to develop and debug apps.
> U-Boot implementation keeps the original file structure widely used for lwIP ports.
> (i.e. port/if.c port/sys-arch.c). That should allow us to easy port apps to or
> from U-Boot. Multiply ethernet devices are supported and "ethact" env variable
> chooses the active device.
> Having a rich IP stack inside U-Boot will allow us to have such applications
> as http or https clients.
[snip]
> diff --git a/lib/Kconfig b/lib/Kconfig
> index 19649517a3..915402e843 100644
> --- a/lib/Kconfig
> +++ b/lib/Kconfig
> @@ -258,7 +258,7 @@ config REGEX
>  choice
>  	prompt "Pseudo-random library support type"
>  	depends on NET_RANDOM_ETHADDR || RANDOM_UUID || CMD_UUID || \
> -		   RNG_SANDBOX || UT_LIB && AES || FAT_WRITE
> +		   RNG_SANDBOX || UT_LIB && AES || FAT_WRITE || LWIP
>  	default LIB_RAND
>  	help
>  	  Select the library to provide pseudo-random number generator

So here we say that you must configure one of the "random" providers,
either software-based or hardware-based.

> diff --git a/net/eth-uclass.c b/net/eth-uclass.c
> index 3d0ec91dfa..f57da423f5 100644
> --- a/net/eth-uclass.c
> +++ b/net/eth-uclass.c
[snip]
> @@ -587,18 +602,26 @@ static int eth_post_probe(struct udevice *dev)
>  		/* Override the ROM MAC address */
>  		memcpy(pdata->enetaddr, env_enetaddr, ARP_HLEN);
>  	} else if (is_valid_ethaddr(pdata->enetaddr)) {
> -		eth_env_set_enetaddr_by_index("eth", dev_seq(dev),
> -					      pdata->enetaddr);
> +		ret = eth_env_set_enetaddr_by_index("eth", dev_seq(dev),
> +						    pdata->enetaddr);
> +		if (ret) {
> +			log_err("Error update env for eth%d\n", dev_seq(dev));
> +			return -EINVAL;
> +		}
>  	} 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(dev), pdata->enetaddr);
> -		eth_env_set_enetaddr_by_index("eth", dev_seq(dev),
> -					      pdata->enetaddr);
> +		ret = eth_env_set_enetaddr_by_index("eth", dev_seq(dev),
> +						    pdata->enetaddr);
> +		if (ret) {
> +			log_err("Error update env for eth%d\n", dev_seq(dev));
> +			return -EINVAL;
> +		}
>  #else
> -		printf("\nError: %s No valid MAC address found.\n",
> +		log_err("\nError: %s No valid MAC address found.\n",
>  		       dev->name);
>  		return -EINVAL;
>  #endif

This is a general fix, yes?

> diff --git a/net/lwip/Kconfig b/net/lwip/Kconfig
> index 295261a042..9135dee6b4 100644
> --- a/net/lwip/Kconfig
> +++ b/net/lwip/Kconfig
> @@ -1,6 +1,7 @@
>  menu "lwIP"
>  config LWIP
>  	bool "Support LWIP library"
> +	select LIB_RAND
>  	help
>  	  Enable the lwIP library code with
>  	  all dependencies (commands are implemented with lwIP

And this part is wrong. We don't _need_ anything here due to the change
in lib/Kconfig.

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20231127/f97960e0/attachment.sig>


More information about the U-Boot mailing list