TFTPGET
};
+void net_lwip_set_current(void);
struct netif *net_lwip_new_netif(struct udevice *udev);
struct netif *net_lwip_new_netif_noip(struct udevice *udev);
void net_lwip_remove_netif(struct netif *netif);
int ret;
struct udevice *dev;
- eth_set_current();
+ net_lwip_set_current();
dev = eth_get_dev();
if (!dev) {
if (argc == 3)
var = argv[2];
- eth_set_current();
+ net_lwip_set_current();
return dns_loop(eth_get_dev(), name, var);
}
return 0;
}
+/* Initialize the lwIP stack and the ethernet devices and set current device */
+void net_lwip_set_current(void)
+{
+ static bool init_done;
+
+ if (!init_done) {
+ eth_init_rings();
+ eth_init();
+ lwip_init();
+ init_done = true;
+ }
+ eth_set_current();
+}
+
static struct netif *new_netif(struct udevice *udev, bool with_ip)
{
unsigned char enetaddr[ARP_HLEN];
ip4_addr_t ip, mask, gw;
struct netif *netif;
int ret = 0;
- static bool first_call = true;
if (!udev)
return NULL;
- if (first_call) {
- eth_init_rings();
- /* Pick a valid active device, if any */
- eth_init();
- lwip_init();
- first_call = false;
- }
-
if (eth_start_udev(udev) < 0) {
log_err("Could not start %s\n", udev->name);
return NULL;
if (!ipaddr_aton(argv[1], &addr))
return CMD_RET_USAGE;
- eth_set_current();
+ net_lwip_set_current();
if (ping_loop(eth_get_dev(), &addr) < 0)
return CMD_RET_FAILURE;
goto out;
}
- eth_set_current();
+ net_lwip_set_current();
if (tftp_loop(eth_get_dev(), laddr, fname, srvip, port) < 0)
ret = CMD_RET_FAILURE;
int wget_do_request(ulong dst_addr, char *uri)
{
- eth_set_current();
+ net_lwip_set_current();
if (!wget_info)
wget_info = &default_wget_info;