12-18-2008 08:18 AM
I'm trying to send 6000 byte UDP packets from an ISR that is triggered at a 8000 Hz rate. This is 384Mbits/s. I have had success with this, but whenever I set my packet size to be >= 1500, the length field of the UDP packet does not match the actual UDP payload length.
For example, if I do the pbuf_alloc() with a size of 6000 and then send this pbuf with udp_sendto(): wireshark reports that the UDP header is showing a size of 6058, but that the actual UDP payload is only 5768 bytes long.
Similarly, if I do the pbuf_alloc() with a size of 1500 and then send this pbuf with udp_sendto(): wireshark reports that the UDP header is showing a size of 1558, but that the actual UDP payload is only 1512 bytes long.
On the other hand, if I do the pbuf_alloc() with a size of 1400 and then send this pbuf with udp_sendto(): wireshark reports that the UDP header is showing a size of 1458, and this matches the UDP payload!
My setup is the ML507 board. I started from the ml507_std_ip_pcores_ppc440 reference design. I removed the Hard_Ethernet_MAC_fifo, and configured for SDMA, using the ml507_ppc440_temac reference design as an example. I have set the Hard_Ethernet_Mac's TX fifo to the max size. LWIP is configured for the RAW API, with ip_frag_max_mtu set to 8000, and n_tx_descriptors has been increased to 262144. I have disabled UDP checksum generation by adding "#define CHECKSUM_GEN_UDP 0" to the opt.h file. I'm using the 10.1 EDK.
One interesting thing is that if I go back to the original ml507_std_ip_pcores_ppc440 hardware with the Hard_Ethernet_MAC_fifo instead of SDMA, the 1500 byte senario produces valid UDP packets! The UDP header says 1558, which matches the UDP payload size. Unfortunately, I have not been able to get Jumbo packets to work with the Hard_Ethernet_MAC_fifo, so I cannot try packets bigger than this.
Because the 1500 byte packet works for the Hard_Ethernet_MAC_fifo implementation, but not the SDMA, I'm guessing that there is a bug in the SDMA code of the xilinx adaptor. The other thing that I don't understand is that the UDP size is larger than the space that I allocated with the pbuf_alloc()! This second item might just be a feature of LWIP that I don't yet understand. What I consider the bigger issue is that the stack is not producing valid jumbo UDP packets.
12-18-2008 10:16 AM
It looks like I fixed this on my own. I am now creating valid UDP Jumbo packets. In xlltemacif_sdma.c, I changed the following code from:
if (q->len > (XTE_MAX_FRAME_SIZE - 18))
XLlDma_mBdSetLength(txbd, (XTE_MAX_FRAME_SIZE - 18));
if (q->len > (XTE_MAX_JUMBO_FRAME_SIZE - 18))
XLlDma_mBdSetLength(txbd, (XTE_MAX_JUMBO_FRAME_SIZE - 18));
I'm not sure how I was able to create jumbo packets at all before. It looks like the original code would have totally prevented me from creating payload over 1500 bytes, but somehow I was getting payload that was just a few hundred bytes short of the 6000 that I wanted. I'll continue to test this solution.
Also, I figured out the discrepancy between the size of my pbuf_alloc, and the resulting UDP payload. (I was allocating 6000, but the UDP payload was trying to be 6050). This was caused by not understanding the LWIP API. I changed my pbuf_alloc from:
p_bryan = pbuf_alloc(PBUF_TRANSPORT, 6000, PBUF_POOL);
p_bryan = pbuf_alloc(PBUF_RAW, 6000, PBUF_POOL);
which now make sense to me.
I hope this helps someone.
01-07-2009 04:12 AM
Be careful with jumbos!!! Only 1GE and beyond must support that UNSPECIFIED length!
- Jumbo = 9000Bytes -> payload of the ethernet MAC frame = 8982Bytes (length is related to the MAC frame)
- Normal = 1500Bytes -> payload of the ethernet MAC frame = 1500Bytes (length isrelated to the payload of the MAC frame)