On Wed, 20 May 2026 17:10:07 +0200
Laurent Vivier
tcp_fill_headers() takes a pointer to a previously computed IPv4 header checksum to avoid recalculating it when the payload length doesn't change, and a separate bool to skip TCP checksum computation.
Replace both parameters with a single uint32_t csum_flags that encodes: - IP4_CSUM (bit 31): compute IPv4 header checksum from scratch - TCP_CSUM (bit 30): compute TCP checksum - IP4_CMASK (low 16 bits): cached IPv4 header checksum value
Have you considered something like: struct csum_state { bool compute_tcp; bool compute_ip; uint16_t computed_ip; }; ? I think the related documentation would look simpler and it should also be more robust to future changes. Not worth a respin though, if it looks like a good idea I guess it could be done as a follow-up. -- Stefano