summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/Kconfig4
-rw-r--r--net/arp.c2
-rw-r--r--net/bootp.c1
-rw-r--r--net/bootp.h1
-rw-r--r--net/cdp.c1
-rw-r--r--net/dhcpv6.c1
-rw-r--r--net/dns.c2
-rw-r--r--net/eth-uclass.c41
-rw-r--r--net/eth_bootdev.c1
-rw-r--r--net/eth_common.c1
-rw-r--r--net/eth_internal.h16
-rw-r--r--net/fastboot_tcp.c1
-rw-r--r--net/fastboot_udp.c1
-rw-r--r--net/link_local.c1
-rw-r--r--net/mdio-mux-uclass.c1
-rw-r--r--net/mdio-uclass.c1
-rw-r--r--net/ndisc.c1
-rw-r--r--net/net.c2
-rw-r--r--net/net6.c2
-rw-r--r--net/nfs.c2
-rw-r--r--net/nfs.h1
-rw-r--r--net/pcap.c2
-rw-r--r--net/ping6.c1
-rw-r--r--net/rarp.c3
-rw-r--r--net/sntp.c1
-rw-r--r--net/tcp.c1
-rw-r--r--net/tftp.c11
-rw-r--r--net/udp.c1
-rw-r--r--net/wget.c1
-rw-r--r--net/wol.c1
30 files changed, 45 insertions, 61 deletions
diff --git a/net/Kconfig b/net/Kconfig
index 5dff6336293..7cb80b880a9 100644
--- a/net/Kconfig
+++ b/net/Kconfig
@@ -42,8 +42,8 @@ config BOOTP_SEND_HOSTNAME
DNS server. To do this, they need the hostname of the DHCP
requester.
If CONFIG_BOOTP_SEND_HOSTNAME is defined, the content
- of the "hostname" environment variable is passed as
- option 12 to the DHCP server.
+ of the "hostname" environment variable is passed as
+ option 12 to the DHCP server.
config NET_RANDOM_ETHADDR
bool "Random ethaddr if unset"
diff --git a/net/arp.c b/net/arp.c
index 37848ad32fb..bc1e25f941f 100644
--- a/net/arp.c
+++ b/net/arp.c
@@ -9,10 +9,10 @@
* Copyright 2000-2002 Wolfgang Denk, wd@denx.de
*/
-#include <common.h>
#include <env.h>
#include <log.h>
#include <net.h>
+#include <vsprintf.h>
#include <linux/delay.h>
#include "arp.h"
diff --git a/net/bootp.c b/net/bootp.c
index 86c56803c76..9dfb50749b4 100644
--- a/net/bootp.c
+++ b/net/bootp.c
@@ -8,7 +8,6 @@
* Copyright 2000-2004 Wolfgang Denk, wd@denx.de
*/
-#include <common.h>
#include <bootstage.h>
#include <command.h>
#include <env.h>
diff --git a/net/bootp.h b/net/bootp.h
index 4e32b19d424..521d38f3528 100644
--- a/net/bootp.h
+++ b/net/bootp.h
@@ -65,7 +65,6 @@ struct bootp_hdr {
extern u32 bootp_id; /* ID of cur BOOTP request */
extern int bootp_try;
-
/* Send a BOOTP request */
void bootp_reset(void);
void bootp_request(void);
diff --git a/net/cdp.c b/net/cdp.c
index a8f890e7522..d4cfc587ee3 100644
--- a/net/cdp.c
+++ b/net/cdp.c
@@ -9,7 +9,6 @@
* Copyright 2000-2002 Wolfgang Denk, wd@denx.de
*/
-#include <common.h>
#include <net.h>
#include "cdp.h"
diff --git a/net/dhcpv6.c b/net/dhcpv6.c
index 4aea779f6f2..54619ee6983 100644
--- a/net/dhcpv6.c
+++ b/net/dhcpv6.c
@@ -7,7 +7,6 @@
/* Simple DHCP6 network layer implementation. */
-#include <common.h>
#include <net6.h>
#include <malloc.h>
#include <linux/delay.h>
diff --git a/net/dns.c b/net/dns.c
index 5b1fe5b0103..08ad54a04d5 100644
--- a/net/dns.c
+++ b/net/dns.c
@@ -22,7 +22,6 @@
* this stuff is worth it, you can buy me a beer in return.
*/
-#include <common.h>
#include <command.h>
#include <env.h>
#include <log.h>
@@ -122,7 +121,6 @@ static void dns_handler(uchar *pkt, unsigned dest, struct in_addr sip,
char ip_str[22];
struct in_addr ip_addr;
-
debug("%s\n", __func__);
if (dest != dns_our_port)
return;
diff --git a/net/eth-uclass.c b/net/eth-uclass.c
index 3d0ec91dfa4..e34d7af0229 100644
--- a/net/eth-uclass.c
+++ b/net/eth-uclass.c
@@ -7,7 +7,6 @@
#define LOG_CATEGORY UCLASS_ETH
-#include <common.h>
#include <bootdev.h>
#include <bootstage.h>
#include <dm.h>
@@ -48,6 +47,8 @@ struct eth_uclass_priv {
/* eth_errno - This stores the most recent failure code from DM functions */
static int eth_errno;
+/* Are we currently in eth_init() or eth_halt()? */
+static bool in_init_halt;
/* board-specific Ethernet Interface initializations. */
__weak int board_interface_eth_init(struct udevice *dev,
@@ -285,11 +286,19 @@ U_BOOT_ENV_CALLBACK(ethaddr, on_ethaddr);
int eth_init(void)
{
- char *ethact = env_get("ethact");
- char *ethrotate = env_get("ethrotate");
struct udevice *current = NULL;
struct udevice *old_current;
int ret = -ENODEV;
+ char *ethrotate;
+ char *ethact;
+
+ if (in_init_halt)
+ return -EBUSY;
+
+ in_init_halt = true;
+
+ ethact = env_get("ethact");
+ ethrotate = env_get("ethrotate");
/*
* When 'ethrotate' variable is set to 'no' and 'ethact' variable
@@ -298,8 +307,10 @@ int eth_init(void)
if ((ethrotate != NULL) && (strcmp(ethrotate, "no") == 0)) {
if (ethact) {
current = eth_get_dev_by_name(ethact);
- if (!current)
- return -EINVAL;
+ if (!current) {
+ ret = -EINVAL;
+ goto end;
+ }
}
}
@@ -307,7 +318,8 @@ int eth_init(void)
current = eth_get_dev();
if (!current) {
log_err("No ethernet found.\n");
- return -ENODEV;
+ ret = -ENODEV;
+ goto end;
}
}
@@ -324,7 +336,8 @@ int eth_init(void)
priv->state = ETH_STATE_ACTIVE;
priv->running = true;
- return 0;
+ ret = 0;
+ goto end;
}
} else {
ret = eth_errno;
@@ -344,6 +357,8 @@ int eth_init(void)
current = eth_get_dev();
} while (old_current != current);
+end:
+ in_init_halt = false;
return ret;
}
@@ -352,17 +367,25 @@ void eth_halt(void)
struct udevice *current;
struct eth_device_priv *priv;
+ if (in_init_halt)
+ return;
+
+ in_init_halt = true;
+
current = eth_get_dev();
if (!current)
- return;
+ goto end;
priv = dev_get_uclass_priv(current);
if (!priv || !priv->running)
- return;
+ goto end;
eth_get_ops(current)->stop(current);
priv->state = ETH_STATE_PASSIVE;
priv->running = false;
+
+end:
+ in_init_halt = false;
}
int eth_is_active(struct udevice *dev)
diff --git a/net/eth_bootdev.c b/net/eth_bootdev.c
index 869adf8cbbd..6ee54e3c790 100644
--- a/net/eth_bootdev.c
+++ b/net/eth_bootdev.c
@@ -8,7 +8,6 @@
#define LOG_CATEGORY UCLASS_BOOTSTD
-#include <common.h>
#include <bootdev.h>
#include <bootflow.h>
#include <command.h>
diff --git a/net/eth_common.c b/net/eth_common.c
index 14d4c07b695..89b5bb37189 100644
--- a/net/eth_common.c
+++ b/net/eth_common.c
@@ -5,7 +5,6 @@
* Joe Hershberger, National Instruments
*/
-#include <common.h>
#include <bootstage.h>
#include <dm.h>
#include <env.h>
diff --git a/net/eth_internal.h b/net/eth_internal.h
index 0b829a8d388..cb302c157b5 100644
--- a/net/eth_internal.h
+++ b/net/eth_internal.h
@@ -11,22 +11,6 @@
/* Do init that is common to driver model and legacy networking */
void eth_common_init(void);
-/**
- * eth_env_set_enetaddr_by_index() - set the MAC address environment variable
- *
- * This sets up an environment variable with the given MAC address (@enetaddr).
- * The environment variable to be set is defined by <@base_name><@index>addr.
- * If @index is 0 it is omitted. For common Ethernet this means ethaddr,
- * eth1addr, etc.
- *
- * @base_name: Base name for variable, typically "eth"
- * @index: Index of interface being updated (>=0)
- * @enetaddr: Pointer to MAC address to put into the variable
- * Return: 0 if OK, other value on error
- */
-int eth_env_set_enetaddr_by_index(const char *base_name, int index,
- uchar *enetaddr);
-
int eth_mac_skip(int index);
void eth_current_changed(void);
void eth_set_dev(struct udevice *dev);
diff --git a/net/fastboot_tcp.c b/net/fastboot_tcp.c
index 2eb52ea2567..d1fccbc7238 100644
--- a/net/fastboot_tcp.c
+++ b/net/fastboot_tcp.c
@@ -3,7 +3,6 @@
* Copyright (C) 2023 The Android Open Source Project
*/
-#include <common.h>
#include <fastboot.h>
#include <net.h>
#include <net/fastboot_tcp.h>
diff --git a/net/fastboot_udp.c b/net/fastboot_udp.c
index 6fee441ab3b..d1479510d61 100644
--- a/net/fastboot_udp.c
+++ b/net/fastboot_udp.c
@@ -3,7 +3,6 @@
* Copyright (C) 2016 The Android Open Source Project
*/
-#include <common.h>
#include <command.h>
#include <fastboot.h>
#include <net.h>
diff --git a/net/link_local.c b/net/link_local.c
index 8aec3c79969..179721333ff 100644
--- a/net/link_local.c
+++ b/net/link_local.c
@@ -11,7 +11,6 @@
* Licensed under the GPL v2 or later
*/
-#include <common.h>
#include <env.h>
#include <log.h>
#include <net.h>
diff --git a/net/mdio-mux-uclass.c b/net/mdio-mux-uclass.c
index 94b90e06576..ee188b504d1 100644
--- a/net/mdio-mux-uclass.c
+++ b/net/mdio-mux-uclass.c
@@ -4,7 +4,6 @@
* Alex Marginean, NXP
*/
-#include <common.h>
#include <dm.h>
#include <log.h>
#include <miiphy.h>
diff --git a/net/mdio-uclass.c b/net/mdio-uclass.c
index 0ebfb2f1343..4f052ae432c 100644
--- a/net/mdio-uclass.c
+++ b/net/mdio-uclass.c
@@ -4,7 +4,6 @@
* Alex Marginean, NXP
*/
-#include <common.h>
#include <dm.h>
#include <dm/lists.h>
#include <eth_phy.h>
diff --git a/net/ndisc.c b/net/ndisc.c
index d1cec0601c8..d417c5987ac 100644
--- a/net/ndisc.c
+++ b/net/ndisc.c
@@ -9,7 +9,6 @@
/* Neighbour Discovery for IPv6 */
-#include <common.h>
#include <net.h>
#include <net6.h>
#include <ndisc.h>
diff --git a/net/net.c b/net/net.c
index 0fb2d250773..d9bc9df643f 100644
--- a/net/net.c
+++ b/net/net.c
@@ -80,8 +80,6 @@
* Next step: none
*/
-
-#include <common.h>
#include <bootstage.h>
#include <command.h>
#include <console.h>
diff --git a/net/net6.c b/net/net6.c
index 2dd64c0e161..4cff98df15c 100644
--- a/net/net6.c
+++ b/net/net6.c
@@ -9,12 +9,12 @@
/* Simple IPv6 network layer implementation */
-#include <common.h>
#include <env_internal.h>
#include <malloc.h>
#include <net.h>
#include <net6.h>
#include <ndisc.h>
+#include <vsprintf.h>
/* NULL IPv6 address */
struct in6_addr const net_null_addr_ip6 = ZERO_IPV6_ADDR;
diff --git a/net/nfs.c b/net/nfs.c
index c18282448cc..537d4c62de2 100644
--- a/net/nfs.c
+++ b/net/nfs.c
@@ -30,7 +30,6 @@
* September 27, 2018. As of now, NFSv3 is the default choice. If the server
* does not support NFSv3, we fall back to versions 2 or 1. */
-#include <common.h>
#include <command.h>
#include <display_options.h>
#ifdef CONFIG_SYS_DIRECT_FLASH_NFS
@@ -914,7 +913,6 @@ static void nfs_handler(uchar *pkt, unsigned dest, struct in_addr sip,
}
}
-
void nfs_start(void)
{
debug("%s\n", __func__);
diff --git a/net/nfs.h b/net/nfs.h
index 68ada0efeb9..6bf1cb76bd5 100644
--- a/net/nfs.h
+++ b/net/nfs.h
@@ -81,7 +81,6 @@ struct rpc_t {
};
void nfs_start(void); /* Begin NFS */
-
/**********************************************************************/
#endif /* __NFS_H__ */
diff --git a/net/pcap.c b/net/pcap.c
index 4036d8a3fa5..c959e3e4e51 100644
--- a/net/pcap.c
+++ b/net/pcap.c
@@ -3,10 +3,10 @@
* Copyright 2019 Ramon Fried <rfried.dev@gmail.com>
*/
-#include <common.h>
#include <net.h>
#include <net/pcap.h>
#include <time.h>
+#include <linux/errno.h>
#include <asm/io.h>
#define LINKTYPE_ETHERNET 1
diff --git a/net/ping6.c b/net/ping6.c
index 4882a17f510..2479e08fd82 100644
--- a/net/ping6.c
+++ b/net/ping6.c
@@ -9,7 +9,6 @@
/* Simple ping6 implementation */
-#include <common.h>
#include <net.h>
#include <net6.h>
#include "ndisc.h"
diff --git a/net/rarp.c b/net/rarp.c
index 231b6233c07..a346e067cb9 100644
--- a/net/rarp.c
+++ b/net/rarp.c
@@ -4,7 +4,6 @@
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
*/
-#include <common.h>
#include <command.h>
#include <log.h>
#include <net.h>
@@ -46,7 +45,6 @@ void rarp_receive(struct ip_udp_hdr *ip, unsigned len)
}
}
-
/*
* Timeout on BOOTP request.
*/
@@ -61,7 +59,6 @@ static void rarp_timeout_handler(void)
}
}
-
void rarp_request(void)
{
uchar *pkt;
diff --git a/net/sntp.c b/net/sntp.c
index dac0f8ceea1..73d1d87d38b 100644
--- a/net/sntp.c
+++ b/net/sntp.c
@@ -5,7 +5,6 @@
*
*/
-#include <common.h>
#include <command.h>
#include <dm.h>
#include <log.h>
diff --git a/net/tcp.c b/net/tcp.c
index a713e1dd609..b0cc8a1fe3e 100644
--- a/net/tcp.c
+++ b/net/tcp.c
@@ -17,7 +17,6 @@
* - TCP application (eg wget)
* Next Step HTTPS?
*/
-#include <common.h>
#include <command.h>
#include <console.h>
#include <env_internal.h>
diff --git a/net/tftp.c b/net/tftp.c
index 2e335413492..2e073183d5a 100644
--- a/net/tftp.c
+++ b/net/tftp.c
@@ -5,7 +5,6 @@
* Copyright 2011 Comelit Group SpA,
* Luca Ceresoli <luca.ceresoli@comelit.it>
*/
-#include <common.h>
#include <command.h>
#include <display_options.h>
#include <efi_loader.h>
@@ -494,8 +493,15 @@ static void tftp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
tftp_prev_block = tftp_cur_block;
tftp_cur_block = (unsigned short)(block + 1);
update_block_number();
- if (ack_ok)
+ if (ack_ok) {
+ if (block == 0 &&
+ tftp_state == STATE_SEND_WRQ){
+ /* connection's first ACK */
+ tftp_state = STATE_DATA;
+ tftp_remote_port = src;
+ }
tftp_send(); /* Send next data block */
+ }
}
}
#endif
@@ -695,7 +701,6 @@ static void tftp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
}
}
-
static void tftp_timeout_handler(void)
{
if (++timeout_count > timeout_count_max) {
diff --git a/net/udp.c b/net/udp.c
index a93822f511c..37162260d17 100644
--- a/net/udp.c
+++ b/net/udp.c
@@ -3,7 +3,6 @@
* Copyright (C) 2020 Philippe Reynes <philippe.reynes@softathome.com>
*/
-#include <common.h>
#include <net.h>
#include <net/udp.h>
diff --git a/net/wget.c b/net/wget.c
index abab371e58e..f1dd7abeff6 100644
--- a/net/wget.c
+++ b/net/wget.c
@@ -6,7 +6,6 @@
#include <asm/global_data.h>
#include <command.h>
-#include <common.h>
#include <display_options.h>
#include <env.h>
#include <image.h>
diff --git a/net/wol.c b/net/wol.c
index 0a625668a99..96478ba5751 100644
--- a/net/wol.c
+++ b/net/wol.c
@@ -3,7 +3,6 @@
* Copyright 2018 Lothar Felten, lothar.felten@gmail.com
*/
-#include <common.h>
#include <command.h>
#include <env.h>
#include <net.h>