I've got an LwIP raw UDP-based application running on a MicroZed. Generally works fine, thousands of packets in either direction. I now want to increase the size of the packets I'm transmitting such that they could span multiple MAC frames. At around 5KB packets, LwIP is cheerfully fragmenting away, and the system seems to operate as before (just with greater bandwidth). But at 7KB packets, the system runs for only varying short times before it crashes. I've heard of others in my circles avoiding outbound LwIP UDP raw fragmentation completely because of similar symptoms observed on Zynq.
I'd like to try a work-around that's not quite as extreme as sending frame-sized packets. I think I should be able to allocate multiple frame-sized pbufs and chain them into a single packet pbuf, all pointing their payloads to different parts of my source memory buffer. The intent is to serve upd_sendto() with pre-digested fragment pbufs. If this allows me to enter LwIP further down the call stack (but still within the API), so much the better. I've been looking for examples of how to do this efficiently, but haven't turned up anything. Questions:
a) should I allocate as PBUF_ROM or PBUF_REF to minimize LwIP copying -- preferably, I'd like LwIP to not have to copy anything but link and IP headers until it hands the contained pbufs to the GEM DMA (my memory buffer, not really ROM but it will be stable for greater than 500us, is itself in non-cacheable space).
b) should I allocate the head pbuf as PBUF_TRANSPORT and the rest as PBUF_IP so there's enough room for frame headers? Or are the headers in the payload, so should I allocate a separate pbuf for just TRANSPORT headers and the rest as PBUF_RAW?
c) once allocated, do I just pbuf_cat() them together so I don't have to worry about refs? For best efficiency, do I cat from the head (2nd onto 1st), or from the tail (last onto penultimate)?
d) then after a good timeout after sending, do I just pbuf_free() the head pbuf (the way I free received fragmented packets)?
If anyone has experience with this, I'd appreciate any tips or examples. Thanks
twv@