lwip update

* The mdns responder has been reworked to lower stack and memory usage. This is
  a variation on the upstream code, it use malloc whereas the upstream code uses
  pools. The high stack usage of the mdns responder was problem for
  esp-open-rtos, so we might have to maintain the differences for now.

* Improved lwip core locking, and lock checking. Upstream improvements, that
  need some added support from esp-open-rtos specific code. More core lock is
  performed when calling from the esp-open-rtos code now, so a little safer. The
  checking is not enforced, but projects might see warning messages and might
  want to look into them.

* The esp-open-rtos lwip support has been sync'ed with the new freertos port
  included with lwip. There are still some minor differences.

* A few lwip timer bugs have been resolved. This might help resolve some issues.

* Plus it picks up all the other upstream fixes and improvements.

* The default lwip stack has been lowered from 768 words to 480 words,
  due to the reduced stack usage by the mdns responder.
This commit is contained in:
Our Air Quality 2018-01-24 14:56:24 +11:00
parent 5f8b3d43c7
commit 3c81f7d587
12 changed files with 345 additions and 185 deletions

View file

@ -546,10 +546,13 @@ bool sdk_wifi_station_dhcpc_start(void) {
sdk_info.sta_ipaddr.addr = 0;
sdk_info.sta_netmask.addr = 0;
sdk_info.sta_gw.addr = 0;
LOCK_TCPIP_CORE();
netif_set_addr(netif, &sdk_info.sta_ipaddr, &sdk_info.sta_netmask, &sdk_info.sta_gw);
if (dhcp_start(netif)) {
UNLOCK_TCPIP_CORE();
return false;
}
UNLOCK_TCPIP_CORE();
}
sdk_dhcpc_flag = DHCP_STARTED;
return true;
@ -561,9 +564,11 @@ bool sdk_wifi_station_dhcpc_stop(void) {
return false;
}
if (netif && sdk_dhcpc_flag == DHCP_STARTED) {
LOCK_TCPIP_CORE();
dhcp_stop(netif);
sdk_dhcpc_flag = DHCP_STOPPED;
UNLOCK_TCPIP_CORE();
}
sdk_dhcpc_flag = DHCP_STOPPED;
return true;
}
@ -616,8 +621,11 @@ bool sdk_wifi_set_ip_info(uint8_t if_index, struct ip_info *info) {
}
struct netif *netif = _get_netif(if_index);
if (netif)
if (netif) {
LOCK_TCPIP_CORE();
netif_set_addr(netif, &info->ip, &info->netmask, &info->gw);
UNLOCK_TCPIP_CORE();
}
return true;
}

View file

@ -216,13 +216,17 @@ bool sdk_wifi_softap_start() {
struct netif *netif = (struct netif *)malloc(sizeof(struct netif));
netif_info->netif = netif;
memcpy(&netif->hwaddr, mac_addr, 6);
LOCK_TCPIP_CORE();
netif_add(netif, &sdk_info.softap_ipaddr, &sdk_info.softap_netmask,
&sdk_info.softap_gw, netif_info, ethernetif_init, tcpip_input);
UNLOCK_TCPIP_CORE();
}
sdk_ic_set_vif(1, 1, mac_addr, 1, 0);
LOCK_TCPIP_CORE();
netif_set_up(netif_info->netif);
UNLOCK_TCPIP_CORE();
if (sdk_wifi_get_opmode() != 3 ||
!sdk_g_ic.v.station_netif_info ||
@ -293,7 +297,9 @@ bool sdk_wifi_softap_stop() {
} while (count < end);
}
LOCK_TCPIP_CORE();
netif_set_down(netif_info->netif);
UNLOCK_TCPIP_CORE();
sdk_TmpSTAAPCloseAP = 1;
sdk_ets_timer_disarm(&hostap_timer);
sdk_ic_bss_info_update(1, &sdk_info.softap_mac_addr, 2, 0);

View file

@ -42,7 +42,10 @@ bool sdk_wifi_station_start() {
struct netif *netif = (struct netif *)malloc(sizeof(struct netif));
netif_info->netif = netif;
memcpy(&netif->hwaddr, &sdk_info.sta_mac_addr, 6);
netif_add(netif, &sdk_info.sta_ipaddr, &sdk_info.sta_netmask, &sdk_info.sta_gw, netif_info, ethernetif_init, tcpip_input);
LOCK_TCPIP_CORE();
netif_add(netif, &sdk_info.sta_ipaddr, &sdk_info.sta_netmask,
&sdk_info.sta_gw, netif_info, ethernetif_init, tcpip_input);
UNLOCK_TCPIP_CORE();
sdk_wpa_attach(&sdk_g_ic);
}
sdk_ic_set_vif(0, 1, &sdk_info.sta_mac_addr, 0, 0);

View file

@ -24,8 +24,10 @@ extern void *sdk_g_cnx_probe_rc_list_cb;
*/
void dhcp_if_down(struct netif *netif)
{
LOCK_TCPIP_CORE();
dhcp_release_and_stop(netif);
netif_set_down(netif);
UNLOCK_TCPIP_CORE();
}
struct sdk_cnx_node *sdk_cnx_rc_search(uint8_t *hwaddr) {

View file

@ -97,8 +97,10 @@ void sdk_eagle_auth_done() {
if (sdk_dhcpc_flag != DHCP_STOPPED) {
printf("dhcp client start...\n");
LOCK_TCPIP_CORE();
netif_set_up(netif);
dhcp_start(netif);
UNLOCK_TCPIP_CORE();
return;
}
@ -107,8 +109,10 @@ void sdk_eagle_auth_done() {
return;
}
LOCK_TCPIP_CORE();
netif_set_addr(netif, &sdk_info.sta_ipaddr, &sdk_info.sta_netmask, &sdk_info.sta_gw);
netif_set_up(netif);
UNLOCK_TCPIP_CORE();
sdk_system_station_got_ip_set(ip_2_ip4(&netif->ip_addr),
ip_2_ip4(&netif->netmask),
ip_2_ip4(&netif->gw));