cancel
Showing results for 
Search instead for 
Did you mean: 

stm32 lwip large udp packet processing problem

elagreca1970
Associate II
Posted on August 22, 2015 at 16:48

Stm32f407

lwip 1.4.1

when trying to process udp packets in a simple socket based udp echo server with mtu size of 1500 bytes echo failed at packet payload size of 1472 bytes. Fixed this by changing hardware checksum to software checksum in low level ethernet unit function and enabling software checksum in lwipopts. Lwipopts provides no way of disabling hardware checksum. However after fine tuning lwipopts hit a barrier where can only echo back up to 32767 bytes. What options to set to increase this size up to 64kbytes?
2 REPLIES 2
sv1eia
Associate II
Posted on August 22, 2015 at 17:10

Hi,

Can you please post the actual changes in source code or options you did for having larger than 1500bytes MTU in lwip?

I'm also interested in this.

Regards,

Christos

elagreca1970
Associate II
Posted on August 22, 2015 at 18:22

Hi

No probs:

In the function low_level_init() in ethernetif.c file change the following line:

heth.Init.ChecksumMode = ETH_CHECKSUM_BY_SOFTWARE;

Then in MX lwip options just enable the relevant checksum options.  From what I found on the web there used to be an option in lwipopts to disable this but it is no longer there!

Using wireshark the packets were being echoed but the checksum was being calculated for each block so the receiving program would discard.  Once checksum was changed to SOFTWARE packets were being received intact.

This got me to echoing back packets up to ~26000 byte mark.  I modified some lwip options to get this up to ~ 32736 bytes:

PBUF_POOL_SIZE - 32

 

MEMP_NUM_REASSDATA - 28

 

MEMP_NUM_FRAG_PBUF - 28

 

IP_REASS_MAX_PBUFS - 28

 

PBUF_POOL_BUFSIZE - 1514

However cannot get above this limit - consistently fails at this point.

Emilio