Bug in Xemacpsif_dma.c contributed with lwip 2.0.2
I'm working with Zynq-7000 Soc and using FreeRTOS+LWIP client iperf demo. When I tried to send UDP packets with payload 1470 bytes long I got statistics that all my IP packets were fragmented. I've figured out that the problem was the setting in xemacpsif.c:
netif->mtu = XEMACPS_MTU - XEMACPS_HDR_SIZE;
I edited it to
netif->mtu = XEMACPS_MTU; and UDP packets weren't fragmented no more.
But in this case TCP packets were corrupted: 1500 bytes on wire (in Wireshark) instead of 1514 bytes (1460 payload + 20 TCP header + 20 IP header + 14 Ethernet header). The problem is this line in xemacpsif_dma.c in emacps_sgsend() function:
max_fr_size = XEMACPS_MAX_FRAME_SIZE - 18;
Why should Ethernet frame max length be reduced by 18 bytes? It has already Ethernet header included. How can Xilinx employers comment it?