Skip to main content
JMarq.1
Associate III
July 4, 2023
Solved

How to set "Don't fragment" flag LWIP short TCP paquets

  • July 4, 2023
  • 17 replies
  • 7129 views

Hello,

I am sending very short TCP paquets (600 bytes maximum) in a PC <=> MCU transfer scenario. I wish the software running on the PC to answer using an empty (len=0) TCP flag ACK packet as soon as it gets every TCP packet.

Using an STM32F207ZG and LWIP stack on STM32CubeIDE, TCP packets are sent correctly but PC software answers an ACK after 50ms approximately. This is too much.

Using an MCU from another brand with a TCP/IP stack different than LWIP, I can send paquets setting "Don't fragment" flag and the receiving software on the PC answers every packet with an ACK in less than 10us.

How can I send packets on LWIP forcing to be set "Don't fragment" flag?

This topic has been closed for replies.
Best answer by waclawek.jan

This is a generic lwip question, rather than STM32-specific, so maybe better discussed in the lwip-users mailing list.

Search indicates, that the don't fragment flag used to be set by default around 2004 (which could probably be relatively simple to restore, as mentioned, in src/core/ipv4/ip.c ip_output_if(), where now is IPH_OFFSET_SET(iphdr, 0);) and here is a thread discussing to set it selectively (but that probably requires further insight to pull it off).

JW

17 replies

waclawek.jan
Super User
July 13, 2023

As Piranha said, there are no guarantees over network layers timing in PC, usually it's dealt with by handwaving ("fast enough"). Also an often overlooked fact is, that switches can impose delays, too - they are usually deemed as "oh it's just hardware", but it's not.

JW