diff options
| author | Laurent Vivier <lvivier@redhat.com> | 2026-05-20 17:10:07 +0200 |
|---|---|---|
| committer | Stefano Brivio <sbrivio@redhat.com> | 2026-05-26 12:17:10 +0200 |
| commit | 92845dd9f0450d54c135ccef6b118fc259ea8dad (patch) | |
| tree | 26d67d4871931b1ff7c77142c1e699fd34ef2570 /test/lib/git: | |
| parent | dec66c02b5e43e0ef809afa47e1008e143a01250 (diff) | |
| download | passt-92845dd9f0450d54c135ccef6b118fc259ea8dad.tar passt-92845dd9f0450d54c135ccef6b118fc259ea8dad.tar.gz passt-92845dd9f0450d54c135ccef6b118fc259ea8dad.tar.bz2 passt-92845dd9f0450d54c135ccef6b118fc259ea8dad.tar.lz passt-92845dd9f0450d54c135ccef6b118fc259ea8dad.tar.xz passt-92845dd9f0450d54c135ccef6b118fc259ea8dad.tar.zst passt-92845dd9f0450d54c135ccef6b118fc259ea8dad.zip | |
tcp: Encode checksum computation flags in a single parameter
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
When IP4_CSUM is not set, the cached checksum is extracted from the low
16 bits. This is cleaner than the pointer-based approach, and also
avoids a potential dangling pointer issue: a subsequent patch makes
tcp_fill_headers() access ip4h via with_header(), which scopes it to a
temporary variable, so a pointer to ip4h->check would become invalid
after the with_header() block.
Suggested-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Reviewed-by: Jon Maloy <jmaloy@redhat.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'test/lib/git:')
0 files changed, 0 insertions, 0 deletions
