
On Wed, 22 May 2024 at 19:04, Jerome Forissier jerome.forissier@linaro.org wrote:
Add support for "net list" and "net stats" to net-lwip/ by copying the code from cmd/net.c.
Signed-off-by: Jerome Forissier jerome.forissier@linaro.org
cmd/net-lwip.c | 98 ++++++++++++++++++++++++++++++++++++++++++++++ include/net-lwip.h | 50 +++++++++++++++++++++++ 2 files changed, 148 insertions(+)
diff --git a/cmd/net-lwip.c b/cmd/net-lwip.c index 2926399bd0..20d0d61176 100644 --- a/cmd/net-lwip.c +++ b/cmd/net-lwip.c @@ -2,6 +2,10 @@ /* Copyright (C) 2024 Linaro Ltd. */
#include <command.h> +#include <dm/device.h> +#include <dm/uclass.h> +#include <linux/compat.h> +#include <linux/ethtool.h> #include <net-lwip.h>
#if defined(CONFIG_CMD_DHCP_LWIP) @@ -43,3 +47,97 @@ U_BOOT_CMD( "[loadAddress] URL" ); #endif
+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 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" : "");
}
return CMD_RET_SUCCESS;
+}
Some of these functions seem to be a c/p from cmd/net.c Carve the common ones out in cmd/net-common.c and reuse them please
[...]
Cheers /Ilias