Merge branch 'bugfix/tw7105_tcp_stable_test_abort_issue' into 'master'

lwip: fix tcp stable test abort issue

This MR covers following changes:
1. Modify dhcp server timer to 1 seconds
2. Enable ETHARP_TRUST_IP_MAC. Consider following scenario: we are in throughput test or traffic stability test, if this option is disabled, then every 5 minutes, the IP/MAC entry in arch cache is aged out, however, the traffic continuously send to lwip from application, because there is no IP/MAC entry in ARP cache, then the packets have to be buffered in ARP queue and a ARP request is triggered, but the ARP queue can only holds 3 packets, the later packets will be dropped, then if the traffic is big, a lot of packets will be dropped here before we get the right ARP response. For TCP, this will trigger re-transmit, it's intolerable for some application, such as real time audio, if re-transmit happen, then performance of voice will be impact. For UDP, sometimes it may also cause problem, such as DHCP, if here we failed to send the DHCP here, we has to wait the DHCP timeout etc... so this option is enabled here by default.

See merge request !681
This commit is contained in:
Jiang Jiang Jian 2017-04-24 13:10:21 +08:00
commit 99e461c676
5 changed files with 22 additions and 4 deletions

View file

@ -719,6 +719,8 @@ static u8_t parse_options(u8_t *optptr, s16_t len)
*******************************************************************************/
static s16_t parse_msg(struct dhcps_msg *m, u16_t len)
{
u32_t lease_timer = (dhcps_lease_time * 60)/DHCPS_COARSE_TIMER_SECS;
if (memcmp((char *)m->options, &magic_cookie, sizeof(magic_cookie)) == 0) {
#if DHCPS_DEBUG
DHCPS_LOG("dhcps: len = %d\n", len);
@ -745,7 +747,7 @@ static s16_t parse_msg(struct dhcps_msg *m, u16_t len)
}
client_address.addr = pdhcps_pool->ip.addr;
pdhcps_pool->lease_timer = dhcps_lease_time;
pdhcps_pool->lease_timer = lease_timer;
pnode = pback_node;
goto POOL_CHECK;
} else if (pdhcps_pool->ip.addr == client_address_plus.addr) {
@ -783,7 +785,7 @@ static s16_t parse_msg(struct dhcps_msg *m, u16_t len)
pdhcps_pool->ip.addr = client_address.addr;
memcpy(pdhcps_pool->mac, m->chaddr, sizeof(pdhcps_pool->mac));
pdhcps_pool->lease_timer = dhcps_lease_time;
pdhcps_pool->lease_timer = lease_timer;
pnode = (list_node *)malloc(sizeof(list_node));
memset(pnode , 0x00 , sizeof(list_node));

View file

@ -166,6 +166,7 @@ enum dhcps_offer_option{
OFFER_END
};
#define DHCPS_COARSE_TIMER_SECS 1
#define DHCPS_MAX_LEASE 0x64
#define DHCPS_LEASE_TIME_DEF (120)

View file

@ -134,6 +134,10 @@ err_t etharp_raw(struct netif *netif, const struct eth_addr *ethsrc_addr,
void etharp_arp_input(struct netif *netif, struct eth_addr *ethaddr, struct pbuf *p);
#if ETHARP_TRUST_IP_MAC
void etharp_ip_input(struct netif *netif, struct pbuf *p);
#endif
#ifdef __cplusplus
}
#endif

View file

@ -585,6 +585,18 @@
*/
#define TCPIP_DEBUG LWIP_DBG_OFF
/**
* ETHARP_TRUST_IP_MAC==1: Incoming IP packets cause the ARP table to be
* updated with the source MAC and IP addresses supplied in the packet.
* You may want to disable this if you do not trust LAN peers to have the
* correct addresses, or as a limited approach to attempt to handle
* spoofing. If disabled, lwIP will need to make a new ARP request if
* the peer is not already in the ARP table, adding a little latency.
* The peer *is* in the ARP table if it requested our address before.
* Also notice that this slows down input processing of every IP packet!
*/
#define ETHARP_TRUST_IP_MAC 1
/* Enable all Espressif-only options */

View file

@ -670,8 +670,7 @@ etharp_get_entry(u8_t i, ip4_addr_t **ipaddr, struct netif **netif, struct eth_a
*
* @see pbuf_free()
*/
static void
etharp_ip_input(struct netif *netif, struct pbuf *p)
void etharp_ip_input(struct netif *netif, struct pbuf *p)
{
struct eth_hdr *ethhdr;
struct ip_hdr *iphdr;