|
From: | Pierre Chatelier |
Subject: | [lwip-users] handle slow TCP handling |
Date: | Tue, 27 Nov 2018 17:16:04 +0100 |
User-agent: | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.3.1 |
Hello, I have a question regarding the expected behaviour with lwip incoming TCP packets. I have a my_tcp_recv_cb() callback that handles incoming TCP packets. Usually, it just ends with tcp_recved(pcb, p->tot_len); pbuf_free(p); However, if sometimes I do not have enough time or memory to handle the packet, I would like to tell "do not ack this one, please send it again later" According to the doc (http://lwip.wikia.com/wiki/Raw/TCP), I understand that I should : -call tcp_recved(pcb, written);//if I was still able to handle "written" bytes, and in that case obviously "written" is less than p->tot_len -do *not* call pbuf_free(p); -return an error (e.g. ERR_MEM) " If there are no errors and the callback function returns ERR_OK, then it is responsible for freeing the pbuf. Otherwise, it must not free the pbuf so that lwIP core code can store it." But in that case, it just starts to be a mess. Some packets begin to be delivered very slowly (1 byte at a time in pbufs!), and it does not seem to behave as expected. Meanwhile, the program that sent all the data to the network didn't notice anything, it has just been informed from its TCP API that everything was delivered. Am I doing wrong ? Did I miss something ? To be comprehensive, here are some options of my lwip instance : PARAMETER LIBRARY_NAME = lwip202 PARAMETER LIBRARY_VER = 1.1 PARAMETER PROC_INSTANCE = ps7_cortexa9_0 PARAMETER ip_frag_max_mtu = 9000 PARAMETER lwip_dhcp = true PARAMETER mem_size = 524288 PARAMETER memp_n_pbuf = 1024 PARAMETER memp_n_tcp_seg = 1024 PARAMETER pbuf_pool_bufsize = 9700 PARAMETER tcp_ip_rx_checksum_offload = true PARAMETER tcp_ip_tx_checksum_offload = true PARAMETER tcp_mss = 8060 PARAMETER tcp_rx_checksum_offload = true PARAMETER tcp_snd_buf = 65535 PARAMETER tcp_tx_checksum_offload = true PARAMETER tcp_wnd = 65535 -- ------------------------------------------- Pierre Chatelier address@hidden (+33) 03 80 71 16 16 ------------------------------------------- |
[Prev in Thread] | Current Thread | [Next in Thread] |