This forum is for sharing information about SiTCP. Please do not hesitate to post any questions, comments or answers within the scope of this purpose.
Initiate FIN (connection termination) from SiTCP
投稿日時 2017/4/6 21:36
Th.Gessler
We are using SiTCP as a server in a data acquisition system. Sometimes, an error condition forces our FPGAs to be reconfigured. In that case, SiTCP drops the connection without notice. This leads to synchronization issues in our run-control system, because the client does may not know when the connection was dropped.
Is there a way to gracefully terminate the TCP connection from SiTCP, i.e., transmit a FIN packet? The only documented feature I could find in this regard are the TCP_CLOSE_REQ and TCP_CLOSE_ACK ports, but they require that the client initiates the termination. In our case, it would be extremely useful if both sides could initiate the FIN process.
If such a feature doesn't exist, could it be added to the core?
投稿日時 2017/4/7 9:25
masakuni
After checking the operation, I will contact you.
Please inform us of your FPGA family and version.
投稿日時 2017/4/7 17:28
Th.Gessler
Thank you for your reply. We are using SiTCP for the Belle II DAQ on a Virtex-4 FX60 and Virtex-5 FX70T.
投稿日時 2017/4/11 15:55
masakuni
To send a FIN packet during server operation, TCP_CLOSE_ACK must be set to 1 until TCP_OPEN_ACK returns to 0.
We confirmed the operation with SiTCP_XC5_32K_BBT_V80.
投稿日時 2017/4/11 16:54
Th.Gessler
OK, so the feature should exist already. We will try it out then. Thank you very much for the information!
投稿日時 2017/4/26 19:02
Th.Gessler
I'd like to comment shortly on our tests with a Linux client (kernel 4.10.11-1). When we set CLOSE_ACK before receiving CLOSE_REQ, the following seems to happen:
- SiTCP sends a FIN-ACK packet
- The client sends a FIN-ACK packet
- SiTCP does not ACK, so Linux retransmits the FIN-ACK after about 200 ms
- SiTCP sends a RST packet
This is not completely clean, because
- The first FIN-ACK from SiTCP does not acknowledge anything
- There is no ACK for the FIN from the client
- The connection is terminated by RST
However, the result is what we need, because Linux closes the socket after the RST. That means we can use the current version as it is. We'll just have to make sure it still works in case we change the client OS or kernel.
投稿日時 2017/4/28 16:54
masakuni
Thank you for your valuable report
Certainly the behavior you pointed out is confirmed in Version 9.0 or earlier. It has been fixed in V10.
投稿日時 2017/4/28 18:14
Th.Gessler
This is even better. Very good news, thank you very much! We'll test it with our system as soon as the v10 netlist is available for Virtex-4.
投稿日時 2017/5/8 23:34
Th.Gessler
Thank you for providing the update. I can confirm that SiTCP v10 acknowledges the FIN/ACK packet from the client, so that the retransmission does not occur.