diff options
| author | Simon Glass <[email protected]> | 2025-03-05 17:25:23 -0700 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2025-03-18 13:12:16 -0600 |
| commit | 0f094b8b146679c3980cd2febde4e902bbc4405d (patch) | |
| tree | c8ddca55cbabb720c0ef749a2432589e16fd9301 /include/net-common.h | |
| parent | f278f0cb4996398720328ce33e057678f6ea4109 (diff) | |
net: Provide a function to run network operations
Add a new netboot_run() function which can be used for simple network
operations, such as loading a file. Put the implementation in an
internal function, used by the existing code.
Place this function into the net/ code, so that it does not need the
command line to be available.
Document which network operations are supported, i.e. a limited subset,
for now.
For the one board which uses lwip, it is not quite clear how to avoid
using the cmdline interface. This will need some discussion.
Signed-off-by: Simon Glass <[email protected]>
Diffstat (limited to 'include/net-common.h')
| -rw-r--r-- | include/net-common.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/include/net-common.h b/include/net-common.h index 29d31f37263..210042fc337 100644 --- a/include/net-common.h +++ b/include/net-common.h @@ -474,6 +474,36 @@ int net_init(void); enum proto_t; int net_loop(enum proto_t protocol); +/* internal function: do not use! */ +int netboot_run_(enum proto_t proto, ulong addr, const char *fname, ulong size, + bool fname_explicit, bool ipv6); + +/** + * netboot_run() - Run a network operation + * + * The following proto values are NOT supported: + * PING, since net_ping_ip cannot be set + * NETCONS, since its parameters cannot bet set + * RS, since first_call cannot be set, along with perhaps other things + * UDP, since udp_ops cannot be set + * DNS, since net_dns_resolve and net_dns_env_var cannot be set + * WGET, since DNS must be done first and that is not supported + * DHCP6, since the required parameters cannot be passed in + * + * To support one of these, either add the required arguments or perhaps a + * separate function and a struct to hold the information. + * + * @proto: Operation to run: TFTPGET, FASTBOOT_UDP, FASTBOOT_TCP, BOOTP, + * TFTPPUT, RARP, NFS, DHCP + * @addr: Load/save address + * @fname: Filename + * @size: Save size (not used for TFTPGET) + * @ipv6: true to use IPv6, false to use IPv4 + * Return 0 on success, else -ve error code + */ +int netboot_run(enum proto_t proto, ulong addr, const char *fname, ulong size, + bool ipv6); + /** * dhcp_run() - Run DHCP on the current ethernet device * |
