[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-users] Re-Transmission from PC is ignored due to sequence numb
Re: [lwip-users] Re-Transmission from PC is ignored due to sequence number
Fri, 20 Apr 2018 08:21:03 -0400
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0
On 4/20/2018 5:57 AM, Daniel L wrote:
I'm using lwip 2.0.2 on a Renesas Rh850 Embedded Device with freeRTOS.
In our network setup, we have a master (PC with Win7) and a slave (embedded
The master sends cyclic requests to the slave. The slave has to answer them
(we are running Modbus over TCP, for the sake of completeness).
Everything is running fine, however, sometimes the PC does not receive our
response (this is also verified in Wireshark on the same machine).
The PC then sends a retransmission after 300ms. The retransmission is
basically the same frame as the previous one, including the previous
Our embedded device receives the retransmission, but it does not pass the
payload to our modbus application software. Instead, lwip sends an empty
acknowledge because the sequence number is not within range.
I'll try to summarize:
1) PC sends request
2) lwip receives request, updates sequence number (tcp_inc.c:1443;
pcb->rcv_nxt = seqno + tcplen;)
3) payload is passed to our application
4) application triggers transmission of response
5) response is sent
6) microcontroller generates a Tx interrupt, indicating everything is fine
7) Wireshark on PC does not show the answer frame
8) after 300ms PC sends retransmission
9) lwip receives retransmission
10) lwip refuses retransmission because sequence number is out of range
(tcp_inc.c:1361; if (TCP_SEQ_BETWEEN(seqno, pcb->rcv_nxt,
pcb->rcv_nxt + pcb->rcv_wnd - 1))
11) lwip does not pass payload to our application, but sends empty
Well, I do not know why the response frame is lost.
This may be an issue of our hardware setup and we are investigating this.
However, I'm wondering if lwip is acting correct. Dropping retransmission
seems bad. The PC sends a retransmission because he is waiting for an
answer. When lwip drops the retransmission due to wrong sequence number, the
PC will never get an answer, no matter how many retransmission it does.
Also, for our embedded application there is no way to know that something is
Is lwip acting correct?
Based on your description, yes, LwIP is acting properly. You need to
find out why the payload packet isn't making it to the PC? How big is
the payload packet? Can you share a file with the packets from Wireshark?
Are there possibilities to handle this problem?
First let's figure out where the payload packet went. Maybe you can add
debug output in your ethernet output routine?
Klos Technologies, Inc.