Increased LWIP_DRIVER_LOOP_INTERVAL to 250 ms, other minor changes

This commit is contained in:
Joseph Henry
2019-02-27 18:25:29 -08:00
parent 8d3c300538
commit 0c06006ab1
2 changed files with 8 additions and 4 deletions

View File

@@ -51,7 +51,7 @@
/** /**
* How often the lwIP tcpip thread callback checks for incoming frames * How often the lwIP tcpip thread callback checks for incoming frames
*/ */
#define LWIP_GUARDED_BUF_CHECK_INTERVAL 25 #define LWIP_DRIVER_LOOP_INTERVAL 250
/** /**
* Number of packets that can be queued for ingress into the lwIP core * Number of packets that can be queued for ingress into the lwIP core

View File

@@ -49,6 +49,7 @@
#include "lwip/ip_addr.h" #include "lwip/ip_addr.h"
#include "lwip/nd6.h" #include "lwip/nd6.h"
#include "lwip/netifapi.h" #include "lwip/netifapi.h"
#include "lwip/stats.h"
#include "VirtualTap.hpp" #include "VirtualTap.hpp"
#include "lwipDriver.hpp" #include "lwipDriver.hpp"
@@ -124,7 +125,7 @@ static void main_lwip_driver_loop(void *arg)
sys_sem_wait(&sem); sys_sem_wait(&sem);
// Main loop // Main loop
while(_run_lwip_tcpip) { while(_run_lwip_tcpip) {
lwip_sleep(LWIP_GUARDED_BUF_CHECK_INTERVAL); lwip_sleep(LWIP_DRIVER_LOOP_INTERVAL);
} }
_has_exited = true; _has_exited = true;
postEvent(ZTS_EVENT_STACK_DOWN); postEvent(ZTS_EVENT_STACK_DOWN);
@@ -167,7 +168,7 @@ void lwip_driver_shutdown()
// Set flag to stop sending frames into the core // Set flag to stop sending frames into the core
_run_lwip_tcpip = false; _run_lwip_tcpip = false;
// Wait until the main lwIP thread has exited // Wait until the main lwIP thread has exited
while (!_has_exited) { lwip_sleep(LWIP_GUARDED_BUF_CHECK_INTERVAL); } while (!_has_exited) { lwip_sleep(LWIP_DRIVER_LOOP_INTERVAL); }
/* /*
if (tcpip_shutdown() == ERR_OK) { if (tcpip_shutdown() == ERR_OK) {
sys_timeouts_free(); sys_timeouts_free();
@@ -232,6 +233,9 @@ err_t lwip_eth_tx(struct netif *n, struct pbuf *p)
void lwip_eth_rx(VirtualTap *tap, const MAC &from, const MAC &to, unsigned int etherType, void lwip_eth_rx(VirtualTap *tap, const MAC &from, const MAC &to, unsigned int etherType,
const void *data, unsigned int len) const void *data, unsigned int len)
{ {
#ifdef LWIP_STATS
stats_display();
#endif
if (!_run_lwip_tcpip) { if (!_run_lwip_tcpip) {
return; return;
} }
@@ -400,7 +404,7 @@ static err_t netif_init(struct netif *n)
n->name[1] = '4'; n->name[1] = '4';
n->linkoutput = lwip_eth_tx; n->linkoutput = lwip_eth_tx;
n->output = etharp_output; n->output = etharp_output;
n->mtu = ZT_MAX_MTU; n->mtu = LWIP_MTU < ZT_MAX_MTU ? LWIP_MTU : ZT_MAX_MTU;
n->flags = NETIF_FLAG_BROADCAST n->flags = NETIF_FLAG_BROADCAST
| NETIF_FLAG_ETHARP | NETIF_FLAG_ETHARP
| NETIF_FLAG_ETHERNET | NETIF_FLAG_ETHERNET