Tool/software:
Hi experts,
When processing received data from Ethernet, the information indicated by the descriptor may not match the contents of the data buffer.
Q:Could you tell me how to avoid this? If the current information is not enough, please let me know what points I should check.
My customer is using Ethernet with F28388D and evaluating LWIP. This is a continuation of this thread.
This phenomenon occurs when the PC and F28388D are connected with a LAN cable. In particular, when the PC links up, many packets flow, so the processing may not be able to keep up and the memory may be rewritten.
They are using a switch called KSZ8794 as the Ethernet PHY. This switch has multiple ports and adds one byte of identification information (TailTag) to the received data from the outside. This identification information needs to be removed, but the data is added to the end of the received data (before the FCS). Therefore, it is necessary to identify the position of the data from the data length (pPacket->validLength) information of the received data and extract it. However, sometimes the location indicated by the data length (pPacket->validLength) contains content that differs from the actual data.
The results of a WireShark log investigation show that when the data length (pPacket->validLength) is processed by the receive function, the data sent later is stored in memory, resulting in the incorrect TailTag being extracted. When the same log is checked with Wireshark, it is confirmed that the correct TailTag is present at the location indicated by the data contents.
The sample code below is used as the base, and interrupts are disabled immediately after an interrupt occurs, and are released once buffer processing is complete.
:<C2000Ware Install Path>\libraries\communications\Ethernet\third_party\lwip\examples\enet_lwip
Best regards,
O.H
Hi experts,
Additional information:
They copied the contents of the receive buffer during interrupt processing(f2838xif_receive()), then set a BreakPoint after copying and compared the results.
The contents of the copy buffer were different from the receive buffer at the moment it stopped at the BreakPoint, and specifically the contents of the copy buffer were several times older.
Best regards,
O.H