summaryrefslogtreecommitdiff
path: root/cmd/net.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2024-10-16 08:12:28 -0600
committerTom Rini <trini@konsulko.com>2024-10-16 11:11:57 -0600
commit608a31bdec6284ad6f821226e4c62c9cd3052874 (patch)
treec43e6664c7530f354f73c05cb817e37d10d93615 /cmd/net.c
parent1ca0ddb643f3b152439f7bb8f6ee3f5826d7102d (diff)
parent4820cb4b16c44ec332b18dbe7207ddd8c0a1d446 (diff)
Merge patch series "Introduce the lwIP network stack"
Jerome Forissier <jerome.forissier@linaro.org> says: This is a rework of a patch series by Maxim Uvarov: "net/lwip: add lwip library for the network stack" [1]. The goal is to introduce the lwIP TCP/IP stack [2] [3] as an alternative to the current implementation in net/, selectable with Kconfig, and ultimately keep only lwIP if possible. Some reasons for doing so are: - Make the support of HTTPS in the wget command easier. Javier T. and Raymond M. (CC'd) have some additional lwIP and Mbed TLS patches to do so. With that it becomes possible to fetch and launch a distro installer such as Debian etc. using a secure, authenticated connection directly from the U-Boot shell. Several use cases: * Authentication: prevent MITM attack (third party replacing the binary with a different one) * Confidentiality: prevent third parties from grabbing a copy of the image as it is being downloaded * Allow connection to servers that do not support plain HTTP anymore (this is becoming more and more common on the Internet these days) - Possibly benefit from additional features implemented in lwIP - Less code to maintain in U-Boot Prior to applying this series, the lwIP stack needs to be added as a Git subtree with the following command: $ git subtree add --squash --prefix lib/lwip/lwip \ https://github.com/lwip-tcpip/lwip.git STABLE-2_2_0_RELEASE Notes 1. A number of features are currently incompatible with NET_LWIP: DFU_TFTP, FASTBOOT, SPL_NET, ETH_SANDBOX, ETH_SANDBOX_RAW, DM_ETH. They all make assumptions on how the network stack is implemented and/or pull sybols that are not trivially exported from lwIP. Some interface rework may be needed. 2. Due to the above, and in order to provide some level of testing of the lwIP code in CI even when the legacy NET is the default, a new QEMU configuration is introduced (qemu_arm64_lwip_defconfig) which is based on qemu_arm64_defconfig with NET_LWIP and CMD_*_LWIP enabled. In addition to that, this series has some [TESTING] patches which make NET_LWIP the default. [1] https://lore.kernel.org/all/20231127125726.3735-1-maxim.uvarov@linaro.org/ [2] https://www.nongnu.org/lwip/ [3] https://en.wikipedia.org/wiki/LwIP Link: https://lore.kernel.org/r/cover.1729070678.git.jerome.forissier@linaro.org
Diffstat (limited to 'cmd/net.c')
-rw-r--r--cmd/net.c115
1 files changed, 0 insertions, 115 deletions
diff --git a/cmd/net.c b/cmd/net.c
index 53ce2bc5d0c..c90578e1b9f 100644
--- a/cmd/net.c
+++ b/cmd/net.c
@@ -674,118 +674,3 @@ U_BOOT_CMD(
);
#endif /* CONFIG_CMD_LINK_LOCAL */
-
-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;
-}
-
-static int do_net_stats(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
-{
- int nstats, err, i, off;
- struct udevice *dev;
- u64 *values;
- u8 *strings;
-
- if (argc < 2)
- return CMD_RET_USAGE;
-
- err = uclass_get_device_by_name(UCLASS_ETH, argv[1], &dev);
- if (err) {
- printf("Could not find device %s\n", argv[1]);
- return CMD_RET_FAILURE;
- }
-
- if (!eth_get_ops(dev)->get_sset_count ||
- !eth_get_ops(dev)->get_strings ||
- !eth_get_ops(dev)->get_stats) {
- printf("Driver does not implement stats dump!\n");
- return CMD_RET_FAILURE;
- }
-
- nstats = eth_get_ops(dev)->get_sset_count(dev);
- strings = kcalloc(nstats, ETH_GSTRING_LEN, GFP_KERNEL);
- if (!strings)
- return CMD_RET_FAILURE;
-
- values = kcalloc(nstats, sizeof(u64), GFP_KERNEL);
- if (!values)
- goto err_free_strings;
-
- eth_get_ops(dev)->get_strings(dev, strings);
- eth_get_ops(dev)->get_stats(dev, values);
-
- off = 0;
- for (i = 0; i < nstats; i++) {
- printf(" %s: %llu\n", &strings[off], values[i]);
- off += ETH_GSTRING_LEN;
- };
-
- return CMD_RET_SUCCESS;
-
-err_free_strings:
- kfree(strings);
-
- return CMD_RET_FAILURE;
-}
-
-static struct cmd_tbl cmd_net[] = {
- U_BOOT_CMD_MKENT(list, 1, 0, do_net_list, "", ""),
- U_BOOT_CMD_MKENT(stats, 2, 0, do_net_stats, "", ""),
-};
-
-static int do_net(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
-{
- struct cmd_tbl *cp;
-
- cp = find_cmd_tbl(argv[1], cmd_net, ARRAY_SIZE(cmd_net));
-
- /* Drop the net command */
- argc--;
- argv++;
-
- if (!cp || argc > cp->maxargs)
- return CMD_RET_USAGE;
- if (flag == CMD_FLAG_REPEAT && !cmd_is_repeatable(cp))
- return CMD_RET_SUCCESS;
-
- return cp->cmd(cmdtp, flag, argc, argv);
-}
-
-U_BOOT_CMD(
- net, 3, 1, do_net,
- "NET sub-system",
- "list - list available devices\n"
- "stats <device> - dump statistics for specified device\n"
-);
-
-#if defined(CONFIG_CMD_NCSI)
-static int do_ncsi(struct cmd_tbl *cmdtp, int flag, int argc, char * const argv[])
-{
- if (!phy_interface_is_ncsi() || !ncsi_active()) {
- printf("Device not configured for NC-SI\n");
- return CMD_RET_FAILURE;
- }
-
- if (net_loop(NCSI) < 0)
- return CMD_RET_FAILURE;
-
- return CMD_RET_SUCCESS;
-}
-
-U_BOOT_CMD(
- ncsi, 1, 1, do_ncsi,
- "Configure attached NIC via NC-SI",
- ""
-);
-#endif /* CONFIG_CMD_NCSI */